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.

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

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.

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

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.

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

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.

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

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.

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.

whole_harpie_synth.jpg

Description:

The whole Harpie synth

Filesize:

229.16 KB

Viewed:

93 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:

94 Time(s)

This image has been reduced to fit the page. Click on it to enlarge.

dsPIC_Harpie_8_Voice.mp3

Description:

Sorry about the clipping (small amount), the output is a bit too hot, will be addressing that soon.

Time flies like a banana.Fruit flies when you're having fun.BTW, Do these genes make my ass look fat?corruptio optimi pessimaLast 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 pessimaLast edited by JovianPyx on Sun Nov 11, 2012 12:08 pm; edited 1 time in total

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum

Please support our site. If you click through and buy from our affiliate partners, we earn a small commission.