Game Boy

Nintendo's handheld; its four-channel sound chip (game-boy-apu) and the cartridge tracker lsdj make it one of the three focus platforms of this wiki. Facts from the LSDj manual (source: s-lsdj-manual):

  • Music software runs from a cartridge; song data lives in battery-backed SRAM (.sav in emulators). LSDj's file screen needs a cartridge with 64 kb SRAM or more (1 Mbit for the multi-song file screen); cartridge batteries eventually die, so back up.
  • The link port carries LSDj-to-LSDj sync, MIDI clock (with an adapter), analog sync (spliced link cable + 3.5 mm plug) and a PS/2 keyboard adapter (sync). Its plug is 6 4 2 over 5 3 1: 1 VDD35 (no wire), 2 SO red, 3 SI orange, 4 SD brown, 5 SC green, 6 GND blue. lsdj syncs on SC, nanoloop on SI, and since pin 1 has no conductor a sync box cannot draw 5 V from the cable (source: s-little-scale-teensy-usb-midi-sync). Wiring details that follow from that split: the LSDj clock line wants a pull-down resistor to ground, 22k to about 100k, and the unused data lines are tied to ground; one small microcontroller drives six machines running LSDj and six running Nanoloop, or 15 in LSDj-only mode, because each needs one output pin and a ground; on a DMG the usable external-clock range was measured at "around 35 to over 200 beats per minute" (source: s-little-scale-arduino-gameboy-sync-boxes). Nanoloop asks so little of the port that a single 4017 CMOS counter — "about $1" — powered from the link connector's 5 V will clock it, though that design does LSDj no good at all (source: s-little-scale-1-dollar-nanoloop-sync). In the other direction, an LSDj in master sync mode puts 32 transitions per sixteenth-note step on the clock line, enough for a counter chip to derive every power-of-two subdivision (source: s-little-scale-syncing-things-to-lsdj).
  • Stereo output only through the headphone jack; channels can be sent to left, right, both or none (stereo-panning).
  • Some Game Boy Advance / DS flash cartridges need the "Goomba" LSDj builds; oxidised cartridge pins and weak batteries are the usual causes of crashes.

Models and their sound#

The APU's features are the same on every model; the analog side and a few access rules differ (sources: s-pandocs-audio-overview, s-pandocs-audio-details, s-pandocs-audio-registers):

  • DMG / Pocket (monochrome): the mildest output high-pass filter; wave RAM can only be accessed in step with the wave channel's own reads, and retriggering the wave channel while it reads a byte corrupts the first bytes of wave RAM (Pan Docs names Duck Tales as a victim) — the classic DMG wave glitch (wavetable-programming).
  • Game Boy Color: a stronger high-pass filter; wave RAM accesses during playback hit the byte being played; adds the read-only PCM12/PCM34 registers ($FF76/$FF77) that expose the channels' digital outputs; APU timing is unchanged in double-speed mode.
  • ProSound — tapping the audio after the volume potentiometer and out through the headphone jack, bypassing the headphone amp's noise. Invented by Timothy Lamb (Trash80); little-scale believes Nanogrrl was first to fit it to an original grey DMG "but I could be mistaken", and documents removing the speaker when the mod is internal (source: s-little-scale-overclocked-game-boy; see recording-samples).
  • Game Boy Advance: the APU was reworked — digital mixing, no DACs (a disabled "DAC" behaves like one fed with 0), an inverted wave-channel DAC (a loud spike when it is disabled), the most aggressive high-pass filter and therefore the most waveform distortion; VIN was dropped. The extra GBA audio features are not available to Game Boy programs.
  • Super Game Boy: the SGB1's APU runs about 2.4 % fast, so everything sounds slightly sharp; the SGB2 fixed it. lsdj compensates by carrying a second pitch table for the SGB, immediately after the standard one — which is why a retune has to patch both, and why KiGB, which reads only the SGB table, tests the wrong one (source: s-little-scale-lsdj-tuning-tables).
  • All models: the built-in speaker sums left and right to mono — stereo only through the headphone jack; the VIN pin lets a cartridge inject an analog fifth channel (no licensed game used it, and Pocket Music does not either). Pocket Music itself — a commercial Game Boy sequencer of 2002 — ships 100 packaged samples, which little-scale extracted from its ROM in 2010 (sample-ripping; source: s-little-scale-rom-sample-extraction).

Scene notes: johan-kotlinski prefers the original Game Boy — "It's a shame that the screen is so poor" (source: s-chipmusic-kotlinski-interviews); an underclocked DMG plays lower and still syncs to a normal one (sync); an EMS cartridge in a Game Boy Pocket can keep resetting "because of power issues" (source: s-chipmusic-lsdj-faq).

Underclocking: which crystal#

Replacing the DMG's crystal oscillator moves pitch and tempo together, by exactly the ratio of the two crystals — the whole machine, since "the crystal oscillator is responsible for controlling all timing aspects of the Game Boy including the frequency pitches of the pulse oscillators". The mod itself is Gieskes'; the tuning consequences are little-scale's (source: s-little-scale-underclocking-and-retuning):

crystalresult
4.194304 MHzstock
2.097152 MHzexactly half — one octave down, still in 12-TET, nothing to patch. nitro2k01 was tracking "the elusive 2.097152mhz crystal oscillator" in June 2009; it is the hard one to buy
2.000000 MHzthe one shops stock. Ratio 0.4768 — an octave and 82 cents, i.e. nearly a semitone flat of the octave: "some disgustingly out of tune B or something similar"
8.000000 MHzthe overclock, built 2008: "almost twice the speed, almost twice the pitch". Ratio 1.9073 — an octave minus 82 cents, the same error mirrored (source: s-little-scale-overclocked-game-boy)

The repair for the second case, from Tom Gilmore (10k), is to compute lsdj's pitch table for twice the fitted crystal — 4 MHz for a 2 MHz machine — so the ROM plays an exact octave down and in tune (rom-retuning). The replacement crystal is taller than the original and has to be laid on its side and taped off from the PCB. An underclocked machine masters or slaves a stock one over the link port either way (sync).

Running LSDj on hardware: flash cartridges#

From defense-mechanism's cartridge guide of 2020-05-21, updated in 2024 (source: s-intense-tech-16-cartridge-family):

  • lsdj needs a cartridge with 128 kB of save memory (SRAM or FRAM) — the 1 Mbit the manual asks for the multi-song file screen. There is no "official LSDJ cartridge": the LSDj licence disallows selling cartridges with it, so eBay listings under that name are low-quality bootlegs without ROM upgrades or save backup; buy from a known maker.
  • SD-card cartridges keep ROM and save on a microSD card: the Krikzz Everdrive GB X3/X5/X7 (the X5 is the recommendation for "compatibility, reliability, and price"); the BennVenn El Cheapo SD and the EZ Flash Jr are no longer sold, and the 2024 update withdraws the EZ Flash Jr "due to numerous quality issues" (its notes — firmware ezgb.dat on the card root, saves in a SAVER folder, a prompt to back the save up to the card on the next boot, a hidden soft-reset button under the shell — are struck through on the page).
  • USB cartridges: the EMS 64M Smart Card and the Drag'n'Derp were the popular ones; Drag'n'Derp production had stopped years before 2020 and EMS production halted around then (remaining stock at retromodding.com and kitsch-bent); ems-qart (Java, all platforms) and the command-line ems-flasher drive EMS carts on modern systems. The update recommends insideGadgets' LinkNLoad32 (4 MB ROM, 128 kB FRAM, USB, managed with the GBxCart software).
  • Flasher-based cartridges: insideGadgets' 1 MB / 128 kB SRAM cart ($29, shipped with the LSDj ROM of your choice) plus the GBxCart-mini flasher (about $50 for both) for upgrades, save backups and kit changes, with open-source command-line and GUI tools — the cheapest route per additional cartridge; the 4 MB / 128 kB FRAM cart needs no battery, so a dead cell can never eat the save.

Save files leave the cartridge as .sav (from a flasher, or from an emulator such as BGB) and are taken apart into songs with liblsdj or lsdpatch (sources: s-intense-tech-04-liblsdj, s-intense-tech-20-lsdpatch).

Emulators#

For LSDj 9.2 only the current BGB (at least 1.5.9), SameBoy, Gambatte and Emulicious are compatible; other emulators give "funny volume behavior" in the pulse and noise channels because 9.2 generates its envelopes in a new way (source: s-intense-tech-21-whats-new-in-lsdj-92). The noise channel's random hardware mute affects "many hardware Gameboy models" but not BGB, SameBoy or most Game Boy Advance models (source: s-intense-tech-19-new-noise-and-910-news); see game-boy-apu.

To verify#

  • (unverified) Model years: DMG 1989, Pocket 1996, Color 1998, Advance 2001. The often-repeated claim that DMG and Pocket/Color differ audibly in noise floor and bass response is only partly covered by Pan Docs (the high-pass filter strength above); the rest stays unverified.

lsdj · nanoloop · game-boy-apu · pan-docs · sync · liblsdj · lsdpatch · defense-mechanism · rom-retuning · alternative-tunings · little-scale

Sources#

s-lsdj-manual · s-pandocs-audio-overview · s-pandocs-audio-details · s-pandocs-audio-registers · s-chipmusic-kotlinski-interviews · s-chipmusic-lsdj-faq · s-intense-tech-16-cartridge-family · s-intense-tech-04-liblsdj · s-intense-tech-20-lsdpatch · s-intense-tech-21-whats-new-in-lsdj-92 · s-intense-tech-19-new-noise-and-910-news · s-little-scale-underclocking-and-retuning · s-little-scale-lsdj-tuning-tables · s-little-scale-overclocked-game-boy · s-little-scale-teensy-usb-midi-sync · s-little-scale-sync-options-for-game-boys · s-little-scale-rom-sample-extraction · s-little-scale-arduino-gameboy-sync-boxes · s-little-scale-1-dollar-nanoloop-sync · s-little-scale-syncing-things-to-lsdj

source file wiki/entities/game-boy.md · 1 unverified · graph