Real diodes are not quite as sharp, because there's an exponential region between forward voltages of 0V and the forward voltage of the junction (~0.7V for P-N diodes, ~0.3 for Schottky).
And vaccum tubes are softer still, with a considerable rolloff region.
This is true. The important feature of germanium diodes, wrt this application, isn't their lower forward voltage as Schottky diodes are even better at that , but rather their characteristic V/I curve which is softer than silicon (0) and produces less odd harmonics which would otherwise contribute to a harsher sound.
Regarding germanium transistors, they're mostly used to replicate old school fuzz guitar pedals. In that application, aside the above characteristic, the particular configuration in which they're employed contributes to the sound: old fuzz pedal produce a very pleasant asymmetric distortion in which one half wave is much less distorted than the other, so that the output can contain a blend of clean and distorted sound. R.G. Keen at Geofex (.com) wrote a thoroughly informative article about how that circuit works which anyone interested in building guitar pedals will find very informative (1).
(0) https://commons.wikimedia.org/wiki/File:V-a_characteristic_d...
(1) http://www.geofex.com/article_folders/fuzzface/fffram.htm
The way around it is to make sure the upper harmonics generated by distortion beyond the limit is below the audible threshold, either by making the period larger (over sampling) or modifying the distortion process. It's not lossless and a difficult design problem when factoring in computational limits. It's often cheaper to use discrete analog components with all their flaws than a good-enough processing chain and computer that can evaluate it.
Even offline whitebox modeling tools like SPICE, and realtime black box tools like Volterra series models are limited by this.
Aliasing causes higher harmonics to reflect at the Nyquist sampling rate and be heard as a signal with lower frequency. e.g. a 25khz signal with a sampling rate of 24khz will end up sounding like a 23khz signal instead. A 26khz signal will sound like a 22khz signal. And so forth. Because there are exponentially more harmonics as frequency increases, aliased harmonics can end up reflecting a startling amount of energy into audio frequency ranges, even if the amplitude of each harmonic is much lower than the amplitude of the fundamental harmonic.
Because the harmonics are reflected, they no longer form a harmonic series, so they end up adding a metallic sound to the overall output signal. The sound of inharmonic aliased signals alone is not unlike the sound of striking a metal dinner plate with a spoon, or a copper pipe with a wrench. Not a pleasant sound.
We have very inexact vocabularies for describing sound. But clipped signals with heavy aliasing are usually described in terms like the following: "harsh", "metallic", "cold", "fizzy".
In fairness, this is a toy example. One would hope that in a mature ecosystem, those few who are capable of doing the very significant heavy math lifting required to implement better clipping will contribute components that can be shared and reused by everyone.
Hopefully, we'll see someone get some code out there that helps clean this up!
My hope with this site and series is to get people like me exposed to the possibilities a little bit of code and a Teensy can unlock for them. The lower the barrier of entry, the more cool things people can create. :)
That being said, I'd love to get feedback on good sources to learn more about signal processing/theory or any resources folks would suggest for covering the topic even better!
It did a great job! It has a lot of processing power and since it's bare-metal, latency and variance concerns are easily avoided.
I was disappointed that there didn't seem to be a good ecosystem of SPDIF/Toslink-based audio I/O for the Teensy, at least at that point. I had to make the Toslink hardware myself.
Toslink is an awesome connector for this type of thing, and I think it would be great if people started using it for Eurorack-style audio processing modules instead of analog signals.
You can get stereo pretty easily this way, and if someone could write up some ADAT lightpipe code, you could even get 8-channel polyphony!
Glad to see some posts about using Teensy for this purpose.
For most users of these chips, "making the X hardware yourself" is the expected outcome, the fact that there's a convenient compute module that has USB power, the processor, a debug interface, a USB connector, and an open-source toolchain to quickly reach the "blink LED" stage is just a small leg up on the normal way of doing things.
I think it's so cool that there's a whole culture of people building little mixers, synths, and guitar pedals and so on in their garage. That's kind of tangential to the high school kids learning to code on Arduinos. And that's kind of tangential to those of us using these development boards professionally, either for prototyping or for low-volume custom stuff.
Side note: You might be interested in the TMDX5535EZDSP DSP eval board (still active, now over 10 years old, but it was a great platform for me to learn the fundamentals of DSP) or the newer TMDSOSKL137 eval board (more appropriate for building a giant mixer), they integrate a lot more audio processing power and have FFT accelerators/SOC audio interfaces that are better than even the Teensy 4.0/4.1.
https://jatinchowdhury18.medium.com/practical-considerations...
Admittedly, I'm early into moving from analog circuits to digital signal processing, so I could be off the mark on my answer. :) Hope it helps, though.
When you clip in discrete time, the spectra is finite (more technically, it's periodic with a period of the sample rate frequency). That means the energy that would go into harmonics past nyquist gets "wrapped" around.
This is the big difference between analog and digital distortion. In analog, it's really quite difficult to create energy at non-harmonic frequencies of the signal. In digital clippers like you have here, it's trivial, and the design problem is figuring out how to deal with it. Most products will use some kind of anti-aliasing strategy (usually oversampling before clipping) to handle it.
I don't see you doing anything in particular to bandlimit your waveshaping, but I might well have missed it.
Nobody using clipping as an effect in their music cares if a fuzz/distortion/overdrive effect is less than pristine from an audiophile standpoint.
Audiophiles would throw up if they realized exactly what's going on in a guitar rig.
Audiophiles also drop a lot of money on gear that intentionally distorts the signal. Aliasing is one reason why they buy tube amplifiers instead of tube modelers in their receivers, although I don't doubt the latter exists.