so it may have taken me four years but i did figure out how to get 8bitsynth to spit out a triangle lol

t*(((t&128)/64)-1)

so that doesn't make any sense on its own so let's go through it. 8bitsynth is centered around this variable, t, which counts up from 0 to 255 and cycles back to 0 however fast it needs to in order to create a sawtooth wave at the note you're playing. (actually it counts up from 0 to 4 billion or whatever the limit is in 32 bits, then, after the equation is computed the result is modulo'd by 256. this is why you can use larger numbers in the equation without running into problems. we can thankfully ignore this extra complexity for the moment.)

to create a triangle wave, what we want is for the equation to count up from 0 to 127, then turn around and count back down from 127 to 0. notice that if we had two sawtooths, one going up and one going down, we could get a triangle by switching between them halfway through the cycle. t provides the upwards sawtooth, the downwards sawtooth is provided by -t, or, equivalently, t*(0-1)

t&128 provides a square wave. to understand why, let's look at this table

(000) 00000000 & (128) 10000000 = (000) 00000000

. . .

. . .

(127) 01111111 & (128) 10000000 = (000) 00000000

(128) 10000000 & (128) 10000000 = (128) 10000000

. . .

. . .

(255) 11111111 & (128) 10000000 = (128) 10000000

cool stuff. let's turn this oscillation between 0 and 128 into swapping between upward and downward sawtooths.

(t&128)/64 becomes an oscillation between 0 and 2.

((t&128)/64)-1 between -1 and 1

finally, if we multiply that by t, what we are oscillating between are the positive and negative versions of t, resulting in a triangle wave, with all the popping and distortion that comes from 8bitsynth. bit harder than using a sample but yk, knowledge is its own reward or something, i'm not wasting my time. here's a thread from 2017 where i fail to figure this out. https://singlecellsoftware.com/node/16441

ah 2017, good times. i thought i was a boy then. i hope that was easy to follow! good luck with your future endeavors!

now that all the waveforms the nes could do can be done on 8bitsynth here's a direct comparison between 8bitsynth and subsynth using just a midi of the best song on the nes. tbh the difference is more subtle than i had initially thought? certainly the triangle sounds the most different. you can say the 8bitsynth has a harsher, rawer character, but i'll probably be sticking to modular for pulse waves at least.

## Caustic Song file (optional):

Pretty cool

Youtube

https://www.youtube.com/channel/UCq5ojFDwsSnEE0sMt0Gw8gA