{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Kenneth Lamar's Website",
  "home_page_url": "https://kennethmlamar.com/",
  "feed_url": "https://kennethmlamar.com/feed.json",
  "description": "Coverage of my projects, both personal and professional.",
  "language": "en-US",
  "authors": [
    {
      "name": "Kenneth Lamar",
      "url": "https://kennethmlamar.com/"
    }
  ],
  "items": [
    {
      "id": "https://kennethmlamar.com/posts/gbnf/",
      "url": "https://kennethmlamar.com/posts/gbnf/",
      "title": "Constraining LLM Output",
      "content_html": "<p>Last year I was reading <a href=\"https://medium.com/@brentcsutoras/the-em-dash-dilemma-how-a-punctuation-mark-became-ais-stubborn-signature-684fbcc9f559\">The Em Dash Dilemma: How a Punctuation Mark Became AI’s Stubborn Signature</a>, as recommended to me by <a href=\"https://www.tomscott.com/newsletter/\">Tom Scott's newsletter</a>.\nThe author told a story where they couldn't get an AI model to avoid using the em dash.\nBelow is my comment responding to this post, which details exactly how to constrain the model.</p>\n<p>If you must absolutely and consistently constrain an LLM to avoid or exclusively generate certain characters, structures, etc., you can enforce this on any model using a grammar file in <a href=\"https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md\">GBNF</a> format.\nSince LLMs are based on sampling from token probabilities, it can generate a list of candidate tokens, then use your provided grammar rules to filter out undesirable options.\nIn this case, the em dash.\nWhat remains may be some highly improbable tokens, which can set some models off in strange directions (especially smaller models), but the point is that we can control these outputs, without even having to ask the model at all.</p>\n<p>For instance, I request the following from Qwen3:</p>\n<blockquote>\n<p>\"Write a list using the em dash for bullets.\"</p>\n</blockquote>\n<p>It outputs the following:</p>\n<blockquote>\n<p>Here’s a list using the em dash (—) as bullets:<br>\n— Item one<br>\n— Item two<br>\n— Item three<br>\n— A longer item with additional details<br>\n— Another bullet point with a note—like this!</p>\n</blockquote>\n<p>I then add the following grammar, which disallows the unicode \\u2014 (em dash) from being used:</p>\n<blockquote>\n<p>root ::= content*<br>\ncontent ::= allowedchar<br>\nallowedchar ::= [\\u0000-\\u2013\\u2015-\\uFFFF]</p>\n</blockquote>\n<p>And make the exact same request:</p>\n<blockquote>\n<p>\"Write a list using the em dash for bullets.\"</p>\n</blockquote>\n<p>It now outputs the following:</p>\n<blockquote>\n<p>– Item one<br>\n– Item two<br>\n– Item three<br>\n– Item four<br>\n– Item five</p>\n</blockquote>\n<p>Note here that, as a substitute, Qwen is now using the en dash (–).\nIt's interesting how it will try for the nearest substitute to best accommodate my request.\nI filtered out the en dash, then it used the horizontal bar (―).\nI filtered out the horizontal bar, then it used two hyphens next to each other (--).</p>\n<p>Constraining an LLM to a specific grammar is a really useful tool.\nThe most common case is to require the LLM to generate valid JSON, for parsing its outputs by a traditional program.\nYou can even specify the names, structure, and output format for the fields, to ensure that the LLM writes something valid (and hopefully meaningful) in each required field.</p>\n",
      "summary": "Using GGML Backus-Naur Form to constrain LLM outputs.",
      "date_published": "2026-05-08T00:00:00.000Z",
      "tags": [
        "personal",
        "AI"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/voice-clones-guide/",
      "url": "https://kennethmlamar.com/posts/voice-clones-guide/",
      "title": "A Guide to Voice Clones",
      "content_html": "<p>I have been experimenting with <a href=\"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/en/README.en.md\">RVC</a> extensively, which provides tools for voice conversion from audio files as well as real-time conversions.\nFor a primer on voice cloning, you can read <a href=\"https://kennethmlamar.com/posts/ai-voice-cloning/\">my blog post on the matter</a>.\nBelow I document what I consider best-practice to maximize voice clone quality while respecting the rights of voice owners.</p>\n<h2 id=\"heading-training-tips\">Training Tips<a href=\"#heading-training-tips\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<ul>\n<li>Background sounds should be absent or removed. <a href=\"https://ultimatevocalremover.com/\">UVR</a> provides vocal separators, which tend to also work well for removing background noise, not only music. <code>MDX-Net Kim Vocal 1</code> is a good model starting point for vocal separation.</li>\n<li>All vocals from other people should be removed, isolating to a single speaker. If you intentionally mix datasets, you can create interesting vocal hybrids, but that task is better suited through the use of model merging.</li>\n<li>All non-vocal sounds should be removed. Non-verbal vocalizations can be kept and often enhance the voice quality for cases when such vocalizations are attempted by a voice puppeteer (though such vocalizations are often poor quality regardless).</li>\n<li>Reverb should be removed in the training set. You can do so with an AI reverb remover such as those offered by <a href=\"https://ultimatevocalremover.com/\">UVR</a>. <code>UVR-DeEcho-DeReverb</code> has worked well for me. Ideally, the dataset doesn't have any reverb to begin with.</li>\n<li>Unless explicitly desired, clips with additional voice processing should typically be excluded from the training data set.</li>\n<li>All clips should be to the same quality. Mixing recordings produced with radically different microphones, different vocal effects applied, or various levels of file compression, as examples, will result in a model that sometimes picks from different qualities due to minor differences perceived in the audio to convert.</li>\n<li>If you are recording your dataset rather than using existing data, try to cover as broad a range of speaking styles as possible. This means recording both speaking and singing, covering the performer's complete vocal singing range, varying loudness, etc.</li>\n<li>Avoid using impersonation performances or fake accents in training, as they can contaminate the data set (unless those vocal stylings are the intention). The final voice clone will trend toward the same style. For instance, voices captured from audiobooks sound like they're reading.</li>\n<li>If possible, ensure all performances were recorded at the same gain levels, to ensure accurate loudness behaviors in the cloned voice.</li>\n<li>10 minutes of training data may be adequate in some cases, 30 minutes often results in a very convincing voice, and 1 hour or more typically offers excellent voice clone quality. Providing much more than an hour results in diminishing returns, taking longer to train a voice without appreciable quality improvements. Note that low quality voices require less training data. For instance, it is not worth gathering more than 30 minutes of phone call quality data, while professional studio audio could benefit from an hour or more of input audio.</li>\n<li>Truncating extended periods of silence from recordings keeps the training data compact and focused, resulting in faster training as the model doesn't need to train on silence. <a href=\"https://www.audacityteam.org/\">Audacity</a> has a <a href=\"https://manual.audacityteam.org/man/truncate_silence.html\">tool</a> for this.</li>\n<li>Whenever possible, listen to every second of your training data before starting the training process. This will give you the opportunity to trim out sections with background noise, multiple speakers, or any other issues.</li>\n<li>To determine when to stop training, use TensorBoard. Go to the RVC folder and run <code>python3 -m tensorboard.main --logdir=logs</code>. Open the browser page for TensorBoard, go to scalers, and turn smoothing all the way up. Under loss, go to the last page of graphs and find <code>loss/g/total</code>. The inflection point in that graph, where the loss is no longer decreasing, is the right point to stop training. I save in 5 epoch intervals so I can keep only the optimal model, before the point of overtraining, deleting or archiving the rest.</li>\n</ul>\n<h2 id=\"heading-conversion-tips\">Conversion Tips<a href=\"#heading-conversion-tips\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<ul>\n<li>Louder input audio tends to work better for pronunciation quality. If the input is too quiet, then the voice starts to sound mumbly. If possible, amplify the input performance before processing, then reduce the converted output audio back down to get it in line with the original loudness. This is particularly important in cases where the audio input was reduced in post rather than being an actual quieter performance.</li>\n<li>Restrict input audio to single speaker. If you have multiple, then the pitch detector tends to bounce between the pitch of the most prominent speakers. While imperfect, you can often separate multiple vocal performances using a vocal remover tuned for karaoke in <a href=\"https://ultimatevocalremover.com/\">UVR</a>. I've had good luck with <code>5_HP-Karaoke-UVR</code>. If the voices have any sort of stereo separation, you could also use tools such as Adobe Audition's <a href=\"https://helpx.adobe.com/audition/using/stereo-imagery-effects.html\">Center Channel Extractor</a> effect, which (unlike the name would suggest) can target sound from any phase of the audio, not just the center.</li>\n<li>Mispronunciations are minimized by speaking loudly, slowly, and clearly. This is often unrealistic depending on the performance you are attempting.</li>\n<li>Do not attempt non-verbal vocalizations. These sounds are too complex for the pitch and pronunciation detectors to follow. Common examples include laughter and sneezes.</li>\n<li>Using noise filters on the input, such as NVIDIA Broadcast, tends to result in the beginning syllable of sentences being cut off or mispronounced. Avoid them or draw out the sound as needed.</li>\n</ul>\n<h2 id=\"heading-sourcing-audio-training-data\">Sourcing Audio Training Data<a href=\"#heading-sourcing-audio-training-data\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<h3 id=\"heading-disclaimer\">Disclaimer<a href=\"#heading-disclaimer\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>A persons' voice is a deeply personal part of themselves.\nStealing it wholesale is generally a bad idea.\n<a href=\"https://youtu.be/5Ru-gDcVNyU\">Don't be a sea witch</a>.\nIf you want to make a voice clone of a person or character privately, that's one thing, but if you want to post such a work publicly, it's best to seek out permission if possible, remove if asked, and examine (and respect) if they already have a preference.\nChecking the <a href=\"https://docs.google.com/spreadsheets/d/1n6KZpcahyckjmzgsH90ghgNs5pcEQ57baavbjAI_ed8/\">Uberduck blacklist</a> is a good starting point for the latter.\nIf you wish to use a voice clone commercially, to make money, then you should have a contract with the original performer that explicitly permits this use.\nOn that front, BeyondWords provides an excellent <a href=\"https://beyondwords.io/ai-voice-ethics/\">contract template</a> suitable for TTS voice clones, easily adaptable to suit voice conversion tools as well.\nAlways clearly label your use of AI and respect the person's <a href=\"https://en.wikipedia.org/wiki/Personality_rights\">personality rights</a>.\nMost of my upcoming suggestions are only suitable for private use, for the development of skills making and using voice clones, though there are some interesting exceptions.</p>\n<h3 id=\"heading-downloading-pre-made-models\">Downloading Pre-Made Models<a href=\"#heading-downloading-pre-made-models\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>The easiest way, by far, to get a trained model, is to download one that someone else already made for you.\nThere are repositories such as <a href=\"https://voice-models.com/\">voice-models.com</a> that provide such downloads.\nThe issue with using these voices is the complete lack of control over the training process.\nThe vast majority of the voices on the platform do not take into account the best-practice training tips I suggest above, often using too little training data as input, using noisy data, overtraining the model, or other oversights.\nUltimately, there is no way to know if a model found online is any good until you download it and try it for yourself.</p>\n<h3 id=\"heading-vocal-stems\">Vocal Stems<a href=\"#heading-vocal-stems\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>If you're trying to create a voice clone of a singer, it can be tempting to download fully-produced songs, then use a vocal isolation tool such as <a href=\"https://ultimatevocalremover.com/\">UVR</a>.\nThat technique works in the general case, but it should be used solely as a last resort.\nMore desirable is to hunt down dry vocal stems.\nThese are the original vocalist recordings, with no processing or music mixed in.\nThey can be hard to come by, typically only showing up in stem leaks online, but they provide a meaningful improvement to voice clone quality when available.</p>\n<p>Music rips from Guitar Hero and Rock Band typically include separated vocals as well.\nThese are almost never dry, but they serve as a better starting point than relying on an AI tool to separate the voice for you.</p>\n<h3 id=\"heading-video-game-rips\">Video Game Rips<a href=\"#heading-video-game-rips\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Video games are an excellent resource for high quality voice lines.\nNewer, larger games tend to have a ton of dialogue for their characters, easily passing the 1 hour threshold suggested for the best quality clones.\nFor instance, Red Dead Redemption 2 <a href=\"https://www.vulture.com/2018/10/the-making-of-rockstar-games-red-dead-redemption-2.html\">reportedly</a> has about 500,000 lines of dialogue.\nZagreus from the game Hades has over 5 hours of dialogue alone.\nMixing often happens in-game, so the base lines are relatively clean and clear of music, background sound, or other distractions that would require filtering.\nCharacter tie-in games that use the original actors are quite useful here as well, to source voices that are otherwise too difficult to isolate in other media.</p>\n<p>You can often get access to these files via <a href=\"https://www.sounds-resource.com/\">The Sounds Resource</a>, an online repository of sound rips from games.\nIf they're missing lines you want, you can rip them from the games yourself (the techniques vary for each game), then, since you're going through the painstaking work of organizing lines already, you can contribute them back to The Sounds Resource.</p>\n<h3 id=\"heading-audiobooks-and-podcasts\">Audiobooks and Podcasts<a href=\"#heading-audiobooks-and-podcasts\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Audiobooks and podcasts have the benefit of being long-form formats to capture someone's voice.\nFocus on single-speaker sources without background music or sound effects.\nThe issue with these sources is that they often have poor vocal range, particularly if the speaker has a relatively monotone way of speaking; if you aren't careful when recording input lines to convert, you can easily fall outside of the voice clone's range.\nI've also found that, if the audiobook narrator sounds like they're reading, the voice clone will often sound like they're reading as well.</p>\n<h4 id=\"librivox\">LibriVox</h4>\n<p><a href=\"https://librivox.org/\">LibriVox</a> is a community project to provide free, public-domain audiobooks of public-domain books.\nWhen a creator provides their work as public-domain, they release all copyrights to the work.\nWhat's interesting here is that this means you can legally clone voices contributed to this project and even use them commercially.\nYou only need to worry about rights that the narrators cannot release, such as <a href=\"https://en.wikipedia.org/wiki/Personality_rights\">personality rights</a>.</p>\n<p>It's worth keeping in mind that most of these books were narrated before voice cloning technology was any good; most of the readers may not realize that their voices could be used in this way.\nFor this reason, one should still exercise caution when attempting to use the audiobooks as a dataset and respect the wishes of the readers out of courtesy.</p>\n<p>Due to the community-contributed nature of the works, most speakers are of very low quality.\nYou will need to sift through the various recordings to find voices you like at a reasonable quality standard.\nI find it helpful to search for recommended reader voices suggested on Internet forums as a starting point.</p>\n<h3 id=\"heading-mozilla-common-voice\">Mozilla Common Voice<a href=\"#heading-mozilla-common-voice\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p><a href=\"https://commonvoice.mozilla.org/\">Common Voice</a> is a community-driven effort to provide high quality annotated speech datasets for use in the development of speech AI technologies, such as TTS and transcription.\nAll audio is released under a permissive <a href=\"https://creativecommons.org/public-domain/cc0/\">CC0</a> license, which effectively serves as a public-domain license and permits commercial use of the data, just like LibriVox.\nUnlike LibriVox, the speakers in this dataset explicitly understand that a core use of the audio is AI models and research.</p>\n<p>The data is freely available for download, but it comes with some major caveats in terms of quality and quantity of data.\nMost audio is recorded using low-quality laptop microphones in noisy rooms.\nFurthermore, any given speaker tends to have recorded no more than a minute or two of audio, which is insufficient for our use.\nOne could use this dataset to create a diverse vocal hybrid or focus on the voices with the longest recording sessions.\nThere are a few voices that reach the threshold of enough audio at high enough quality for use, but you'll need to download the full English dataset and organize them by speaker ID to track them down.</p>\n<h3 id=\"heading-twitch\">Twitch<a href=\"#heading-twitch\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>The <a href=\"https://www.twitch.tv/directory/category/just-chatting\">Just Chatting</a> section on <a href=\"https://www.twitch.tv/\">Twitch</a> can be a good resource for finding voices to clone.\nTop creators tend to use high-quality microphones that make correspondingly high-quality voice clones possible.\nThey also spend lots of time yapping on the Internet.\nYou can find a trove of audio data if the creator is providing past broadcasts to view on demand, and they can be downloaded trivially via <a href=\"https://github.com/yt-dlp/yt-dlp\">yt-dlp</a>, and as audio only using the <code>-x</code> flag.</p>\n<p>Almost every professional streamer will have some sort of background music to keep things lively.\nFor our purposes, this is undesirable but can be removed.\nHowever, there's a clever trick to getting clean spoken audio: In the last several years, streamers on Twitch have gotten DMCA takedown notices for using copyrighted audio in their streams.\nTwitch now has strict <a href=\"https://www.twitch.tv/p/en/legal/community-guidelines/music/\">guidelines</a> on the use of music on stream.\nIn practice, copyright owners have only targeted VODs.\nIn response to this, Twitch permits streaming with <a href=\"https://obsproject.com/kb/twitch-vod-track-guide\">two separate tracks</a>, a live track, which can (for now) contain copyrighted audio, and a VOD track, which is often music-free.\nWe can leverage this to capture raw audio of the streamer's voice, then trim out elements such as sound effects and keyboard noises.</p>\n<h3 id=\"heading-discord-calls\">Discord Calls<a href=\"#heading-discord-calls\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>If you want to record your friends, nothing beats the convenience of a Discord call.\nYou don't need to pester them to set up a microphone recording; just get them to join a call with <a href=\"https://craig.chat/\">Craig</a>.\nCraig provides multi-track voice recording for Discord.\nYou can set up your own instance of the bot easily using <a href=\"https://github.com/tomich/craig/pull/1\">my Docker container</a> that I put together.</p>\n<p>Interestingly, while the <a href=\"https://support-dev.discord.com/hc/en-us/articles/8563934450327-Discord-Developer-Policy\">Discord developer policy</a> explicitly disallows the collection of <em>message content</em> to train AI models, there is no such rule about voice data.\nThus, your main legal concern is getting the consent of your friends, not just for the creation of the model but also for recording the conversation itself (lest you run afoul of wiretapping laws).</p>\n<p>The main issue with this technique is that Craig receives audio in the form processed by Discord.\nThat means the voice recordings will be affected by any processing the user has turned on, such as auto-gain, Krisp background noise suppression, noise gates, etc. as well as cutouts from network issues.\nAudio will be compressed to the bitrate used by Discord, but even free tier Discord servers tend to use a high enough bitrate to achieve <a href=\"https://en.wikipedia.org/wiki/Transparency_(data_compression)\">transparency</a> for most voices.\nI've also noticed slight audio artifacts around 16KHz on all recordings, visible in spectrograms.\nThey are faithfully reproduced by the voice clones, but I haven't been able to recognize them when listening.</p>\n<h3 id=\"heading-text-to-speech-voices\">Text-To-Speech Voices<a href=\"#heading-text-to-speech-voices\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Text-to-speech has the benefit of scale: it is trivial to generate hours of audio data.\nWe can leverage that for the production of voice clones.\nBy providing reading content to a TTS system, we can produce an arbitrarily large training set to convert the text conversion model into a speech conversion model.\nThe generated audio should be as varied as possible, adjusting pitch, emotion, etc. controls as made available to the specific speech engine.\nCloning earlier speech technologies can provide a distinct and interesting voice clone sound.\nI've had particular interest in voices such as the Speak &amp; Spell toy, which used the Texas Instruments LPC <a href=\"https://en.wikipedia.org/wiki/Texas_Instruments_LPC_Speech_Chips\">Speech Chip</a> commonly added to consumer electronics in the late '70s and '80s, as well as the classic <a href=\"https://en.wikipedia.org/wiki/PlainTalk\">MacInTalk</a> voices used in '80s Macintosh computers (and which still exist in modern macOS today).</p>\n<h2 id=\"heading-settings\">Settings<a href=\"#heading-settings\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>The various RVC tools provide a variety of settings, but these settings are poorly documented, at least among English speakers.\nIn an effort to remedy this, I have put together a detailed explanation for every setting, what each setting is called for each tool, and what it does to improve the final conversion quality.</p>\n<table>\n<thead>\n<tr>\n<th><a href=\"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/en/README.en.md\">WebUI</a></th>\n<th><a href=\"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/en/README.en.md\">Realtime</a></th>\n<th><a href=\"https://github.com/w-okada/voice-changer/blob/master/README_en.md\">w-okada</a></th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Transpose</td>\n<td>Pitch settings</td>\n<td>TUNE</td>\n<td>Offsets the input vocal pitch by some number of semitones. This should be adjusted until the cloned voice matches the typical pitch of the target speaker. Every multiple of 12 setting adjusts the voice pitch by an octave. Using whole octaves is primarily used to ensure the cloned voice sings in the same key as the input performance.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Response threshold</td>\n<td>S. Threshold</td>\n<td>Controls the noise gate. Any sound below the threshold is suppressed. This is used to prevent background noise and hiss from being turned into strange mumbling.</td>\n</tr>\n<tr>\n<td>Search feature ratio</td>\n<td>Index rate</td>\n<td>INDEX</td>\n<td>When an index file is provided, this slider augments the target voice by preserving more of its accent and less of the input voice (to reduce tone leakage). This is particularly useful for voices trained with little training data and a low epoch count. If set too high, it can cause strange pronunciation artifacts. I usually find something around 0.3-0.5 to sound good, but it varies by voice model.</td>\n</tr>\n<tr>\n<td>Pitch extraction algorithm</td>\n<td>Pitch detection algorithm</td>\n<td>F0 Det.</td>\n<td>The algorithm used to determine the pitch of the input voice, which is then used to drive the pitch of the cloned voice. Different algorithms are better at different things. <code>rmvpe</code> is the current state-of-the-art and works fastest and usually with the highest quality.</td>\n</tr>\n<tr>\n<td>Volume envelope scaling</td>\n<td>Loudness factor</td>\n<td>N/A</td>\n<td>How little to preserve the loudness of the input performance. At 0, the loudness of the cloned voice should match the loudness of the input voice. At 1, the cloned voice will always be at full loudness. 0 is useful if you want to distinguish between whispers, talking, screaming, etc. 1 is useful to have the cloned voice always speak loudly and clearly, as loud as the loudest things it was trained on (which can have artifacts such as mic clipping depending on the training set). Values in-between provide partial volume control biased toward being louder, the closer you get to 1.</td>\n</tr>\n<tr>\n<td>Protect voiceless consonants</td>\n<td>N/A</td>\n<td>Protect  (advanced setting)</td>\n<td>Reduces artifacts caused by consonants and breathing sounds. Higher levels provide more protection at the cost of voice cloning accuracy.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Sample length</td>\n<td>CHUNK</td>\n<td>Realtime voice changers in RVC work by sending small chunks of audio for quick conversion, then stitching them together. Longer sample lengths feed in longer chunks, making the stitches less obvious and reducing GPU requirements but increasing output latency. On a low end GPU, setting this too low will make the GPU unable to keep up and produce stutters. On a high end GPU, setting this too low will cause warbling as an artifact of stitching many overly-short chunks together.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Extra inference time</td>\n<td>EXTRA</td>\n<td>How much old audio to load into each chunk. The extra context usually improves voice quality for the generated chunk but is more demanding for the GPU.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Input noise reduction</td>\n<td>NOISE</td>\n<td>Attempts to remove non-speech background noise from the input to prevent sounds from being turned into strange mumbling.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Number of CPUs</td>\n<td>N/A</td>\n<td>The number of CPUs used for the harvest pitch algorithm. Only relevant when <code>harvest</code> is chosen as the pitch detection algorithm.</td>\n</tr>\n<tr>\n<td>N/A</td>\n<td>Fade length</td>\n<td>overlap (advanced setting)</td>\n<td>The length between chunks to crossfade together. Longer reduces warbling artifacts at the cost of increased latency.</td>\n</tr>\n</tbody>\n</table>\n",
      "summary": "A master guide to the creation and use of voice clones.",
      "date_published": "2025-02-03T00:00:00.000Z",
      "tags": [
        "personal",
        "AI"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/ai-voice-cloning/",
      "url": "https://kennethmlamar.com/posts/ai-voice-cloning/",
      "title": "Intro to Modern Voice Conversion AI",
      "content_html": "<p>Voice conversion, also known as speech-to-speech, provides a means to take the vocal performance of one actor and apply that performance to the voice of another.\nThis is in contrast to related text-to-speech voice clones, which convert text into speech from a specific speaker.\nWhile there is a long history of efforts to improve the quality of vocal clones, 2023 saw major breakthroughs in AI voice cloning, enabling anyone with a recent GPU to train and use their own AI voice models.\nThis month will mark the 1 year anniversary of my discovery and experimentation with voice conversion technology.</p>\n<h2 id=\"heading-a-brief-history\">A Brief History<a href=\"#heading-a-brief-history\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Using a vocal performance to drive sound is nothing new.\nBack in the 1930&#39;s, Disney used the <a href=\"https://en.wikipedia.org/wiki/Talk_box\">talk box</a> to <a href=\"https://youtu.be/TngjAdisWCE\">make a train whistle shout &quot;all aboard&quot;</a> in Dumbo and <a href=\"https://youtu.be/itA37G3k4dE\">a spring argue with Donald Duck</a> in Clock Cleaners.</p>\n<p>As a more recent example, sound designer Ben Burtt produced a variety of robot voices in the 2008 Pixar film, WALL·E.\nOf particular interest is AUTO, the ship&#39;s autopilot, which was the only robot voice that was created using a speech synthesizer, <a href=\"https://en.wikipedia.org/wiki/MacInTalk\">MacInTalk</a>, instead of vocal filter chains.\nThough MacInTalk gets the voice credit in the film, an <a href=\"https://web.archive.org/web/20090226031129id_/http://www.moviesonline.ca/movienews_14930.html\">interview</a> with Ben Burtt reveals that he used his own voice to guide the performance, referring to it as &quot;audio puppeteering,&quot; which permitted him to adjust the pitch and timing of AUTO&#39;s synthetic voice.</p>\n<blockquote>\n<p>Q: Did you program MacInTalk to do Auto things?</p>\n<p>BEN BURTT: With Auto we started with typing, inputting the sound. I got the software for MacInTalk, then I could use a microphone and use my own voice to say a performance and that could be injected and twist and warp the MacInTalk voice to follow that performance. So it was a combination. Some of these things I refer to as audio puppeteering. You know, you’re kind of behind the scenes with whatever means you can to interact, whether it is your own voice, whether it is your hands, whether it’s running a piece of equipment. Somehow the output is sound and hopefully expressive sound and when it comes to character what are meant to be vocals.</p>\n</blockquote>\n<p>More recently, in 2022, it was revealed that <a href=\"https://www.respeecher.com/\">Respeecher</a> was used to provide <a href=\"https://arstechnica.com/information-technology/2022/09/james-earl-jones-signed-darth-vader-voice-rights-to-disney-for-ai-use/\">modern voice acting for Darth Vader</a>.\nDisney continues to use this technology to bring back to life a variety of characters whose actors are deceased or have had their voice change too significantly, with full permission from the associated actor or estate.</p>\n<h2 id=\"heading-modern-voice-clones\">Modern Voice Clones<a href=\"#heading-modern-voice-clones\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>By 2023, <a href=\"https://github.com/svc-develop-team/so-vits-svc\">SO-VITS</a> released, which offered speech-to-speech conversion not just for spoken audio, but also singing.\nIt&#39;s an open-source project, unlike Respeecher, and is freely usable by anyone with a recent GPU and enough VRAM.\nAs an extension to this work, Retrieval-based Voice Conversion, known as <a href=\"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/en/README.en.md\">RVC</a> for short, now offers the current state-of-the-art local speech-to-speech converter.</p>\n<p>RVC has been responsible for a massive influx of AI voice covers of popular songs.\nCombined with AI vocal stemming with tools such as <a href=\"https://ultimatevocalremover.com/\">Ultimate Vocal Remover</a>, it becomes possible to make any voice sing any song.\nThere are even <a href=\"https://github.com/SociallyIneptWeeb/AICoverGen\">tools</a> that fully automate this process end-to-end, though the quality may suffer without additional adjustments by hand.</p>\n<p>These voice cloners also work in real-time, with projects such as <a href=\"https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI/blob/main/docs/en/README.en.md\">RVC Realtime</a>, <a href=\"https://github.com/w-okada/voice-changer/blob/master/README_en.md\">w-okada</a>, and <a href=\"https://rentry.co/forkvoicechangerguide\">deiteris&#39; fork</a>, making it possible to converse with someone in real-time using a voice clone.\nOn a 3070 Ti, I can produce a voice clone guided by my voice, with fewer than 300 ms of processing latency added to my mic setup.\nFrankly, I didn&#39;t believe that this technology would get this good within my lifetime and expected it to be relegated to the realm of <a href=\"https://youtu.be/k3jHNzg0DKY\">sci-fi</a> for the foreseeable future.</p>\n<h2 id=\"heading-my-experiments\">My Experiments<a href=\"#heading-my-experiments\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>For nearly a year, I have found myself obsessed over working with voice clone technology.\nI have been experimenting to learn the ins and outs, the technical limitations, and the features on offer.\nTo date, I have trained over 220 voice clones using RVC V2, created using personally curated and cleaned data sets.</p>\n<p>When you first hear a voice clone, be it of your own voice, your own performance, or that of a friend, there is a surrealism to it.\nA standout for me was how RVC seemingly manages to preserve minor vocal nuances of the cloned performer in the AI voice, even if they were never provided by the input performer.\nFor instance, I have a friend with a habit of taking in a sharp breath in after speaking, and the voice model reproduces this even if the voice puppeteer doesn&#39;t do so.\nIt means that the performer needs to put in very little effort to produce an accurate impersonation, focusing primarily on pitch, energy, and accent rather than the little quirks.</p>\n<p>It even captures the quirks of the recording hardware, with <a href=\"https://en.wikipedia.org/wiki/Plosive\">plosives</a> faithfully recreated if the model was trained on speech made without a <a href=\"https://en.wikipedia.org/wiki/Pop_filter\">pop filter</a>.\nLikewise, mic clipping, if present in training, is accurately reproduced when the input voice speaks loudly.\nVoice models generated from low-quality equipment or infrastructure, such as from telephone calls, reproduce a performance that sounds just like that equipment.\nExcitingly, you can even go the other way: you can create a voice model in a professional recording studio and then guide the performance casually with a lower quality microphone (I have intentions to do this for my own voice at some point in the future).\nI was also impressed at how well voice clones reproduce complex voice filters, such as the <a href=\"https://youtu.be/w0W2Tt4fzSU\">&quot;squid voice&quot;</a> used in Splatoon or filters used to make any number of robot voices.</p>\n<p>This tech enables all sorts of interesting uses, from getting an audiobook narrated by anyone you want, to real-time conversion of live TV speakers to have the voice of another, to AI covers of popular songs.\nOne of my uses has been to &quot;AI restore&quot; dialogue in old video games.\nPajama Sam stores all of its voice lines at merely 11 KHz, resulting in low-quality dialogue akin to the low pass filter used in phone calls.\nTraining a voice model on dialogue from <a href=\"https://www.sounds-resource.com/pc_computer/pajamasamgamestoplayonanyday/\">Pajama Sam: Games to Play on Any Day</a>, which used voice lines recorded at 22 KHz, produces a high-quality voice model that can be driven by the original low-quality lines from previous games, effectively restoring the lost detail.\nThere are minor pronunciation issues present in some of the lines, a common shortcoming of RVC exacerbated by the low-quality input voice, but it serves as an interesting experiment, nevertheless.</p>\n<div id=\"pNfoCMh4ufU\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"pNfoCMh4ufU\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/pNfoCMh4ufU.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>\n<p>For me personally, I have found the exploration enlightening on better understanding aspects of speech and vocals that I had never seriously considered before.\nFor instance, it is important for singers to perform within their vocal range.\nAI voice models retain a comparable vocal range to the actual person, with singing beyond that range resulting in terrible croaking sounds or a fallback to the base model, producing an unconvincing clone.\nWhile I was aware of vocal range and the need to transpose, I now understand this at an intuitive level, being able to use voice models to simulate working with a variety of vocalists at a level that historically would have been reserved for professional music producers.</p>\n<p>Voice clones have also served as jumping off point for my developing other tangential skills such as singing, voice acting, impressionism, and music production.\nImproving these skills helps me produce more interesting and convincing voice clones.\nI can only imagine the things real pros, these skills already in hand, could accomplish by adding this tool to their repertoire.</p>\n<p>Voice models work best when trained on dry vocal samples (where no effects have been applied to the audio).\nWhen an AI cover is created, the same dry vocal style is reproduced.\nIn produced songs, singing is often processed to create a distinctive sound profile, and these effects must be accurately recreated if an &quot;authentic&quot; voice clone cover is to be made.\nWorking with voice clone models has given me more of an ear for these effects and, while I don&#39;t really have the tools for many of them, I have at times worked to reproduce aspects such as matching reverb levels or recreating fades.\nAs an aside, it&#39;s noteworthy that voice clones can draw out &quot;autotuned&quot; vocals more prominently than the original performance.</p>\n<p>This tech also allows me to separate someone&#39;s vocal performance from their underlying voice.\nIt&#39;s the whole point of these tools: separating pitch, energy, and pronunciation into discrete, independent components, to be mapped onto the voice clone&#39;s timbre.\nIt can be enlightening to realize that what you like about someone&#39;s voice aesthetics is not how they sound but the way they say things to begin with.\nMaking this separation would not have been practical historically.</p>\n<h2 id=\"heading-ethical-and-legal-concerns\">Ethical and Legal Concerns<a href=\"#heading-ethical-and-legal-concerns\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>The action of cloning someone else&#39;s voice is a legal and ethical minefield, an ever-present elephant in the room.\nLike many AI technologies, we are currently in a Wild West scenario, where public understanding and legislation lag far behind the state-of-the-art.</p>\n<p>During the last US Presidential election, AI voice cloning was used to impersonate Joe Biden in New Hampshire, leaving voicemails encouraging voters in the primaries to, &quot;save your vote for the November election.&quot;\nIn response, Joe Biden&#39;s <a href=\"https://www.whitehouse.gov/briefing-room/speeches-remarks/2024/03/07/remarks-of-president-joe-biden-state-of-the-union-address-as-prepared-for-delivery-2/\">2024 State of the Union Address</a> suggested an intent to ban voice cloned impersonations.</p>\n<blockquote>\n<p>Harness the promise of A.I. and protect us from its peril.\nBan A.I. voice impersonation and more!</p>\n<p>~Joe Biden</p>\n</blockquote>\n<p>Later, the FCC explicitly <a href=\"https://www.fcc.gov/document/fcc-makes-ai-generated-voices-robocalls-illegal\">noted</a> that voice clone robocalls were illegal, just as all unsolicited robocalls already are.</p>\n<p>Though explicit legislation does not currently exist, and I am not a lawyer, it is my impression that the vast majority of general AI voice cloning legal and ethical norms are appropriately covered by existing <a href=\"https://en.wikipedia.org/wiki/Personality_rights\">personality rights</a> law.</p>\n<p>In the United States, at least, personality rights generally disallow <a href=\"https://en.wikipedia.org/wiki/Passing_off\">passing off</a> a work as being made or backed by the person whose likeness is used.\nWith that in mind, it is crucial to always disclaim an AI generated voice as such using clear labels.\nLast year, YouTube added a <a href=\"https://blog.youtube/inside-youtube/our-approach-to-responsible-ai-innovation/\">requirement</a> for all videos on their platform to disclose the use of AI-generated content.\nFurther, personality rights generally protect defamation; it is certainly not appropriate to put words in someone&#39;s mouth to hurt their reputation.</p>\n<p>Personality rights also have a far-reaching history disallowing the use of one&#39;s likeness in commercial scenarios, particularly of endorsements.\nThis suggests that it is illegal to use AI voice clones in a commercial work without those voice rights being licensed by the voice&#39;s owner.\nRecently, Tom Hanks <a href=\"https://www.instagram.com/p/Cx2MsH9rt7q/\">warned</a> of a deepfake using his likeness to promote a dental plan that he had no affiliation with, a clear violation of his personality rights.</p>\n<p>From an ethical point of view, it is also courteous to get permission from the voice owner before publishing anything with their likeness.\nIn lieu of being able to get in touch with them, removal upon request is best-practice, even if you are not strictly, legally obligated to do so.\nHigh-profile misuse has damaged public perception of this technology; being a good steward of this technology is important to showcase positive, responsible uses of the tech.</p>\n<p>There are also questions on the legality of the training data sourced.\nOpenAI <a href=\"https://openai.com/blog/openai-and-journalism\">maintains</a> that the training of models (at least their text models) using publicly available data falls under fair use, being sufficiently transformative of the source material.\nUS legal precedent indicates that AI models <a href=\"https://www.reuters.com/legal/ai-generated-art-cannot-receive-copyrights-us-court-says-2023-08-21/\">cannot be copyrighted</a>.\nHowever, A.I. Hub, a Discord server where voice models, primarily of vocalists, were shared, was shut down by Discord under copyright grounds (likely because copyrighted music, performances, and training data were also being shared).\nThe moderators of that community believe that the models, being trained on but not directly containing the original copyrighted vocals, are not protected by that copyright.\nIt remains to be seen how future issues of voice cloning will be handled, but it is clear that we live in an exciting new time to see how these new technologies shake out.</p>",
      "summary": "Discussing the state-of-the-art in voice conversion.",
      "date_published": "2025-02-02T00:00:00.000Z",
      "tags": [
        "personal",
        "AI"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/ps2-repair/",
      "url": "https://kennethmlamar.com/posts/ps2-repair/",
      "title": "PS2 Repair",
      "content_html": "<h2 id=\"heading-initial-assessment\">Initial Assessment<a href=\"#heading-initial-assessment\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Yesterday, I attempted to repair a PS2 that was not turning on.\nThe red standby LED did not light up, and, upon pressing the power button, there was no response.\nThis indicated that there was an issue with some aspect of the console&#39;s power supply or the power button itself.</p>\n<h2 id=\"heading-diagnosing-the-problem\">Diagnosing the Problem<a href=\"#heading-diagnosing-the-problem\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>To diagnose the problem, I began by checking the power cable, which was providing the expected 120V AC from the wall.\nNext, I tested the power connector and switch, which passed through the 120V when switched on.\nThen, I tested the power board fuse, which was still providing continuity and was intact.\nThe front power button provided continuity when pressed and was properly attached, so I ruled that out as the cause.\nHowever, when I tested the power board output when turned on, it was providing no voltage when 12V DC was expected.\nThis confirmed that the power board was the issue, though further problems could still exist down the line.\nI disassembled the console further but found no obvious faults on visual inspection.</p>\n<h2 id=\"heading-finding-a-solution\">Finding a Solution<a href=\"#heading-finding-a-solution\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>I looked up prices for a replacement power board and found that they cost around $30.\nHowever, an entire functional PS2 can be purchased for $70, making the repair costs unjustifiable.\nTherefore, I reassembled the console and decided to call it a day.</p>\n<p>On a positive note, I did capture some interesting photos of the console&#39;s PCB while I had it disassembled.</p>\n<h2 id=\"heading-gallery\">Gallery<a href=\"#heading-gallery\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<a class=\"img\" href=\"https://kennethmlamar.com/_astro/_A7C2593.ZQdX2oqD_eVRs3.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/_A7C2593.ZQdX2oqD_t9j90.avif 300w, /_astro/_A7C2593.ZQdX2oqD_ZpCEut.avif 600w, /_astro/_A7C2593.ZQdX2oqD_Z25XbY8.avif 928w, /_astro/_A7C2593.ZQdX2oqD_23DN0e.avif 1280w, /_astro/_A7C2593.ZQdX2oqD_Z2wrxGl.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/_A7C2593.ZQdX2oqD_Lz5EN.webp 300w, /_astro/_A7C2593.ZQdX2oqD_Z7cRXF.webp 600w, /_astro/_A7C2593.ZQdX2oqD_Z1Mxpsk.webp 928w, /_astro/_A7C2593.ZQdX2oqD_1flEwg.webp 1280w, /_astro/_A7C2593.ZQdX2oqD_Z29F8jE.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/_A7C2593.ZQdX2oqD_ZXjOr1.jpeg\" srcset=\"/_astro/_A7C2593.ZQdX2oqD_Z1kjwYk.jpeg 300w, /_astro/_A7C2593.ZQdX2oqD_Z2e6vCN.jpeg 600w, /_astro/_A7C2593.ZQdX2oqD_1aK5Gt.jpeg 928w, /_astro/_A7C2593.ZQdX2oqD_1QaSLl.jpeg 1280w, /_astro/_A7C2593.ZQdX2oqD_1ifES5.jpeg 1856w\" alt=\"A close-up of the PS2 Emotion Engine chip\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"5461\" height=\"3421\"></picture></a><a class=\"img\" href=\"https://kennethmlamar.com/_astro/_A7C2600.CtQtpK9l_Z1pWPEY.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/_A7C2600.CtQtpK9l_fAB2i.avif 300w, /_astro/_A7C2600.CtQtpK9l_ZrDOv6.avif 600w, /_astro/_A7C2600.CtQtpK9l_oHPkT.avif 928w, /_astro/_A7C2600.CtQtpK9l_2noIky.avif 1280w, /_astro/_A7C2600.CtQtpK9l_Z1o0Q3R.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/_A7C2600.CtQtpK9l_y1ny6.webp 300w, /_astro/_A7C2600.CtQtpK9l_Z9e2Yi.webp 600w, /_astro/_A7C2600.CtQtpK9l_H8BQH.webp 928w, /_astro/_A7C2600.CtQtpK9l_Z2k106G.webp 1280w, /_astro/_A7C2600.CtQtpK9l_Z11eqGb.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/_A7C2600.CtQtpK9l_ZSbqfO.jpeg\" srcset=\"/_astro/_A7C2600.CtQtpK9l_Z1xRf62.jpeg 300w, /_astro/_A7C2600.CtQtpK9l_Z2g7FDq.jpeg 600w, /_astro/_A7C2600.CtQtpK9l_Z1oK0Mq.jpeg 928w, /_astro/_A7C2600.CtQtpK9l_17TN63.jpeg 1280w, /_astro/_A7C2600.CtQtpK9l_2qGmvy.jpeg 1856w\" alt=\"A close-up of a chip that says, &quot;Sony Computer Entertainment&quot;\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"4581\" height=\"3752\"></picture></a><a class=\"img\" href=\"https://kennethmlamar.com/_astro/_A7C2598.BI7RGLi4_ykH6i.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/_A7C2598.BI7RGLi4_2jssTu.avif 300w, /_astro/_A7C2598.BI7RGLi4_Z1o3QSl.avif 600w, /_astro/_A7C2598.BI7RGLi4_XtvGi.avif 928w, /_astro/_A7C2598.BI7RGLi4_26lEiF.avif 1280w, /_astro/_A7C2598.BI7RGLi4_2dQ0p3.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/_A7C2598.BI7RGLi4_Z2siSnD.webp 300w, /_astro/_A7C2598.BI7RGLi4_Z15D5mx.webp 600w, /_astro/_A7C2598.BI7RGLi4_1gTid6.webp 928w, /_astro/_A7C2598.BI7RGLi4_1i3vOH.webp 1280w, /_astro/_A7C2598.BI7RGLi4_Z2tyI2c.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/_A7C2598.BI7RGLi4_5yQ8n.jpeg\" srcset=\"/_astro/_A7C2598.BI7RGLi4_uYBLa.jpeg 300w, /_astro/_A7C2598.BI7RGLi4_1REpMg.jpeg 600w, /_astro/_A7C2598.BI7RGLi4_ZOYkr2.jpeg 928w, /_astro/_A7C2598.BI7RGLi4_1SRK4M.jpeg 1280w, /_astro/_A7C2598.BI7RGLi4_Xm5ax.jpeg 1856w\" alt=\"A picture of the PS2 PCB, with a PlayStation-branded coin cell battery in focus.\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"5010\" height=\"3753\"></picture></a>",
      "summary": "Diagnosing a dead PS2.",
      "date_published": "2023-03-07T00:00:00.000Z",
      "tags": [
        "personal",
        "gaming",
        "hardware"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/dashcam/",
      "url": "https://kennethmlamar.com/posts/dashcam/",
      "title": "Stitching Dash Cam Footage",
      "content_html": "<p>Since YouTube provides effectively unlimited video uploads, I have been archiving all of my dash camera footage there.\nTo prevent the chance of data corruption, dash cams often split long recordings into smaller files as they are recorded.\nThis way, if a file is corrupted, it only affects a small chunk rather than the entire recording.\nMy dash cam only supports chunks up to 10 minutes in size, far shorter than my typical drive.\nFor the sake of organization, I want my segments combined into a full-length trips so that I have one trip per video upload.\nThere are some solutions already available online, but none of the existing tools met my needs.\nImplementing the desired segment joining was simple enough, so I wrote my own script.\nAt a broad level, it works by leveraging FFMPEG's concat feature.\nIt is tested on Windows, but should work on any platform with <a href=\"https://ffmpeg.org/\">FFMPEG</a> and Python 3.\nI would have added YouTube upload API support as well, but <a href=\"https://developers.google.com/youtube/v3/docs/videos/insert\">a policy</a> established several years ago to cut down on spam forces all videos uploaded through the API to always be private.\nThe full script I wrote can be found below.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"python\"><code><span class=\"line\"><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"\"\"This simple Python script is designed to seamlessly concatenate dash camera</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">footage segments into a single clip via FFMPEG.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"\"\"</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">import</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">NOTE</span><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">: Change these to suit your preferences.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># These folders and executables should exist before running the script.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The input folder. All segments will be pulled from here.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">INPUT_FOLDER</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> =</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"./raw/\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The output folder. All concatenated clips will be placed here.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">OUTPUT_FOLDER</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> =</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"./concat/\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The full path to FFMPEG.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">FFMPEG_PATH</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> =</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"ffmpeg\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The number of seconds expected between segments, which varies by dash cam</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># configuration. The default is 2 minutes, just in case the 1 minute segment</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># size I use somehow doesn't align perfectly in the saved dates.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">SEGMENT_LENGTH</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> =</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 2</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> *</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 60</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The extension of the individual video files.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">EXTENSION</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> =</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"TS\"</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Prepare and run the FFMPEG concat command to combine all listed files.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">def</span><span style=\"--shiki-light:#6F42C1;--shiki-dark:#DBB7FF\"> run_ffmpeg</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">(files_list):</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">    num_files </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> len</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">(files_list)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # There are no files.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    if</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> num_files </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">==</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # There is nothing to do.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">        return</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # There is only one file.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    elif</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> num_files </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">==</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 1</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # The name of the file is reused.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # It effectively becomes a copy operation.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        path </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> OUTPUT_FOLDER</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.path.splitext(files_list[</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">].name)[</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">] </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \".TS\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # There is more than one file.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    else</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Naming has the first and last file names separated by a dash to</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # indicate the whole time range.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        path </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> OUTPUT_FOLDER</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.path.splitext(files_list[</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">].name)[</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">] </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"-\"</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> \\</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">               +</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.path.splitext(files_list[</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">-</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">1</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">].name)[</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">0</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">] </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \".TS\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # The clip we want to generate already exists.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    if</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.path.isfile(path):</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Do nothing. There is no need to redo already completed work.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">        return</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # Set up our input file contents.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # We need this to contain a list of files to concatenate,</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # as per FFMPEG concat documentation.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">    file_contents </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # Iterate over each file.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    for</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\"> file</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> in</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> files_list:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Add the file to the list, in the right format for FFMPEG to parse.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # https://trac.ffmpeg.org/wiki/Concatenate</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        file_contents </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+=</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"file '\"</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\"> file</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">.path </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"'</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#FF9492\">\\n</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # Write the contents to file.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    with</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> open</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">(</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"./mylist.txt\"</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">, </span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"w+\"</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">) </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">as</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> f:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        f.write(file_contents)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # Run the actual command.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">    os.system(</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">FFMPEG_PATH</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \" -f concat -safe 0 -i mylist.txt -c copy \"</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> path)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    return</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">def</span><span style=\"--shiki-light:#6F42C1;--shiki-dark:#DBB7FF\"> main</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">():</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">    # Check the contents of the input folder, if it exists.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">    with</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.scandir(</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">INPUT_FOLDER</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">) </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">as</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> unsortedFiles:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Populate a list of all segments in the directory.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        files </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> []</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Get each file from the iterator.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # They are unsorted by default.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">        for</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\"> file</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> in</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> unsortedFiles:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # Ignore non-video files.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">            if</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> not</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\"> file</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">.path.endswith(</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\".\"</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> +</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> EXTENSION</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">):</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">                continue</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">            files.append(</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\">file</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Sort the segments by name.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Since dashcam footage is named by timestamp,</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # this will effectively sort by date.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        files </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> sorted</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">(files, </span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\">key</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=lambda</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> e: e.name)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # This will be the date the current segment was modified.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 0</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # This will be the date the previous segment was modified.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        old_time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> 0</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # This is the list of all segments to concat with FFMPEG.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        files_list </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> []</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Iterate over each segment.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">        for</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\"> file</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> in</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> files:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # Set the old_time for the now-previous segment.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">            old_time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> time</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # Set the new time for the current segment.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">            time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> os.stat(</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\">file</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">, </span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\">follow_symlinks</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\">False</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">).st_mtime</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # If more than SEGMENT_LENGTH seconds have passed.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # This segment is part of a new clip.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">            if</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">&gt;</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> old_time </span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">+</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> SEGMENT_LENGTH</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">                # Run FFMPEG on the existing list of segments.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">                run_ffmpeg(files_list)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">                # Clear the list to prep for the next session of video segments.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">                files_list.clear()</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">            # Add the segment to the list.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">            files_list.append(</span><span style=\"--shiki-light:#E36209;--shiki-dark:#FFB757\">file</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">)</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\">        # Run FFMPEG one final time, to make sure the last clip is concatenated.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">        run_ffmpeg(files_list)</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">if</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> __name__</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\"> ==</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> \"__main__\"</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">:</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">    main()</span></span></code></pre>\n",
      "summary": "Dash cams separate clips into short segments. With a simple script, I can seamlessly stitch them back together.",
      "date_published": "2022-04-26T00:00:00.000Z",
      "tags": [
        "personal",
        "notes"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/netbook/",
      "url": "https://kennethmlamar.com/posts/netbook/",
      "title": "Using a Netbook in 2022",
      "content_html": "<a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1694.Blrk7D2y_ZobRoO.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1694.Blrk7D2y_Z1jiPt4.avif 300w, /_astro/IMG_1694.Blrk7D2y_4NSS6.avif 600w, /_astro/IMG_1694.Blrk7D2y_cvkFP.avif 928w, /_astro/IMG_1694.Blrk7D2y_1Ksbbl.avif 1280w, /_astro/IMG_1694.Blrk7D2y_ZQiAhA.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1694.Blrk7D2y_Z10S3Wg.webp 300w, /_astro/IMG_1694.Blrk7D2y_neFoT.webp 600w, /_astro/IMG_1694.Blrk7D2y_uV7cD.webp 928w, /_astro/IMG_1694.Blrk7D2y_28eAy2.webp 1280w, /_astro/IMG_1694.Blrk7D2y_ZtwaTT.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1694.Blrk7D2y_Z1dlqF5.jpeg\" srcset=\"/_astro/IMG_1694.Blrk7D2y_1Wprcx.jpeg 300w, /_astro/IMG_1694.Blrk7D2y_Z1IDWfe.jpeg 600w, /_astro/IMG_1694.Blrk7D2y_Z1AWvru.jpeg 928w, /_astro/IMG_1694.Blrk7D2y_uXfVP.jpeg 1280w, /_astro/IMG_1694.Blrk7D2y_Z26Mvw6.jpeg 1856w\" alt=\"A photograph of a Netbook on a table, running the LXQT desktop environment\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"3267\" height=\"3024\"></picture></a>\n<p>There is a saying that limitations breed creativity.\nFor me, the limitation is my first personal laptop, an Acer Aspire One D150 Netbook from 2009.\nThe creativity is finding anything to do with it in 2022.</p>\n<table>\n<thead>\n<tr>\n<th>Features</th>\n<th>Acer Aspire One D150</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>CPU:</td>\n<td>32-bit Intel Atom N270 @ 1.6 GHz</td>\n</tr>\n<tr>\n<td>Graphics:</td>\n<td>Intel 945GSE</td>\n</tr>\n<tr>\n<td>RAM:</td>\n<td>2 GB of 533MHz DDR2 (Upgraded from 1GB)</td>\n</tr>\n<tr>\n<td>Storage:</td>\n<td>160 GB 5,400 RPM HDD</td>\n</tr>\n<tr>\n<td>Wireless:</td>\n<td>Atheros BCM4312 802.11b/g</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"heading-getting-up-and-running\">Getting Up and Running<a href=\"#heading-getting-up-and-running\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<h3 id=\"heading-the-os\">The OS<a href=\"#heading-the-os\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>When setting this device up, I had to decide which operating system to install on it.\nThe stock Windows XP it came with has been unsupported since 2014.\nI wanted to make this a secure, Internet connected device, so Windows XP wasn&#39;t suitable for my uses.\nInstead, I looked to Linux.\nThe open-source community provides lightweight software that can breathe new life into aging devices, and I wasn&#39;t afraid of getting my hands dirty to make things work.</p>\n<p>When exploring my options, I was surprised to learn that most Linux <a href=\"https://en.wikipedia.org/wiki/Linux_distribution\">distros</a> have dropped support for the x86 32-bit architecture.\nMost of the <a href=\"https://distrowatch.com/search.php?ostype=Linux&amp;architecture=i686\">remaining options</a> seem to be Debian and a handful of Debian derivatives.\nOther distributions, such as Ubuntu, provide 32-bit LTS builds, but those will lose support in 2023.\nI decided to install Debian as my OS, since it was closest to the Ubuntu experience I&#39;m used to.\nLXQT served as my <a href=\"https://en.wikipedia.org/wiki/Desktop_environment\">DE</a>, since it&#39;s one of the lightest modern desktop environments in the Linux world.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/netbook-screenshot.BVchCQcP_qeF0x.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/netbook-screenshot.BVchCQcP_Z2fCagO.avif 300w, /_astro/netbook-screenshot.BVchCQcP_Z2f5Lcr.avif 600w, /_astro/netbook-screenshot.BVchCQcP_1HBNOM.avif 928w, /_astro/netbook-screenshot.BVchCQcP_1E9c6f.avif 1024w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/netbook-screenshot.BVchCQcP_Z2ttBGS.webp 300w, /_astro/netbook-screenshot.BVchCQcP_Z2sWdCv.webp 600w, /_astro/netbook-screenshot.BVchCQcP_1tKmoI.webp 928w, /_astro/netbook-screenshot.BVchCQcP_ZiiAjQ.webp 1024w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/netbook-screenshot.BVchCQcP_2fLPaM.jpeg\" srcset=\"/_astro/netbook-screenshot.BVchCQcP_Z2orsXB.jpeg 300w, /_astro/netbook-screenshot.BVchCQcP_Z2nU4Te.jpeg 600w, /_astro/netbook-screenshot.BVchCQcP_1yMv80.jpeg 928w, /_astro/netbook-screenshot.BVchCQcP_2fLPaM.jpeg 1024w\" alt=\"A screenshot of my Netbook running the LXQT desktop environment\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\"></picture></a><figcaption>LXQT on my netbook.</figcaption></figure>\n<h3 id=\"heading-sleep-bug\">Sleep Bug<a href=\"#heading-sleep-bug\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>When I first installed Debian on the machine, the first thing I noticed was that my Netbook would often fall asleep if left at idle for more than a minute or two.\nThis is not default behavior in Debian and was never an issue in Windows XP.\nI came to discover that this line of computers has a bug where lid close events get sent to the OS periodically even when left open.\nThis caused the computer to sleep while on, sleep mid-boot, and even sleep before finishing a shutdown.\nInitially, my fix was to change my configuration so that lid close events would be ignored.\nThis is a reasonable solution, although it means actually closing the lid would no longer do anything.</p>\n<p>I later discovered that Acer had provided a BIOS update that fixes this issue.\nUnfortunately, Acer support no longer provides software downloads for devices this old.\nI could have tried to find a download from some random forum on the Internet, but I instead tracked down the latest BIOS update using the <a href=\"http://web.archive.org/\">Wayback Machine</a>.\nThe Wayback Machine supports wildcard searches to see all files archived under a server directory.\nI found the directory where the BIOS files used to be by following around some pages still on the Internet linking to the (dead) download.\nFrom there, it was a matter of filtering to <code>.zip</code> archives and finding appropriately named BIOS files.\nFortunately, the Wayback Machine had archived these drivers, and I was able to download the last BIOS revision, <a href=\"https://www.google.com/url?q=http://web.archive.org/web/2011*/http://global-download.acer.com/GDFiles/BIOS/BIOS/BIOS_Acer_1.13_A_A.zip%3Facerid%3D634006067021142404%26Step1%3DNetbook%26Step2%3DAspire%2520One%26Step3%3DAOD150%26OS%3DX02%26LC%3Den%26BC%3DAcer%26SC%3DPA_6&amp;usg=AOvVaw3VOh3yOR9s7B5ZBluGzDLK\">1.13</a>.</p>\n<p>Installing the BIOS update was somewhat inconvenient, as there are no visible options in the BIOS menus.\nEventually, I found a <a href=\"https://youtu.be/ZR6paPNebPY\">tutorial</a> on YouTube that worked for me.\nThe process is as follows:</p>\n<ol>\n<li>Ensure the battery is attached.</li>\n<li>Connect a flash drive formatted as FAT32 containing the <code>.fd</code> firmware file, <code>KAV10.fd</code> in this case.</li>\n<li>Hold Fn+Esc.</li>\n<li>While still holding these keys, plug in the power cable.</li>\n<li>While still holding the keys, press the power button.</li>\n<li>After waiting a few seconds, release the keys.</li>\n<li>You can tell that it worked if the screen remains blank but the flash drive is blinking as the firmware is read.</li>\n</ol>\n<p>I also found an alternative, easier approach.</p>\n<ol>\n<li>Image <a href=\"https://www.freedos.org/\">FreeDOS</a> onto a USB flash drive. <a href=\"https://rufus.ie/\">Rufus</a> has this functionality built in.</li>\n<li>Copy the <code>DOS</code> folder from the firmware <code>.zip</code> file to the root of the flash drive.</li>\n<li>Boot the Netbook off the USB to load into FreeDOS.</li>\n<li><code>cd</code> to the <code>DOS</code> folder copied earlier.</li>\n<li>Run the <code>.bat</code> file.</li>\n<li>Follow the prompts.</li>\n</ol>\n<p>With the BIOS updated, I could safely remove my hack, and lid close events now worked properly.\nNo more random sleeping.</p>\n<h3 id=\"heading-wi-fi-firmware\">Wi-Fi Firmware<a href=\"#heading-wi-fi-firmware\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>My last major setup difficulty involved finding and installing Wi-Fi firmware.\nOn this Netbook, as with many laptops (especially of this era), Wi-Fi firmware support in Linux is poor.\nAfter following <a href=\"https://wiki.debian.org/bcm43xx\">a guide</a> on the Debian Wiki, I was able to get it working by installing <code>b43-firmware-installer</code>, a packages that downloads and installs the proprietary Broadcom firmware needed for this machine&#39;s wireless adapter.</p>\n<h2 id=\"heading-the-creativity\">The Creativity<a href=\"#heading-the-creativity\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Now we get to the fun part: finding tasks well-suited for such a low power device.\nThis Netbook makes a <a href=\"https://www.raspberrypi.org/\">Raspberry Pi</a> look high end, and frankly, most projects would be better suited by the energy efficiency of a Pi.\nMy netbook&#39;s benefits over a Pi come from the hardware: a (low resolution) screen, (cramped) keyboard, (tiny) trackpad, and (aging) battery are all included in one convenient(ish) package.\nIf I wanted to run these projects on a Pi, I&#39;d have to buy more equipment.\nThis netbook costs me nothing extra, since it&#39;s been sitting in a closet doing nothing for years.</p>\n<h3 id=\"heading-web-browsing\">Web Browsing<a href=\"#heading-web-browsing\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Most web browsers have dropped support for 32-bit platforms.\nFirefox still maintains a version, called <a href=\"https://www.mozilla.org/en-US/firefox/enterprise/\">Firefox ESR</a>, that continues to receive updates on machines this old.\nHowever, the web has continued to become a more complex and bloated place.\nThe mere act of opening a tab can overwhelm this device for over a second before the CPU settles down.\nSimple sites are manageable, if uncomfortable.\nAny site serving web video is far too much for my Netbook, so I have resorted to lightweight alternatives such as downloading YouTube videos using <a href=\"https://github.com/yt-dlp/yt-dlp\">yt-dlp</a> for later playback in <a href=\"https://www.videolan.org/\">VLC</a> or watching live broadcasts using <a href=\"https://streamlink.github.io/\">streamlink</a>.</p>\n<p>As an alternative to traditional web browsers, I have developed a newfound appreciation for text-based web browsers.\n<a href=\"https://lynx.invisible-island.net/\">Lynx</a> is a 6 MB text web browser that runs entirely within a terminal.\nMost websites with reasonably well-organized html just work on Lynx.\nThe inability to serve anything other than text removes a ton of unnecessary bloat present on the web and makes navigating the Internet a downright snappy experience on this Netbook.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/lynx-website.C6tp4Vnc_Z7D8OF.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/lynx-website.C6tp4Vnc_ajHQT.avif 300w, /_astro/lynx-website.C6tp4Vnc_1t20w3.avif 600w, /_astro/lynx-website.C6tp4Vnc_1dIRGL.avif 928w, /_astro/lynx-website.C6tp4Vnc_1K6gbH.avif 1105w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/lynx-website.C6tp4Vnc_1z1jKn.webp 300w, /_astro/lynx-website.C6tp4Vnc_Z2cswop.webp 600w, /_astro/lynx-website.C6tp4Vnc_Z2rKEdG.webp 928w, /_astro/lynx-website.C6tp4Vnc_Zs2htX.webp 1105w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/lynx-website.C6tp4Vnc_19kgkU.png\" srcset=\"/_astro/lynx-website.C6tp4Vnc_N9UNN.png 300w, /_astro/lynx-website.C6tp4Vnc_26RdsW.png 600w, /_astro/lynx-website.C6tp4Vnc_1Qz5DF.png 928w, /_astro/lynx-website.C6tp4Vnc_19kgkU.png 1105w\" alt=\"A terminal window displaying my website in Lynx\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1105\" height=\"579\"></picture></a><figcaption>My website in Lynx.</figcaption></figure>\n<h3 id=\"heading-web-server\">Web Server<a href=\"#heading-web-server\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>It doesn&#39;t take a supercomputer to run a web server, at least not if the pages served are lightweight and the number of visitors remains low. Just look at this <a href=\"https://solar.lowtechmagazine.com/power.html\">solar-powered website</a>, which uses only a Raspberry Pi, a solar panel, and a battery.\nI installed <a href=\"https://www.lighttpd.net/\">lighttpd</a>, a web server optimized for minimal resource use, and threw a few files on it.</p>\n<h3 id=\"heading-games\">Games<a href=\"#heading-games\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<h4 id=\"armagetron-advanced\">Armagetron Advanced</h4>\n<p>For me, <a href=\"http://www.armagetronad.org/\">Armagetron Advanced</a> was a real classic.\nIt&#39;s a 3D Tron-inspired lightcycle game that is free and open-source.\nIt was one of my most-played games on my Netbook back when it was my main device.\nIt was (and remains) one of the few 3D games that runs reasonably well on it.</p>\n<h4 id=\"cave-story\">Cave Story</h4>\n<p>This is another classic from this Netbook&#39;s past.\nDeveloped over the course of five years by one man and released in 2004, <a href=\"https://www.cavestory.org/\">Cave Story</a> is a 2D platform adventure game.\nAs it was free and required little in the way of hardware capabilities, this was quite frequently played on my Netbook.\nI found a proper Linux build with 32-bit support, and it runs great, just as well as it did when I played it years ago.</p>\n<h4 id=\"open-rollercoaster-tycoon-2\">Open RollerCoaster Tycoon 2</h4>\n<p><a href=\"https://openrct2.org/\">Open RollerCoaster Tycoon 2</a> is an open-source conversion of RollerCoaster Tycoon 2.\nThe original game was written almost entirely in hand-written assembly, but this project works to convert the entire codebase to C++.\nWhile it doesn&#39;t reach a full 60 FPS in larger parks, the experience is still entirely playable on my Netbook.\nOf note, the PPA recommended by the Open RCT2 developers doesn&#39;t seem to provide packages for the 32-bit architecture.\nI had to build and run this one from source.</p>\n<h4 id=\"mgba\">mGBA</h4>\n<p>Just like a Pi, low powered computers such as this are well-suited for emulation of older game systems.\nmGBA is one of the most mature GBA emulators available.\nUsing it on a Netbook makes for one oversized Game Boy.\nNot all titles run at full speed, but there are still plenty that do.</p>\n<h4 id=\"super-mario-64\">Super Mario 64</h4>\n<p>Super Mario 64 recently had its code <a href=\"https://github.com/n64decomp/sm64\">fully decompiled</a> into C code that can be rebuilt into a bit-for-bit identical N64 ROM.\nUsing this base code, the game has been ported to many different platforms, including PC.\nThe <a href=\"https://github.com/sm64-port/sm64-port\">PC port</a> runs reasonably well on my Netbook, at native widescreen resolution.</p>\n<h4 id=\"minecraft\">Minecraft</h4>\n<p>Running Minecraft was a poor experience on this machine, though I didn&#39;t come in expecting much.\nThe official Linux launcher requires a 64-bit CPU, so I had to use a community-supported alternative with 32-bit support, <a href=\"https://multimc.org/\">MultiMC</a>.\nThis was not the last complication.\nStarting with Minecraft 1.13, they increased the minimum OpenGL version required.\nAs a result, my lowly Intel 945GSE refused to boot the latest version of the game.\nI had to install version 1.12.2, the last supported version.\nFinally in game, I turned the settings down as low as they would go.\nI ended up with a Minecraft experience that ran at 5-7 FPS.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/netbook-minecraft.BzP3DMvM_Z1dKhDU.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/netbook-minecraft.BzP3DMvM_127IIn.avif 300w, /_astro/netbook-minecraft.BzP3DMvM_ZaUGft.avif 600w, /_astro/netbook-minecraft.BzP3DMvM_BnopJ.avif 928w, /_astro/netbook-minecraft.BzP3DMvM_Z11ku6D.avif 1024w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/netbook-minecraft.BzP3DMvM_2aIcnk.webp 300w, /_astro/netbook-minecraft.BzP3DMvM_WELot.webp 600w, /_astro/netbook-minecraft.BzP3DMvM_1JXR4G.webp 928w, /_astro/netbook-minecraft.BzP3DMvM_Z1fbVwH.webp 1024w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/netbook-minecraft.BzP3DMvM_Z1a9MNq.jpeg\" srcset=\"/_astro/netbook-minecraft.BzP3DMvM_Z2fhssz.jpeg 300w, /_astro/netbook-minecraft.BzP3DMvM_1BQfmv.jpeg 600w, /_astro/netbook-minecraft.BzP3DMvM_2pal2I.jpeg 928w, /_astro/netbook-minecraft.BzP3DMvM_Z1a9MNq.jpeg 1024w\" alt=\"A screenshot of Minecraft running on the Netbook\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"600\"></picture></a><figcaption>This was the best I could manage.</figcaption></figure>",
      "summary": "Limitations breed creativity.",
      "date_published": "2022-04-25T00:00:00.000Z",
      "tags": [
        "personal",
        "hardware",
        "gaming",
        "server"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/intel-vtune/",
      "url": "https://kennethmlamar.com/posts/intel-vtune/",
      "title": "Intel VTune Profiler",
      "content_html": "<div class=\"lp\" data-astro-cid-mkx4gk7v><a class=\"lp-link\" href=\"https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html\" data-astro-cid-mkx4gk7v><img class=\"lp-img\" src=\"https://kennethmlamar.com/assets/images/previews/5e81673ed01b477b.webp\" alt=\"Fix Performance Bottlenecks with Intel® VTune™ Profiler\" width=\"1920\" height=\"1080\" data-astro-cid-mkx4gk7v><div class=\"met\" data-astro-cid-mkx4gk7v><img class=\"fav\" src=\"https://kennethmlamar.com/assets/images/previews/dd0d03cf61c6e142.png\" alt=\"Intel\" width=\"32\" height=\"32\" data-astro-cid-mkx4gk7v><div class=\"txt\" data-astro-cid-mkx4gk7v><strong class=\"ttl\" data-astro-cid-mkx4gk7v>Fix Performance Bottlenecks with Intel® VTune™ Profiler</strong><span class=\"dsc\" data-astro-cid-mkx4gk7v>Use advanced sampling and profiling methods to quickly analyze code, isolate issues, and deliver performance insight on modern CPUs, GPUs, and FPGAs.</span><div class=\"attr\" data-astro-cid-mkx4gk7v><em class=\"pub\" data-astro-cid-mkx4gk7v>Intel</em></div></div></div></a></div>\n<h2 id=\"heading-vtune\">VTune<a href=\"#heading-vtune\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>In any situation where you&#39;re running performance-critical code, I would consider profiling to be an essential part of code development.\nIntel VTune is a performance profiler, used to aid in program optimization by showing how much time is spent in each instruction within a program.\nIt supports CPUs, GPUs, FPGAs, a wide variety of languages, multithreaded code, and more.\nIt is built on top of <a href=\"http://www.intel.com/software/pintool\">Intel Pin</a>, the same tool used in the original implementation and <a href=\"https://kennethmlamar.com/posts/convul/\">my reimplementation</a> of <a href=\"https://ieeexplore.ieee.org/abstract/document/8952233\">ConVul</a>.\nUsing this tooling, profiling is performed at run-time, instrumenting code to determine how much time is spent in each section of the code.\nIt requires no special build steps, supporting arbitrary binaries out of the box.\nIn general, all you&#39;ll want to do is enable debug symbols so that reports can include more verbose data like function names.\nA profiler will show <a href=\"https://en.wikipedia.org/wiki/Hot_spot_(computer_programming)\">&quot;hot spots&quot;</a>, potential trouble spots and sections worth optimizing more heavily.</p>\n<p>As a personal example, when I developed my <a href=\"https://dl.acm.org/doi/abs/10.1145/3380536.3380543\">Lock-free transactional vector</a>, I was using a C++ <code>std:unordered_map</code>.\nI had a section of code where I relied on catching an exception to handle a missing key in the hash table.\nIn retrospect, this was a simple yet significant mistake.\nAt the time, I didn&#39;t realize just how expensive C++ exceptions were, especially in concurrent code.\nCatching these exceptions consumed most of my benchmark&#39;s run time.\nI replaced it with a key <code>find()</code> instead and the performance issue disappeared.\nWithout profiling, I likely wouldn&#39;t have identified the issue, but VTune pointed it out to me.</p>\n<p>If you prefer command-line tooling over the GUI provided by VTune, Chandler Carruth presented an excellent walkthrough of performance analysis and the gotchas of profiling C++ code using clang.</p>\n<div id=\"nXaxk27zwlk\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"nXaxk27zwlk\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/nXaxk27zwlk.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>",
      "summary": "Profiling software to improve performance.",
      "date_published": "2022-04-04T00:00:00.000Z",
      "tags": [
        "professional",
        "concurrency"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/raspberry-pi-usb/",
      "url": "https://kennethmlamar.com/posts/raspberry-pi-usb/",
      "title": "Booting a Raspberry Pi from USB",
      "content_html": "<p>While Raspberry Pis typically boot off of an SD or micro SD card, one can instead opt to boot off of USB storage. This is useful in a pinch, where you don&#39;t have a microSD card with a large enough capacity but do have a large enough flash drive. It&#39;s also useful if you prefer to boot off of an external hard drive or SSD, since they are designed to handle the stress of frequent reads and writes typically performed by an operating system.</p>\n<p>There are several ways to boot off of USB. I prefer to use the <code>bootcode.bin</code> boot mode, which allows you to put a small <code>bootcode.bin</code> file on the SD card used with the Pi and flash the rest of the image on a USB device instead of the SD card. This approach is detailed <a href=\"https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#special-bootcode-bin-only-boot-mode\">in the Raspberry Pi official documentation</a>.</p>\n<p>For a full list of boot behaviors and options, check out the full documentation&#39;s boot modes section:</p>\n<div class=\"lp\" data-astro-cid-mkx4gk7v><a class=\"lp-link\" href=\"https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-boot-modes\" data-astro-cid-mkx4gk7v><div class=\"met\" data-astro-cid-mkx4gk7v><div class=\"txt\" data-astro-cid-mkx4gk7v><strong class=\"ttl\" data-astro-cid-mkx4gk7v>Raspberry Pi Documentation - Raspberry Pi hardware</strong><span class=\"dsc\" data-astro-cid-mkx4gk7v>The official documentation for Raspberry Pi computers and microcontrollers — boot modes, USB mass storage boot, and hardware configuration.</span><div class=\"attr\" data-astro-cid-mkx4gk7v><em class=\"pub\" data-astro-cid-mkx4gk7v>Raspberry Pi</em></div></div></div></a></div>",
      "summary": "Booting a Raspberry Pi off of USB storage instead of an SD card.",
      "date_published": "2022-03-31T00:00:00.000Z",
      "tags": [
        "personal",
        "hardware",
        "notes"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/ryzen-instructions/",
      "url": "https://kennethmlamar.com/posts/ryzen-instructions/",
      "title": "Unsupported Ryzen Instructions",
      "content_html": "<p>Ryzen processors shook up a stagnant processor market with more cores at competitive prices. Recent models have closed the gap on single-core performance, leaving few major weaknesses when compared against Intel processors. However, Ryzen has historically had growing pains supporting the full instruction sets provided by Intel, some of which still exist to this day. The situation has largely improved over time via microcode updates, BIOS patches, and new processor revisions.</p>\n<p>Processors use <a href=\"https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits\">feature flags</a> to convey which instruction sets are supported. If the associated flag is set, software can safely call those instructions, often with performance gains from calling a single specialized instruction instead of a large sequence of more common instructions or providing extra features.</p>\n<p>On Ryzen, these enable bits are often set even when only a portion of the instructions are supported. This is the case for 16-bit legacy instructions. These instructions are used when virtualizing &#39;90s-era operating systems, such as Windows 98. Ryzen processors falsely claim full support for these 16-bit instructions, even though actual support is only partial. This is frustrating, as not claiming support would allow VMware to seamlessly fall back to virtualizing the required instructions in software. As it stands, the config needs to manually be adjusted to request software mode for these instructions, even today.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/Ryzen-Win98.EP5jxRwS_Z5xwk4.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/Ryzen-Win98.EP5jxRwS_274dbU.avif 300w, /_astro/Ryzen-Win98.EP5jxRwS_ZTAsui.avif 600w, /_astro/Ryzen-Win98.EP5jxRwS_12Yov6.avif 928w, /_astro/Ryzen-Win98.EP5jxRwS_ZW0mkR.avif 1280w, /_astro/Ryzen-Win98.EP5jxRwS_6b3kV.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/Ryzen-Win98.EP5jxRwS_Z1yqjIx.webp 300w, /_astro/Ryzen-Win98.EP5jxRwS_u68ob.webp 600w, /_astro/Ryzen-Win98.EP5jxRwS_2rG0oz.webp 928w, /_astro/Ryzen-Win98.EP5jxRwS_1U3dMo.webp 1280w, /_astro/Ryzen-Win98.EP5jxRwS_Z2szbbK.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/Ryzen-Win98.EP5jxRwS_1K5Hih.png\" srcset=\"/_astro/Ryzen-Win98.EP5jxRwS_Z2khHF7.png 300w, /_astro/Ryzen-Win98.EP5jxRwS_ZgKfxo.png 600w, /_astro/Ryzen-Win98.EP5jxRwS_1FOBs0.png 928w, /_astro/Ryzen-Win98.EP5jxRwS_Z1xLmbE.png 1280w, /_astro/Ryzen-Win98.EP5jxRwS_1K5Hih.png 1856w\" alt=\"Error messages in Windows 98 resulting from incorrect virtualization on Ryzen\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1172\"></picture></a><figcaption>A Windows 98 VM running on a Ryzen processor</figcaption></figure>\n<p>Instruction support has plagued the launch of popular video game titles. In the early days, Destiny 2 <a href=\"https://www.forbes.com/sites/jasonevangelho/2019/07/12/amd-motherboard-patch-ryzen-3000-customers-affected-by-destiny-2-and-linux-boot-problems/#56f47f0e16b8\">failed to run</a> on Ryzen systems without a BIOS update. While details are scant, the update presumably added support for instructions that were used by the game that were improperly handled by the CPU. Red Dead Redemption II was <a href=\"https://old.reddit.com/r/reddeadredemption/comments/dsezeq/rockstar_games_launcher_crash_list_of_all/\">similarly affected</a>.</p>\n\n<p>A particularly egregious example was the way Ryzen handled random number generation. Some processors have instructions designed to provide fast random number generation in hardware. Ryzen claims this support, yet its initial implementation <a href=\"https://arstechnica.com/gadgets/2019/10/how-a-months-old-amd-microcode-bug-destroyed-my-weekend/\">always returned 0xffffffff</a>, or -1 in signed 32-bit integer representation. To resolve this, Linux kernel developers had to ignore this instruction even for processors that claimed to support it.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/Dilbert-RNG.DC8FmzDm.gif\" title=\"Click to view full-size\"><img src=\"https://kennethmlamar.com/_astro/Dilbert-RNG.DC8FmzDm.gif\" alt=\"Dilbert - Tour of Accounting\" width=\"900\" height=\"266\" loading=\"lazy\" decoding=\"async\"></a><figcaption>Dilbert by Scott Adams, October 25, 2001</figcaption></figure>",
      "summary": "The relatively new Ryzen processor line has had some growing pains with instruction support.",
      "date_published": "2022-03-21T00:00:00.000Z",
      "tags": [
        "hardware"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/convul/",
      "url": "https://kennethmlamar.com/posts/convul/",
      "title": "ConVul Reimplementation",
      "content_html": "<h2 id=\"heading-convul\">ConVul<a href=\"#heading-convul\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p><a href=\"https://ieeexplore.ieee.org/abstract/document/8952233\">ConVul</a> is a concurrency vulnerability detector that uses <a href=\"http://www.intel.com/software/pintool\">Intel Pin</a> to instrument and detect potential bugs at run time in concurrent code. Concurrent bug detection is a hard problem, as, in the naïve case, bug checkers must comprehensively examine all possible interleavings of all instructions that could possibly occur.</p>\n<p>The authors of ConVul simplified the process by identifying which instructions could actually have their execution order reversed in practice (dubbed exchangeable events in the paper). If they are exchangeable, then it is worth checking to see if reversing their order would result in a buggy execution. This check happens at runtime, so it is possible that certain instructions could be exchangeable yet missed by actual situations seen by a particular run. This makes their approach more of a heuristic, albeit a practical one to find bugs that could realistically occur.</p>\n<p>The authors&#39; second set of optimizations to reduce the checking complexity was to consider only three classes of concurrency bugs: <a href=\"https://cwe.mitre.org/data/definitions/416.html\">use after free</a>, <a href=\"https://cwe.mitre.org/data/definitions/415.html\">double free</a>, and <a href=\"https://cwe.mitre.org/data/definitions/476.html\">null pointer dereference</a>. These bugs are common and high impact, making them worthwhile targets. By restricting to these, only a small subset of instructions needs to be instrumented and checked for reorderings, reducing the overhead of the tool.</p>\n<h2 id=\"heading-reimplementation\">Reimplementation<a href=\"#heading-reimplementation\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>I identified the ConVul paper as an ambitious class project idea when I took a computer security class last year. While the results were promising, the authors never provided their code. Only their <a href=\"https://github.com/mryancai/ConVul\">benchmarks</a> were made publicly available for use.</p>\n<p>To address this gap, I decided to reproduce the tool as my contribution. I had hoped to extend it to detect bugs in lock-free code, but my research sent me in a different direction. Nevertheless, my class paper and reimplemented code can be found on my GitHub. Ultimately, I consider my newfound understanding of Pin to be a valuable new tool under my belt, as this project made me feel comfortable instrumenting code for run-time code analysis.</p>\n<h3 id=\"heading-code\">Code<a href=\"#heading-code\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<div class=\"lp\" data-astro-cid-mkx4gk7v><a class=\"lp-link\" href=\"https://github.com/KennethLamar/ConVul\" data-astro-cid-mkx4gk7v><img class=\"lp-img\" src=\"https://kennethmlamar.com/assets/images/previews/4ec4122bcd472ebd.webp\" alt=\"GitHub - KennethLamar/ConVul: A reimplementation of ConVul, a concurrency vulnerability detector.\" width=\"1200\" height=\"600\" data-astro-cid-mkx4gk7v><div class=\"met\" data-astro-cid-mkx4gk7v><img class=\"fav\" src=\"https://kennethmlamar.com/assets/images/previews/b69ea4759d4d4256.png\" alt=\"GitHub\" width=\"512\" height=\"512\" data-astro-cid-mkx4gk7v><div class=\"txt\" data-astro-cid-mkx4gk7v><strong class=\"ttl\" data-astro-cid-mkx4gk7v>GitHub - KennethLamar/ConVul: A reimplementation of ConVul, a concurrency vulnerability detector.</strong><span class=\"dsc\" data-astro-cid-mkx4gk7v>A reimplementation of ConVul, a concurrency vulnerability detector. - KennethLamar/ConVul</span><div class=\"attr\" data-astro-cid-mkx4gk7v><em class=\"pub\" data-astro-cid-mkx4gk7v>GitHub</em></div></div></div></a></div>\n<h3 id=\"heading-class-paper\">Class Paper<a href=\"#heading-class-paper\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p><a href=\"https://github.com/KennethLamar/ConVul/raw/main/Paper.pdf\">https://github.com/KennethLamar/ConVul/raw/main/Paper.pdf</a></p>",
      "summary": "Implementing a concurrency vulnerability detector.",
      "date_published": "2022-03-10T00:00:00.000Z",
      "tags": [
        "professional",
        "concurrency"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/resilio-sync-oracle-cloud/",
      "url": "https://kennethmlamar.com/posts/resilio-sync-oracle-cloud/",
      "title": "Running Resilio Sync in Oracle Cloud Free Tier",
      "content_html": "<p><a href=\"https://www.resilio.com/individuals/\">Resilio Sync</a> is a file synchronization and sharing service that provides a decentralized, peer-to-peer alternative to traditional cloud-hosted alternatives like Google Drive, OneDrive, and Dropbox. I use it for fast file sharing between my devices and between my friends, without concerns over file sizes or cloud vendor restrictions.</p>\n<p>One of the shortcomings of this solution is that there is no guarantee that any peer devices will be online to receive a file unless you have made sure to leave it on in advance. To overcome this, I have leveraged the Oracle Cloud free tier, which allows me to run a Resilio Sync instance 24/7. This instance leverages the 200GB of free block storage to keep files synchronized. Resilio has an optional encryption option I use so that the cloud machine can synchronize the files without having access to them. Additionally, the ARM compute instances are provisioned with symmetric gigabit networking, which means that I can use the cloud server to alleviate most of the bandwidth limits inherent from sharing files over residential Internet connections. I like this solution because it keeps me in control of my own files.</p>\n",
      "summary": "Using Oracle Cloud's free tier, I have enhanced my own decentralized file share.",
      "date_published": "2022-01-24T00:00:00.000Z",
      "tags": [
        "personal",
        "cloud",
        "server"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/gpu-pv/",
      "url": "https://kennethmlamar.com/posts/gpu-pv/",
      "title": "Splitting a GPU among Multiple VMs with GPU-PV",
      "content_html": "<p>Windows Display Driver GPU Paravirtualization, or GPU-PV for short, was announced for release in <a href=\"https://devblogs.microsoft.com/directx/directx-heart-linux/#gpu-virtualization\">this blog post</a>. It provides a GPU driver within <a href=\"https://en.wikipedia.org/wiki/Hyper-V\">Hyper-V</a> that taps into the full power of a GPU, splitting resources among the host and the VMs as needed. Conventional VM GPUs are primarily designed for accelerating desktop GUIs yet are insufficient for use in gaming or other graphically demanding workloads. Oftentimes, driver support is poor, resulting in graphical glitches and crashes. Even when they do work, latency is often unacceptably high. GPU-PV attempts to solve these limitations, making it viable to run your own personal cloud GPU-accelerated VMs, ideal for gaming, machine learning, scientific computing, and other GPU-accelerated tasks split among multiple users on a single physical machine.</p>\n<p>The main limit here is that you are constrained to running a Windows-based host with only Windows VM guests currently supported. Since most games run natively on Windows already, this may not be a major concern, but this will depend on the use case. For instance, GPU-PV can be used to expose the virtualized GPU to <a href=\"https://docs.microsoft.com/en-us/windows/wsl/about\">WSL2</a> for hardware-accelerated ML on Linux from within Windows.</p>\n<p>There are also some rough edges. <a href=\"https://en.wikipedia.org/wiki/OpenGL\">OpenGL</a> support is limited and <a href=\"https://en.wikipedia.org/wiki/Vulkan\">Vulkan</a> won&#39;t work at all. Additionally, resolution changes and <a href=\"https://docs.microsoft.com/en-us/windows/security/identity-protection/user-account-control/how-user-account-control-works\">UAC</a> prompts often result in black screens for a few seconds. Finally, a display must be connected to the GPU (even a dummy connection will work), or else display capture will fail.</p>\n<h2 id=\"heading-tutorials\">Tutorials<a href=\"#heading-tutorials\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>While official documentation is scant, there are several tutorials already available to set this up for yourself.</p>\n<p>This blog post provides a textual tutorial and more background on GPU-PV:</p>\n<div class=\"lp\" data-astro-cid-mkx4gk7v><a class=\"lp-link\" href=\"https://web.archive.org/web/20231107182321/https://mu0.cc/2020/08/25/hyperv-gpupv/\" data-astro-cid-mkx4gk7v><div class=\"met\" data-astro-cid-mkx4gk7v><div class=\"txt\" data-astro-cid-mkx4gk7v><strong class=\"ttl\" data-astro-cid-mkx4gk7v>GPU Virtualization with Hyper-V – James&#39; Personal Site</strong><span class=\"dsc\" data-astro-cid-mkx4gk7v>How to partition and share a physical GPU among multiple Windows virtual machines using Hyper-V GPU-PV (archived copy on Wayback Machine).</span><div class=\"attr\" data-astro-cid-mkx4gk7v><em class=\"by\" data-astro-cid-mkx4gk7v>James</em><em class=\"pub\" data-astro-cid-mkx4gk7v>mu0.cc (Internet Archive)</em></div></div></div></a></div>\n<p>This video provides an excellent guide to set it up yourself as well:</p>\n<div id=\"XLLcc29EZ_8\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"XLLcc29EZ_8\" params=\"start=570\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/XLLcc29EZ_8.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>\n<p>Finally, this GitHub project below will provide a refined script that quickly sets you up with a fresh install of Windows with GPU-PV enabled and <a href=\"https://parsec.app/\">Parsec</a> installed for up to 4K resolution and more than 120Hz refresh rates via hardware-accelerated desktop streaming to a virtualized display driver.</p>\n<div class=\"lp\" data-astro-cid-mkx4gk7v><a class=\"lp-link\" href=\"https://github.com/jamesstringerparsec/Easy-GPU-PV\" data-astro-cid-mkx4gk7v><div class=\"met\" data-astro-cid-mkx4gk7v><img class=\"fav\" src=\"https://kennethmlamar.com/assets/images/previews/b69ea4759d4d4256.png\" alt=\"GitHub\" width=\"512\" height=\"512\" data-astro-cid-mkx4gk7v><div class=\"txt\" data-astro-cid-mkx4gk7v><strong class=\"ttl\" data-astro-cid-mkx4gk7v>GitHub - jamesstringer90/Easy-GPU-PV: A Project dedicated to making GPU Partitioning on Windows easier!</strong><span class=\"dsc\" data-astro-cid-mkx4gk7v>A Project dedicated to making GPU Partitioning on Windows easier! - jamesstringer90/Easy-GPU-PV</span><div class=\"attr\" data-astro-cid-mkx4gk7v><em class=\"pub\" data-astro-cid-mkx4gk7v>GitHub</em></div></div></div></a></div>",
      "summary": "Using GPU-PV for cutting-edge GPU acceleration within a VM.",
      "date_published": "2022-01-20T00:00:00.000Z",
      "tags": [
        "personal",
        "hardware",
        "cloud",
        "server",
        "gaming"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/disabling-desktop-in-linux/",
      "url": "https://kennethmlamar.com/posts/disabling-desktop-in-linux/",
      "title": "Disabling and Enabling Your Desktop Environment in Linux",
      "content_html": "<p>To prevent a Linux desktop environment from starting on boot, all you have to do is use <code>systemd</code> to set the default mode with the following command:</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> set-default</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> graphical.target</span></span></code></pre>\n<p>The next time you boot, you will launch in a terminal, with no desktop GUI running.</p>\n<p>To restore back to the GUI, you can run the following command:</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> set-default</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> multi-user.target</span></span></code></pre>\n<p>This command also requires a reboot to take effect, but it will restore your standard desktop environment.</p>\n<p>To easily automate the whole process, I have added the following lines to my <code>.bashrc</code> file:</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">alias</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> startx</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"sudo systemctl set-default graphical.target &amp;&amp; sudo reboot now\"</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">alias</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\"> term</span><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">=</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\">\"sudo systemctl set-default multi-user.target &amp;&amp; sudo reboot now\"</span></span></code></pre>\n<p>Now, all I have to do is type <code>term</code> to reboot to a terminal and <code>startx</code> to reboot to a desktop environment.</p>\n",
      "summary": "Turning the desktop environment off saves compute for servers, but sometimes you still want the convenience of a GUI. These shortcuts let you quickly switch between either.",
      "date_published": "2022-01-20T00:00:00.000Z",
      "tags": [
        "personal",
        "server",
        "notes"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/nanite2/",
      "url": "https://kennethmlamar.com/posts/nanite2/",
      "title": "Using Nanite with Virtual LEGO Elements in Unreal Engine 5 - Part 2",
      "content_html": "<p>Since my last <a href=\"https://kennethmlamar.com/posts/nanite1/\">blog post</a> on the matter, I have developed an approach to overcome some of my issues with UE5&#39;s new Nanite features. To optimize my terrain for Nanite, I have started using a <a href=\"https://docs.unrealengine.com/5.0/en-US/API/Plugins/ProceduralMeshComponent/UProceduralMeshComponent/\">ProceduralMeshComponent</a> to generate a fully connected mesh. This allows me to create a mesh by enumerating the geometry via code. I used a multi-part tutorial I found online (<a href=\"http://wlosok.cz/procedural-mesh-in-ue4-1-triangle/\">part 1: generating a single triangle</a> and <a href=\"http://wlosok.cz/procedural-mesh-in-ue4-2-subdivided-plane/\">part 2: generating a subdivided plane</a>) to guide my approach. In this way, I was able to write code to generate the top face and stud associated with each brick, then stitch together the sides to ensure the mesh is fully connected. However, a procedural mesh is insufficient for Nanite, as it only supports static meshes. Unreal Engine has a button to convert a procedural mesh into a static mesh, but I needed to automate this from code. I examined and repurposed the source code of Unreal Engine, identifying the code behind the button and repurposing it for myself. I came up with this approach based on <a href=\"https://answers.unrealengine.com/questions/550160/where-is-the-create-static-mesh-feature-coded-on-p.html\">this question</a>, which led me to <a href=\"https://answers.unrealengine.com/questions/551137/procedural-mesh-not-saving-all-of-its-sections-to.html\">this example</a> (note that the code listed here is outdated and you must instead borrow from the latest engine code).</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/LEGONanite.BYsP0EQS_Zdol5Y.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/LEGONanite.BYsP0EQS_1ykV6R.avif 300w, /_astro/LEGONanite.BYsP0EQS_Z1vYsO.avif 600w, /_astro/LEGONanite.BYsP0EQS_2hTI8b.avif 928w, /_astro/LEGONanite.BYsP0EQS_Z2nCvun.avif 1280w, /_astro/LEGONanite.BYsP0EQS_10449p.avif 1560w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/LEGONanite.BYsP0EQS_1V7lty.webp 300w, /_astro/LEGONanite.BYsP0EQS_lfpSR.webp 600w, /_astro/LEGONanite.BYsP0EQS_Z2pv0j4.webp 928w, /_astro/LEGONanite.BYsP0EQS_ZXUTAT.webp 1280w, /_astro/LEGONanite.BYsP0EQS_Z1d4twg.webp 1560w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/LEGONanite.BYsP0EQS_oi4iC.png\" srcset=\"/_astro/LEGONanite.BYsP0EQS_qxBOA.png 300w, /_astro/LEGONanite.BYsP0EQS_Z19jiK6.png 600w, /_astro/LEGONanite.BYsP0EQS_1a7oPT.png 928w, /_astro/LEGONanite.BYsP0EQS_Z1JMixt.png 1280w, /_astro/LEGONanite.BYsP0EQS_oi4iC.png 1560w\" alt=\"My LEGO test.\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1560\" height=\"1200\"></picture></a><figcaption>A test of my procedural brick generation and stitching code.</figcaption></figure>\n<p>After this, I started refining my approach. To add the LEGO logo and injection marks, I created the top of each brick in <a href=\"https://www.blender.org/\">Blender</a> (this was easier than figuring out how to make the object in code) and exported to OBJ. From there, I created my own OBJ import code in Unreal. This was relatively easy, as OBJ is a simple and <a href=\"https://en.wikipedia.org/wiki/Wavefront_.obj_file\">well-documented</a> format. Using Blender&#39;s developer mode, I was able to identify the vertex ID of each corner for use in a procedural stitching algorithm. While it is still a work-in-progress, here is a preview of the refined approach.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/LEGONanite2.KQqBhPcX_ZUeHq7.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/LEGONanite2.KQqBhPcX_ZynkEh.avif 300w, /_astro/LEGONanite2.KQqBhPcX_1s0Xl3.avif 600w, /_astro/LEGONanite2.KQqBhPcX_ZQ0xhe.avif 928w, /_astro/LEGONanite2.KQqBhPcX_1jvOSS.avif 1280w, /_astro/LEGONanite2.KQqBhPcX_Z17qWC0.avif 1481w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/LEGONanite2.KQqBhPcX_Pjgec.webp 300w, /_astro/LEGONanite2.KQqBhPcX_Z2dtyzp.webp 600w, /_astro/LEGONanite2.KQqBhPcX_xG3Bf.webp 928w, /_astro/LEGONanite2.KQqBhPcX_Z1feoCN.webp 1280w, /_astro/LEGONanite2.KQqBhPcX_1nYVEf.webp 1481w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/LEGONanite2.KQqBhPcX_wsGkl.png\" srcset=\"/_astro/LEGONanite2.KQqBhPcX_4rRhC.png 300w, /_astro/LEGONanite2.KQqBhPcX_25QbhW.png 600w, /_astro/LEGONanite2.KQqBhPcX_Zdakkk.png 928w, /_astro/LEGONanite2.KQqBhPcX_Z26KDWH.png 1280w, /_astro/LEGONanite2.KQqBhPcX_wsGkl.png 1481w\" alt=\"A revised LEGO test.\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1481\" height=\"1199\"></picture></a><figcaption>A revised test of my procedural brick generation and stitching code.</figcaption></figure>\n<p>At this stage, my remaining challenges are:</p>\n<ul>\n<li>Scaling the processes up to a massive island. There seem to be some engine limits in geometric density for procedural meshes limiting the number of bricks I can represent.</li>\n<li>Fixing normals so that odd shading artifacts no longer appear and so the LEGO logo is sufficiently distinct.</li>\n<li>Properly connecting the beveled edges while remaining a contiguous surface.</li>\n<li>Adjusting my OBJ importer, as all geometry is mirrored until I manually correct it.</li>\n</ul>\n<p>While I have very limited amounts of time to devote to the project at this point, it has been fun working on it, as I have never worked with geometry at this low a level before.</p>",
      "summary": "Overcoming some of my struggles with Nanite in UE5.",
      "date_published": "2022-01-14T00:00:00.000Z",
      "tags": [
        "personal",
        "LEGO",
        "Unreal",
        "gaming"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/systemd-service-tutorial/",
      "url": "https://kennethmlamar.com/posts/systemd-service-tutorial/",
      "title": "Making and Running Services on Linux using systemd",
      "content_html": "<p>Once I have set up a project on a server, I typically want it to run all the time, surviving across reboots and restarting if it crashes. To facilitate this, I use <code>systemd</code>, a Linux system manager that enables the use of <a href=\"https://en.wikipedia.org/wiki/Daemon_(computing)\">daemons</a> and other custom background tasks. Below are my notes on how to set up such a system for personal projects.</p>\n<h2 id=\"heading-guide\">Guide<a href=\"#heading-guide\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>First, create a <code>.service</code> file under <code>/etc/systemd/system/</code>. For the sake of this tutorial, we will create one for Minecraft and choose to call it <code>minecraft.service</code>. Services are owned by root, so we must <code>sudo</code> to create the file successfully.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> touch</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> /etc/systemd/system/minecraft.service</span></span></code></pre>\n<p>Each <code>.service</code> file follows the syntax documented <a href=\"https://www.freedesktop.org/software/systemd/man/systemd.syntax.html\">in the systemd.syntax reference</a>. My typical use requires only a few changes to a base set of contents, so I will provide that template here. Use this template to modify <code>minecraft.service</code> as needed, saving as root. The purpose of each line is described below in comments.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"ini\"><code><span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># /etc/systemd/system/minecraft.service</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">[Unit]</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># A description used to identify what this service does.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">Description</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=Run Minecraft</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Ensures that the service doesn't start until after networking has started.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">After</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=network.target</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">[Service]</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The working directory.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># This should be set to wherever you want to run the task.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># This is typically the directory where the executable lives.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">WorkingDirectory</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=/home/ubuntu/minecraft</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The user and group you want to run this command as.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Typically, I run commands as my own user (ubuntu) to simplify permissions.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">User</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=ubuntu</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">Group</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=ubuntu</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># This line ensures the program restarts on its own in case the process crashes.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">Restart</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=always</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The actual command to execute on boot.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># We create a screen instance called mc.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># This will alow us to attach to the screen instance if necessary.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># After that is the command itself.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># In this case, we run a bash script in the working directory.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">ExecStart</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=/usr/bin/screen -DmS mc bash minecraft.sh</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">[Install]</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># The run level.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Ensures the process starts at the right part of the boot process.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#D73A49;--shiki-dark:#FF9492\">WantedBy</span><span style=\"--shiki-light:#24292E;--shiki-dark:#F0F3F6\">=multi-user.target</span></span></code></pre>\n<p>Now reload <code>systemd</code> so it has access to your new service. This should be run whenever <code>minecraft.service</code> is modified.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10;overflow-x:auto\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> daemon-reload</span></span></code></pre>\n<p>Enable the service so it will run automatically at boot.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> enable</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span></code></pre>\n<p>From here, you can either start the service now with <code>sudo systemctl start minecraft.service</code> or reboot to ensure the service starts properly.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10;overflow-x:auto\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> reboot</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> now</span></span></code></pre>\n<p>After a reboot, you can verify that the command is executing by attaching to its <a href=\"https://linux.die.net/man/1/screen\"><code>screen</code></a> instance.</p>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">screen</span><span style=\"--shiki-light:#005CC5;--shiki-dark:#91CBFF\"> -r</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> mc</span></span></code></pre>\n<p>You can detach from a screen instance by pressing <code>Ctrl+a</code> <code>d</code>. A full cheat sheet of <code>screen</code> commands can be found via <a href=\"https://linuxize.com/post/how-to-use-linux-screen/\">this article on Linuxize</a>.</p>\n<h2 id=\"heading-a-short-systemctl-cheat-sheet\">A Short <code>systemctl</code> Cheat Sheet<a href=\"#heading-a-short-systemctl-cheat-sheet\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<pre class=\"astro-code astro-code-themes github-light github-dark-high-contrast\" style=\"--shiki-light:#24292e;--shiki-dark:#f0f3f6;--shiki-light-bg:#fff;--shiki-dark-bg:#0a0c10; overflow-x: auto;\" tabindex=\"0\" data-language=\"bash\"><code><span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Reload the system manager configuration.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Run this after performing any modifications to a .service file.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> daemon-reload</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Enable the service to run at boot.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> enable</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Disable the service so it no longer runs at boot.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> disable</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Start the service.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Used if the service is not running.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># This might happen if it was manually stopped</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># or if it was never enabled to run at boot.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> start</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Stop the service.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># When Restart=always is used, this command is necessary</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># to prevent the killed process from restarting.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> stop</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span>\n<span class=\"line\"></span>\n<span class=\"line\"><span style=\"--shiki-light:#6A737D;--shiki-dark:#BDC4CC\"># Equivalent to running stop followed by start.</span></span>\n<span class=\"line\"><span style=\"--shiki-light:#6F42C1;--shiki-dark:#FFB757\">sudo</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> systemctl</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> restart</span><span style=\"--shiki-light:#032F62;--shiki-dark:#ADDCFF\"> minecraft.service</span></span></code></pre>",
      "summary": "A quick example, just as much for myself as for anyone else to reference.",
      "date_published": "2022-01-13T00:00:00.000Z",
      "tags": [
        "personal",
        "server",
        "notes"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/minecraft-oracle-cloud/",
      "url": "https://kennethmlamar.com/posts/minecraft-oracle-cloud/",
      "title": "Running Minecraft in the Oracle Cloud Free Tier",
      "content_html": "<p>Recently, I worked with a friend to migrate his Minecraft server over to the Oracle Cloud free tier, primarily using <a href=\"https://blogs.oracle.com/developers/post/how-to-set-up-and-run-a-really-powerful-free-minecraft-server-in-the-cloud\">this blog post</a> as a guide. Using the Oracle Cloud service is a significant upgrade over the $12/month plan provided by <a href=\"https://www.bisecthosting.com/minecraft-server-hosting.php\">Bisect Hosting</a> my friend was using, which often lagged and enforced arbitrary limits on server configurations. Hosting via the cloud overcame these limits for free, plus we found that the server ping was cut in half, presumably because the Oracle data centers were closer than Bisect's offerings.</p>\n<p>Ultimately, for anyone willing to get their hands dirty with some <a href=\"https://en.wikipedia.org/wiki/Command-line_interface\">CLI</a> use, the Oracle Cloud server is more powerful and more flexible while running 24/7 at the unbeatable price of free. It also offered significant advantages over a home server solution, since it doesn't cut into residential data caps, doesn't consume a share of limited residential upload bandwidth, and provides better uptime and consistency than could be expected with a local machine.</p>\n",
      "summary": "Oracle Cloud's free tier makes an excellent and free Minecraft server host.",
      "date_published": "2022-01-13T00:00:00.000Z",
      "tags": [
        "personal",
        "gaming",
        "cloud",
        "server"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/nanite1/",
      "url": "https://kennethmlamar.com/posts/nanite1/",
      "title": "Using Nanite with Virtual LEGO Elements in Unreal Engine 5 - Part 1",
      "content_html": "<p>Unreal Engine 5 has built new features into the engine to make it easier for developers to build massive, high-fidelity worlds. <a href=\"https://docs.unrealengine.com/5.0/en-US/RenderingFeatures/Nanite/\">Nanite</a> provides a virtualized geometry system, meant to replace the need for <a href=\"https://en.wikipedia.org/wiki/Level_of_detail_(computer_graphics)\">LODs</a> while enabling extreme geometric detail up close.</p>\n<p>I was personally interested in trying this new technology on LEGO brick-built scenes, as LEGO bricks are small, <a href=\"https://en.wikipedia.org/wiki/Voxel\">voxel</a>-like elements with limited options for LODs per-brick. I set out on an overambitious project to procedurally generate a performant, brick-built, minifig-scale island using Nanite to handle LODs.</p>\n<p>I found a significant limitation with Nanite that hampered my efforts. Voxel-like worlds, without careful optimization, are one of the worst-case scenarios for Nanite. Nanite works by breaking down clusters of polygons into hierarchal groups that can be simplified down on a per-cluster basis into reduced levels of detail. On something as simple as a cube, there are no clusters to simplify down to. Additionally, the elements I was using suffered from using disconnected meshes for the block, the stud, and each portion of the LEGO logo on top of the studs. These disconnected meshes are referred to in the Nanite documentation as <a href=\"https://docs.unrealengine.com/5.0/en-US/RenderingFeatures/Nanite/#facetedandhard-edgenormals\">faceted normals</a>. Ultimately, whenever polygons are disconnected, Nanite is unable and unwilling to merge them together.</p>\n<p>This means that, for Nanite to work its magic, LEGO elements must all be merged into large mesh chunks offline, then processed by Nanite for use in-engine. Additionally, portions of LEGO elements, such as the tubes used to improve piece grip, should be removed if they will never be seen, as Nanite has difficulty <a href=\"https://en.wikipedia.org/wiki/Hidden-surface_determination#Culling_and_Visible_Surface_Determination\">culling</a> <a href=\"https://docs.unrealengine.com/5.0/en-US/RenderingFeatures/Nanite/#closelystackedsurfaces\">closely stacked surfaces</a>. Performing these sorts of operations automatically and at scale is something I haven't fully worked out, although <a href=\"https://www.nvidia.com/en-us/on-demand/session/gtcspring21-e32773/\">similar processing</a> was done in-engine in <a href=\"https://www.lightbrick.com/builders-journey\">LEGO® Builder's Journey</a>.</p>\n",
      "summary": "An overview of my struggles with Nanite in UE5.",
      "date_published": "2021-12-30T00:00:00.000Z",
      "tags": [
        "personal",
        "LEGO",
        "Unreal",
        "gaming"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/oracle-cloud-free/",
      "url": "https://kennethmlamar.com/posts/oracle-cloud-free/",
      "title": "The Oracle Cloud Free Tier",
      "content_html": "<p>In the interests of competing against other cloud providers, Oracle provides one of the most competitive sets of <a href=\"https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier_topic-Always_Free_Resources.htm\">always-free resources</a> around. Most of their competitors only provide free trial services or services with limited run times.</p>\n<p>Oracle <a href=\"https://blogs.oracle.com/cloud-infrastructure/post/oracle-builds-out-their-portfolio-of-oracle-cloud-infrastructure-always-free-services\">expanded</a> their list of free services earlier this year, notably adding support for up to four cores of Ampere A1 Compute, either in one machine or spread across up to 4 machines. This is a significant improvement over their free 1 OCPU VMs. These servers are particularly useful for projects that require relatively reliable 24/7 uptime, such as <a href=\"https://kennethmlamar.com/posts/minecraft-oracle-cloud/\">Minecraft servers</a>, periodic web scrapers, web servers, and <a href=\"https://kennethmlamar.com/posts/resilio-sync-oracle-cloud/\">self-hosted file syncing with Resilio Sync</a>. I am already using the service for a few of <a href=\"https://kennethmlamar.com/tags/cloud/\">my own</a> personal projects.</p>\n<p>There are few strings attached to these instances. The main catch is that there is no guarantee that Oracle will continue to provide these services indefinitely. At any point, they could transition to paid services only, at which point you would have to pay or migrate off the platform. For small hobbyist projects, this should be of limited concern.</p>\n",
      "summary": "Why the Oracle Cloud free tier is worth using for small personal projects.",
      "date_published": "2021-12-29T00:00:00.000Z",
      "tags": [
        "personal",
        "cloud",
        "server"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/ds-lite-repair/",
      "url": "https://kennethmlamar.com/posts/ds-lite-repair/",
      "title": "DS Lite Repair",
      "content_html": "<a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1262.C2ua2mZd_1yvIXv.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1262.C2ua2mZd_syVCc.avif 300w, /_astro/IMG_1262.C2ua2mZd_1aTqwa.avif 600w, /_astro/IMG_1262.C2ua2mZd_ynM5l.avif 928w, /_astro/IMG_1262.C2ua2mZd_1RMOTc.avif 1280w, /_astro/IMG_1262.C2ua2mZd_ZsK9gf.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1262.C2ua2mZd_Z1hRwEm.webp 300w, /_astro/IMG_1262.C2ua2mZd_Zzx2Ko.webp 600w, /_astro/IMG_1262.C2ua2mZd_Z1c3Gcd.webp 928w, /_astro/IMG_1262.C2ua2mZd_Z1RaAOJ.webp 1280w, /_astro/IMG_1262.C2ua2mZd_7BzIh.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1262.C2ua2mZd_ZFlR3n.jpeg\" srcset=\"/_astro/IMG_1262.C2ua2mZd_9ooWY.jpeg 300w, /_astro/IMG_1262.C2ua2mZd_QISQW.jpeg 600w, /_astro/IMG_1262.C2ua2mZd_fdfq8.jpeg 928w, /_astro/IMG_1262.C2ua2mZd_2iPw6s.jpeg 1280w, /_astro/IMG_1262.C2ua2mZd_Z2tY8tU.jpeg 1856w\" alt=\"My clear DS Lite.\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"4032\" height=\"3024\"></picture></a>\n<p>While I try to take good care of my possessions, my DS Lite was easily my most-used handheld console growing up, and it suffered for it. Many of these aging consoles suffer from a broken hinge. The mechanism goes under stress every time you open or close the system. On mine, what started as a crack expanded until the plastic itself fell off.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_2o7K9b.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_2jmzut.avif 300w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_15AbGc.avif 600w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_vCw7m.avif 928w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1bdgHq.avif 1280w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_1wFUuG.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_ry0aE.webp 300w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_ZLdnCC.webp 600w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1lb3cs.webp 928w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_1YXv2n.webp 1280w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1tiGA6.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1ud8Om.jpeg\" srcset=\"/_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_1NvhFc.jpeg 300w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_zISQU.jpeg 600w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Lei5.jpeg 928w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1BbSNg.jpeg 1280w, /_astro/Nintendo_DS_Lite_(right_side).B-NtN9Cs_Z1ud8Om.jpeg 1856w\" alt=\"A view of the right side of the Nintendo DS Lite.\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1192\"></picture></a><figcaption>Just imagine this, but with a chunk of plastic missing from the hinge and some Mario stickers on it. Photo by Havok at en.wikipedia, CC BY 2.5, via Wikimedia Commons</figcaption></figure>\n<p>With this issue, my DS flopped about, so I decided (perhaps ten years late) that a replacement shell was in order. Since I was going through the effort, I decided to buy a shell in a totally different, unofficial color. DS reproduction shells are sold cheap on AliExpress. I chose a clear design and bought it for about $10 from <a href=\"https://www.aliexpress.com/item/32820118046.html\">this listing</a>.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1253.DLmW0w1R_1oY2Er.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1253.DLmW0w1R_ZmBwyo.avif 300w, /_astro/IMG_1253.DLmW0w1R_VlDBW.avif 600w, /_astro/IMG_1253.DLmW0w1R_1hwvVf.avif 928w, /_astro/IMG_1253.DLmW0w1R_Z1MEu4c.avif 1280w, /_astro/IMG_1253.DLmW0w1R_Z1NIwTb.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1253.DLmW0w1R_Z4bK2A.webp 300w, /_astro/IMG_1253.DLmW0w1R_1eLq8K.webp 600w, /_astro/IMG_1253.DLmW0w1R_1zWis3.webp 928w, /_astro/IMG_1253.DLmW0w1R_2tevgL.webp 1280w, /_astro/IMG_1253.DLmW0w1R_Z1qW7wu.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1253.DLmW0w1R_20XFFf.jpeg\" srcset=\"/_astro/IMG_1253.DLmW0w1R_Z2b5nGI.jpeg 300w, /_astro/IMG_1253.DLmW0w1R_ZR7cvn.jpeg 600w, /_astro/IMG_1253.DLmW0w1R_ZvVkc5.jpeg 928w, /_astro/IMG_1253.DLmW0w1R_Z208oi5.jpeg 1280w, /_astro/IMG_1253.DLmW0w1R_20XFFf.jpeg 1856w\" alt=\"A clear plastic shell replacement\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1392\"></picture></a><figcaption>The replacement shell, still in its plastic.</figcaption></figure>\n<p>Replacing the shell took quite a bit of patience, but I got the job done. The reproduction shell isn&#39;t made to the same level of quality as the original. The screws tended to strip the plastic, but so long as I don&#39;t need to open it up frequently, that should be fine. The hinge is a bit stiff, but I&#39;ll take stiff over broken. Overall, I&#39;m very happy with how it turned out, and it makes a great display piece. Check out the gallery below.</p>\n<p>Later, I decided to fix a more serious issue: the shoulder buttons were really unreliable, often ignoring my presses or releasing before I actually let go. <a href=\"https://mariokart.fandom.com/wiki/Snaking\">Snaking</a> certainly didn&#39;t do the system any favors. I found a guide online that suggested carefully removing and scraping off the metal contact in the microswitch of each shoulder button to remove oxidization. This worked perfectly, and my DS is now restored back to full health.</p>\n\n<h2 id=\"heading-gallery\">Gallery<a href=\"#heading-gallery\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1264.DV-Pdpu0_Z14Emni.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1264.DV-Pdpu0_L2zup.avif 300w, /_astro/IMG_1264.DV-Pdpu0_Z2tGMwg.avif 600w, /_astro/IMG_1264.DV-Pdpu0_Z1YmW8b.avif 928w, /_astro/IMG_1264.DV-Pdpu0_ozlz.avif 1280w, /_astro/IMG_1264.DV-Pdpu0_1dW0er.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1264.DV-Pdpu0_14sm1d.webp 300w, /_astro/IMG_1264.DV-Pdpu0_Z2bh10s.webp 600w, /_astro/IMG_1264.DV-Pdpu0_Z1FWaBn.webp 928w, /_astro/IMG_1264.DV-Pdpu0_naYIg.webp 1280w, /_astro/IMG_1264.DV-Pdpu0_1AIpB8.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1264.DV-Pdpu0_Z1wU04.jpeg\" srcset=\"/_astro/IMG_1264.DV-Pdpu0_Z12qgCU.jpeg 300w, /_astro/IMG_1264.DV-Pdpu0_M1u9l.jpeg 600w, /_astro/IMG_1264.DV-Pdpu0_1hlkxq.jpeg 928w, /_astro/IMG_1264.DV-Pdpu0_Z1f5kRV.jpeg 1280w, /_astro/IMG_1264.DV-Pdpu0_Z1wU04.jpeg 1856w\" alt=\"A front view of a clear DS Lite\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1908\"></picture></a><figcaption>I really like the internal views made possible from the clear design.</figcaption></figure><figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1260.-HZDsKHa_ZXJkFl.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1260.-HZDsKHa_GIrH7.avif 300w, /_astro/IMG_1260.-HZDsKHa_20GCSs.avif 600w, /_astro/IMG_1260.-HZDsKHa_2lRvcK.avif 928w, /_astro/IMG_1260.-HZDsKHa_SNgoW.avif 1280w, /_astro/IMG_1260.-HZDsKHa_RJdyX.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1260.-HZDsKHa_109edU.webp 300w, /_astro/IMG_1260.-HZDsKHa_2j7ppg.webp 600w, /_astro/IMG_1260.-HZDsKHa_Z2pSQ5n.webp 928w, /_astro/IMG_1260.-HZDsKHa_5v7UY.webp 1280w, /_astro/IMG_1260.-HZDsKHa_1fvCVE.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1260.-HZDsKHa_ZmJGEx.jpeg\" srcset=\"/_astro/IMG_1260.-HZDsKHa_Z16Joqd.jpeg 300w, /_astro/IMG_1260.-HZDsKHa_cdLK8.jpeg 600w, /_astro/IMG_1260.-HZDsKHa_xoE4q.jpeg 928w, /_astro/IMG_1260.-HZDsKHa_Gkmb4.jpeg 1280w, /_astro/IMG_1260.-HZDsKHa_ZmJGEx.jpeg 1856w\" alt=\"A top view of a clear DS Lite\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1392\"></picture></a><figcaption>You can see how everything is organized within. There are markings on the back of the screen made during manufacturing.</figcaption></figure><figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1261.DRHG2sOi_eLFMr.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1261.DRHG2sOi_ZyU24g.avif 300w, /_astro/IMG_1261.DRHG2sOi_J3975.avif 600w, /_astro/IMG_1261.DRHG2sOi_15e1qn.avif 928w, /_astro/IMG_1261.DRHG2sOi_27khRJ.avif 1280w, /_astro/IMG_1261.DRHG2sOi_26gf2K.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1261.DRHG2sOi_Zgufxs.webp 300w, /_astro/IMG_1261.DRHG2sOi_12sUCS.webp 600w, /_astro/IMG_1261.DRHG2sOi_1nDMWb.webp 928w, /_astro/IMG_1261.DRHG2sOi_1j29oL.webp 1280w, /_astro/IMG_1261.DRHG2sOi_2t2Epr.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1261.DRHG2sOi_PLjNf.jpeg\" srcset=\"/_astro/IMG_1261.DRHG2sOi_Z2nnScA.jpeg 300w, /_astro/IMG_1261.DRHG2sOi_Z14pH1f.jpeg 600w, /_astro/IMG_1261.DRHG2sOi_ZIeOGW.jpeg 928w, /_astro/IMG_1261.DRHG2sOi_1TQnDQ.jpeg 1280w, /_astro/IMG_1261.DRHG2sOi_PLjNf.jpeg 1856w\" alt=\"A bottom view of a clear DS Lite\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1392\"></picture></a><figcaption>The bottom looks great, as you can see the battery cartridge slots and more. It even came with a clear stylus.</figcaption></figure><figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1265.Br1b2dW7_1bvLDP.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1265.Br1b2dW7_Z12ODK4.avif 300w, /_astro/IMG_1265.Br1b2dW7_2sJMIu.avif 600w, /_astro/IMG_1265.Br1b2dW7_1xGkaL.avif 928w, /_astro/IMG_1265.Br1b2dW7_1r3m2Q.avif 1280w, /_astro/IMG_1265.Br1b2dW7_Z8FbHw.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1265.Br1b2dW7_ZJoReg.webp 300w, /_astro/IMG_1265.Br1b2dW7_Z2j1yyD.webp 600w, /_astro/IMG_1265.Br1b2dW7_1Q76Gz.webp 928w, /_astro/IMG_1265.Br1b2dW7_1NOLpx.webp 1280w, /_astro/IMG_1265.Br1b2dW7_e6dEa.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1265.Br1b2dW7_Z1oa6W2.jpeg\" srcset=\"/_astro/IMG_1265.Br1b2dW7_2dSCUx.jpeg 300w, /_astro/IMG_1265.Br1b2dW7_EgVAa.jpeg 600w, /_astro/IMG_1265.Br1b2dW7_ZfLvWy.jpeg 928w, /_astro/IMG_1265.Br1b2dW7_byqNl.jpeg 1280w, /_astro/IMG_1265.Br1b2dW7_Z1oa6W2.jpeg 1856w\" alt=\"The clear DS Lite charging\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1493\"></picture></a><figcaption>Since the whole unit is clear now, you can see the charge LED bleed through the entire body.</figcaption></figure><figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/IMG_1267.DMIwIDtK_1W2DN3.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/IMG_1267.DMIwIDtK_1Mnmle.avif 300w, /_astro/IMG_1267.DMIwIDtK_2uHQfc.avif 600w, /_astro/IMG_1267.DMIwIDtK_1SccNn.avif 928w, /_astro/IMG_1267.DMIwIDtK_2gjJIJ.avif 1280w, /_astro/IMG_1267.DMIwIDtK_Z5eeqH.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/IMG_1267.DMIwIDtK_1US3F.webp 300w, /_astro/IMG_1267.DMIwIDtK_JgmWD.webp 600w, /_astro/IMG_1267.DMIwIDtK_7JIvO.webp 928w, /_astro/IMG_1267.DMIwIDtK_Z1tDG0c.webp 1280w, /_astro/IMG_1267.DMIwIDtK_v8uxO.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/IMG_1267.DMIwIDtK_Z26sdEn.jpeg\" srcset=\"/_astro/IMG_1267.DMIwIDtK_1tcOG1.jpeg 300w, /_astro/IMG_1267.DMIwIDtK_2bxjzY.jpeg 600w, /_astro/IMG_1267.DMIwIDtK_1z1F9a.jpeg 928w, /_astro/IMG_1267.DMIwIDtK_Z2nOGRV.jpeg 1280w, /_astro/IMG_1267.DMIwIDtK_Z26sdEn.jpeg 1856w\" alt=\"The clear DS Lite powered on\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1392\"></picture></a><figcaption>The same is true of the power LED and, oddly, the bottom screen.</figcaption></figure>\n<h2 id=\"heading-youtube-videos\">YouTube Videos<a href=\"#heading-youtube-videos\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Videos for the shell replacement and repair are readily available on YouTube, and I used these as reference.</p>\n<p>Here&#39;s a good video of the shell replacement from The Fix.</p>\n<div id=\"iJMFkXCBUKE\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"iJMFkXCBUKE\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/iJMFkXCBUKE.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>\n<p>Here&#39;s a video of the DS shoulder button repair I used, also from The Fix.</p>\n<div id=\"VnWdawXC-RM\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"VnWdawXC-RM\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/VnWdawXC-RM.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div>",
      "summary": "Replacing the shell and fixing the shoulder buttons of my trusty DS Lite.",
      "date_published": "2021-12-14T00:00:00.000Z",
      "tags": [
        "personal",
        "gaming",
        "hardware"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/relaxed-memory/",
      "url": "https://kennethmlamar.com/posts/relaxed-memory/",
      "title": "When To Use Relaxed Memory Semantics",
      "content_html": "<h2 id=\"heading-background\">Background<a href=\"#heading-background\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>The <a href=\"https://en.cppreference.com/w/cpp/atomic\">C++ atomic operations library</a> is a convenient way to access <a href=\"https://en.wikipedia.org/wiki/Atomicity_(database_systems)\">atomic</a> operations within C++ code. Atomic operations are essential building blocks for lock-free programming. Every atomic operation in the C++ library provides support for an optional <a href=\"https://en.cppreference.com/w/cpp/atomic/memory_order\">memory order</a> parameter.</p>\n<p>Modern processors use <a href=\"https://en.wikipedia.org/wiki/Instruction_pipelining\">pipelining</a>. Pipelining works like a car assembly line, but for instructions, dividing individual operations into a series of smaller steps that can be performed by different parts of the processor in parallel. By tracking data dependencies, both the compiler and the processor identify instructions that are semantically equivalent when reordered and perform these reorderings to keep the pipeline full and minimize <a href=\"https://en.wikipedia.org/wiki/Pipeline_stall\">stalls</a>. Because reordering will not change overall program behavior, programmers can write code that is easy to read while still benefitting from optimized reordering that provides equivalent results. However, this optimization only works for sequential programs.</p>\n<h2 id=\"heading-the-problem\">The Problem<a href=\"#heading-the-problem\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>When writing concurrent code, the effects of reordering may be visible to other threads. When an object must be synchronized between threads, we need to ensure those effects are visible. We must prevent reordering of operations that affect shared memory objects to ensure correctness, though this comes at the cost of losing some of the performance gains associated with reordering. Different instructions and architectures provide different ordering guarantees that may not be sufficient in a concurrent environment without more explicit mechanisms being added, such as memory <a href=\"https://en.wikipedia.org/wiki/Memory_barrier\">barriers</a>. The C++ atomics library provides these barriers based on the memory order requested from the programmer and the memory ordering guarantees provided by the processor. In this way, the library remains platform-agnostic, using as few additional fences as needed to satisfy the reordering constraints chosen.</p>\n<h2 id=\"heading-the-insight\">The Insight<a href=\"#heading-the-insight\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>While I have been aware of memory order parameters for a long time, I have long wondered when it is appropriate to relax the constraints. Traditionally, I have used the strictest and default <a href=\"https://en.cppreference.com/w/cpp/atomic/memory_order#Sequentially-consistent_ordering\">sequentially-consistent</a> ordering, as this option ensures that all instructions leading up to the atomic operation have completed before the operation starts and that the atomic operation completes before the subsequent operations on that thread start. This provides a total ordering on all atomic operations that use this, which is typically what we want in lock-free code. However, there are several patterns where this level of strictness isn't necessary.</p>\n<h3 id=\"heading-atomic-counters\">Atomic counters<a href=\"#heading-atomic-counters\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>One simple example would be an atomic counter. Incrementing a counter consists of three steps: loading the counter's current value, incrementing the value locally, and storing the incremented value back in memory. If multiple threads increment the counter at the same time, these steps may interleave, and some increments will be overwritten and lost. The atomic increment function ensures that these three steps are indivisible and thus counts are not lost, but oftentimes sequential consistency is a far greater requirement than is needed for a simple counter. When we don't care the order in which increments occur or when those increments become visible to other threads, we can use <a href=\"https://en.cppreference.com/w/cpp/atomic/memory_order#Relaxed_ordering\">relaxed</a> ordering.\nRelaxed ordering only guarantees that our increments are not lost, since this is inherently guaranteed by the atomic library. Only for the final read of the counter would we need stronger reordering guarantees to read the final value.</p>\n<h3 id=\"heading-locks\">Locks<a href=\"#heading-locks\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Locking is another popular pattern. In this paradigm, we use our own atomic operations to provide the locking mechanism, rather than the <a href=\"https://en.cppreference.com/w/cpp/thread/mutex\">mutex</a> library (which uses atomics internally anyway). When designing your own mutual exclusion lock, the lock only requires <a href=\"https://en.cppreference.com/w/cpp/atomic/memory_order#Release-Acquire_ordering\">acquire-release</a> reordering semantics. It ensures that anything that happens within a <a href=\"https://en.wikipedia.org/wiki/Critical_section\">critical section</a> is visible to another thread after it acquires the lock for itself. Anything else can be freely reordered safely.</p>\n<h3 id=\"heading-more\">More?<a href=\"#heading-more\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>There are certainly more uses of relaxed memory semantics that I didn't cover here. What I find useful about specific examples is that they provide a stronger intuition of how relaxed memory works and when it's applicable. With careful thought, one can identify more cases of free (but still correct) performance gains from relaxed ordering. I am relieved that using the strongest guarantees is the right choice for most lock-free programming synchronization; it means that my designs aren't leaving free performance on the table by using the strictest memory ordering.</p>\n",
      "summary": "Relaxed memory semantics are tricky to work with in C++. Let's go through some example use cases.",
      "date_published": "2021-12-08T00:00:00.000Z",
      "tags": [
        "professional",
        "concurrency"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/lftt-enhancements/",
      "url": "https://kennethmlamar.com/posts/lftt-enhancements/",
      "title": "Improvements to Lock-Free Transactional Transformation",
      "content_html": "<h2 id=\"heading-musings\">Musings<a href=\"#heading-musings\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Recently, I went to CppCon, where I saw tons of great talks and had many insightful discussions. The community is brilliant, and the fields they come from are diverse. I was there with my team to present our lab&#39;s latest research work at an industry-centric conference. More specifically, I co-presented on our lab&#39;s use of persistent memory to augment concurrent data structures. One of the papers we presented was <a href=\"https://dl.acm.org/doi/abs/10.1145/3446391\">PETRA: Persistent Transactional Non-Blocking Linked Data Structures</a>. This work augments one of our lab&#39;s earlier papers, <a href=\"https://dl.acm.org/doi/abs/10.1145/3209690\">Lock-Free Transactional Transformation for Linked Data Structures</a>, more commonly called LFTT, by leveraging its existing transaction descriptors for use as persistent logs. This presentation brought the core LFTT design back into my thoughts.</p>\n<h2 id=\"heading-lftt\">LFTT<a href=\"#heading-lftt\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>LFTT was one of the earliest projects I work with in my lab. It was the foundation of what I built for my Senior Design project in my undergraduate program, a project which ultimately led to my pursuit of a Ph.D.</p>\n<p>LFTT is a static transactional framework. Unlike traditional works, where transactions conflict on low-level reads and writes at individual memory locations, LFTT only considers high-level semantic conflicts. In other words, we don&#39;t care what memory locations a transaction reads from or writes to; we care only about which nodes we insert, delete, or find. This approach often results in a significant performance improvement over traditional methods. For instance, a linked list insertion in a transaction must add all traversed links to the read set when considering low-level reads. These can conflict with removals of any of the traversed nodes in traditional frameworks. LFTT, on the other hand, only needs to consider the inserted node itself for potential conflicts. Reduced conflicts mean increased parallelism and reduced time bottlenecked on conflict resolution. By building LFTT on top of existing <a href=\"https://en.wikipedia.org/wiki/Non-blocking_algorithm#Lock-freedom\">lock-free</a> node-based lists, we get consistency and progress for free while adding transactional correctness. LFTT is a great solution, but it has several limitations that our lab has slowly worked to overcome and improve upon.</p>\n<h2 id=\"heading-improvements\">Improvements<a href=\"#heading-improvements\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Some members of my team have <a href=\"https://dl.acm.org/doi/abs/10.1145/3303084.3309491\">added support</a> for dynamic transactions, where the operations that need to occur are not known until after the transaction has started. This allows for functionality such as conditional logic, where the result of one operation determines which operations happen next within a transaction. This paper also added wait-free guarantees (over the lock-freedom used in the original paper) and support for transactions involving multiple LFTT data structures at once.</p>\n<h2 id=\"heading-my-improvements\">My Improvements<a href=\"#heading-my-improvements\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>During most of 2019, I spent my time thinking about how to augment LFTT further when I applied the design to a <a href=\"https://en.cppreference.com/w/cpp/container/vector\">vector</a> data structure, a type of resizable array, in my paper, <a href=\"https://dl.acm.org/doi/abs/10.1145/3380536.3380543\">Lock-free transactional vector</a>. By this point, now four years since the original LFTT publication, we were concerned that reviewers would complain about this work appearing to be a simple incremental improvement over LFTT. As a result, I feel that my final publication underplayed the significance of the improvements I made to LFTT, which were numerous. Here is a list of LFTT limitations, all resolved in my paper:</p>\n<ul>\n<li>LFTT only works with set-based data structures</li>\n<li>LFTT only works on node-based data structures</li>\n<li>LFTT will always write and can conflict, even for read-only transactions</li>\n<li>LFTT conflict resolution is prone to a cyclic dependency</li>\n<li>LFTT suffers from the <a href=\"https://en.wikipedia.org/wiki/ABA_problem\">ABA problem</a></li>\n</ul>\n<p>Now I will discuss how I addressed each of these issues.</p>\n<h3 id=\"heading-lftt-only-works-with-set-based-data-structures\">LFTT only works with set-based data structures<a href=\"#heading-lftt-only-works-with-set-based-data-structures\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>LFTT was designed only to work on ordered sets, containers of elements that are either present or absent (just like mathematical sets). In a vector, each element is associated with an index. This means that each of our items must track both an index and a value, not just presence. Supporting this would also be useful for key-value data structures. I added support for this in the transactional vector.</p>\n<p>In a transactional framework, transactions must be &quot;atomic&quot;, which is a fancy way of saying either the whole transaction appears to succeed in an instant or fails and never takes effect. Thus, any work done before failure must be reverted. Properly maintaining the right value to pair with a key in LFTT is a surprisingly tricky process, as old values must be properly maintained to logically roll back failed transactions.</p>\n<h3 id=\"heading-lftt-only-works-on-node-based-data-structures\">LFTT only works on node-based data structures<a href=\"#heading-lftt-only-works-on-node-based-data-structures\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>LFTT was designed to work only on node-based data structures, such as linked lists, skip lists, trees, tries, <a href=\"https://ieeexplore.ieee.org/abstract/document/7536527\">MDLists</a> etc. This is clearly incompatible with the array-based design of the vector. One may at first consider making the vector node-based, but this would defeat the entire design advantage of the vector, namely the contiguous storage guarantees. Instead, I extended the design to apply to array-based data structures. This was tricky, as I could not rely on <a href=\"https://en.wikipedia.org/wiki/Read-copy-update\">RCU</a> mechanisms present on node-based structures. I accomplished this via two approaches: the compact vector limits the size of each vector index to fit in a <a href=\"https://www.felixcloutier.com/x86/cmpxchg8b:cmpxchg16b\">128-bit atomic</a>, and the segmented vector provides updates via an atomic pointer to the value. Elements are handled in segments the size of a cache line, to maximize cache locality, meaning I had to support layering. Partial layer updates meant that some historic layers had to be preserved in a chain of updates.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/TransVecLayout.B85N95-J_ZA7hG8.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/TransVecLayout.B85N95-J_8W8LF.avif 300w, /_astro/TransVecLayout.B85N95-J_rAjzQ.avif 600w, /_astro/TransVecLayout.B85N95-J_2lJoax.avif 928w, /_astro/TransVecLayout.B85N95-J_OcDwK.avif 1280w, /_astro/TransVecLayout.B85N95-J_2pXk24.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/TransVecLayout.B85N95-J_1PD4gh.webp 300w, /_astro/TransVecLayout.B85N95-J_29hf4s.webp 600w, /_astro/TransVecLayout.B85N95-J_Z11KO9M.webp 928w, /_astro/TransVecLayout.B85N95-J_Z2pFepI.webp 1280w, /_astro/TransVecLayout.B85N95-J_Z1vCl7U.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/TransVecLayout.B85N95-J_ZkXYNt.png\" srcset=\"/_astro/TransVecLayout.B85N95-J_zf0f0.png 300w, /_astro/TransVecLayout.B85N95-J_RSb3b.png 600w, /_astro/TransVecLayout.B85N95-J_Z2i9Sb4.png 928w, /_astro/TransVecLayout.B85N95-J_Z14j7vS.png 1280w, /_astro/TransVecLayout.B85N95-J_ZkXYNt.png 1856w\" alt=\"A diagram of the segmented and compact vector designs\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1044\"></picture></a><figcaption>On the left, the segmented vector points to layers of updates to atomically update values. On the right, the compact vector stores all required data for each value from within its own atomic memory location.</figcaption></figure>\n<h3 id=\"heading-lftt-will-always-write-and-can-conflict-even-for-read-only-transactions\">LFTT will always write and can conflict, even for read-only transactions<a href=\"#heading-lftt-will-always-write-and-can-conflict-even-for-read-only-transactions\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>LFTT maintains transaction state using a transaction descriptor. This descriptor maintains a list of operations, and any operation that has physically occurred points back to its own descriptor. This enables other threads to identify conflicting transactions and help them complete. Because this is the core mechanism for conflict detection, a transaction descriptor must be allocated even for read-only transactions. From there, each element read must have its transaction descriptor pointer updated to point to its latest transaction descriptor. Furthermore, these transactions always conflict with any overlapping transactions. This is bad because, in traditional transaction frameworks based on low-level reads and writes, a read never conflicts with another read, but in LFTT they do.</p>\n<p>When applying my layering trick to support array-based transactions, I noticed that the chain of updates, without memory reclamation or consolidation, provides a comprehensive history of all previous values. This provides an interesting opportunity for read-only transactions. I can <a href=\"https://en.wikipedia.org/wiki/Linearizability\">linearize</a> at the very start of any read-only transaction and, because historic values are present, I can read whatever value was present at the start of the transaction, while totally ignoring any other transactions as they update the values. This required adding a counter to version each transaction, to identify the state of the vector at the start of the read-only transaction and know how far back in time to read values.  This design comes at the cost of space, as historic records must be preserved for these operations, and some amount of synchronization overhead from the shared atomic counter, but it completely eliminates conflicts for read-only transactions.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/TransVecLayers.CjmvRTnE_Z58XzE.png\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/TransVecLayers.CjmvRTnE_1bSmut.avif 300w, /_astro/TransVecLayers.CjmvRTnE_ZBbCyt.avif 600w, /_astro/TransVecLayers.CjmvRTnE_kQMaF.avif 928w, /_astro/TransVecLayers.CjmvRTnE_ZufMiQ.avif 1280w, /_astro/TransVecLayers.CjmvRTnE_Z1BD5rA.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/TransVecLayers.CjmvRTnE_Z1mQR2d.webp 300w, /_astro/TransVecLayers.CjmvRTnE_1TfgHL.webp 600w, /_astro/TransVecLayers.CjmvRTnE_Z2dSrm1.webp 928w, /_astro/TransVecLayers.CjmvRTnE_1cq8aK.webp 1280w, /_astro/TransVecLayers.CjmvRTnE_52P21.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/TransVecLayers.CjmvRTnE_Z1bldYg.png\" srcset=\"/_astro/TransVecLayers.CjmvRTnE_Z2eo7m7.png 300w, /_astro/TransVecLayers.CjmvRTnE_12I1nR.png 600w, /_astro/TransVecLayers.CjmvRTnE_1YLr81.png 928w, /_astro/TransVecLayers.CjmvRTnE_Z3WUPw.png 1280w, /_astro/TransVecLayers.CjmvRTnE_Z1bldYg.png 1856w\" alt=\"A diagram of the layers used in the segmented vector design\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"789\"></picture></a><figcaption>Layers in the segmented vector are prepended from back to front. This allows partial updates, but, crucially, provides support for reading historic values in old layers for conflict-free reads.</figcaption></figure>\n<h3 id=\"heading-lftt-conflict-resolution-is-prone-to-a-cyclic-dependency\">LFTT conflict resolution is prone to a cyclic dependency<a href=\"#heading-lftt-conflict-resolution-is-prone-to-a-cyclic-dependency\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>LFTT&#39;s original version was lock-free. It could not guarantee <a href=\"https://en.wikipedia.org/wiki/Non-blocking_algorithm#Wait-freedom\">wait-freedom</a> because the conflict resolution algorithm was prone to a cyclic dependency, where the only way to break the cycle was to abort at least one of the offending transactions. This can occur, for instance, if one transaction is trying to insert nodes for 1 and 2, in that order, and another is trying to insert for nodes 2 and 1, in that order. The first will physically insert 1 and the second will physically insert 2. Now the first will try to physically insert at 2 and see the other transaction has claimed this spot, so it will try to help that other transaction complete. Likewise, the other transaction is trying to physically insert a 1 and will see the first transaction already claimed that spot, then try to help it complete. This causes an endless helping dependency, which the original paper breaks up by tracking if recursive helping adds the same transaction to the help stack multiple times and then killing one of the transactions. As mentioned before, one of my team&#39;s previous papers <a href=\"https://dl.acm.org/doi/abs/10.1145/3303084.3309491\">addressed</a> this problem, but I found what I consider a simpler and more elegant solution.</p>\n<p>In my solution, I leverage the static transactions present in LFTT. When a transaction is static, we know ahead of time the complete list of operations a transaction wants to perform. What this means is that we can apply a deterministic order of operations for all transactions. Simply put, we can perform operations in sorted order, from low to high index/value. This will make cyclic dependencies impossible, and since transactions are an all-or-nothing matter, it doesn&#39;t matter which order we perform operations at the semantic level, as no one will see the intermediate state externally. If we apply this deterministic approach to our previous example, both transactions would try to insert 1 first. One will succeed and try to insert 2. The other will see the conflict on 1 and help the successful transaction insert its 2.</p>\n<h3 id=\"heading-lftt-suffers-from-the-aba-problem\">LFTT suffers from the ABA problem<a href=\"#heading-lftt-suffers-from-the-aba-problem\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h3>\n<p>Another lab interested in our work <a href=\"https://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/2019/MSC/MSC-2019-01.pdf#page=25\">identified</a> a concurrency bug in the original design of LFTT. If a thread, T1, becomes idle just before adding a new node to the list, then a second thread, T2, can help and commit. However, if another transaction removes that node before T1 resumes, T1 could actually succeed in inserting the node again, after its own transaction has already committed. This is an occurrence of the <a href=\"https://en.wikipedia.org/wiki/ABA_problem\">ABA problem</a>. My vector design avoided this issue, as it does not need to deal with node reinsertion. A proper fix to the node-based design would add a counter in the <a href=\"https://en.wikipedia.org/wiki/Tagged_pointer\">unused bits</a> of each node pointer, to help ensure pointer uniqueness.</p>\n<h2 id=\"heading-conclusions\">Conclusions<a href=\"#heading-conclusions\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Ultimately, I&#39;ve been thinking of LFTT again because of PETRA. PETRA was being designed while I was working on my transactional vector. This means that several of these design enhancements didn&#39;t make their way to PETRA in time for its publication. Fortunately, these enhancements have been published, meaning anyone attempting to use PETRA could foreseeably implement these improvements there. I hope this blog post is useful for anyone wanting to avoid the same pitfalls in the future.</p>",
      "summary": "An overview of enhancements over base LFTT.",
      "date_published": "2021-11-21T00:00:00.000Z",
      "tags": [
        "professional",
        "concurrency"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/homage-to-crts/",
      "url": "https://kennethmlamar.com/posts/homage-to-crts/",
      "title": "A Homage to CRTs",
      "content_html": "<p>You may remember CRT (cathode-ray tube) displays, those big boxes we used to use for screens. Back before LCDs, they were one of the only display options available. They were big, heavy, large, power-hungry, flickery, sometimes staticky, and often prone to electromagnetic interference. For these reasons, you may wonder why anyone would want to use them in the modern day.</p>\n<figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/Discarded-Adam_Kent.9Ocobyu4_Z1yrwrq.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/Discarded-Adam_Kent.9Ocobyu4_2uaYAD.avif 300w, /_astro/Discarded-Adam_Kent.9Ocobyu4_eCmTl.avif 600w, /_astro/Discarded-Adam_Kent.9Ocobyu4_Z258gqB.avif 928w, /_astro/Discarded-Adam_Kent.9Ocobyu4_2rrwfJ.avif 1280w, /_astro/Discarded-Adam_Kent.9Ocobyu4_1H80CL.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/Discarded-Adam_Kent.9Ocobyu4_3mJsR.webp 300w, /_astro/Discarded-Adam_Kent.9Ocobyu4_Z2caRdq.webp 600w, /_astro/Discarded-Adam_Kent.9Ocobyu4_yfCfy.webp 928w, /_astro/Discarded-Adam_Kent.9Ocobyu4_Z1XM8e4.webp 1280w, /_astro/Discarded-Adam_Kent.9Ocobyu4_1F3kA6.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/Discarded-Adam_Kent.9Ocobyu4_17uxjJ.jpeg\" srcset=\"/_astro/Discarded-Adam_Kent.9Ocobyu4_Z25nQil.jpeg 300w, /_astro/Discarded-Adam_Kent.9Ocobyu4_JfEOi.jpeg 600w, /_astro/Discarded-Adam_Kent.9Ocobyu4_Z1zuXvE.jpeg 928w, /_astro/Discarded-Adam_Kent.9Ocobyu4_Z2jRVzw.jpeg 1280w, /_astro/Discarded-Adam_Kent.9Ocobyu4_17uxjJ.jpeg 1856w\" alt=\"A CRT monitor abandoned on the ground\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1234\"></picture></a><figcaption>Photo by Adam Kent on Flickr.</figcaption></figure>\n<p>Here&#39;s a list of reasons CRT monitors are often better than what is offered today:</p>\n<h2 id=\"heading-minimum-input-latency\">Minimum input latency<a href=\"#heading-minimum-input-latency\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Modern displays, particularly TVs, are notorious for applying lengthy processing effects in the name of &quot;enhanced&quot; image quality, but these come at the cost of input latency, often in the order of hundreds of milliseconds of additional delay, which is significant. Most TVs offer a gaming mode, which disables most of this post processing, but there is extra latency involved even then. People can get used to this input latency, but they will always suffer from a competitive disadvantage in games. Even trying to use your TV as a PC monitor may add noticeable latency to actions as simple as mouse cursor movements.</p>\n<p>It is impossible to achieve better latency than a CRT at a given refresh rate. CRTs are an analog technology and had no easy way to buffer images for processing. Instead, these screens are designed to scan out the image to screen as soon as the data is provided to it. This means the only meaningful latency incurred from a CRT is the time it takes for the scanout itself to complete. At 60Hz, this scanout will take about 16.6 ms. The top of the display scans out the image instantaneously, while the bottom of the image finishes getting output at the end of the 16.6 ms period. This means the average latency of a CRT is about 8.3 ms, and with a V-SYNC enabled 60Hz signal, this cannot get any better. There are only a few modern displays that do better, such as expensive competitive gaming monitors that run at refresh rates far higher than a CRT can maintain.</p>\n<h2 id=\"heading-superior-black-levels\">Superior black levels<a href=\"#heading-superior-black-levels\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>CRTs have excellent black levels, superseded only perhaps by modern OLED displays. Compared to conventional LCDs, CRTs have always offered true blacks without suffering from banding or other artifacts. Games with dark lighting greatly benefit from this technology.</p>\n<h2 id=\"heading-arbitrary-refresh-rates\">Arbitrary refresh rates<a href=\"#heading-arbitrary-refresh-rates\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Modern LCD technology is constrained to a handful of specific refresh rates, typically consisting of 60Hz. If the frame rate of the content displayed isn&#39;t a factor of the monitor&#39;s refresh rate, it will result in improper frame pacing, which appears to the user as unstable judder, particularly noticeable on smooth camera pans. This is why modern games often target 60 or 30 fps, and never anything in-between (unless it&#39;s <a href=\"https://youtu.be/xIy0Sb0SvIw?t=245\">Batman: Return to Arkham</a>).</p>\n<p>CRTs generally support arbitrary refresh rates. So long as the refresh rate doesn&#39;t exceed the maximum speed achievable by the electron beam, you can keep turning the refresh rate up, or strategically turn the refresh rate down (though turn it too low, and flicker becomes more apparent). This is great for games where you can&#39;t quite achieve the target frame rate. 45 fps, for instance, would be a perfectly acceptable target; just set your CRT to 90Hz and off you go with proper frame pacing. Another great use is in classic games. Arcade games often leveraged CRTs for all sorts of non-standard refresh rates back in the day, and a real CRT not only provides a more authentic <a href=\"https://www.mamedev.org/\">MAME</a> emulation experience than an LCD, a CRT can also adjust its refresh rate to match the content being displayed, no need for frame dropping, emulation speed changes, or potentially expensive adaptive refresh rate technology.</p>\n<h2 id=\"heading-arbitrary-resolutions\">Arbitrary resolutions<a href=\"#heading-arbitrary-resolutions\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Modern LCDs use a fixed grid of pixels. For instance, a 1080p screen consists of a grid 1920 pixels wide by 1080 pixels tall. Non-native resolutions must be rescaled to fit on screen. Conventionally, this is handled by bilinear filtering, a cheap scaler that blurs the image. There are modern upscalers taking hold in the industry to work around this issue, such as <a href=\"https://www.nvidia.com/en-us/geforce/technologies/dlss/\">NVIDIA DLSS</a> and <a href=\"https://gpuopen.com/fidelityfx-cas/\">AMD FidelityFX CAS</a>, but a CRT can bypass the problem entirely. You can choose to run at any resolution you like, and CRTs permit targeting even sub-720p resolutions while still looking great. This is an excellent way to claw back performance if your graphics card isn&#39;t quite up to snuff, without totally compromising the game you&#39;re trying to play.</p>\n<h2 id=\"heading-high-motion-clarity\">High motion clarity<a href=\"#heading-high-motion-clarity\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>Because CRTs inherently work by scanning an image out to the screen with an electron beam, it provides what is essentially a strobing effect, where each frame of an image is clearly distinct from the next. This provides extreme clarity in motion, where detail is retained even for fast motion. It can be clearly illustrated in the Blur Busters <a href=\"https://www.testufo.com/\">UFO motion test</a>, where the three-eyed alien&#39;s eyes all seem to smear together on an LCD yet remain distinct on a CRT. Modern displays achieve comparable results though backlight strobing, black frame insertion (BFI), or NVIDIA Ultra Low Motion Blur (ULMB) technology, but this remains a niche feature supported only on high-end displays. Some amount of blur <a href=\"https://youtu.be/VXIrSTMgJ9s\">can be desirable</a> as a post-processing effect in games, but you still want the opportunity to choose between sharp motion and motion blur that applies selectively and artistically, such as DOOM 2016, which can apply motion blur only to the weapon view models to add more impact to the animations. LCD blur merely piles its blur on top of artistic blur as an unpleasant side effect.</p>\n<h2 id=\"heading-concluding-remarks\">Concluding Remarks<a href=\"#heading-concluding-remarks\" class=\"heading-permalink\"><span class=\"visually-hidden\"> permalink</span><svg fill=\"currentColor\" aria-hidden=\"true\" focusable=\"false\" width=\"1em\" height=\"1em\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M9.199 13.599a5.99 5.99 0 0 0 3.949 2.345 5.987 5.987 0 0 0 5.105-1.702l2.995-2.994a5.992 5.992 0 0 0 1.695-4.285 5.976 5.976 0 0 0-1.831-4.211 5.99 5.99 0 0 0-6.431-1.242 6.003 6.003 0 0 0-1.905 1.24l-1.731 1.721a.999.999 0 1 0 1.41 1.418l1.709-1.699a3.985 3.985 0 0 1 2.761-1.123 3.975 3.975 0 0 1 2.799 1.122 3.997 3.997 0 0 1 .111 5.644l-3.005 3.006a3.982 3.982 0 0 1-3.395 1.126 3.987 3.987 0 0 1-2.632-1.563A1 1 0 0 0 9.201 13.6zm5.602-3.198a5.99 5.99 0 0 0-3.949-2.345 5.987 5.987 0 0 0-5.105 1.702l-2.995 2.994a5.992 5.992 0 0 0-1.695 4.285 5.976 5.976 0 0 0 1.831 4.211 5.99 5.99 0 0 0 6.431 1.242 6.003 6.003 0 0 0 1.905-1.24l1.723-1.723a.999.999 0 1 0-1.414-1.414L9.836 19.81a3.985 3.985 0 0 1-2.761 1.123 3.975 3.975 0 0 1-2.799-1.122 3.997 3.997 0 0 1-.111-5.644l3.005-3.006a3.982 3.982 0 0 1 3.395-1.126 3.987 3.987 0 0 1 2.632 1.563 1 1 0 0 0 1.602-1.198z\"></path></svg></a></h2>\n<p>CRTs have been out of production <a href=\"https://www.npr.org/sections/alltechconsidered/2016/08/15/489629491/saying-goodbye-to-old-technology-and-a-legendary-nyc-repair-shop\">since 2015</a>. Their weight makes them expensive to ship. Plus, they are delicate enough to require careful packing, which you often can&#39;t rely on from private shippers on eBay or other online services. However, they were ubiquitous enough that you can still find them in local thrift shops. If you have the space, I highly suggest keeping one of these things around, particularly for games that most benefit from the technology. They are hardly a one-size-fits-all solution, but there are still many situations where I would rather use a CRT over any modern display. Be sure to buy a PC CRT monitor, rather than a CRT TV. CRT TVs are far more limited, with low color resolution, interlacing, and a mere 525 scan lines.</p>\n<p>If you aren&#39;t yet convinced, Digital Foundry has covered the greatness of CRT technology in one of their videos:</p>\n<div id=\"V8BVTHxc4LM\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"V8BVTHxc4LM\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/V8BVTHxc4LM.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>",
      "summary": "CRTs are a great option for gaming, offering advantages unmatched even by modern flat panels.",
      "date_published": "2021-11-12T00:00:00.000Z",
      "tags": [
        "personal",
        "gaming",
        "hardware"
      ]
    },
    {
      "id": "https://kennethmlamar.com/posts/8-player-double-dash/",
      "url": "https://kennethmlamar.com/posts/8-player-double-dash/",
      "title": "8 Player Splitscreen in Mario Kart: Double Dash!!",
      "content_html": "<p>I remember playing Mario Kart: Double Dash!! multiplayer on many a TV growing up. At one point, I discovered the existence of the GameCube Broadband Adapter, a rare accessory that enabled local and online network linking for a small number of games. For Mario Kart, it enabled a unique party trick: up to 8 GameCubes linked together with up to 16 players, two per kart. This was the first time Nintendo allowed all 8 positions in a race to be human-controlled. This type of setup was, and still is, fascinating to me.</p>\n<p>Unlike Xbox, where LAN was a core part of the console, the GameCube adapter was an add-on accessory, priced at <a href=\"http://www.nintendoworldreport.com/hardware/2306/gamecube-broadband-adapter-gamecube\">$34.95</a> each and requiring multiple adapters to support an actual link, which kept it out of my grasp as a child. As an adult, they are long out of production, with a price to match that status. Even if you have a few adapters in hand, they remain a clunky and difficult to coordinate option, requiring multiple GameCubes, multiple copies of the game, multiple TVs, multiple adapters, and multiple controllers.\n</p><figure><a class=\"img\" href=\"https://kennethmlamar.com/_astro/MKDD_LAN_English.D3l9Qvv6_bfbB5.jpeg\" title=\"Click to view full-size\"><picture><source srcset=\"/_astro/MKDD_LAN_English.D3l9Qvv6_Z1LTkqr.avif 300w, /_astro/MKDD_LAN_English.D3l9Qvv6_1cymfH.avif 600w, /_astro/MKDD_LAN_English.D3l9Qvv6_j3c3r.avif 928w, /_astro/MKDD_LAN_English.D3l9Qvv6_ZK6o04.avif 1280w, /_astro/MKDD_LAN_English.D3l9Qvv6_20vwvd.avif 1856w\" type=\"image/avif\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><source srcset=\"/_astro/MKDD_LAN_English.D3l9Qvv6_1kP0Wo.webp 300w, /_astro/MKDD_LAN_English.D3l9Qvv6_ZJSqao.webp 600w, /_astro/MKDD_LAN_English.D3l9Qvv6_Z1DoAmE.webp 928w, /_astro/MKDD_LAN_English.D3l9Qvv6_ZqPgqT.webp 1280w, /_astro/MKDD_LAN_English.D3l9Qvv6_1Cj5eq.webp 1856w\" type=\"image/webp\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\"><img src=\"https://kennethmlamar.com/_astro/MKDD_LAN_English.D3l9Qvv6_Zzqmgq.jpeg\" srcset=\"/_astro/MKDD_LAN_English.D3l9Qvv6_Z1bgGlT.jpeg 300w, /_astro/MKDD_LAN_English.D3l9Qvv6_1Nc0kf.jpeg 600w, /_astro/MKDD_LAN_English.D3l9Qvv6_TFP7Y.jpeg 928w, /_astro/MKDD_LAN_English.D3l9Qvv6_Z2tg6X2.jpeg 1280w, /_astro/MKDD_LAN_English.D3l9Qvv6_Zzqmgq.jpeg 1856w\" alt=\"A diagram of of LAN multiplayer with 8 GameCubes connected together via a networking hub\" sizes=\"(min-width: 58rem) 928px, calc(100vw - 2rem)\" loading=\"lazy\" decoding=\"async\" width=\"1856\" height=\"1181\"></picture></a><figcaption>This complex set-up is an example Nintendo provides in the game&#39;s instruction manual.</figcaption></figure>\n<p>In comes Dolphin, a mature GameCube emulator with built-in emulation of the Broadband Adapter. This is a useful solution, as it completely sidesteps the need for a real adapter, or even the need for multiple GameCubes, copies of the disc, TVs, or real GameCube controllers. I got to work trying this out for myself using my own dump of the game and managed a promising configuration where 8 instances of the emulator all networked together as expected. This enabled me to lay out all 8 screens together on one monitor, which I recorded as a proof-of-concept, as seen in my video below. Considering the increasing resolutions and dimensions of modern TVs compared to the CRTs used when the game released, this is actually quite workable.</p>\n<div id=\"_FqtYo2NTk4\" class=\"youtube-embed\" data-astro-cid-nizrgmoa><lite-youtube videoid=\"_FqtYo2NTk4\" style=\"background-image:none\" data-astro-cid-nizrgmoa=\"true\"><img class=\"yt-thumb\" src=\"https://kennethmlamar.com/assets/images/yt/_FqtYo2NTk4.webp\" alt=\"\" loading=\"lazy\" decoding=\"async\" data-astro-cid-nizrgmoa><div class=\"lty-playbtn\" data-astro-cid-nizrgmoa></div></lite-youtube></div><script type=\"module\" src=\"https://kennethmlamar.com/opt/buildhome/repo/src/components/YouTube.astro?astro&type=script&index=0&lang.ts\"></script>\n<p>Later that year, I linked two instances of the emulator together on a laptop and managed 8 player Mario Kart: Double Dash for real, though I didn’t have the opportunity to record the event.</p>\n<p>As an aside, Nintendont, a GameCube ISO loader for Wii, also has support for the Broadband Adapter, emulating it over Wi-Fi and even supporting a mix of Wi-Fi and real Broadband Adapters together. This was a long-standing <a href=\"https://github.com/FIX94/Nintendont/issues/144\">feature request</a> fulfilled after lots of hard development work from FIX94 and some charitable donors who made the feature bounty worthwhile. It’s very much worth a try if you have the right hardware lying around.</p>",
      "summary": "Fulfilling the 8-player splitscreen dream on a GameCube classic.",
      "date_published": "2021-11-07T00:00:00.000Z",
      "tags": [
        "personal",
        "splitscreen",
        "gaming",
        "archives"
      ]
    }
  ]
}
