The tiny musical LPC810
I did a breakout board for the NXP LPC810 ARM Cortex M0+ 8-DIP little monster and was thinking of what it could be good for?
Because of the raw 32-bit processing power hosted in this little thing I figured it could make a nice little synth.
But it doesn't have a digital to analog converter and the low 6GPIOs won't do for an R2R resistor ladder DAC I had to figure out something else.Most CD-players today use a 1-bit Sigma-Delta DAC.
Perfect, just 1 GPIO.
So I connected a lowpass filter (resistor and capacitor) to P0_3 on the beast and 2 hours later I had a PDM DAC with great specs.
How about a DAC with a resolution of 44.1KHz and 16-bits?
The bitstream runs at 3.6MHz and it can easily do stereo on 2 GPIOs.
Now it's time for the different virtual analog synthesizer blocks to be coded.
Output a 256 16-bit sinetable at 44.1KHz
The DCF
The DCO block
The Envelope
No synth Is complete without an envelope module.
The simple module controls volume over time by defining the attack time, decay time, sustain level and release time.
Really simple but needs a trigger to know when there is a note on or note off event.
Since our synth doesn't have a keyboard or MIDI input yet we can only run through the attack and release states, landing at the sustain level.
Testing the synth
The testcode plays a C4 with a nice Roland SawString sound (3 detuned saw oscillators) at a 20sec attack time and the filter fully open.
It's still monophonic but when implementing the MIDI handler I'll try to see how many blocks I can run indexed thus testing it for polyphony.
Enjoy.
The quest for SuperSaw sounds
Today lead synthesizers are measured by how good they are at generating the SuperSaw sound.
The sound is a famous trance lead sound that comes from the Roland JP-8000 analog modeling synth.
The sound is created using an odd number of detuned saw oscillators.
The first graph shows the output frequency spectrum of the oscillators.
Detuning the oscillators
The table shows the fractional detune of each oscillator against the center pitch.
The JP-8000 uses 7 oscillators but at least 3 oscillators are needed to imitate the SuperSaw sound.
The hostboard for scanning synth parameter pots
Populated
The basic DAC schematics
The synthesizer
Now I need to design the DCO, LFO, ENV and DCF blocks.
All of them need to go into the 44.1K ISR to calculate a 16-bit sample every timer tick.
Then it will be easy to run a UART as MIDI and modify the parameters in each block.
I may have to rewrite the PDM loop in ARM assembly to reach 64x or 128x oversampling in the bitstream.
At the moment, written in C, it's just 32x oversampling.
Another thing is that the ISR have to change the DAC GPIOs to input during the ISR execution to not leave the pin high or low.
This would create distortion at the sampling frequency.
Analog modeling filter code
The filter code is my personal version of a 4pole, 24db analog filter with resonance written in C.
Its fast and sound very round and pleasing with a great resonance sound.
This is the first time I put it out for everyone to use and it was originally written in x86 assembly code.
Runs great on the NXP.
Oscillators
The synth has three 32-bit saw oscillators tuned at middle F with 44701Hz sampling frequency.
This gives a 16bit fractional resolution and 0x00010000 as the frequency count for F4.
One oscillator is used for the center frequency of the key and the other two may be detuned above or below with a resolution of 1/65536 steps.
Perfect for generating analog synth sounds or SuperSaw sounds.
Comments