After talking to Chris about my general guitar pedal ideas, I started doing some research
into how I could make a digital pedal using an arduino or ESP32. There are a lot of "kits" but
probably wont go that route. I also looked into JUCE and watched some videos on how faust is used for DSP.
I have two final sounds I am going for: synthetic feedback and a modulation between two waveshapes (a sort
of modulated distortion).
The fender runaway (pictured left) is an old synthetic feedback expression pedal. It adds feedback as you
push down the pedal. The expression overdrive
by ernie ball (pictured right) is a distortion expression pedal; however it is quite subtle and really
just used for switching between lead and rhythm tones. Basically, a combination of the two would be cool, but
instead of a subtle change in distorion, I want the signal to essentially break up in the down position
and have a ton of feedback. Instead of using it to switch between two tones,
I would be using it more like a wah pedal and to create its own sounds.
This week, I spent most of my time configuring the JUCE framework. It took me longer
than I expected to get a simple hello world program because of technical difficulties.
Because of a Windows updated, I needed to updated my SDKs and
reconfigure visual studio, but its all worked out now.
JUCE is completely open source if you publish all projects to a public repo, so I also set up
what I needed on Fork and Github.
Initially (at least), I plan on using JUCE to make a VST for my desired effect. I can then
control the position of the "pedal" with a midi controller foot pedal. If this works well,
I can then begin to think about actual hardware.
Here are some videos I watched about JUCE:
JUCE setup
Basic Plugin in JUCE
I've been learning a lot about how JUCE works and getting used to the standard libraries.
I wrote a simple program that tracks pitch using a FFT. Its just a spectrogram right now.
I also wrote a super simple oscillator program in JUCE. Now, I need to figure out how
to get the fundamental pitch in my FFT program and use it to set the frequency of the
oscillator. This is surprisingly hard so far.
Heres a video about pitch tracking JUCE. It is kind of a confusing video and there is
no published code, but they accomplish "roughly" what I want to accomplish.
FFT pitch tracking and generation
I made some noises!
Starting with my simple FFT code, I wrote a function to get the fundamental frequency,
and then I created a wavetable synthesizer to use the frequency. Right now, the application
takes audio input and plays a sinwave an octave up from the input.
Again, this was hard given how simple the program is, but it was also very rewarding.
I definitely learned a lot about JUCE.
Right now, this program is only a standalone application. It does not build to a VST, so I cannot
load it into my DAW to test it with an amp simulator yet. The next step will be making my code
work as a plugin, and then I need to add quite a few parameters: adjustable volume, harmonic offset,
etc.
Here is a video I used to learn about wavetable synthesis:
Wavetable Video
I worked on building a basic GUI for my plugin. I created vertical sliders for the
feedback's gain and the total gain out, and I decided to create a rotary slider - a circular dial -
for the offset of the feedback. This circular dial ranges from +0 to +24 where +0
is the fundamental frequency and +24 is two octaves above the fundamental.
Right now, the only slider with any functionality is the "Gain Out" slider. I spent most of
my time learning how to make a GUI in JUCE and setting up the plugin for the FFT and synth
code. Hopefully, next week I will have a working version of the plugin.
Here is picture of the GUI so far:
The plugin works... somewhat?
I changed the GUI so that it works with automation in a DAW, and I added a slider for
"Tolerance." This parameter controls how much amplitude is needed to cause feedback.
If Tolerance is 0, then the plugin will try to make every small noise into feedback, and
this is quite annoying.
If tolerance is turned up, then it will only create feedback for louder sounds.
I also added a windowing function to the FFT to try to elimate some noise.
Sooooo, I got the plugin to work, but there is one BIG issue. I need to figure out
how to add the sinewave to the audio buffer in JUCE without deleting the original sound.
Right now, I hacked it by sending the sinewave to the left channel and keeping the incoming audio in the
right channel. So I need to learn more about the audio buffer object in JUCE and fix
this.
I also need to smooth out the transition between notes, eliminate popping, and possibly
modify my algorithm so the feedback has infinite sustain. Regardless, here is a demo
of the current plugin.
I fixed the feedback gain and gain parameters. I eliminated the popping and
clicking by implementing smoother transitions between gain values. I also
smoothed out the frequency changes. This adds a subtle portamento and makes
the plugin sound a little less robotic.
Now, my fundamental frequency algorithm is the main issue. Right now, it simply
finds the max amplitude bin of the FFT. This often is the 2nd harmonic and not
the 1st. To fix this I have a few options: I can implement a different
algorithm on my own, I can use the open source "aubio" library to
implement the very good and reliable YINFFT pitch detection algorithm,
or I can stay with my current approach and hardcode a check to make sure it
does not use the 2nd harmonic. Here is a CCRMA paper explaining some different
pitch detection algorithms:
Pitch Article
Heres a demo of the plugin so far:
demo 2
I experimented with various changes to the pitch detection algorithm,
but I was not too impressed with the results. This might be something I
change in the future. However, for now, with the expression pedal
acting as envelope, the pitch errors are not too bad.
I played around with the MIDI pedal I am borrowing from CCRMA, and
based on some trial and error, I made some small changes.
First, I made the overall feedback amplitude lower.
I also changed the parameter for feedback gain so that it changes with smaller
increments. These two changes give the VST more range in the types of sounds
it can generate. The feedback can now range from very subtle and silent to
quite loud and jaring.
I also added a detune parameter. This is a value that is added to the offset.
It ranges from -50.0 to 50 hertz. This serves two purposes.
First, I have found that a slightly detuned feedback can sound more natural.
Secondly, I can use this parameter in Ableton with an LFO to modulate
the freuqncy of the feedback. I think this sounds pretty good. Here is an
image of the GUI and a short demo recording.