|HOME| |DIY FAQ| |GEO FAQ| |Debugging Page| |Links| |Schematics| |Wiki| |Layouts Gallery| |STORE|
|AMPAGE| |GEOFEX| |AMZ|

Welcome, Guest. Please login or register.
Did you miss your activation email?
October 02, 2014, 12:23:27 AM
969050 Posts in 103378 Topics by 32885 Members
Latest Member: Surprises
Home Help Login Register
DIYstompboxes.com  |  DIY Stompboxes  |  Digital & DSP  |  Stepping into the digital world with a DIY guitar DSP effects system 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Stepping into the digital world with a DIY guitar DSP effects system  (Read 13103 times)
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Stepping into the digital world with a DIY guitar DSP effects system
« on: February 26, 2011, 03:25:05 PM »

My original topic:  http://www.diystompboxes.com/smfforum/index.php?topic=88921.0

=== Introduction ===

I'm like a lot of DIY'ers in that I really want to explore the digital side of
developing guitar effects.  In school, we were spoiled on 8-bit PIC processors,
so I wanted to take the next step and try out Microchip's 16-bit dsPIC chips.

My goal is to develop a simple DSP platform with which I can sample a guitar
signal, try out some filtering/waveshaping/whatever, and spit the samples out
of the on-board audio DAC.

In short, I hope that this thread does the following:

1.  Shows where I'm currently at with the project and provide a place for updates.
2.  Allows other members of the community to ask questions and/or contribute ideas.
3.  Shows other curious DIY'ers how a DSP system can be implemented to get real, audible
    results with relative ease.

Keep in mind that this is, and will probably be for quite some time, a WORK-IN-PROGRESS!
We all know the learning process never ends, but I'm really enjoying this project so far and
I wanted to share it with everyone here.   Grin

I'll try to include a high-level overview of the system and its major parts for now, but
please feel free to ask questions and/or make requests and I'll be happy to respond with
more details.



=== Schematic ===




DSP:  The brain of the system is the 16-bit dsPIC33FJ64GP802 processor from Microchip.  This
      chip was chosen because it has all the required peripherals on-board, including a
      12-bit ADC and a 16-bit stereo DAC specifically designed for audio purposes.  It runs at
      at 80Mhz, or 40 MIPS.  The dsPIC chips are essentially the same as Microchip's regular
      16-bit processors (PIC24) except that they also have a DSP engine.

Port Expander:  This is used for extra general purpose input/output, or GPIO for short.  It
      has two ports, each with 8 additional I/O lines. Right now, I
      am using 4 lines as data to my LCD screen.  I plan on keeping the entire other
      port unused for now, and using a header for easy access to those
      pins later on, just in case the extra I/O is needed. (add-on boards?)

LCD Screen:  The display is a 16x2-line character LCD.  I'd like to keep this in the system
        and eventually use it as a user-interface.  Perhaps program a few different
        effects and use buttons with the display to act as a simple menu to select which
        algorithm the user wants to use.

Dual Op-Amp:  The special feature of the MCP6022 chip is that its outputs are rail-to-rail
         capable and it runs on 5 volts.  The DAC output only swings about 1Vrms peak
         so there is plenty of headroom.  The DAC outputs are also differential, so
         the op-amps convert the signals to single-ended.


=== Programming the dsPIC ===

Programmer:  Pickit 2
Compiler:  MikroC PRO for dsPIC30/33 and PIC24

You can program the dsPIC (along with MANY other Microchip devices) with the above tools.
MikroC PRO is a trusted, VERY GOOD third-party C compiler with excellent software libraries.
It is free to download here: http://www.mikroe.com/eng/products/view/231/mikroc-pro-for-dspic30-33-and-pic24

The Pickit 2 is a Microchip programmer that can handle basically all of Microchip's
processors except for their latest-and-greatest ones.  It's a great tool for hobbyists
at only $34.99:  http://www.microchipdirect.com/productsearch.aspx?Keywords=PG164120

I have code written already to communicate with the other devices in the system.  Thus, there
is a single location in the main function where you can play around with coding different
effects algorithms.  So, if you don't want to concern yourself with anything else, you can
just jump right to that spot in the code and start programming some effects!


=== My First Digital Effect:  Foldback Distortion ===

With a working ADC-DAC loopback platform, now we can get to the fun part.  One simple
distortion algorithm (which I admittedly found online somewhere) is called a foldback
distortion.  Basically, the algorithm clips the samples at a certain threshold that you
define, then it clips additionally based on the difference between the sample and the threshold.
So, the bigger difference between the signal and the clipping threshold, the more clipping
you will actually get.  The resulting sound isn't super-impressive, but again, this was the
very first thing I tried and honestly I was just excited to be able to hear that my project
was working!


=== Conclusion and Tentative Plans ===

Hopefully this thread will be helpful to others who want to develop their own DSP systems.
Sure, it ain't the best, but it works, and its a great way to take that first big step into
learning more about digital devices and applying it to something cool like guitar!

As a side-note, I thought it might be worth while to have professional PCBs made.  I'll see
what kind of response this post gets and maybe if there is enough interest I can take that
step and do a layout.  I just don't want to pay for several boards when I really only need
one or two for myself.  If other folks are interested in the project maybe I can order some
though and make a little kit out of it.

I planned on adding support for EEPROM and SRAM chips just in case extra memory
is required.  Also, analog pots will be added so the user can change parameters in real-time.

Aside from that stuff, I'm going to continue to experiment with different algorithms and just see
what kind of sounds I can get.  Again, any suggestions in this area would be fantastic!   Tongue


=== Attachments ===

Code, sound samples, pictures, etc are available upon request.
Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
potul
Posts: 351


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #1 on: February 26, 2011, 04:37:54 PM »

Hi

looks like a lot of fun!

It seems some of us in this forum have been putting our eyes on dsPICs, you are the 3rd one in a couple of weeks who starts playing with them.
I found dspic33 to be a perfect starting point for digital experimentation, as they have almost everything needed already in the PIC (although I wish they would have more RAM).

I saw the foldback distortion algorithm some time ago (I think in musicdsp), but didn't try it my self. How does it sound?
So far I've only experimented with modulation based effects (tremolo, flanger, chorus), and a little delay (limited by the amount of memory). I want to try next some compression algorithm, and I'm also experimenting with pitch shift.

Good luck, we will follow closely your progress.

Mat
Logged
JKowalski
Posts: 1137


Chris S.


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #2 on: February 26, 2011, 06:08:10 PM »

Hi

looks like a lot of fun!

It seems some of us in this forum have been putting our eyes on dsPICs, you are the 3rd one in a couple of weeks who starts playing with them.
I found dspic33 to be a perfect starting point for digital experimentation, as they have almost everything needed already in the PIC (although I wish they would have more RAM).

I saw the foldback distortion algorithm some time ago (I think in musicdsp), but didn't try it my self. How does it sound?
So far I've only experimented with modulation based effects (tremolo, flanger, chorus), and a little delay (limited by the amount of memory). I want to try next some compression algorithm, and I'm also experimenting with pitch shift.

Good luck, we will follow closely your progress.

Mat

Yeah, it's pretty interesting how many people suddenly took the leap to dsPICs. I've been wanting to do this for a long time and buying a Pickit3 finally let me.

It's pretty great though, nice to have a group of people making the foray at the same time, good support!



Just a note - I believe that if you are reading the busy flag on the LCD display you are going to have a 5V signal going into your port expander chip.

Logged
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #3 on: March 02, 2011, 06:36:50 PM »

Thanks for the feedback guys!  It's cool to see other people are going this route as well.  Do you guys have any suggestions for trying out the modulation based effects you mentioned?  I have yet to give those a shot.

I'll work on getting some sound samples up from the foldback distortion.  I also wanna take some pictures once I get the project onto some protoboard.  I'm just starting a big job and have a baby coming soon so I'm a little tight on time right now  icon_wink
Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
potul
Posts: 351


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #4 on: March 03, 2011, 08:51:33 AM »

Take a look at this document:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.110.4688&rep=rep1&type=pdf

It contains a good explanation of most of the modulation based effects and more. You will not be able to use the code, because it's not for dspic, but you can get the concept.
You need a couple of building blocks:

Delay line
LFO

Once you have these 2 working, you can create some of the basic modulation stuff (flanger/chorus, tremolo, etc...)

Here you have an example of Delay line, although it will require some tweaking:

http://www.dsprelated.com/showcode/58.php

And for information around using DDS to create an LFO, you can check here:
http://www.electricdruid.net/index.php?page=info.dds

Have fun,

Mat
Logged
potul
Posts: 351


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #5 on: March 03, 2011, 05:19:04 PM »

Hi,

I recorded a first crappy video demoing some of the algorithms I'm playing with. I love the sequenced tremolo

http://www.youtube.com/watch?v=Yj0t6TNvrgM

Enjoy.
Logged
jasperoosthoek
Posts: 782


Jasper O.


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #6 on: March 04, 2011, 02:08:46 AM »

Great stuff, count me in! I would be interested in a professionally fabbed PCB if you decide to design it.
Logged

[DIYStompbox user name]@hotmail.com
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #7 on: March 27, 2011, 01:06:01 PM »

Apologies for taking so long...here's some preliminary pics of the system on a breadboard (not all parts are on the breadboard right now) and the PCB.

I also purchased a drill press today, just waiting for the drill bits to come in, then I can continue.   Grin

Took the pics with my iPhone so the image quality is meh, hehe.

Thanks for the resources potul, and your effects are very cool, I'm hoping I can try out stuff like that as well!

Breadboard:


Top side:


Bottom side:
« Last Edit: March 27, 2011, 01:09:38 PM by dougman0988 » Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
potul
Posts: 351


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #8 on: March 30, 2011, 06:54:07 AM »

Nice PCB

By the way, how's the noise in the breadboard? I've been playing myself with a similar setup, and I've got a lot of noise or crosstalk or similar. i.e I get a noise whenever a LED is on.

Mat
Logged
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #9 on: April 03, 2011, 09:37:48 AM »

Thanks potul (or Mat if you prefer!)

I started this project using external ADCs and DACs...I had noise issues with the DAC output, it wouldn't stay steady.  Since I've switched to the dsPIC's peripherals I can't say I've had much trouble with noise. *knock on wood*
Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #10 on: April 15, 2011, 05:59:19 PM »

Alright!

It took me a while, but the PCB is fully assembled and everything seems to be working great.

Now the experimenting can officially begin!  Anyone have good suggestions for maybe some interesting distortions or short-delay modulation types of algorithms?  In the meantime, I'll be playing with this thing to see what kind of sounds I can create.   icon_biggrin



Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
potul
Posts: 351


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #11 on: April 16, 2011, 12:02:29 AM »

Looks great! Let the fun start!

I would start by coding a simple delay line and an LFO. With this you can get much of the modulation/delay effects. Probably the easier one is a Flanger.

Mat
Logged
Bigorno
Posts: 3


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #12 on: July 14, 2011, 02:01:42 PM »

Hello dougman0988,

I'm planning to do something similar but with the Texas Instrument Launchpad.
I'm new to the DIY realtime audio Processing and your project is a big source of motivation.

Do you want to share with me the code that read the stuff from the ADC and send it back to the DAC please?  icon_redface
First I don't want to do any guitar processing.  icon_cry

I want to understand what you did with this chip and then I will implement it on the TI msp430 chip.  icon_mrgreen

Thank you very much for your help.

Thierry
Logged
Max OLydian
Posts: 2


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #13 on: May 06, 2012, 06:55:14 PM »

Hey dougman- are you still working on this? I've been thinking about starting a project like this myself, and if you're still active, it'd be great to collaborate.
Logged
dougman0988
Posts: 34

Guitar lessons, music theory, audio projects


WWW
Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #14 on: July 30, 2012, 09:33:25 PM »

Hey dougman- are you still working on this? I've been thinking about starting a project like this myself, and if you're still active, it'd be great to collaborate.

I will admit I haven't touched the project in quite a while, beyond the point of passing audio and trying to code some *extremely* basic sounds.
Too many things going on lately...but I definitely want to get back to it and try some more effects.
Have you gotten started with something?
Logged

www.pickuptheguitar.com
Guitar lessons, music theory, audio projects
Max OLydian
Posts: 2


Re: Stepping into the digital world with a DIY guitar DSP effects system
« Reply #15 on: September 10, 2012, 07:48:33 AM »

Hi dougman, back again- I hear you about being busy, same with me.  No, I haven't actually started anything yet, was still in the parts spec stage.  How do you like the dsPIC?
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to: