Lab1 Making FX in Pd

From CCRMA Wiki

Jump to: navigation, search

by Esteban Maestre


For this lab you need your Satellite CCRMA kit, a computer to program it, and some headphones with a mini 1/8" stereo jack. For applying created effects to a real instrument, you will also need your instrument with an appropriate instrument-kit audio cable (this will depend on the audio digital interface used with CCRMA Satellite), and a kit-headphones (this will also depend on the audio digital interface used).

Contents

Introduction

As you might have perceived from the early illustrative examples shown in class, the flow of audio processing in PureData is considerable natural, as it is in general pretty easy to translate the functional block diagrams seen during the lectures. 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 PureData 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, one can find a large number of audio examples from where you can learn valuable insight.

Another very intuitive programming language (being lower level) for signal processing is Faust [2], although it will be left out of support for these labs. Of course, you are very welcome to satisfy you curiosity. An excellent tutorial for audio signal processing in Faust written by Prof. Julius Smith can be found here [3].

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.

You should work directly on CCRMA Satellite (first using a recorded sound source) when possible. If you are going to start trying out your effects first with a recorded sound and have not brought any sound file(s) with you, you can search and download (under a Creative Commons License) some clean guitar sounds from Freesound [4].



Getting Started

Login into Satellite CCRMA using the same method as in lab 0. The files relating to the Stompbox Workshop are stored in ~/pd/stompbox

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 varying 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:

File:mul2.JPG

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

File: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

File: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:

File: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:

File: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)

File: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

File: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 sinewave (or other simple waveform) of a given frequency (carrier signal), resulting in the appearance of inharmonic components that give the sound a 'metallic' character. The basic operational differences with a tremolo effect are that here (i) the carrier signal oscillates around zero, and (ii) its range of frequencies is much higher. 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 [5], 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.

Personal tools