Lab1 Making FX in Pd 2013

From CCRMA Wiki
Jump to: navigation, search

by Esteban Maestre


For this lab you need your Satellite CCRMA kit, a computer to program it via SSH/Ethernet, and some headphones with a mini 1/8" stereo jack. For applying the effects to a real instrument afterwards, you will also need your instrument; a digital audio interface (for acquiring the audio coming out of your instrument; and (a) an appropriate instrument-kit audio cable (this will depend on the audio digital interface used with CCRMA Satellite), and (b) a kit-headphones (this will also depend on the audio digital interface used).

Introduction

As you might have perceived from the early illustrative examples shown in class, the flow of audio processing in Pure Data is considerably natural, as it is in general pretty easy to translate the functional block diagrams seen during the lectures into a Pd patch. Even though some of the simple examples seen in class are available for your reference, we encourage you to experience the creation of patches from scratch: we understand that trying to build basic effects in Pd is very convenient because it will allow you to both learn the basic principles behind the effect, and get more insight on Pd and its already available (large) set of objects.

Although during this lab we will explain how to use most of the objects required, a good set of Pd tutorials can be found here [1]. In the documentation directory of the pd-extended installation (coming with CCRMA Satellite), one can find a large number of audio processing examples (some of the pretty complex) from where you can learn valuable insight.

Overview

Given that only dynamics-based effects have been covered in class, our first lab on making FX in Pd is based on those type of effects. The objective of this lab is to get familiarized with the effect design process, so that when further effect types get covered in class you can go ahead and try them yourself.

In this lab, we will build two effects from scratch: a tremolo effect, and a ring modulator (both with stereo output). For the more brave, we will guide you to the construction of a simple (mono) compressor.

When possible, you should work directly on CCRMA Satellite first by reading a sound sample residing where the Pd patch is created. If you have not brought any sound file(s) with you or you don't like the ones we provide, you can search and download (under a Creative Commons License) some sounds samples from Freesound [2].



Getting Started

Login into Satellite CCRMA using the same method as in Lab 0. The files relating to the Stompbox Workshop should be stored in ~/pd/stompbox and ~/pd/wavefiles.

Start up Pure Data with the following command:

pd &

Effect 1: Tremolo

A first step is to have a clear idea of the overall operational structure of the effect. The actual realization and/or parameter tuning can of course vary depending on your preferences. For the case of a tremolo, the structure is pretty simple. We have seen that a tremolo effect is based on rapidly/repeatedly changing (modulating) the amplitude of the input signal.

Changing the amplitude can be easily achieved by multiplying the signal by a number. This can be done with the [mull~] object:

Mul2.JPG

If the multiplication is to be carried out using instead the [*~] object displayed below

Mul00.JPG,

it is important to consider that when the number is expected to abruptly change its value, an interpolating block like [line~] is used between the number and the [*~] object, so that artifacts caused by jumps in the number value are avoided (this is especially relevant for 'manual' controls). Combining a message box with a [line~] object as in

Line.JPG

will do the job, since one also needs to specify the interpolation time (in this case 4ms) in its second inlet. This combination is equivalent to using the [mull~] object above (which also requires an interpolation time in its third inlet).

Since the number to be used in the multiplication is expected to oscillate with time, we will have to make use of a Low Frequency Oscillator (LFO). For doing so, the key object is the [osc~] signal generator:

Osc.JPG

If you check the help for [osc~] (via the contextual menu) you will see that this object generates a sinusoidal signal that oscillates between -1 and +1, at a frequency determined from the number fed into its inlet.

Note that the outlet of [osc~] is a signal and not a number. This implies that the [mull~] object is not a valid candidate. Either we convert our signal to a number, or we use the [*~] object which accepts two signals at its inlets:

Mul1.JPG

In order to read a signal from a wave file, the objects [open] and [readsf~] can be connected as in (for instance, replace file.wav with guitar2.wav)

Openfile.JPG

where two message boxes are used to start and stop playing the file. Conversely, if the signal is to be acquired from one of the audio input channels (whichever audio interface has been connected through Jack or Alsa), the object [adc~] can be used as in

Adc.JPG

where the audio signal is obtained from the left channel.

[ EXERCISE 1.1 ] Construct a full tremolo effect with manual controls for:

- Rate

- Depth

- Bypass


[ EXERCISE 1.2 ] Add a stereo panning control that allows three working modes:

a) Manual control of panning position.

b) Automated control of oscillatory panning position by means of a dedicated LFO (Rate and Depth controls).

c) Starting from b), embed an automation to the panning position Rate control so that it oscillates at rates that are an integer divisor of the tremolo rate.

Effect 2: Ring Modulator

A ring modulator is a sound effect that originated from radio-frequency (RF) frequency modulation schemas, and consists on multiplying the audio signal by a sine wave (or other simple waveform) of a given frequency. This signal is called the carrier signal. Although structurally similar to the tremolo effect, a ring modulator causes more dramatic changes to the input signal because (a) the carrier signal oscillates around zero, and (b) the frequency ranges for the carrier signal are larger. The moogerfooger MF-102 is an analog ring modulation effect released in 1998 by Moog Music.

[ EXERCISE 2 ] Check the specifications of the moogerfooger MF-102 here [3], and implement your own digital version with all features except for the type of carrier waveform, which will only be sinusoidal (leave out square or triangular carriers). Reuse the oscillatory panning position control implemented in EXERCISE 1.2.c to add it as an additional feature.

Important NOTE on Exercise 2: In theory, when ring modulation is implemented in the digital domain, care must be taken due to potential aliasing. Since the audio signal and the carrier signal are multiplied, the bandwidth of the resulting signal is the addition of the two bandwidths. In general, aliasing is avoided by performing 'oversampling'. Given that the concept of 'oversampling' has not been covered yet, we will just ignore the effect of aliasing by assuming that the bandwidth of a sinusoidal carrier (the only waveform type that you will make available in your implementation) with a maximum frequency of 4KHz will not lead to an audible degradation of the resulting signal.

(XTRA) Effect 3: Mono Compressor

Ask the instructors.