electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » Developers' Corner
Simple DIY dsPIC Project
Post new topic   Reply to topic Moderators: DrJustice
Page 4 of 7 [159 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Author Message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Mon Oct 22, 2012 5:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

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.

Note that reading pots is a low intensity need in my synth.

_________________
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
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Mon Oct 29, 2012 8:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message Visit poster's website
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Tue Oct 30, 2012 5:04 am    Post subject: Reply with quote  Mark this post and the followings unread

How does it sound? got a demo?

What is the next step - fine tuning the sound or adding polyphony?

_________________
JacobWatters.com
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Tue Oct 30, 2012 3:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

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

Download
 Filename:  dsPIC_one_string_harp.mp3
 Filesize:  4.36 MB
 Downloaded:  1189 Time(s)


_________________
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
Back to top
View user's profile Send private message Visit poster's website
Dan Lavin



Joined: Nov 09, 2006
Posts: 649
Location: Spring Lake, Mi, USA
Audio files: 21

PostPosted: Tue Oct 30, 2012 4:21 pm    Post subject: Reply with quote  Mark this post and the followings unread

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 Wink)

Looking forward to further reports!

_________________
Synth DIY since 1977!
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24075
Location: The Netherlands, Enschede
Audio files: 277
G2 patch files: 320

PostPosted: Wed Oct 31, 2012 3:54 am    Post subject: Reply with quote  Mark this post and the followings unread

Sounds like liftoff to me, great!
_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Wed Oct 31, 2012 5:30 am    Post subject: Reply with quote  Mark this post and the followings unread

Wow! That sounds awesome! Great work Scott Smile
_________________
JacobWatters.com
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Wed Oct 31, 2012 7:56 am    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Nov 01, 2012 4:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

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.


dsPIC_4_string_harp_demo_01.mp3
 Description:
dsPIC 4 String Harp Demo

Download
 Filename:  dsPIC_4_string_harp_demo_01.mp3
 Filesize:  3.76 MB
 Downloaded:  1092 Time(s)


_________________
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
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Fri Nov 02, 2012 8:17 am    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message Visit poster's website
sneakthief



Joined: Jul 24, 2006
Posts: 569
Location: Berlin

PostPosted: Fri Nov 02, 2012 8:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Keep up the good work, Scott.

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 Smile

_________________
Sneak-Thief - raw electrofunk
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Fri Nov 02, 2012 8:56 am    Post subject: Reply with quote  Mark this post and the followings unread

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.

And I'm still looking for more ways to reduce the overhead...

_________________
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
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Fri Nov 02, 2012 7:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's another demo, same sequence, but with several improvements to the code.


dsPIC_4_string_harp_demo_02.mp3
 Description:

Download
 Filename:  dsPIC_4_string_harp_demo_02.mp3
 Filesize:  3.87 MB
 Downloaded:  988 Time(s)


_________________
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
Back to top
View user's profile Send private message Visit poster's website
sneakthief



Joined: Jul 24, 2006
Posts: 569
Location: Berlin

PostPosted: Sat Nov 03, 2012 3:50 am    Post subject: Reply with quote  Mark this post and the followings unread

Will you be connecting a display?

What are your thoughts about using graphics displays with SPI, such as this:

http://www.ebay.com/itm/1-8-Serial-SPI-LCD-Module-MicroSD-Socket-ST7735R-For-Arduino-/160758311211?pt=LH_DefaultDomain_0&hash=item256df1292b

...or this:

http://www.ebay.com/itm/1-5-SPI-Parallel-TFT-Color-LCD-Module-Display-128X128-RGB-Y100-/261036873880?pt=LH_DefaultDomain_0&hash=item3cc7029898


Or perhaps a simple 16x2 I2C version:

http://www.ebay.com/itm/Serial-IIC-I2C-TWI-1602-162-16X2-Character-LCD-Module-Display-For-5v-Arduino-/300746445605?pt=LH_DefaultDomain_0&hash=item4605e29325

_________________
Sneak-Thief - raw electrofunk
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Wed Nov 07, 2012 6:57 am    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Wed Nov 07, 2012 7:01 am    Post subject: Reply with quote  Mark this post and the followings unread

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.

Currently, I am working on bringing the synth up to 8 voices.

_________________
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
Back to top
View user's profile Send private message Visit poster's website
cloudscapes



Joined: Feb 09, 2004
Posts: 100
Location: Montreal

PostPosted: Thu Nov 08, 2012 11:35 am    Post subject: Reply with quote  Mark this post and the followings unread

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.

what a great thread to follow!

_________________
Sonic Crayon DIY effects lab
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Thu Nov 08, 2012 4:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks cloudscapes Smile

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.


whole_harpie_synth.jpg
 Description:
The whole Harpie synth
 Filesize:  229.16 KB
 Viewed:  391 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

whole_harpie_synth.jpg



harpie_voice_engines.jpg
 Description:
Harpie Voice Engines Board
 Filesize:  140.18 KB
 Viewed:  376 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

harpie_voice_engines.jpg



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

Download
 Filename:  dsPIC_Harpie_8_Voice.mp3
 Filesize:  3.63 MB
 Downloaded:  991 Time(s)


_________________
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

Last edited by JovianPyx on Thu Nov 08, 2012 5:10 pm; edited 6 times in total
Back to top
View user's profile Send private message Visit poster's website
audiodef



Joined: Sep 05, 2011
Posts: 726
Location: LFO1
Audio files: 53

PostPosted: Thu Nov 08, 2012 4:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

Putting in a post to follow this thread - will listen later. Smile
_________________
There's an invisible radio gnome playing a gong from a flying teapot - don't miss out!
Back to top
View user's profile Send private message Visit poster's website
bubzy



Joined: Oct 27, 2010
Posts: 594
Location: United Kingdom
Audio files: 64

PostPosted: Fri Nov 09, 2012 6:43 am    Post subject: Reply with quote  Mark this post and the followings unread

sounding good!
fell asleep a little bit there.

_________________
_Richard_ Smile
Back to top
View user's profile Send private message
elmegil



Joined: Mar 20, 2012
Posts: 2177
Location: Chicago
Audio files: 16

PostPosted: Fri Nov 09, 2012 7:15 am    Post subject: Reply with quote  Mark this post and the followings unread

That sounds AWESOME.
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Fri Nov 09, 2012 4:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Here's a piece I did for testing the Harpie.

EDIT ADD: NOTE: DO NOT USE THIS ON THE RADIO. IT HAS CLIPPING. THE NEXT SAMPLE IS MUCH BETTER.


sg20121109a.mp3
 Description:
My Brain Is An Electron

Download
 Filename:  sg20121109a.mp3
 Filesize:  1.52 MB
 Downloaded:  1007 Time(s)


_________________
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

Last edited by JovianPyx on Sun Nov 11, 2012 12:08 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
elmegil



Joined: Mar 20, 2012
Posts: 2177
Location: Chicago
Audio files: 16

PostPosted: Sat Nov 10, 2012 7:31 am    Post subject: Reply with quote  Mark this post and the followings unread

So when's the album coming out? Very Happy
Back to top
View user's profile Send private message
ejr27233



Joined: Feb 08, 2010
Posts: 52
Location: UK

PostPosted: Sat Nov 10, 2012 8:12 am    Post subject: Reply with quote  Mark this post and the followings unread

You have been paid the ultimate complement....My wife, listening from the next room thought it was a 'real' (ie accoustic) instrument!!

Fantastic project...please keep it up
Back to top
View user's profile Send private message
JovianPyx



Joined: Nov 20, 2007
Posts: 1988
Location: West Red Spot, Jupiter
Audio files: 224

PostPosted: Sun Nov 11, 2012 6:28 am    Post subject: Reply with quote  Mark this post and the followings unread

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 4 of 7 [159 Posts]
View unread posts
View new posts in the last week
Goto page: Previous 1, 2, 3, 4, 5, 6, 7 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

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


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use