Author Topic: looking for a basic DSP circuit  (Read 2034 times)

0 Members and 1 Guest are viewing this topic.

aran.e666

looking for a basic DSP circuit
« on: May 31, 2017, 09:03:25 AM »
after my latest attempt at cloning an xp-100 failed, ive decided to keep things simple. what i am looking for is a schematic for a digital effects board. preferably i would like the actual DSP to have RAM expansion as i will add more effects later. could someone send me in the right direction regarding schematics or a DSP that will work fairly good? i'm not looking for anything thats got super low latency or perfect modelling but something that will sound decent.

on a side note and slightly more complex, how would i go about adding a display to said effects unit to tell the user that the effect's algorithm has changed? to keep it simple i will use two 7 segment displays. i assume that i would need a display driver (mircocontroller and an octal flip flop?), buttons to switch both the algorithm and what is displayed on the screen and of course an algorithm to change what the display shows (unless the driver already has this feature built in)

thanks
~A

Digital Larry

Re: looking for a basic DSP circuit
« Reply #1 on: May 31, 2017, 10:32:11 AM »
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

aran.e666

Re: looking for a basic DSP circuit
« Reply #2 on: May 31, 2017, 10:55:29 AM »
that looks really cool, i already have my teensy in use but i'm sure i can try it. only setback is that it's out of stock...

potul

Re: looking for a basic DSP circuit
« Reply #3 on: June 01, 2017, 08:12:09 AM »
I think you can geit it from the PJRC site directly

https://www.pjrc.com/store/teensy3_audio.html


aran.e666

Re: looking for a basic DSP circuit
« Reply #4 on: June 01, 2017, 12:31:29 PM »
I will take a look and see if they have it.

On a side note, i feel that if i buy a premade board  i might be limited. What i really want to be able to do is add a potentiometer to a PIC and use small increments to either shift the pitch or change volume depending on what patch i will use. Also im not sure how to change patches/effects with a rotary encoder or buttons but i think i will have to use another PIC. My problem is that im not that competent in C thus im not sure how i can get this stuff to interact. I feel bad for asking someone to do it so i guess someone could maybe explain how to do what i am asking from a software standpoint?

Thanks
~A

Digital Larry

Re: looking for a basic DSP circuit
« Reply #5 on: June 01, 2017, 01:49:09 PM »
One thing to remember is that Teensy hardware is open source, even the audio board, so you could conceivably develop something to your own needs.  Regarding knowing C or not, I think you could find a lot of pre-existing code for i2c interface, but you will still need to learn something in order to bring it all together.
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

aran.e666

Re: looking for a basic DSP circuit
« Reply #6 on: June 01, 2017, 02:30:50 PM »
yeah i think i will go down the Teensy route but as i said, i am currently using it in a project (a keyboard) so i cannot use it. i'l probably order a new one.

just to clear something up, lets say i add a potentiometer for an expression pedal (using a PIC) would i set the increment value to the PIC, set its action in each program in the ROM (so volume or pitch) and then put code in the DSP instructions telling it what GPI i am using? i did find a DSP that would be a good DIY solution but i'm not sure if you can add external ROM and i'm not sure about how it interfaces with other parts. i think i'l use i2c as you said and try when i get the parts. i would supply a schematic but i don't want to go completely off topic as this is about DSPs and not adding expression pedals unless you actually need one. :P

ElectricDruid

Re: looking for a basic DSP circuit
« Reply #7 on: June 01, 2017, 06:37:11 PM »
Doesn't the Teensy itself have ADC inputs you could use for adding a pot or an expression pedal input?

Adding a PIC to do that seems like making things unnecessarily complicated, and these things are generally complicated enough as it is!  ;)

Dealing with rotary encoders isn't too bad, but you need two pins (rather than one for a pot) and if you're doing it properly, you need to do software debouncing on the encoder contacts. None of it is hard, but it's all fiddly the first time you do it. That said, you might well find code for the Teensy that implements that for you.

HTH,
Tom

aran.e666

Re: looking for a basic DSP circuit
« Reply #8 on: June 02, 2017, 03:27:48 PM »
yeah i will certainly look for some code to hook up an encoder and what not.

when i said 'i will add another PIC' i meant if i was to actually build the unit with a dsPIC33FJ64GP802 and port expander. obviously the DSP can't process the audio, a pot and a rotary encoder alone so i was considering adding another PIC and writing some basic code so that i could drive the pot with x amount of increments whilst running some debounce code for the rotary encoder. that is, of course, if i decide not to go with the Teensy/DSP board combo.

ElectricDruid

Re: looking for a basic DSP circuit
« Reply #9 on: June 03, 2017, 09:29:42 AM »
If you do decide to go with the dsPIC 33FJ64GP802, my DigiDelay pedal would be a possible hardware platform. Since it's a digital pedal, you've got the dsPIC, 256KB of external RAM, and 5 pots connected for controls.

http://electricdruid.net/diy-digital-delay/

You won't find much boilerplate code for the dsPIC though, and it doesn't have the power of the Teensy, so I don't think I recommend it. Plus the DAC on the dsPIC '802 is noisy. I was disappointed, although I did the best with it I could.

Tom

aran.e666

Re: looking for a basic DSP circuit
« Reply #10 on: June 03, 2017, 12:45:11 PM »
thanks for the link, i will read up on it as i am sure it will help me with this project. i also heard it's not really perfect but it's a start. then again, as you said, the Teensy does have more processing power so i will probably see if i can do more with a Teensy.

just another general question, how many different effect patches do you think i can get onto the Teensy/dsPIC? I suppose i can add some EPROM but i don't know how to add it and switch between effects yet. my main worry with using the dsPIC is that i will be limited on GPIOs and space for the code as i will add multiplexed LED displays and a rotary encoder as i previously discussed. i feel like a port expander would do the trick but i still would be limited on processing speeds etc.

ElectricDruid

Re: looking for a basic DSP circuit
« Reply #11 on: June 04, 2017, 07:46:43 AM »
You can probably get far more patches than you'll need. I mean, a patch is what? 8 parameters tops? so just 256 bytes of EEPROM would give you 32 patches. If you had 1K of EEPROM, you'd have plenty of storage, I'd have thought.

Tom

aran.e666

Re: looking for a basic DSP circuit
« Reply #12 on: June 04, 2017, 09:28:18 AM »
yeah that makes sense, i think i'l be fine just for a couple patches since i'm not going too crazy. personally i like to stick to analogue effects but some stuff has to be done digitally. there really isn't too much that interests me other than stuff like pitch modulation so i definitely thing i'l be okay.

i appreciate all the help guys, its been very helpful :D

Digital Larry

Re: looking for a basic DSP circuit
« Reply #13 on: June 04, 2017, 01:35:35 PM »
Well, you're going to need algorithms in addition to patches which might be considered as settings of those algorithms.  Until you know what you're going for and actually compile some of those things, I'd say it will be hard to predict how much space will be needed.
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

aran.e666

Re: looking for a basic DSP circuit
« Reply #14 on: June 04, 2017, 06:31:26 PM »
yeah i know. considering most of the external stuff such as all the pots and the display will be controlled by the DSP i think i will lack space. do you think it's worth using another PIC to control the the patch changes and pots? if i do that then i'l have to figure out an algorithm to get the DSP and PIC working together. plus i still haven't figured out how to change the patches so it will just make it more complicated  :icon_eek:  :icon_biggrin:

Digital Larry

Re: looking for a basic DSP circuit
« Reply #15 on: June 04, 2017, 08:46:12 PM »
Unfortunately I don't have any experience with PICs or Teensy so can't tell you.
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

aran.e666

Re: looking for a basic DSP circuit
« Reply #16 on: June 04, 2017, 09:04:18 PM »
don't worry, i'm sure i will figure it out. i think my schematic will work fine but i still have to figure out ways around some constraints such as memory as we discussed. the dsPIC i want to use had a flash of 64kb so it will suffice for now. when i actually figure out how to digitally switch patches then i will add some EEPROM, figure out how to get the EEPROM and internal flash memory to work together and work from there.

ElectricDruid

Re: looking for a basic DSP circuit
« Reply #17 on: July 17, 2017, 05:56:43 PM »
Well, you're going to need algorithms in addition to patches which might be considered as settings of those algorithms.  Until you know what you're going for and actually compile some of those things, I'd say it will be hard to predict how much space will be needed.

I agree about the "Until you know what you're going for" part, but there are two different things going on here. One is algorithms and program code, which all goes in flash memory. The other is patches (settings for those algorithms) which would typically go into EEPROM. Many chips have both, but usually a lot of flash and not much EEPROM, and that balance is typically what's required.
Obviously having enough space is a concern, but until you're hard up against the limit, you don't really need to be worrying about it. 64K is a lot of program and data tables (flash) and 256bytes is a lot of patches (EEPROM).

Once you *are* hard up against the limit, you start pruning, or get clever with your tables, or something. There's always a way.

HTH,
Tom

Edit: Anyway, the dsPIC 33FJ64GP802 has a bigger brother, the dsPIC 33FJ128GP802 with 128KB flash, so you can always move to the larger chip.
« Last Edit: July 17, 2017, 06:05:41 PM by ElectricDruid »

Transmogrifox

Re: looking for a basic DSP circuit
« Reply #18 on: July 25, 2017, 03:40:27 PM »
FYI -- I just bought a teensy 3.2.

Comparing the specs of the audio codec in the teensy audio board and the ADC in the Teensy 3.2 I don't see that the audio board adds anything of value.  Both are in the same range of ENOB and SNR.

The DAC on the Teensy is 12-bit...but that isn't the end of the story.  Add an 8-bit PWM to the 12-bit DAC output through a resistor divider and now you have a 20-bit DAC.  You send the 12 MSB to the DAC and 8 LSB to the PWM output and I am willing to guess you can get better DAC performance than the CODEC on the audio board.

I haven't got that far yet...probably a month or 2 out before I start messing with this, but for mono audio I would consider the Teensy to be a 1-stop shop.

The other advantage is it's conceivable that you can keep up with sample-by-sample processing on the built-in ADC and DAC for a total of 1 or 2 sample latency through the system.  A little more aggressive analog filtering is the main thing needed to for the built-in solution.

Either way I think for the frequency range typical for guitar I would go as far as saying you can get BETTER audio quality from the built-in ADC and DAC than you can from the audio board.  The audio board CODEC specs were not looking like a very substantial improvement when I reviewed it.

The audio board adds a lot of value if you're doing stereo or more channels...but it also adds latency.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

ElectricDruid

Re: looking for a basic DSP circuit
« Reply #19 on: August 05, 2017, 06:20:31 AM »
The DAC on the Teensy is 12-bit...but that isn't the end of the story.  Add an 8-bit PWM to the 12-bit DAC output through a resistor divider and now you have a 20-bit DAC.  You send the 12 MSB to the DAC and 8 LSB to the PWM output and I am willing to guess you can get better DAC performance than the CODEC on the audio board.

I'd be surprised if that were the case, specs notwithstanding. A PWM output is the lowest-fi of audio output solutions. Getting it and the DAC matched up well enough to say that you've really got 20 bits would be a very big ask.
What's the linearity on the 12-bit DAC, for example? It could well be a couple of bits out.

Quote
The other advantage is it's conceivable that you can keep up with sample-by-sample processing on the built-in ADC and DAC for a total of 1 or 2 sample latency through the system.  A little more aggressive analog filtering is the main thing needed to for the built-in solution.

I wouldn't sweat the latency. Assume you sample at 48KHz and process a block of 16 samples each time. This is a good idea since block processing is much more efficient than doing one single sample everytime. How bad's the latency? 16/48000 = 33usecs, a 1/3rd of a millisecond. That's so far below perceptible you'll never know.

Quote
Either way I think for the frequency range typical for guitar I would go as far as saying you can get BETTER audio quality from the built-in ADC and DAC than you can from the audio board.  The audio board CODEC specs were not looking like a very substantial improvement when I reviewed it.

Again, I'd be very surprised if this is true in practice. My recent experience has been that external codec beats on-chip devices every time. Putting sensitive ADC and DAC on the same chip as a noisy uP is asking for trouble and asking for digital noise to creep into your input/output signals. Getting ADC/DAC off onto a separate chip with its own power supply with its own decoupling usually helps a lot.

Quote
The audio board adds a lot of value if you're doing stereo or more channels...but it also adds latency.

Try it. I think once you've done some experiments you might rethink whether the audio board is worthwhile.

Tom