-1

I'm working on a guitar effects "pedal" using the NEXSYS A7 Board. For this purpose, I've purchased the I2S2 PMOD and successfully got it up and running using the example code provided by Digilent.

Currently, the design is a "pass-through", meaning that audio comes into the FPGA and immediately out.

I'm wondering what would be the correct way to store the data, make some DSP on this data to create the effects, and then transmit the modified data back to the I2S2 PMOD. Maybe it's unnecessary to store the data? maybe I can pass it through an RTL block that's responsible for applying the effect and then simply transmit the modified data out?

  • For a live performance pedal you don't want to store much data; usually 10s of ms or less. Start with something simple : store 50 or 100ms of data in a ring (read old data, store new data, inc address modulo memory size). Output = Newdata =( incoming sample * 0.n + olddata * (1 - 0.n)) for variable n. Very crude reverb or echo.... –  Jan 30 '22 at 20:53
  • Thanks for the tip! I assume by "ring" you mean a ring buffer FIFO? btw if I'm interested in a distortion effect, can it be accomplished by simply multiplying the incoming data by a constant? Thanks! – Daniel Korbin Jan 31 '22 at 12:53
  • 1
    This question (and it's answer) does not appear to be [on-topic](https://stackoverflow.com/help/on-topic) here. – user16145658 Jan 31 '22 at 14:52
  • I’m voting to close this question because it is off-topic. This is question about digital signal processing, not about VHDL programming. – Renaud Pacalet Feb 02 '22 at 08:21
  • @RenaudPacalet I get what you mean, but even though it is DSP related, I'm asking what to do in terms of VHDL since the whole project is on an FPGA. – Daniel Korbin Feb 02 '22 at 17:09
  • @DanielKorbin Fine, so please show your VHDL code and explain what's wrong with it. We will then, maybe, be able to help you fixing it. You could also take a look at the [help center](https://stackoverflow.com/help) and especially at the [asking section](https://stackoverflow.com/help/asking). – Renaud Pacalet Feb 02 '22 at 17:28
  • @RenaudPacalet There's nothing wrong with the code right now, I'm just trying to figure out how to use it differently. More specifically, I want to modify the incoming data before transmitting it back. [TOP VHDL Block](https://pastebin.com/pS0ZU1kP) [I2S Transceiver](https://pastebin.com/TiPf5w3A) – Daniel Korbin Feb 02 '22 at 19:53
  • @DanielKorbin I think you should definitely read the [asking section of the help center](https://stackoverflow.com/help/asking). Please no external links, no pictures, just plain questions with all required elements. What is your VHDL coding problem, exactly? – Renaud Pacalet Feb 02 '22 at 20:16

1 Answers1

0

Collated from comments and extended.

For a live performance pedal you don't want to store much data; usually 10s of ms or less. Start with something simple : store 50 or 100ms of data in a ring (read old data, store new data, inc address modulo memory size). Output = Newdata = ( incoming sample * 0.n + olddata * (1 - 0.n)) for variable n. Very crude reverb or echo.

Yes, ring = ring buffer FIFO. And you'll see my description is a very crude implementation of a ring buffer FIFO.

Now extend it to separate read and write pointers. Now read and write at different, harmonically related rates ... you have a pitch changer. With glitches when the pointers cross.

Think of ways to hide the glitches, and soon you'll be able to make the crappy noises Autotune adds to most all modern music from that bloody Cher song onwards. (This takes serious DSP : something called interpolating filters is probably the simplest way. Live with the glitches for now)

btw if I'm interested in a distortion effect, can it be accomplished by simply multiplying the incoming data by a constant?

  • Multiplying by a constant is ... gain.

  • Multiplying a signal by itself is squaring it ... aka second harmonic distortion or 2HD (which produces components on the octave of each tone in the input).

  • Multiplying a signal by the 2HD is cubing it ... aka 3HD, producing components a perfect fifth above the octave.

  • Multiplying the 2HD by the 2HD is the fourth power ... aka 4HD, producing components 2 octaves higher, or a perfect fourth above that fifth.

  • Multiply the 4HD by the signal to produce 5HD ... and so on to probably the 7th. Also note that these components will decrease dramatically in level; you probably want to add gain beyond 2HD, multiply by 4 (= shift left 2 bits) as a starting point, and increase or decrease as desired.

  • Now multiply each of these by a variable gain and mix them (mixing is simple addition) to add as many distortion components you want as loud as you want ... don't forget to add in the original signal!

There are other approaches to adding distortion. Try simply saturating all signals above 0.25 to 0.25, and all signals below -0.25 to -0.25, aka clipping. Sounds nasty but mix a bit of this into the above, for a buzz.

Learn how to make white noise (pseudo-random number, usually from a LFSR).

Multiply this by the input signal, and mix or match with the above, for some fuzz.

Learn digital filtering (low pass, high pass, band pass for EQ), and how to control filters with noise or the input signal, the world of sound is open to you.