9 posts / 0 new
Last post
eddielovesyou
Offline
Joined: 05/12/2014 - 12:40
8 Bit Synth Basics

I'm sketching out some tunes that will eventually be put into Famitracker (creates files compatible with NES ROMs), and I'd like to set up Caustic to emulate the sound limitations of the Nintendo's 8-bit chip.  I've searched around online about 8-bit expressions, but can't find anything on the basics.  

I'd like to be able to create triangle and square waves, and adjust the pulse width of the square if possible.  Any hints?  I know I could use some of the other machines, but I'm also curious as to how to translate these into math.

nitro27
nitro27's picture
Offline
Joined: 10/11/2015 - 18:27
Y'all should already know

Y'all should already know that the variable "t" in 8bitsynth is a counter that goes from 0-255 however many times per second, and also how bitwise operators and the modulus work.

I've got PWM. (t)&128 will give a square* wave.

00111111 (127) & 01000000 (128) = 00000000

01000001 (129) & 01000000 (128)= 01000000 (128)

So whenever t is larger than 128, the synth will output 128. We can modulo t to make it greater than 128 for less time, like so.

(t%196)&128 gives a 25% pulse:
127 > 0
129 > 128
195 > 128
196 > 0
255 > 0

Therefore, famitracker style,
pw0 = (t%224)&128
pw1 = (t%196)&128
pw2 = t&128
pw3 = -((t%196)&128)

*You can't get a true square out of 8bitsynth because of how its "DAC" centers the output. But, afaik, the nes does something similar.

nitro27
nitro27's picture
Offline
Joined: 10/11/2015 - 18:27
Or at least it would if I

Or at least it would if I weren't a dumbass and understood how modulus worked.

It seems to me that t%196 should cause the output to go from 0-195 and then 0-64 and repeat. It, uh, doesn't. What's up with that?

edit: ooh, also, if you want to read some nerd shit, check this out
http://nesdev.com/apu_ref.txt

eddielovesyou
Offline
Joined: 05/12/2014 - 12:40
Thank you, I'll check those

Thank you, I'll check those out.  In the meantime, I imported some single-cycle samples of the raw NES waveforms into PCMSynth which has been working pretty well.  You're right that the NES square is definitely not a clean square, which is part of the magic.  To say nothing about that pseudo triangle!

 

 

TheRektafire
Offline
Joined: 08/27/2014 - 10:45
Yeah that slightly distorted

Yeah that slightly distorted triangle sound is bae, sadly it is difficult to make in caustic, I tried to draw the shape in the subsynth custom wave but I couldn't do it in my relatively small (for this kind of thing) phone screen :( i tried to reverse engineer the wavetable info so i could just draw it with a hex editor instead but that didnt get very far lol. Do you have a waveform of it that can be loaded into the pcmsynth or preferably the subsynth? Also do you have any retro game samples whether it be dpcm or wav like the sunsoft bass, contra drums etc?

TheRektafire
Offline
Joined: 08/27/2014 - 10:45
I tried putting these

I tried putting these equations into the 8bitsynth and noticed all the ones except for the normal square (t&128) are out of tune slightly :(

nitro27
nitro27's picture
Offline
Joined: 10/11/2015 - 18:27
Oh shit I figured out why my

Oh shit I figured out why my equations are broken!

You know how I said t goes from 0-255 and repeats? That's if it were a real 8 bit processor. But t doesn't start out as an 8 bit number! 8bitsynth runs through the equation at whatever word size (probably 32) and then modulos the output by 256. This explains why t>>1 causes the output to go down an octave instead of doing other stuff, and also why we can divide by 1024 without accidentally dividing by 0. So all we need to do is modulo t by 256 before sending it through the equation.

tl;dr
pw0 = ((t%256)%224)&128
pw1 = ((t%256)%196)&128
pw2 = t&128
pw3 = -(((t%256)%196)&128)

Make your checks out to cash.

eddielovesyou
Offline
Joined: 05/12/2014 - 12:40
I got the samples I use in

I got the samples I use in PCMSynth here:

https://www.adventurekid.se/akrt/waveforms/akwf-nes-8-bit-free/

 

Haven't tried looking for any of the classic DPCM samples, but I'm sure they're out there.

AndyZamoron
AndyZamoron's picture
Offline
Joined: 05/22/2014 - 12:54
Having the attention span of

Having the attention span of a gnat has kept me disinterested in watching the tutorials. Which were painstakingly made to help understand... I know, blah-blah blah, tutorials. However, I did watch most of the 8-bit tutorial. And, I must say that the 8-bit is one of the most powerful & malleable instruments in the Caustic arsenal. I do advise using the shuffle option from the instrument's pattern group submenu. It'll make for MUCH better automation transitioning. Think about if you had to turn a dial while playing the song... you have to wait for the next note calculation. So if you end an automation at a note, it'll still play from before the end point. Some presets need to be shuffled more than others. The other option would be to, from the sequencer's instrument automation submenu, move each automation dot a little bit left. (Which sometimes I still do to make it sound how I want it to)

Hope my rambling helps.

It's the lead, starting at 30 s, for this track. My songs hardly ever even have a lead. You'll know why Beam Me Up is the title when you hear it. And, accidentally, it's all thanks to the 8-bit with mixing board reverb & delay.

<iframe width="100%" height="20" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks...

I use the 8-bit quite often. This song has two, maybe three, 8-bit slots used. The initial 1 m 45 s become hectic. I always strive to give each of my creations a great intro.

<iframe width="100%" height="20" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks...