Created Wed, 14 Jan 2015 20:44:28 +0000 by madias
Wed, 14 Jan 2015 20:44:28 +0000
Hello, I currently doing a conversation of my 4-voice dual DCO synth with 4 analog filters. In my first project I used 4 Amega328 minis with 8-bit parallel DAC's as voice engines, one Atmega 328 for inputs and potis and a TM4C123G LaunchPad for controlling everything (voice engines via I2C, ADSR's, LFO's, control voltage outputs for filters and VCA, displays (one 4 line LCD and one 320*240 TFT). I wanna share with you my first basic voice engine adapted to a pic32mx250 using a mcp4922 as dual output.
This is a very rough conversation (because of the 8-bit of the 328er) with following limits: []using 16bit values for phase accumulator (maybe switching to floating or 32bit?) = less accurate []wavetables limited to 256steps (more steps need reorganize the phase accumulator) []only two DCO and one LFO []wavetables are limited to 8 bit (just adjust the "DAC_val1=sig[0][color=#FF0000]<<4[/color]; " in the waveengine code
Features: []Wavetables: sine,tri,saw-up,saw-down,sqr,PWM []midi notes conversation: use note[] for midi notes []frequency modulation between DCO0+DCO1 []LFO modulation for pitch and PWM
In this version there is no I2C or MIDI protocol implimented. I've analyzed the main IRQ (calculating DCO's and SPI output), there is much space left on the pic32 for much more things to to :) Maybe one PIC32 is enough for a complete polyphonic synth (but I need for one physical output 3 additional DAC's for the analog section: cutoff,resonance,VCA, I've ordered a cheap octal 8bit spi DAC for the control things already) My sample code should run fine on UECIDE with no additional libraries and a PIC32MX250. For other MCU's the SPI pins have to be changed (I use mapPps)
The code plays midi-notes 0-80 in the main loop. regards
ps: a note to myself: [color=#FF0000]never [/color]use "int" anymore: use uint16_t (int on avr=16bit, int on PIC32=32bit, I spend 2 hours for finding the error)
Wed, 14 Jan 2015 23:13:02 +0000
ok, I've done some further testings:
floatings are a noway within the IRQ loop: about 66% utilization caused by the IRQ only with 2 voices! (at this point I miss my tiva tm123 with HW floating points...) so I stay with 16bit variables, so i get about 50% MCU utilization with virtual 16 voices (on 2 outputs) running - not bad! explanation for picture: I'm toggling two pins: first one is in the main loop, without nothing further. second one is in the IRQ: at the beginning HIGH, at the end LOW
[attachment=0]saleae-irq-test.png[/attachment]
Sun, 15 Mar 2015 12:16:40 +0000
Ok. Further success. Got my PIC32MX250 to play 4 voices simultaneously via 2 I2s-DAC's (both on independent SPI channels). Overclocked to about 60 MHZ for further headroom. I'll try to get the whole voice engine into this PIC: ADSR's, LFO's, octal-DAC for voltage controlling the filters. All other stuff (patch editing, display(s), rotary encoders, knobs, MIDI, storage) is outsourced to a STM32F103 (maple mini clone for 3 bucks). I also got my first PCB (the quad multimode filter board) into production. Notes to myself: Never use Fritzing anymore, use KiCAD. I am curious if my board wlll working, have to wait 2-4 weeks for delivery. File on dirt cheap dirty boards: http://dirtypcbs.com/view.php?share=5397&accesskey=