I have recently added two new programs to the repository, a Delay and a Phaser, both based on examples following the excellent tutorial by Martin Nawrath on Arduino Realtime Audio Processing.
The Delay uses a buffer (an array) from which, every step of the process, it retrieves a sample. It then scales it down, adds it to a fresh sample, and finally stores the result, cyclically, in the same buffer. If the incoming signal stops, instead of fresh samples we hear the old samples still in the buffer progressively decaying, as they get more and more scaled down with each cycle; the size of the buffer determines the length of the delay (that is, unless we decide not to scale them down, in which case they pile up in a feedback loop). I thought on calling the effect a reverb, but I think of a reverb as a something much more complex -a collection of many of these individual elements-, so I went with Delay instead.
The Phaser also retrieves a sample from the buffer and adds it to a fresh sample, but it takes it from a place in the array “behind” the place where new samples are being stored, and it doesn’t scale it. The distance between storing and retrieving is the difference in phase between samples, and changing that distance in time produces the characteristic sweep of the effect.
In both effects, the buffers I use store 256 samples; unfortunately, 512 are too much for the ATtiny. Samples are processed at 7.8Khz, so 256 is a very short buffer size, indeed. That’s all there is, though, so to make up for it I added an artificial delay to the loop execution, for a total of three parameters: feedback, buffer size, and loop delay:
- Feedback controls how much we scale the stored signal: more feedback means less scaling, up to a point where the stored signal doesn’t decay and enters a feedback loop. With this parameter all the way up, you will get a feedback loop even if nothing is connected to the miniMO (any input, even almost nothing, eventually adds up to the maximum)
- Buffer size controls the delay time; it is very, very short, but you can get very interesting effects in combination with the loop delay
- The loop delay does make the audio delay longer because it reads the buffer more slowly, but it also changes the pitch and ultimately the character of the processed sound
As for the Phaser, it also offers three parameters:
- Phase controls how far back we read from the stored signal. Progressive changes in this parameter make the classic Phaser sound
- Phased Buffer Size controls how much of the original buffer we use, so we end up adding a phased, shorter, version of the wave to itself
- Loop delay again makes the main processing loop take longer. It also changes the character of the sound, and at its highest levels it adds a very short delay to it, too
Buffer size and Loop delay are both experimental parameters -literally, parameters for you to experiment beyond the scope of the original effect.
Finally, The Phaser has an extra feature, the ability to toggle between normal and high sensitivity. Usually (in my setups), I measure incoming signals against a reference set by the voltage the miniMO is operating at (Vcc), and that usually works fine. I noticed, though, that with external signals not from miniMOs (say, a rhythm playing from my phone), the output was quieter than that of the the Delay, so I added the ability to change to a fixed 1.1v reference on the fly. The thing is, the new reference would also apply to the potentiometer readings, making them reach the maximum value at a third of its movement range. I solved this problem by switching the reference back to Vcc before starting a potentiometer measurement, and altered the “sampling loop” to give the new reference voltage extra time to settle before measuring.