Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Web Development

Audio Applications and Effects Made Easy


The Bypass Switch

One of the modules I created is bypass switch. Most audio effects have a bypass switch built in to allowing signal processing to be quickly turned on and off. Though not useful by itself, the bypass switch module is designed for incorporation into effect plug-ins including the vibrato described shortly. There are two aspects of the bypass switch: The actual signal switching and the user interface. I choose a toggle switch (a standard SynthMaker module) as the UI element. Figure 2 shows the module's UI and Figure 3 the implementation.

[Click image to view at full size]
Figure 2: Bypass Switch Module's UI

The UI in Figure 2 is simple. A toggle switch, a couple of labels and input/output connectors. Not shown is the tool tip help displayed whenever the mouse is positioned over the module. You'll notice the UI is transparent. This was done so the bypass switch takes on the appearance of whatever module it is incorporated into.

[Click image to view at full size]
Figure 3: Bypass Switch Module's Implementation

Figure 3 shows the implementation. Briefly, the toggle switch's boolean output drives a selector that routes the unprocessed (dry) signal or the processed (wet) signal to the module's output connector. When the toggle switch is in the bypass position the dry signal is routed to the output. In the on position the wet signal is routed. The string field connected to the Help module provide the tool tip help. It is interesting that the toggle switch can be clicked on the schematic and the selector component will change selections to show it operation. Features like these help with debugging.

A Vibrato Effect

Moving up the complexity scale I next present a vibrato effect. As you may know, vibrato is a form of frequency modulation applied to an audio signal. Here the vibrato effect is obtained by changing the delay, input samples are exposed to, by a time varying signal produced by a LFO. Figure 4 shows the completed module's UI including the tool tip help and Figures 5 and 6 show a portion of its implementation.

[Click image to view at full size]
Figure 4: Vibrato Module's UI

The vibrato module sports a labeled brushed aluminum front panel, a LFO with user selectable wave shape and frequency, a vibrato depth control and the bypass switch discussed previously.

[Click image to view at full size]
Figure 5: The Vibrato's Implementation

Here you can see the modules which make up the vibrato effect including an LFO module of my own design. The top half of the schematic shows how the functionality is achieved; the bottom half of the schematic shows how the presentation is achieved.

[Click image to view at full size]
Figure 6: Vibrato Module's Implementation (continued)

The Fractional Delay module in Figure 6 is a code module containing:

streamin in;
streamout out;
streamin delay;

float index;
float intdelay,frac;
float temp1,temp2;
float out1;
float mem[44100];
float MAXDELAY=44100;

stage(1)
{
	mem[index]=in;
	
	intdelay = delay - 0.5;
	intdelay = rndint(intdelay);
	frac = delay - intdelay;

	temp1 = index - intdelay;
	temp2 = temp1 - 1;
	temp1 = temp1 + (temp1 < 0)&MAXDELAY;
	temp1 = mem[temp1];

	temp2 = temp2 + (temp2 < 0)&MAXDELAY;
	temp2 = mem[temp2];

	out = (1 - frac) * temp1 + frac * temp2;
	
	index=index+1;
	index=(index<MAXDELAY)&index;
}

The somewhat strange language syntax is driven in part by the the need to support streaming SIMD instruction set extensions (SSE) on Intel and AMD processors. Conditional expressions are especially strange since they act on four channels simultaneously.

The vibrato works as follows: As samples enter the vibrato they are placed at the start of a delay line. Where samples are extracted from the delay line depends upon the maximum depth allowed for the effect which I have limited to:

(.2 * sample rate) / (2 * Pi)

or 20 percent of the maximum frequency allowed at the current sample rate. This maximum level is controlled by the circuitry in Figure 6. If the depth control is set to zero the samples are always extracted from the same location in the delay line which represents the latency of the sampled audio (~16 milliseconds average). As depth is increased, the position of the extracted samples modulates around this point as a function of the LFO's output level. You can hear and see the vibrato effect in operation by rigging up a test schematic as shown in Figure 7.

[Click image to view at full size]
Figure 7: Testing the Vibrato Module

Here a potentiometer is used to control the frequency of a sine wave oscillator that is the signal source. The scope module on the left shows the waveform being applied to the vibrato. The scope on the right is used to see the frequency modulation in operation. Since the output of the vibrato module is connected to the DS Out module you can hear as well as see the vibrato in operation.

Conclusions

As you can probably tell, I'm somewhat taken by SynthMaker. Not only does the program have most of the functionality I need but there is an active user community with some very seasoned users that are willing and able to answer new user questions. In addition, examples abound that can be used in parts or parcel in your own applications. Plenty of audio applications can be created with little DSP experience although as usual the more you know the better. Coding will be required for many advanced applications.

SynthMaker is not without its limitations, however. One feature I feel is lacking is the ability to couple the SynthMaker environment to external functionality contained in DLLs. I have written to the company and requested they add this feature and their response was the feature was on their list but of low priority. While SynthMaker does have FFTs and inverse FFTs they are not yet real time quality (admitted to me by the company themselves) so this needs to be addressed as well. While I'm a Windows-only user, the lack of a version of SynthMaker for Macs and for UNIX is considered a limitation by many. Finally, although the product documentation is fairly well done it could easily be flushed out even further. This would help new users, including myself, quite a bit.

Even with these limitations, SynthMaker is a great tool for developing stand alone audio processing programs and VST plug-ins. In addition to being quite capable, it is also fun to use. It is my VST development system of choice for now and with enhancements will continue to be so in the future.

Resources

SynthMaker 1.1 was used during the preparation of this article. A downloadable version of the personal edition costs $133 US at the time this article was written. A professional edition is also available for those who want to sell their creations commercially. All documentation is available, for free, on-line.

You may find the following resources helpful/informative:

  • synthmaker.com. The manufactures web site. On this site are a forum for user interaction with each other and the manufacturer, a wiki for product documentation, DSP tutorials and numerous examples of user created effects and instruments. A free 30 day demo version of SynthMaker is available with the only limitation being that any stand alone application or VST plug-in developed manifests a buzzing noise when used.
  • musicdsp.com. A site with many code snippets for common DSP functions.
  • Digital Audio With Java. My book with many algorithms for processing of sound including reverb, echo, phasing, pitch shifting, and many more.
  • Information on VST instruments and plug-ins is available from Steinberg at www.steinberg.net. The current version of the VST specification is 3.0.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.