Paul’s Tech Talk – LSDJ 5.3.5_4x Part 1: Overclocking and dual oscillator theory

- Posted October 23rd, 2017 by

Hello beautiful people and thank you for reading Paul’s Tech Talk on The ChipWIN Blog!

Today we’re going to talk about a very special version of LSDJ, and a tracking method that cannot often be used on Gameboy, but flourishes on other platforms such as NES: ~ OVERCLOCKING ~ ♪♫

During the avalanche of updates that gave light to this column in the first place, the community was hard at work trying to sniff out bugs and offer feature suggestions of their own. Some were very daring, seemed almost impossible, but were still considered by Johan for integration. One of them was actually the notion of underclocking. Why make the gameboy even slower than it is, you will undoubtedly ask? Well there is one limitation of the Gameboy hardware that theoretically could have been overcome with this method: its note range.

Gameboy Pocket featuring a Variable Clock Mod


Dig Deep, Jump High

It’s a fairly well-known fact: on Gameboy, the Pulse channels can’t go as low as the Wave channel, which benefits from an extra octave down. But while its low-end makes the Wav channel perfect for Bass and Kick design, it has also contributed to making it fit that role by default, rather than by choice. This had the adverse effects of making Pulse Kicks a bit of a mean joke, considered by douche purists to be a sort of LSDJ “noob” stamp (f*ck you purists, pulse kicks are great), but worse, the versatility of the Wav would oft be lost on leads and harmony, where it could shine just as much as in the lower end.

LSDJ is what you’d call a “color-enhanced” Gameboy rom. One of the missing links between Grayscale-only games like Trip World, and GBC exclusives like the (awesome) Harry Potter RPGs. Just like Pokémon Yellow, Wario Land II, or other “black cartridge” games, it’s designed to run on the Grey Brick we all love, but if you slap it on a GB Color, it will make use of its faster CPU and GPU and display shiny color palettes. The GB Color cpu runs at roughly twice the speed of the DMG and GBPocket. In order to maintain consistency between platforms, this means that the rom recognizes which system it boots on, and adjusts to the clock speed accordingly.

Left to right: Grayscale, Color-enhanced, Color exclusive

As a result, the lowest tempo setting you can go on a DMG is 40, whereas on a Color, it’s 80. Someone then had the idea to force boot the rom on DMG mode, on a GB Color. The results were interesting to say the least. Tempo was effectively divided in half, and so was pitch! The pulse channel could now reach one octave lower, albeit at the cost of half the CPU speed. Unfortunately, the rom was marred with glitches and didn’t run smoothly at all. After raising this idea to Johan, we concluded that the only way to achieve an extra octave down would be to use a manual variable clock mod such as those sold by thursday customs, which would alter the analog CPU frequency, but leave the processing untouched.

What happened next, however, was both truly unexpected, and friggin’ awesome.


Johan’s interest had still been piqued by this endeavor, and he bestowed unto us all a very unique version of LSDJ.

At the time, LSDJ had already grown by leaps and bounds, and the latest version was 5.3.5. Johan had just tweaked the calculation between the CPU clock and how it generated Tempo values and Tick length. Drum f*cking roll. Here comes 5.3.5_4x.

TEMPO WAS MULTIPLIED BY ~F O U R~ !!

Yep. You read that right. By four. That means that on this one version, LSDJ now went from 320, to a whopping 1020. At it’s slowest tempo setting, LSDJ was now 65 bpm faster than the fastest stock setting. Ain’t that a coinkydink.

Now. Before going all ham about exploring new undiscovered techniques and going full experimental, let’s actually try to tame that beast, and look at the state of things on other platforms. Namely NES and Famitracker. Time for THEORY!

NES Custom Engine Speed and Reaching into the Audio Range

Because European broadcasting engineers are stupid, the PAL standard exists. The European NES then has to work with a 50Hz screen refresh rate, whereas NTSC Models like the US-NES and the J-Famicom work with 60. In order to reflect that, Famitracker features a handy engine speed cursor, which not only lets you adjust between PAL and NTSC standards, but also lets you specify a custom engine speed for your system, as low as 16 Hz, and as high as 400 Hz!

Now, 400Hz, doesn’t that ring a bell? That’s right. We’re just shy of the standard tuning of A, 440 Hz. Just between G and G#. It was already the case with 50 and 60 Hz, but with 400, we’re now well into what we call the perceptible Audio Range. Theoretically speaking, the human ear should be able to percieve sound frequencies from 20 to about 20 000 Hz. My personal audition test says I can hear from roughly 27 to 18K. Rip Treble. But anyone with a healthy hearing can hear around 400. In Famitracker, this Refresh Rate value is what determines Ticks.

Let’s say you’re the mutant Quicksilver. If you were able to clap your hands as fast as 30 times per second (WR is actually 12 which is already mind boggling), we should be able to hear your claps, but also a 30Hz rumble, created by the speed of your clapping. If you were able to clap as fast as 440 times per second your claps would generate a perfectly tuned A4 note, on top of the clapping noise.

Thanks to the NES tick speed going this high into audio range, we can use the same principle in Famitracker, and now in LSDJ as well ! Let’s try to make that NES clap.

♥ Case study ♥

Fire up an instance of Famitracker. Leave the Engine speed to 60 Hz for now. Create a Pulse instrument. Set the duty cycle to 50%, then enter the following Volume sequence and Loop it.

Now play around on the keyboard. You should hear a very fast looping on-and-off Pulse sound. The higher you go, the better you will notice, a 30 Hz rumble. I recorded the note C5 playing this instrument and slapped it on Audacity for science.

The first track is the audio out from FamiTracker. The second one is a 30Hz Square I generated in Audacity for illustration purposes. You can clearly see the C5 Pulse starting and stopping, in exact sync with the 30Hz square below. The on-and-off Volume sequence of the Pulse actually generated the very rough equivalent of a Square Wave, which, when you think of it, is nothing more than a sharp shift in polarity. Hard minus, Hard plus. Hard on, Hard off.

Bear in mind this 30Hz rumble (as in half of the 60Hz refresh rate, since the pulse is On every 2 ticks) was achieved with standard engine speed. Now set the engine speed to custom and enter 240 Hz. Play the same note, and you should hear a 120Hz tone below your High-C rasp. Open up your instrument again and play around on the keyboard. You should notice that on the B notes, some interesting phasing happens. In standard tuning, B2 is exactly 123,47 Hz. If you play this low B with a Volume sequence that generates a 120Hz tone on top, the 123 Hz note and the 120 Hz extra tone will phase in and out of each other. This will generate roughly the same sound as 2 slightly detuned Pulse waves (which they essentially are) but all within One pulse channel.

Here’s a waveform render in Audacity, and a sound clip of B+120Hz overtone, played at different octaves.

Pretty cool isn’t it? Now consider that this was ‘only’ 240 Hz, with a very simple Volume on-and-off sequence. Just imagine what you can do with a whole range of engine speeds, and more complex sequences, involving a combination of Duty cycle, Arpeggios, and even Expansion chips?? That’s right. We still have miles to go before we master these techniques the way Chibi-tech does, but that’s the basic gist of it. Using the speed of ticks to generate extra oscillators within a single channel.

WHAT ABOUT LSDJ?

You’re right. I’ve veered off into theory limbo again and forgot to actually talk about LSDJ. Or have I? Actually, now that theory is out of the way, I can spend the second part of the article only on practical application and try out some crazy stuff with this sweet sweet 4x tempo test version! If you still have your LSDJ license credentials, this link should take you straight to it.

Let’s get the disclaimers out of the way though. LSDJ is not famitracker, Gameboy is not NES. They both feature PSG and PCM capabilities, they’re more or less modeled to be similar, but they really aren’t. With Famitracker, you can choose your engine speed very precisely, to the Hertz, and crashes are very unlikely to occur, even at the highest setting.

With LSDJ, tick speed will be determined by the tempo setting, so calculating their frequency in Hz is a lot less precise. You could try to base it off of Tempo, multiplied by 0.4, but LSDJ does drift quite a bit so it would only be indicative. This means roughly that stock LSDJ ticks will span from 16 Hz at tempo 40 to 102 Hz at tempo 255. On the 4x version, they will span from 128 Hz (tempo 80, actual speed 320) to 408 Hz (tempo 255, actual speed 1020). Just as high as the NES.

You might see quite a lot of screens like this one if you’re not careful :3 use an emulator.

Let’s also not forget that CPU-intensive tracks at 200+ bpm will make a DMG crawl to a halt. Using a version that multiplies tempo by 4 is out of the question on the gray brick. If you intend to experiment with this version, I really recommend that you use either BGB, to preserve your hardware from crashes, or AT LEAST a Gameboy Color. This is software overclocking. The CPU doesn’t run any faster, but LSDJ does. Prepare for a lot of crashes and glitches either way.

Before I come back with a fistful of weird overclock sound examples in the next issue, why don’t you try to reproduce the Fami example on a Gameboy, and see what happens? This is a very temperamental version so getting a feel for its limitations is going to be crucial here. Spoilers: The VOLUME COLUMN in tables is going to be your friend.

I’ll leave you guys to it and come back very soon. See you on the other side!

Note: traducción al Español por Pixel_Guy encontrado aquí

 

Dig this article? Then consider supporting us on Patreon!