Put a few examples into a basic pedal for my needs.
For now, it’s just reverb, delay, gain, and pitch shifting. Definitely needs some work, but you can make some pretty neat sounds with this combination of effects.
Let me know if you find it useful or want to improve it.
P.S. this is my first time using C++. Don’t judge my code too much.
This is great - thank you so much!
Np, I’m still learning about DSP programming so there are definitely clipping issues in this version (esp. with feedback delay on). I’ll be updating it over time and posting here when major changes go into the repo.
Just pushed a new version of the “basic” pedal.
Here’re the changes:
- Added distortion controls (both tanh and arctan are available. Switch between via a toggle switch to hear the differences)
- Simplified dry/wet crossfade for reverb
- Added dry/wet crossfade for pitch shifting
- Removed delay (will add back later)
Plans for the next version:
- Add compression controls
- Add better delay
Thank you again. This is really helping me understand how to get started with programming the petal. Keep it coming!
By the way - I am finding there’s a lot of latency. Are you, or is that something particular to my setup? Am testing Guitar->Petal->Amp so nothing else in the chain. Even with all effects off I’m getting lag between plucking a string and hearing it through the amp.
@jon The pitch shift effect definitely introduces latency over time. It’s not perfect, so I normally turn Knob 2 all the way down to bypass pitch shifting.
(I really only use shifting when I’m recording into Ableton for an effect)
The other effects don’t introduce much latency at all for me, though reverb kind of does by design.
Ah - thought I had everything switched off, but maybe the pitch shift was engaged. Will test later and report back. And, yes, this was definitely latency not reverb!
Thanks again - really cool.
Totally, there’s definitely room for optimization if you’d like to try your hand at that. I think before I move on to more effects, I’ll spend some time cleaning up the code and trying to reduce the latency you’re experiencing.
Need to figure out a good way to profile the daisy’s performance…
Will take a look and see what I can do. Learning cpp at the same time - was a Perl programmer a while back, but they never adopted embedded Perl for a reason So steep curve, but am enjoying the climb.
Thanks so much for sharing this! I too am experiencing the latency issue, which is a bummer, because I’m really focused on developing an effect that centers around pitch shifting. About to try your new version… excited about the pitch shift dry/wet control!
Thanks for this example, @quentopp! I found it very helpful, but I was disappointed to run into the pitch-shifter latency issue that others on this thread have also experienced. I tried carving your example down to the minimal possible pitch-shifter, but the problem persisted. I opened a thread hoping to find a resolution for that here: Latency of Pitch Shifter on Petal
Glad you got something out of my explorations.
Yeah, I generally crossfade at less than 50% so I can hear the dry signal with no latency because the latency makes it hard to play. Unfortunately I don’t have time to dig into the latency issue within the pitch shift library itself. It seems that the delay gets worse over time and is least extreme when the petal has just been reset. Definitely a bummer
For what it’s worth, I’ve found that you can change the latency in the pitch shifter by editing the SHIFT_BUFFER_SIZE in pitchshifter.h. I am sure there is a proper way to extend this file so you can set that value in your code rather than monkeying with the header, but for now I just edited the header. I, too, am new to C++, so I have not yet taken the time to figure out how to extend that. Anyhow, it definitely helps with latency. I have mine set to 8192 (default is 16384) and it is much less perceptible. You could take it down to 4800 or 1024, but you will notice more artifacts in the shifted signal.