Audio ABCs
For some reason, analogue synthesisers are experiencing a bit of a
renaissance, fetching high premiums, and causing riots at car boot sales
when one is spotted amongst the rubble and home-made biscuits. But despite
all the fuss, there's nothing that an analogue piece of circuitry can do
that can't be emulated by a few bits of digital logic (even noise).
Since digital audio is little more than huge collections of numbers
(obviously in some coherent form), samples can be generated by any means:
a text editor, for example. First Word may not have the twiddle-factor of
an analogue synthesiser, but it certainly has the sonic potential. The
system works as follows: each letter in the ASCII character set has a
different numerical value (a space for example is $20), and combinations
of these can form recognisable patterns. Unfortunately, a letter to the
building society still sounds as bad as it looks...
For a square wave you need two descrete values: '0' ($30) and 'd' ($64),
for example. The first character is inputted a number of times (the more,
the lower in pitch the resultant sound will be), and then the second, the
same number of times. As a rough guide: frequency in Hertz =
sample rate / number of characters.
This pattern is then repeated, perhaps with varying 'periods' so as to
create a pulse width modulating effect, for as far as the text editor can
go without starting a new line (usually about 255 characters). Carriage
returns have their own ASCII value, and so these will cause a 'spike' in
the audio, so it's best to keep to one line (although it is quite
conceivable to use this to some advantage).
More exotic waveforms are an extension of the above idea. Sawtooth
waveforms are produced by writing the alphabet forwards, whilst triangle
waves can be made by writing the alphabet forwards and then backwards. To
experiment with other numeric patterns, you'll need an ASCII character set
map, but resonant waves, sine waves, and filter sweeps are all possible.
(If you're handy with C or Basic, you could write a program that
constructs a disk file full of numbers, like the one below, and save
yourself all that typing.)
Once you have a waveform cycle, this 8-bit data needs to be loaded into a
sample editor (as a *.SPL file in Replay 16) to be elongated, as it's
probably quite insubstantial in the audio scheme of things. This requires
a tedious bit of cutting and pasting, something that most editors are good
at. It may also need optimising, particularly if you've used low values.
Then you can be creative, using the editor's envelope shaping facilities
to add some much needed dynamics to the sample. Some editors will let you
'draw in' a new amplitude envelope, but any fade in/out combination tool
can be equally as effective.
A brief physics lecture...
To create a truly authentic analogue rasp, the sample must be thickened to
the consistency of school custard. One method is to use phasing:
overlaying two identical samples, with one slightly out of phase (achieved
by inserting a small space at the start of the sample), produces
fluctuations in the amplitude (thickening and thinning in different places
of the sound). If you repeat the process a few times, the sound can be
vastly altered.
All this amplitude wibbling is due to the phase relationship (which isn't
to be confused with a celebrity marriage) of the original sound, and the
time-shifted sound (see the diagram). A shift of 1 to 45ø is typical for
effects; 180ø out of phase produces a cancelling effect (since the two
waveforms are equally opposite); 360ø is a full-cycle. Some editors, like
Replay 16 or Zero-X, have built-in effects that can do a similar job, thus
taking a welcome excursion around the mathematics.
*** BOX OUT ***
/* ANSI C code for generating a square wave disk file */
#include
#include
#define PERIOD 100
FILE *fp;
char sdata[20000];
void
main()
{
short x = 0, y = 0;
while(x < 20000)
{
if(y < PERIOD)
sdata[x] = 100;
if(y >= PERIOD)
sdata[x] = -100;
x++;
y++;
if(y>= (PERIOD * 2))
y = 0;
}
if((fp = fopen("a:\\square.spl", "wb")) == NULL)
exit(0);
fwrite(sdata, sizeof(char), 20000, fp);
fclose(fp);
exit(1);
}
*** end boxout ***
*** CAPTIONS ***
*** SAMPLES1.GIF ***
How to create a phasing effect in Replay 16
** SAMPLES2.GIF **
After a liberal dose of paste, the sample is long and useable
** SAMPLES3.GIF **
Chisel off the sharp edges with a suitable envelope shaper (Avalon)
** SAMPLES4.GIF **
Even the alphabet is musical. Honest