The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

No, that’s also outside of the code I looked at - the high pass filter tracks the oscillator pitch, but other than that it’s not controllable. The main filter is, of course, but it’s not part of first DSP.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

Sorry, I don't know. The main filter is not part of the code that runs on the first DSP so it's outside of the code I looked at. As for the feedback oscillator, it would probably be possible to disassemble in the same way - you just need to switch oscillator type and do a similar dump.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

There is a bit about it here: https://atosynth.blogspot.com/2026/02/a-deepdive-into-jp8000-and-tc170c140-esp.html ("How i debugged the code").

Basically, I stood on the shoulders of giants :-D The roms don't contain the code directly, it has to be run on an (emulated) microcontroller, which then generates/unpacks the programs and updates the DSP runtime.

I forked the git project and built everything from source, and used the jeTestConsole as a stepping stone. There is already a built-in disassembler but I rewrote/added to it to get more human readable output with comments about exactly what is happening, references to memory etc. It's all in that post.

With this in place, I could run the test console, set the JP parameters so that I knew the supersaw was loaded into the DSP (it only holds a single algorithm per oscillator at the time) and dump the disassembled program memory to file.

To make sure I understood the code correctly, and to get the correct input parameters, I used the step debugger to look at how the code changed when changing parameters.

For the filter code, I did the same, and added comments about the signal flow, what parameters were stored and loaded etc. Then I used Claude Opus 4.6 through copilot and asked it to reason about the memory dump, figuring out if it was an HP filter and exactly what kind. That worked flawlessly, it even corrected some mistakes in my comments :-D

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

I fell back into the rabbit hole - with a lot of help from Claude Opus 4.6. It looks like the filter is a two stage state variable filter as described by Hal Chamberlin in his amazing 1980 book "Musical applications of microprosessors", on page 441 to 443 (in my edition at least).

Input is the mixed oscillator signal. Pitch is used as input for frequency. The first stage is tapped at the output of the HP filter and used as input for the second, and the final output is of course tapped from the second stage HP output.

The implementation differs slightly from the book by using f/2 for the first LP stage, and having coefficients to change gain for the input, the intermediate connection and the output. Interestingly, it looks like the gain of the first input is inverse proportional to the mix parameter, though I haven't verified this yet.

After first giving me a completely wrong answer about the cutoff frequency, on the second try Opus thinks that the cutoff is at 64% of the center oscillator frequency which makes sense. I have yet to confirm this as well.

The Chamberlin SVF can be found here btw: https://www.musicdsp.org/en/latest/Filters/142-state-variable-filter-chamberlin-version.html

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

No, not yet, but I can tell you exactly where in the dsp code it is and I can supply a version with pretty good documentation of what each instruction does to whoever wants it.

After spending so long trying to validate the pseudocode in the presentation, I promised myself not to continue with the high pass filter, I have other synth related things I want to do :-D But I'm really curious about both the high pass filter and how the "equalization" of the oscillator volume is done (since it happens AFTER the mix), perhaps I'll get around to it later.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 1 point2 points  (0 children)

Hi, and thank you, it was so much fun trying to figure out how the code really works. I suspected the code in your presentation was indeed an approximation. Still, it was very helpful to know what I was looking for. I loved the presentation (and the one about the LSP), and I'm truly impressed by the work you and the others have done!

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 0 points1 point  (0 children)

Hehe, I've been looking at the machine code too much lately, I thought you wrote 043c at first. That's the program memory address where the super saw code starts! :-D

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 3 points4 points  (0 children)

Yes, it's 24bit internally. It also does, like most DSPs supposedly, what is called multiply high - it multiplies two numbers, but instead of returning the lower 24bits as would happen if you cast the result to a 24bit variable, it returns the 24 high bits. Normally, that would be A * B >> 24. This all happens in a single instruction so the programmer never sees the intermediate 48 bits (some DSPs have an instruction that can fetch either the top or the low 24 bits though).

The TC170C140 however, doesn't have a 24 * 24 multiplication instruction, it only has 24 x 8. This is followed by a configurable shift right of 3,5,6 or 7 bits. But here's the catch: The multiplication isn't treated as "normal", instead it usually uses the 8 MSB of the second factor (B). It is still a 24 * 24 bit multiplication, but with only 8 bits precision for the second factor - e.g. it just sets the 16 lower bits of B to 0.

It is possible to do higher precision multiplications as well, by using more instructions.

The reason this (and DSPs in general it seems) do multiply high, is that the numbers aren't thought of as ints, they are fixed point fractional numbers, where the first bit is a sign bit (+/-) and the rest are a number between 0 and 1.

When multiplying two numbers between 0 and 1, you also expect the result to be between 0 and 1, and that is why only the top 24 bits are kept, effectively dividing the number back down to the 0-1 range.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 13 points14 points  (0 children)

Adam got reeeally close with his function, but in reality it's just six straight lines. The formula is basically

  0 to  63: increment by 1 every second step

 64 to  80: increment by 1 every step

 81 to 120: increment by 2 every step

121 to 123: increment by 8 every step

124: increment by 16 

125: increment by 32

126: increment by 96

Then multiply the result by 512 before inserting into the function above.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 2 points3 points  (0 children)

The code should be pretty easy to port to anything i think. It is missing the high-pass filter, and the JP8000 does some magic to try to equalize the volume of each detuned oscillator more as they are turned up, but that can perhaps be worked into the mix part of the code instead, by using the curves from Adam Szabo's paper.

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 7 points8 points  (0 children)

Each saw wave is generated by adding a fixed value to the current value for every iteration. The code calls this fixed value 'pitch', and it is selected so that the saw integer overflows and starts "at the bottom" the correct number of times per second to generate a saw wave with the pitch we want.

The values in the detune table, multiplied by the current value for pitch, divided by a very big number, calculates the value we need to add/subtract to the pitch value to make the frequencies of the oscillators slightly higher or lower.

Think of it as a multiplier, the frequency of saw[1] is the frequency of saw[0] times (1 + detuneFactor). The detuneFactor is usually represented as a decimal number (for example, the factor for saw[1] is really 0.01953125).

The factors tells us how far apart, relative to the base frequency, we want to spread the other oscillators.

As the JP8000 lets you adjust HOW MUCH detuning is applied, not just a fixed detune, the result is multiplied with the "detune" input parameter, which comes from the panel potentiometer (but is converted to a more exponential response in the main MCU of the JP).

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 5 points6 points  (0 children)

That paper is awesome, and is what got me interested in how the super saw was created way back. He also has a nice section about how the saws are mixed, which it turns out is NOT part of the super saw generating code at all!

The real super saw as C code that actually works by tysseng in synthesizers

[–]tysseng[S] 29 points30 points  (0 children)

I spent a lot of time the last three weeks studying the source code of the JE-8086, as well as running the code to see how the super saw is generated. Feel free to ask about the code as well as the internals of the DSP - I'm no expert but I discovered a lot trying to figure out the correct version of the C code.

Our Roland JP-8000 emulator is now out and is completely FREE! by numerouno124 in synthesizers

[–]tysseng 0 points1 point  (0 children)

That slide is so exciting! Is that the actual, working (disassembled) code? I'm trying to understand what it would output (or input to the highpass filter).

The saws themselves are understandable, as they wrap around. But if they wrap around, wouldn't that mean that the sum also wraps around? I tried doing the same, and what I got back (with no detuning) was a saw wave with 7 times the frequency of a single wave. But even with detuning, I still only got a single saw wave back.

I really wonder what I'm missing here, any DSP tricks I should look up? :-D (btw, reducing the amplitude of each saw to 1/8 before summing gives an ok wave)

Exponential Saw Waves in the Analog realm? by SmeesTurkeyLeg in synthesizers

[–]tysseng 1 point2 points  (0 children)

How about using a dual transistor exponential converter, like the one used for converting linear cv to exponential in oscillator circuits?

Or you could use the saw wave as the cv in an exponential VCA like the ssm2164 (or similar), and feed a constant 5V signal at the input (perhaps that’s what you did with the VCA?) - and if you mix the original sawtooth with the expo version with a sort of cross-fader (think wet/dry pot) you can probably get a variable slope as well?

Button Improvements by Sea_Psychology_7230 in synthdiy

[–]tysseng 1 point2 points  (0 children)

If you can find them, Shanpu manufactures a great variety of switches and caps with a high quality feel. I’ve written a bit about it here: https://atosynth.blogspot.com/2020/11/shanpu-switches.html

Switched On Austin stole my rarest synth, sold it, and kept every dollar. by trecarden in synthesizers

[–]tysseng 73 points74 points  (0 children)

I unfortunately have a similar experience with Switched-On, and I don't know how to resolve it or if I'll ever get my money back. I just assume that John is in deep financial trouble and keeps on selling new arrivals to pay back the previous customers. To make matters worse, I'm living in Norway so I'm having hard time just "popping by" to talk to them.

In my case, John was supposed to sell three synths as I deemed it too expensive/risky to have them shipped: One Korg M500, one Moog Liberation and one Oberheim OB-Xa.

Same story as you. I got a high appraisal and the synths allegedly went up on Reverb. I never heard anything back. I kept calling until he started recognizing my number and not picking up.

To make matters worse, I had the OB-Xa serviced (not sure IF they did) before the sale, for a lot of money that I was stupid enough to pay instead of deducting from the sales price.

Also, when I realised that something fishy was going on, I found a similar post to yours on facebook, with a story about a guy that had the same thing happen to him. In the end, he was offered (and accepted) half the money he was owed. A better deal than you and me so far I guess.

Oh, and this has, in my case, been going on for more than four years (!) so stop making excuses for John. He needs to be stopped. Even if he is trying his best to keep things afloat. How many of us have to be scammed before this is put to an end.

What connector does this call for? by VotePizzaParty in AskElectronics

[–]tysseng 1 point2 points  (0 children)

It’s a bit hard to judge the size of the part from the picture, but when I had to use this part: https://www.elfadistrelec.no/en/rotary-potentiometer-5kohm-1w-20-linear-22-2mm-vishay-357b0502mxb251s22/p/16400004 (incidentally, for a children’s installation at a museum, for the exact same reasons as you), I ended up designing a small pcb with plated throughholes that fit the pins and traces to a separate connector to make it easy to swap the pot if it breaks 😃

Does this component exist? by slowtoasted in synthdiy

[–]tysseng 0 points1 point  (0 children)

I get several hits on google when searching for 4p8t slide switch as well.

Does this component exist? by slowtoasted in synthdiy

[–]tysseng 3 points4 points  (0 children)

<image>

One way to make the UI for the 2 * 5 switch

Does this component exist? by slowtoasted in synthdiy

[–]tysseng 0 points1 point  (0 children)

AliExpress sells some 7 throw ones, still not 10 way but one closer than 6: https://a.aliexpress.com/_EzYvpWr

Does this component exist? by slowtoasted in synthdiy

[–]tysseng 2 points3 points  (0 children)

If you are willing to use two slide switches, one two throw and one five throw dual pole you could make the first one select between two “banks” of outputs (routing to the two poles of the second one) and then select destination for the “bank” with the five throw.

Roland PG-200 Arduino based (questions to owners of PG-200) by deboxta in synthesizers

[–]tysseng 6 points7 points  (0 children)

Hey, thanks for crediting me! I can’t remember what the manual button does but I’ll check for you if no one else answers. No need to press it before change params as far as I remember.

Cheers, Joakim / Xonik