Little Sound Dj Wiki
Advertisement

As you may know, Little Sound Dj can play back samples using the kit instrument. It is also possible to add custom samples using the lsdpatcher tool. Recently, Little Sound Dj and lsdpatcher got major sample playback quality improvements. This page attempts to describe those changes.

Dithering

Original

LSDj 9.2.L on DMG, no dither

LSDj 9.2.L on DMG, dither

Spectrogram comparing original, dither off and on. Dithering flattens the quantization noise.

A lot of noise, so called “quantization noise”, is introduced when converting 16-bit audio to 4-bit audio. It can sound distorted and trashy. Dithering is a technique for making this noise less annoying. Before the conversion, dithering noise is added to the signal to spread the quantization noise across all frequencies. This is especially good for clean sounds with a lot of bass or mid range, like bass drums and toms.

With old Little Sound Dj + lsdpatcher, dithering was either not used at all, or used moderately with a rectangular noise distribution that did not sound very good. New Little Sound Dj + lsdpatcher by default uses full dithering with a high-quality triangular noise distribution.

Triangular dithering was introduced in lsdpatcher v1.8.0. LSDj v9.0.0 has updated stock sample kits with triangular dithering.

Resampling

Original: Sweep from 2 kHz to 11.5 kHz.

lsdpatcher v1.7.0. Lots of aliasing, frequencies above 6 kHz are mirrored down.

lsdpatcher v1.9.0. Improved resampling using libresample4j.

Spectrogram comparing original, v1.7.0 and v1.9.0 on DMG.

Up to lsdpatcher v1.7.0, downsampling to the LSDj sample frequency 11468 Hz was done using naive nearest neighbor conversion. This caused aliasing, that is, frequencies over 6 kHz were mirrored down to create false bass and mid frequencies. To avoid this, it was recommended to downsample in SoX before lsdpatcher import.

The situation improved in lsdpatcher v1.9.0, which uses libresample4j for resampling. With it, frequencies above 6 kHz are correctly filtered out before downsampling. This avoids aliasing, and there is no longer any need to use SoX.

Wave Refresh

Original: 2-5 kHz sweep.

LSDj 9.1.C on DMG

LSDj 9.2.L on DMG

Spectrogram comparing original, 9.1.C and 9.2.L. 9.2.L signal is a lot cleaner than 9.1.C!

Game Boy hardware is not intended to play back full audio samples. It can however be done using clever programming. The usual method is to play a 32-sample long waveform (like can be seen in Little Sound Dj WAVE screen) and replace its contents once the samples played through. To reach the target sample frequency of 11468 Hz, wave refresh must happen about 360 times per second. Unfortunately, as some noise is added every time the wave is replaced, this is a fairly noisy playback method.

Two important noise reduction techniques were found for LSDj 9:

  1. Use hardware timer instead of screen update position to accurately time the waveform update.
  2. Avoid a hardware bug that makes the first sample in each waveform incorrectly use the last played value from previous waveform.

These techniques were added in lsdpatcher v1.11.0 and Little Sound Dj v9.2.0.

Inverted Polarity

Electronic audio signals are represented by positive and negative voltages. With correct polarity, positive voltage pushes the speaker cone towards you, and negative pulls it from you.

For Game Boy, my assumption was that a sample value of 0 means negative voltage, and F means positive. I recently discovered this is is wrong, and that polarity has been inverted all these years: 0 really means positive and F means negative! This mistake meant that especially kick drums lost some of the initial snap. The difference is subtle but noticeable, especially when listening through headphones.

(The full truth might be even more complicated: it seems different Game Boy models have different polarity! For example, SameBoy emulator assumes that Game Boy Advance has different polarity from DMG. I left the default lsdpatcher setting to match DMG polarity, as it is the most popular model, with a menu option to change polarity to match GBA.)

Fixes to make polarity match DMG were made in Little Sound Dj v9.1.B, lsdpatcher v1.10.5 and BGB 1.5.9.

Lsdpatcher GUI

lsdpatcher v1.13.0

It is probably in place to mention, the lsdpatcher GUI received a massive overhaul. Making sample kits is now easier and more fun than ever, with intuitive and responsive controls.

Emulator Warning!

Most Game Boy emulators do not emulate audio playback correctly. Of the ones I tested, BGB, SameBoy and Gambatte do a decent job. If you use some other emulator, and find audio quality is worse than e.g. SameBoy, please contact the emulator developer(s) and complain.

Summary

Due to diligent research, novel techniques and best-practice engineering, sample playback quality is significantly improved in LSDj 9 and lsdpatcher. I hope you will be inspired to create new sample kits that benefit from the increased clarity and punch. Happy tracking! / Johan

Further Reading

Advertisement