The dsp-G1 Analog Modeling Synth source code


So let’s put this to an end?

It’s not a DCO but an NCO.
And my coding could be better.



Waiting to see the exponential coefficient table for the cutoff :smiley:


Exponential coefficient table is no problem.

The problem is that the 4K flash is stuffed :slight_smile:


All I can say is that this is now heading in the right direction!


Yaaaaaaaaaaaaaaaaay, here’s your comlimentary picture :


> The problem is that the 4K flash is stuffed :slight_smile:

First, eliminate the division routine generated by the compiler for the “/12” and “/127”. In the former case, through a loop subtracting 12 from the MIDI note number until it falls below 12, and counting the number of shifts (there will be at most 10 iterations, and there’s a chance it might actually be faster than a general purpose division routine). In the later case, by >> 7.


I thought about it, and you only need 64 bytes of lookup data (two tables of 16 uint16_t). Pseudocode here.


I’ll take your inputs and thoughts into consideration.

Your pseudo code is pretty good.

But I just can’t get it why you want the cutoff to be log and not lin?


You can use objdump -d -h -S program.elf > program.txt to get a disassembled version of the compiled code. Good place to start looking for optimizations.


Actually in LPCXpresso/Eclipse you can just highlight the elf/hex file in the IDE and select disassemble :slight_smile:


Then you have one excuse less for not using it!


janost> You can use it anyway you like except make your own profit on the exact code. I don’t mind if anyone rip parts of the code for their own ideas but you can’t sell it as is. The schematic design is free of use.

Unfortunately that’s not what it says at

Here is the licensing information I could find at that URL:

It is an exclusive license for so the images and code may not be published on any other web page. You may use the schematics and code for personal projects but the design and code is copyright DSP Synthesizers, Sweden All rights reserved.

And in the header of the source code:

// Analog Modeling Synth main code
// Copyright DSP Synthesizers © 2014
// Code may not be redistributed and is for personal use only
// The code may only be listed here on

On the basis of the first of those licensing statements, it is not permitted for anyone else to use parts of your code for any purpose at all - only Hackster is permitted to use it, but the license does not say how or in what way Hackster is allowed to use it.

The second license statement is not consistent with the first, because it implies that the code is licensed to end users other than Hackster, for personal use only (personal use is undefined). The inconsistency is that you grant an exclusive license to Hackster in the first statement, but then appear to grant a license to others in the second statement. Also, the statements “it is an exclusive licence for so the images and code may not be published on any other web page” and “code may not be redistributed and is for personal use only” really complicate the matter - they mean that others can’t communicate any changes or adaptations or other use they have made of your code to anyone else - all such changes must remain “personal” and can’t be re-published. Strictly speaking, someone who has downloaded your code can’t even give a modified (or unmodified) version of it to their friend.

You really are better off using a recognised open-source license for your source code, and/or a Creative Commons or open-hardware license for your schematics. As it stands, I would urge extreme caution on the part of anyone contemplating use or re-use of your code or design, due to the rather unclear and inconsistent but nonetheless very onerous restrictions you have placed on how the material may be used.


Regarding using an existing and known license, check out

Oh, and cutoff response should really be log and not lin; TRUST OLIVIER ON THAT ONE! :wink:


The code is really meant to show how it works.

If you want to use the code as is, it’s better to buy a preprogrammed chip.

But I’ll look into updating the license.


Of course cutoff should be log.

@pichenettes "If you have a frequency knob with 10Hz on one end and 10kHz on the other end, you’ll need to have 1kHz in the middle. Not 5kHz."
Didn’t you mean 316 Hz in the middle?

@janost If pichenettes spends his time to read your code and writes a whole page about it and gives suggestions, I don’t think he wants to offend you…
You see this is a forum of both; users (“who cares the code”) and developers (“how does the code work”).


> Didn’t you mean 316 Hz in the middle?

Right! I’m more used to the obvious 20 Hz - 20 kHz with 630 Hz in the middle - but I thought using decades would be clearer. Oops!


I would rip my arm of for and implement any suggestion Olivier gives - at least on my projects - as he probably is the most experienced person on this planet when it comes to digital and hybrid synthesizers.

  • he dreams in C++

Not the most experienced on the planet but I admit he’s good.
And I rather keep my arm :slight_smile:


@janost I think this is not competition about who is good but If you ask me Olivier proved himself both technically and commercially enough.

Look at the Mutable Instrument’s history . What it was in the beginning and what it is now.

If you look at the forum you will see Olivier is also cruel on himself for his work ,design and decision that he made.

IMHO , This motto is what it makes Mutable Instruments successful


Well, any changes will go into the MK-II chip as the dsp-G1 is already sent to Adafruit for review and eventual stock.