Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Mon Oct 22, 2012 5:50 pm Post subject:
Code for ADC for 2 potentiometers (or CVs) is now working. I used DMA in one-shot mode to reduce both CPU time and RAM used. Only 2 words of RAM are needed, one for each pot value. ADC is working in ALTS mode. No interrupts are required. Each ADC cycle is initiated by a single BSET instruction. Because the DMA controller has registers for 2 channels, these can be set (for two pots) and never touched again. So almost magically, all one needs to do is issue a channel-enable (one BSET) and just wait for the result. If done in a pipelined manner, there is no need to poll any "done" bit (assuming the processing time is longer than it takes the ADC to finish it's work).
I find this a very powerful feature of the dsPIC to be able to use DMA in this manner since the hardware can be doing two things at the same time - crunching the ADC and doing whatever calculations need doing. Note that DMA in a dsPIC does not cycle steal from the CPU because it uses a second port to the SRAM.
This method can be coupled to the DAC interrupt timing and reduce total interrupt push/pop and peripheral maintenance code and associated overhead. Of course, with a bit more overhead more pots could be managed this way. My current project requires only 2.
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Mon Oct 29, 2012 8:36 pm Post subject:
I've gotten a basic one string Karplus-Strong model to work which can be controlled by 2 pots, one for linear damping and one for low-pass filter Fc. It works quite well and proves the ADC, DAC and SPI code works. This uses a dsPIC running as MIDI controller and voice assigner connected to a dsPIC which runs as a voice engine. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Tue Oct 30, 2012 3:48 pm Post subject:
Here is a sample from the single delay line version. The first half or so was with 2x oversampling, so an octave higher, the second half used no oversampling. Some scales and notes with different settings. 2 pots, one for linear damping, the other is for the reflection filter - lowpass single pole. This is very early in development. One thing I hear is a prominent click in the start of the waveform at pluck time. This is most likely because I am using a simple rectangular pulse to excite the waveguide. I'm hoping that If I make the "pluck pulse" a trapezoid, it should improve.
PLEASE DON'T PUT THIS IN THE PLAYLIST, IT'S BORING.
dsPIC_one_string_harp.mp3
Description:
Single String Digital Karplus-Strong Model Using dsPIC33F
Joined: Nov 09, 2006 Posts: 649 Location: Spring Lake, Mi, USA
Audio files: 21
Posted: Tue Oct 30, 2012 4:21 pm Post subject:
Scott, I think it's only boring if you don't hear the potential there. This is good work! I would agree on the initial pluck being a little digital/click sounding (like the whole thing isn't digital )
Looking forward to further reports! _________________ Synth DIY since 1977!
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Wed Oct 31, 2012 7:56 am Post subject:
I tried 2 things to eliminate the pop at the start of the sound:
1) random fill - This did nothing to decrease the pop (which I suspected, but I wanted to try it to hear if the randomness would add randomized character to the timbre). Timbre sounded good.
2) Trapezoid excitation pulse. This worked wonders. Only 4 samples from zero to full scale was enough to eliminate the perception of a pop. Because I don't clear the delay line before excitation, the timbre is sufficiently different each time a string is plucked while it is still vibrating. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Thu Nov 01, 2012 4:28 pm Post subject:
The dsPIC voice program is now 4 voice polyphonic.
I have included a demo in which I use a MIDI sequencer to play a repeating set of notes that span the range of the instrument. As the sequence plays (about 4 minutes), I noodle the 2 knobs (real pots) on the synth. One is the damping knob, the other is the filter knob. As you can hear, there is quite a range of timbre change available with just these 2 knobs. I can also change the exciter pulse length as a fraction of the waveguide length only as a matter of recompile at the moment. For the demo it was set to 1/4 wave which gives a good amount of energy for harmonics as well as a fundamental with good amplitude.
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Fri Nov 02, 2012 8:17 am Post subject:
Instead of a trapezoid pluck pulse, using a single pole lowpass IIR filter and a rectangular pluck pulse to generate the pluck, I was able to eliminate many cycles of execution time. The actual voice generation code uses 296 clocks for four voices at 2x oversample. That means 592 for 8 voices. The total clock count available is 708, so more than 100 are available each sample time for "other stuff" such as dealing with incoming SPI messages, ADC values, pluck pulse start, etc. A 12 voice synth with 2 voice engines (and one more dsPIC for MIDI controller) is looking very possible now. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima
I've been following your progress since the beginning and this really shaping up into a great project.
I'm fascinated by the thought of having tiny, discrete hardware synths that I can bring with me during my live performances (weight always being a limiting factor).
FWIW, that's even more voices than my Nord Micromodular can handle when modelling something like this - nice _________________ Sneak-Thief - raw electrofunk
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Fri Nov 02, 2012 8:56 am Post subject:
Thanks sneakthief,
This has been quite a load of fun actually. The dsPIC is a very powerful chip. In fact, since writing my last post, I've reduced the clocks to 256 for 4 voices at 2x oversample. The DSP instructions allow quite a bit of parallelism where several different things are happening within the same clock period. Besides good, clever logic design, the two most important factors in reducing clock overhead are the DSP instructions and the addressing modes. I discovered that I had done addressing arithmetic with discrete add instructions when I could use an addressing mode that auto increments or adds two registers to get an address.
I also have plans to push some things that are being done by the voice engine into the MIDI controller which will lower the clock overhead even more.
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Wed Nov 07, 2012 6:57 am Post subject:
This particular synth needs no display since there is no patch memory. All of the timbre information comes from the 2 pots.
However, if I were to use a display (perhaps in another synth), I'd consider SPI since the dsPIC I'm using has 2 SPI channels and I use only one for interprocessor communication. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Wed Nov 07, 2012 7:01 am Post subject:
The second voice engine dsPIC has been added and wired up. It is currently running a data reliability test with SPI. The SPI (sent from the MIDI controller in master mode) now drives 2 devices and has run for more than 24 hours with no errors. The test sends 32 bit messages, the first 16 bits is a pseudorandom word from an LFSR. The second word is the inversion of the first word. The receiver inverts one word and then compares the two. If the same, the data is considered good.
I've also recently added support for the sustain pedal to the MIDI controller.
Joined: Feb 09, 2004 Posts: 100 Location: Montreal
Posted: Thu Nov 08, 2012 11:35 am Post subject:
holy cow! that last sample sounds amazing! really amazing!
DSP math is way over my head. I doubt I'd be able to produce anything as nice or complex even with a much more powerful micro. I'd brute force and botch it, inevitably.
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Thu Nov 08, 2012 4:11 pm Post subject:
Thanks cloudscapes
But wait - there's more ...
I've added a second dsPIC voice engine, done a bit of troubleshooting and now I have an 8 voice DSP harp polysynth using 3 dsPICs. One is a MIDI controller and voice assigner and the other two are 4 string harp voice engines.
The sample provided is a MIDI sequence playing into the harp and I'm noodling the two knobs. The sample is completely dry.
You'll notice around 3:17 it starts to go really flat. That's a consequence of the karplus-strong model. I may throw in a display... - if I did I give it selectable tuning tables.
EDIT ADD:
Part of the technology in the MIDI controller is the re-use of a string if possible. That is, if I play a C and a G and then go back to the same C, that combination uses only two voices because the C is being "re-plucked", like a real harp. This means that for many applications, fairly complex chord rythms can happen with long sustain time with little if any discernable voice theft. This synth does do voice theft, but only as a last resort.
dsPIC_Harpie_8_Voice.mp3
Description:
Sorry about the clipping (small amount), the output is a bit too hot, will be addressing that soon.
Filesize:
3.63 MB
Viewed:
1773 Time(s)
whole_harpie_synth.jpg
Description:
The whole Harpie synth
Filesize:
229.16 KB
Viewed:
547 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
harpie_voice_engines.jpg
Description:
Harpie Voice Engines Board
Filesize:
140.18 KB
Viewed:
532 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima Last edited by JovianPyx on Thu Nov 08, 2012 5:10 pm; edited 6 times in total
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima Last edited by JovianPyx on Sun Nov 11, 2012 12:08 pm; edited 1 time in total
Joined: Nov 20, 2007 Posts: 1988 Location: West Red Spot, Jupiter
Audio files: 237
Posted: Sun Nov 11, 2012 6:28 am Post subject:
Thank you both very much for your kind comments.
As for an album? heh, well, I am building up a collection of stuff, who knows...
And I am most certainly continuing work on this project and others like it. I'm trying to find out just how far I can push these little buggers. _________________ FPGA, dsPIC and Fatman Synth Stuff
Time flies like a banana. Fruit flies when you're having fun. BTW, Do these genes make my ass look fat?corruptio optimi pessima
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum