Shitwave – A PRNG based drone generator for Gameboy
Mar 23, 2009
by: Nitro2k01
0
1,344 views

3377654447_ae9a507890_m Shitwave vis 2
Little-scale recently posted All 4-bit Waveforms That Have 32 Samples, a Max patch that would generate all possible wave frames that could be used with LSDj, given gazillions years. However, the result was a little boring because it would start out as a 1/32 PWM and slowly progress towards a longer and longer PWM. Even within many years, chances are you’d still have a very low duty PWM.
So I decided to find an algorithm that would produce more interesting sounds and still cycle through all 1632 possibilities. My choice was a Pseudo Random Number Generator using a Linear Feedback Shift Register. Actually not completely unlike the one in the Gameboy’s noise generator.
However, where the GB’s generator goes through a small number of states, and the buffer constitutes one sample, I’m using the full 16 bytes (32 samples) used in the Gameboy’s wave channel as my shift register. (Equivalent of one frame in the LSDj softsynth)
The shift register is a regular Fibonacci where the two topmost bits are xor’d with each other and shifted in at the bottom. The program is written in spaghetti style hardcore assembly language and the code is 256 bytes big. (The file header is another 80 bytes. So all in all, the program is 336 bytes.) The rest of the 32 kB is zeros, so there’s room for additional functionality. (Suggestions, anyone?)
The visuals are showing the currently playing waveform. The background pattern for the visuals are generated with a simple xor algorithm to make it appear random.

Unfortunately I don’t have a camera with a microphone, or even editing software that can handle the non-standard MOV file that my DSC gives me. So the audio is recorded separately from the video.

Audio:

Video: (No sound :( )

And last but not least… The ROM for those who dare and desire to try the program themselves.
shitwave1.zip (637 bytes, zip)
A and B (Or left and right) controls the type of visualization used. Select (Or up) re-seeds the PRNG. Preferably, run this program on real hardware, not in an emulator. If you must use an emulator, use no$gmb.

Oh, the name “Shitwave”? I mispelled “Shiftwave” when creating the folder for the project, and then I decided it was a fitting name.
Shitwave in no$gmb

Shitwave in a hex editor

Leave a Reply