SKTremolo – An Open-Source VST3 Tremolo

While contemplating a series of articles on digital audio oscillator types and implementations, I asked myself, “What audio effect would provide the simplest demonstration of these things while also being fun and interesting?” The first thing that came to mind was the humble tremolo. This is the stuttery, pulsing effect you hear on the rhythm guitars in such songs as “Crimson and Clover” by Tommy James and the Shondells and “How Soon Is Now” by The Smiths. It uses oscillators to modulate gain and is something most folks can sink their teeth info without getting bogged down in DSP and complicated math. Having just listened to both of these songs recently, I was pretty motivated to implement the effect. So I decided to hunker down and put one together.

To make things more fun for me, I decided to implement the tremolo effect as a VST3 plug-in so the musically-inclined technorati can drop it in their favorite DAW or VST3-compatible live performance software. I call it SKTremelo (an inspired name, for sure). Did I mention it’s open-source (MIT-licensed)? From the code, you can see not only how three basic oscillators, sine, square, and triangle are implemented (more on these in future articles), but also how they fit into a real-world digital audio application.

The plug-in itself was implemented using the JUCE 8 framework. I deliberately chose to keep the implementation simple. JUCE experts will undoubtedly berate me for not using things like AudioProcessorValueTreeState or the built in Oscillator helper class. But I wanted this implementation to be digestible to someone new to JUCE. There’s not a lot of magic going on here. I may end up doing a series of articles or videos on this as well as I realize there’s a shortage of beginner-friendly JUCE tutorials.

Downloading SKTremolo
If you’re interested in downloading the source code, you can find it on my GitHub.

https://github.com/shanekirk/sktremolo_vst

A pre-built 64-bit VST3 binary for Windows can be downloaded from GitHub as well.
https://github.com/shanekirk/sktremolo_vst/releases/tag/SKTremolo_1.1

If you’re on a different platform or need a different plug-in type, JUCE makes it easy to rebuild the plug-in yourself targeting different plug-in formats. I’ll leave that as an exercise for you, my dear reader.

Building SKTremolo
To build the plug-in, download JUCE 8 if you don’t have it already and extract it to an appropriate location on your computer. Open the SKTremolo.jucer file in Projucer and click the “Save and Open in IDE” button. Once in your IDE of choice (Visual Studio 2022 for me), you can build a new binary.

Installing SKTremelo
Installing SKTremelo is as simple as copying the binary (SKTremolo.vst3) to your system VST3 folder. On Windows, this is commonly “C:\Program Files\Common Files\VST3”. If you’re building for OSX, this is usually “~/Library/Audio/Plug-Ins”.

Once the plug-in is in the right location, your DAW software should be able to find it. Some DAWs scan for plug-ins on startup. Some require you to manually rescan. I’ll leave it to you to figure it out.

Conclusion
So that’s it really. I just wanted to let folks know the plug-in and source code are available. If anyone has questions or suggestions, please leave a comment below. And if this is your kind of thing, keep your eyes peeled. There will definitely be some related material on the way in the near future.

Decibels and dB SPL

(Note: This is a slightly modified excerpt of Chapter 1 from a book I’ve been working on entitled “Digital Audio for C++ Programmers.”)

The decibel is perhaps one of the most confusing and misunderstood topics in audio. It has a confusing formula that appears to change based on the context. It’s also used in a variety of applications beyond audio. In fact, much of the documentation you’ll find is actually related electronics and telecommunications. And to muddy things even more, by itself the plain ole decibel doesn’t even really convey much meaning. It merely relates one power value to another. So, if after reading this article, you still find decibels confusing, don’t fret. You’re in good company.

The decibel originated with telephony in the early 1900’s. It was used as a way to describe the power efficiency of phone and telegraph transmission systems. It was formally defined as 1/10th of something called a bel. Interestingly, the bel was rarely used. The decibel got all the glory. The decibel has since found its way into all sorts of other domains, such as optics, electronics, digital imaging, and, most importantly to me, audio.

There are two benefits to using the decibel. The first is that switching to a logarithmic scale converts an awkward range of values (e.g., 0.0002 Pascals – 20 Pascals) to something much easier to reason about (e.g., 0 dB SPL – 120 dB SPL) . The other benefit applies to audio – a logarithmic scale is much closer to how the human ear actually hears. With a linear scale, like Pascals, doubling the value doesn’t usually feel like a doubling of loudness. With decibels, we actually get a scale that’s much closer to how to perceive loudness.

The decibel, in the generic sense, is not strictly a physical unit. When we think of physical units, we typically think about things like Amperes (number of moving electrons over time), Pascals (pressure), meters (distance), Celsius (temperature), etc. These are absolute units that correspond to physical things. The decibel isn’t like that. It’s a relative unit. It provides a relation of two things, which are themselves physical units. And it does this on a logarithmic scale.

The general formula for the decibel is as follows.

The decibel, abbreviated dB, is the logarithmic ratio between two power values. One of these two values is a reference value. The other is a measured value.

You may notice the phrase “power value” in that formula. In physics, this means the amount of energy transferred over time. The unit for power is usually the watt. However, there are plenty of units used that aren’t power values (such as Pascals in acoustic audio). So we have to convert those units into something related to power. This typically just means squaring the measured and reference values. The decibel formula ends up looking like so.

With logarithms, we can pull that exponent out and turn it into a multiplication.

This can be simplified even further like so.

And this is the formula you’ll most likely encounter when applying the decibel to measured and reference units which aren’t power-based (like Pascals in acoustic audio). It’s just a derivation of the original formula with the measured and reference values tweaked.

Standard Reference Values

A lot of domains, such as electronics and audio, have standardized reference values for the various things being measured. When we talk about these standardized flavors of the decibel, we add suffixes to the dB abbreviation. Examples of this are dBV (voltage based), dBm (radio power), dBZ (radar power), etc. The one we’re most concerned with in the field of acoustic audio is dB SPL.

dB SPL

dB SPL is the most common flavor of decibel for indicating the loudness of acoustic audio. SPL stands for sound pressure level. The reference value used in calculating dB SPL is the threshold of human hearing – 0.000020 Pa. We plug this into the decibel formula along with a measured value, also in Pascals, to come up with a dB SPL value.

A measurement of 0 dB SPL is considered the threshold of human hearing. That is, it’s the quietest sound that the human ear is capable of hearing. On the upper end of the scale, somewhere between 130 dB SPL and 140 dB SPL, is what’s referred to as the threshold of pain. When the volume of sound approaches this level, it can result in physical discomfort and some amount of hearing loss is almost certain.

The following two tables shows some common sounds and their approximate sound pressure measurements. The first table shows measurements in Pascals. The second table shows them in dB SPL. Compare them and you’ll see that dB SPL is much less awkward to use.

Sound SourceDistance from EarPascals
Jet Engine1 meter632
Threshold of PainAt ear20 – 200
Yelling Human Voice1 inch110
Instantaneous Hearing Loss Can OccurAt ear20
Jet Engine100 meters6.32 – 200
Chainsaw1 meter6.32
Traffic on a Busy Road10 meters0.2 – 0.63
Hearing Loss from Prolonged ExposureAt ear0.36
Typical Passenger Car10 meters0.02 – 0.2
Television (typical volume)1 meter0.02
Normal Conversation1 meter0.002 – 0.02
Calm RoomAmbient0.0002 – 0.0006
Leaf rustlingAmbient0.00006
Threshold of HearingAt ear0.00002
Sound Pressure Measured in Pascals, “Sound pressure” Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc, 22 July 2004, https://en.wikipedia.org/w/index.php?title=Sound_pressure&oldid=1112496481. Accessed 29 Nov. 2022.

Sound SourceDistance from EardB SPL
Jet Engine1 meter150
Threshold of PainAt ear130-140
Yelling Human Voice1 inch135
Instantaneous Hearing Loss Can OccurAt ear120
Jet Engine100 meters110-140
Chainsaw1 meter110
Traffic on a Busy Road10 meters80-90
Hearing Loss from Prolonged ExposureAt ear85
Typical Passenger Car10 meters60-80
Television (typical volume)1 meter60
Normal Conversation1 meter40-60
Calm RoomAmbient20-30
Leaf rustlingAmbient10
Threshold of HearingAt ear0
Sound Pressure Measured in dB SPL, “Sound pressure” Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc, 22 July 2004, https://en.wikipedia.org/w/index.php?title=Sound_pressure&oldid=1112496481. Accessed 29 Nov. 2022.

There are instruments available that measure sound pressure levels and report dB SPL. One such instrument is shown below. This happens to be my personal db SPL meter.

These devices are fun to take to concerts or demolition derbys if for no other reason than giving you the intellectual authority to complain about permanantly damaged hearing.

Conclusion

Hopefully, this article has helped demystify the decibel. Mathematically, they’re not something to be feared. It’s usually the logarithms that scare folks away. And if you’ve long since forgotten how logarithms work, go brush up on them and come back to this article a second time. It will make a lot more sense.

If you found this content useful, or if something could have been explained better, please leave me a comment below.

Until next time.

DIY Guitar Fx: 4 Channel Audio Looper

For guitar players, the word “looper” usually calls to mind one of two types of effects pedals – audio samplers and signal path modifiers.

Sampler/repeating loopers record whatever the guitarist is doing for some period of time and then they loop the recording until the guitarist makes it stop. Think Loop Station from BOSS or the DITTO Looper from TC Electronic. Guitarists typically use these types of pedals to create backing tracks to play against. And while they have a reputation for being difficult to work with in a live setting or when playing with other musicians, they’re great brainstorming tools.

Loopers of the signal path variety allow the guitarist to control chains of effects. Think of an effect loop on an amp. An amp’s effects loop allows you to chain a bunch of effects together and apply them to the guitar signal after the preamp gets a chance to do its work, but before the power is applied to the signal. This prevents the preamp from noising up your effects. It also has the added advantage of allowing you, the guitarist, to bypass the effects loop altogether with the push of a single button. A pedal-based looper on its own doesn’t help you much in the post preamp department, but it does enable you to cluster effects and toggle the cluster on/off with a single footswitch press. You’re also not limited to a single pedal-based effects loop. You can have as many as you want. And because the loops themselves can be chained together, a guitarist has enormous flexibility in how they control the effects applied to their signal.

This blog entry will be concerned only with the latter type of pedal. When I say looper, I’m speaking entirely of the signal routing variety.

Motivation

I’ve got somewhere in the neighborhood of three dozen effects pedals (maybe more) in my “Box O’ Sounds”. Do I use them all? No. Certainly no more than half a dozen ever leave my practice space. But there are a number of pedals that I almost always use together to achieve a particular sound. And it’s important to me to be able to toggle them on/off together. Unless I’m super fast and feeling really coordinated, this can be really awkward. This is especially true in a live scenario where the mind can wander. Being able to treat a few pedals as a single unit is ideal. And that’s what motivated me to start exploring loopers. Once I realized how simple they were to build, I couldn’t resist trying to build one for myself.

As far as guitar pedals go, loopers are probably the easiest of all pedals to build because they don’t really modify the signal. A looper just routes the signal to different locations using a bunch of wire, switches, and jacks. They’re easy to understand. There’s almost never a circuit board mounted inside one of these things (unless you’re looking at a digital, MIDI-control unit like those from RJM Music Technology).

Materials

The following is a list of parts I used to build my looper. This listing is for four channels. If you don’t need that many channels, adjust accordingly.

  • Enclosure – I went with a 4S1032L aluminum enclosure from 4Site Electronics.
  • 24AWG single strand wire. Color really isn’t important. But I picked up some violet, red, and black spools just to help eyeball where things are going.
  • 4 3PDT footswitches (one for each loop).
  • 1 ¼” stereo jack (used on the instrument side of the pedal).
  • 9 ¼” mono jacks (1 for the amp side of the pedal and then 2 for each loop).
  • 4 5mm LEDs (I went with blue).
  • 4 LED bezels (I used to some cheap plastic LED mounting clips from Mouser)
  • 4 10KOhm resistors (1 for each LED)
  • Optional Power jack – 2.1mm is the conventional power jack size. I went with a 3 pin, panel mount barrel connector.
  • 9V battery connector.

Schematic

I looked around at various schematics online and ultimately created one tailored to my own needs. Below is a completely unoriginal schematic I drew based on other designs from numerous other people.

Some things worth noting:

No power is actually needed for the looper to function. Power is only really needed for the LEDs. If the battery dies or you unplug the looper from external power, you’ll still be able to use the effects loops. You’ll just have to rely on your ears to know what state the looper is in. The less I have to think about this stuff, the more I can focus on the songs. So, for me, it’s important that the LEDs work.

If you think about the switch, loop jacks, LED, and resistor as a discrete unit, you’ll realize these things are just blocks of components chained together. You can easily add or remove clusters of these to get just the right number of loops for your taste.

Pedal Design

The first thing I did after getting all of my parts was to design the internal layout of the pedal. It’s important that you take some time to plan this stuff out. There are a lot of bulky components going into this pedal. It’s easy to assume you’ve got plenty of room to work with. Looks can be deceiving. I can’t stress this enough – PLAN THE LAYOUT. Enclosures aren’t cheap. And ruining a build because you’re overconfident with the drill can be really discouraging.

I did all of my planning in 3DSMax just because that’s what I know how to use. I couldn’t find a source for good 3D models of my components, so I ended up modeling them myself. I didn’t get incredibly detailed with them. I just made sure the overall dimensions were accounted for.

Enclosure Prepping

After putting together a 3D model of my parts, enclosure, and drill holes, I exported vector artwork of the various sides and brought them into Adobe Illustrator. From Illustrator, I was able to print the artwork out to scale. This became my drilling template. I cut out each side and taped them to the enclosure.

I drilled a few small pilot holes to get started and then switched to a stepped drill bit to get the right size holes that I needed. I recommend double checking the hole sizes against the components as you go just to make sure the holes aren’t too big. It’s easier to make a hole bigger. But there’s not much you can do about a hole that’s too big. A little wiggle room is ok for a jack or a switch. But too much and you’ll need to start over with a new enclosure or buy bigger washers.

With the holes drilled, you might think about sanding and/or painting the enclosure. I wasn’t too thrilled with the factory finish on the enclosures. I wanted more of a brushed look, so I sanded everything down.

I started with 80 grit sandpaper, graduated to 100 grit, and then finished with 150 grit. Since I wanted to have a brushed finish, it was important that I paid attention to the direction I sanded. If you don’t sand in a single direction, it won’t look brushed at all. I finished up with some super fine steel wool. And then cleaned everything off with some mineral spirits. After the mineral spirits evaporated, I rinsed everything off.

Wiring Up

This may seem like an obvious thing to say, but I know someone will make the mistake so I’ll say it anyway. Make sure you do you wiring and soldering OUTSIDE of the enclosure. You can periodically test fit components to make sure your runs of wire are the right length. But you’ll cause yourself major headaches if you try to solder things inside the enclosure.

Something I did that may come back to bite me is wiring my instrument-in and amp-out jacks on ends opposite to the switches they’re connected to. It was important for me to follow the convention of having the instrument-in on the right side and the amp-out on the left side of the enclosure. It was also important for me to think about the loop channels as running from left to right. So in order to accomplish that, I ended up having to add an extra 16+ inches or so of wire that I wouldn’t otherwise need if I were willing to compromise. The extra wire creates an opportunity for more noise and signal degradation. But it’s not something I’ve really noticed as of yet. If it does come back to haunt me, I’ll probably end up rewiring this thing at some point.

Regarding the LEDS, this was the first time I had ever used plastic holders. The idea is you snap the holder into the hole and then pop the LED in from the bottom. The problem is the LED isn’t held very tightly and it’ll pop out as easily as it popped in. I’m not sure how most folks deal with this, but I put a little dab of super glue around both the outside of the holder (prior to insertion) and on the outer edge of the LED (wipe off any excess that shows up on the top of the enclosure). That seemed to work ok. But time will tell how well it holds up.

Conclusion

There’s not much to this project. Troubleshooting should be fairly straightforward. As you build, test for continuity along the way. Even the cheapest of multimeters can do this and it’ll save you loads of trouble.

For those new to pedal building, there are some fantastic resources online to help guide you along. Some of my favorites are below:

Planet Z – This is a website run by a wonderful fellow named John Cooper. He has SUPERB introductory video tutorials on enclosure and pedal design. He goes into much more detail than I did. He also has a fantastic tutorial on Sketchup. If you’re new to 3D modeling and are looking for a low-cost (free) way to take your first steps, Sketchup is the way to go.

gaussmarkov: diy fx – You’ll find loads of great material here on components and effects-related circuits. Gaussmarkov even took the time to create beautiful POVRAY renderings to help illustrate some of the material. I think the most valuable section here for first time builders is the Parts section.

ProGuitarShop.com – FX Loops Explained – This isn’t really a builder site. But it contains a great high-level discussion of effects loops. If you’re new to the idea of effects loops, or have always wondered what was so special about your amp’s effects loop, check out this article.

Good luck!

-Shane