### Week 3: Real Things

#### bugs... more drums... bicycle spokes

The first thing we did in this class was attempt to model the sounds of various bugs, frogs, etc. as recorded on a nice, humid, summer New Jersey night. The trick was not so much to build a full-fledged algorithmic model of the bug-sounds so much as to use some of our existing computer music tools to multiply and "fold" a small set of basic bug soundfiles to create the impression of teeming (albeit somewhat weird) life.
• [click here for an mp3-encoded (size = 480k) recording of Real Live New Jersey bug sounds!]

We started by trying to build a single bug-sound using the RTcmix FMINST. instrument. After fooling with the parameters a fair amount, we came up with a sound that was (sort of) like a real bug, generated with the following scorefile (I have included the parameters for the FMINST algorithm here for quick reference):

```/* p0 = start; p1 = dur; p2 = amplitude; p3 = pitch of carrier (hz or oct.pc);
p4 = pitch of modulator (hz or oct.pc); p5 = fm index low point;
p6 = fm index high point;  p7 = stereo spread (0-1)
function slot 1 is oscillator waveform, slot 2 is the amp;
slot 3 is index guide  */

rtsetparams(44100, 1)
makegen(1, 10, 1000, 1)
makegen(2, 24, 1000, 0, 1, 100, 1)
makegen(3, 24, 1000, 0,1, 100,1)
FMINST(0, 7, 20000, 10.03578, 1879, 0, 30)
```
• [click here for an mp3-encoded (size = 113k) output of the above scorefile]

Recall that this is run by saying "FMINST < filename.sco" where "filename.sco" is the name of the file with the above score information

Next we took the single chirp and sequenced it to work towards the sound of a cricket chirping repeatedly:

```rtsetparams(44100, 1)
makegen(1, 10, 1000, 1)
makegen(2, 24, 1000, 0, 1, 100, 1)
makegen(3, 24, 1000, 0,1, 100,1)

start = 0.0
for (k = 1; k < 10; k = k+1) {
FMINST(start, 0.05, 20000, 10.03578, 1879, 0, 30)
start = start + 0.06
}
```
• [click here for an mp3-encoded (size = 9.5k) output of the above scorefile]

Then we took this sequence and repeated it several times, again chasing after the elusive cricket-sound:

```rtsetparams(44100, 1)
makegen(1, 10, 1000, 1)
makegen(2, 24, 1000, 0, 1, 100, 1)
makegen(3, 24, 1000, 0,1, 100,1)

start = 0.0
for (m = 0; m < 7; m = m+1) {
for (k = 0; k < 4; k = k+1) {
FMINST(start, 0.05, 20000, 10.03578, 1879, 0, 30)
start = start + 0.06
}
start = start + 0.9
}
```
• [click here for an mp3-encoded (size = 116k) output of the above scorefile]

As with last week's class, we noticed that the sound was too "perfect" to be natural, so we added some randomness to the scorefile and created a passable cricket:

```rtsetparams(44100, 1)
rtoutput("bugs3a.aiff")
makegen(1, 10, 1000, 1)
makegen(2, 24, 1000, 0, 1, 100, 1)
makegen(3, 24, 1000, 0,1, 100,1)

start = 0.0
for (m = 0; m < 7; m = m+1) {
buzzes = random()*3 + 2
for (k = 0; k < buzzes; k = k+1) {
FMINST(start, 0.05, 20000, 10.03578, 1879, 0, 30)
start = start + (0.06 + (random()* 0.04))
}
start = start + (0.9 + (random() * 0.3))
}
```
• [click here for an mp3-encoded (size = 140k) output of the above scorefile]

This seemed satisfactory for the class exercise, so we then generated a series of different "crickets" by slightly changing the FMINST parameters and using a different random-generator seed for each scorefile. Here are the relevant changes:

```/* bugs3b */
rtoutput("bugs3b.aiff")
. . .
srand(78)
. . .
FMINST(start, 0.05, 20000, 10.03578, 1979, 0, 30)

/* bugs3c */
rtoutput("bugs3c.aiff")
. . .
srand(878)
. . .
FMINST(start, 0.05, 20000, 10.03578, 1898, 0, 30)

/* bugs3d */
rtoutput("bugs3d.aiff")
. . .
srand(14)
. . .
FMINST(start, 0.05, 20000, 10.0378, 1892, 0, 30)
```

As indicated by the "rtoutput()" statements in the above scores, we wrote each "cricket" into a separate soundfile. We then used the mix digital soundfile graphical mixing application (see the resources page to download this application from NoTAM, the Norwegian computer-music place) to combine these soundfiles into one file.

• [click here for an mp3-encoded (size = 153k) output of this procedure]
We then loaded that resulting soundfile again into mix on several separate tracks. By randomly staggering the input time of each copy of the soundfile, we were able to produce a thick texture of virtual crickets.
• [click here for an mp3-encoded (size = 231k) output of this procedure]

Finally, we took this thick soundfile and filtered it with a very sharp band-pass filter centered around 8000 Hz, making the cricket sounds just a bit more realistic. We used the graphical SGI application gQ written by Dan Trueman to do this. The RTcmix filter program IIR could also have been used for the same purpose.

• [click here for an mp3-encoded (size = 231k) output of this procedure]

We also tried to create a constant insect 'hum' in the background, using the RTcmix instrument AMINST and the following score for the basic sound:

```/* aminst -- amplitude modulation synthesis
*
*  p0 = start
*  p1 = duration
*  p2 = amplitude
*  p3 = carrier frequency (hz)
*  p4 = modulator frequency (hz)
*  p5 = stereo spread <0-1> [optional]
*  assumes function table 1 is the amplitude envelope
*  assumes function table 2 is the modulation envelope
*  function table 3 is the carrier waveform
*  function table 4 is the modulator waveform
*
*/

rtsetparams(44100, 1)
rtoutput("am2.aiff")
makegen(1, 24, 1000, 0,0, 0.1,1, 3.4,1, 3.5,0)
makegen(2, 24, 1000, 0,0, 1,1, 2,0)
makegen(3, 10, 1000, 1)
makegen(4, 10, 1000, 1)
AMINST(0, 3.5, 10000, 780, 315)
```
• [click here for an mp3-encoded (size = 53k) output of the above scorefile]

We ultimately combined all these files (using mix) to make a composite soundfile of layered bugs.
• [click here for an mp3-encoded (size = 409k) output of this procedure]

Although our class results lean slightly towards the Martian side of insectoid life forms, with a little effort a passable synthetic swamp can be synthesized...

• [click here for an mp3-encoded (size = 481k) recording of a whole menagerie of synthetic bugs]

### Chris Bailey's Snazzy Drum Machine

Chris has worked up a nice set of sample scorefiles and examples for recreating the drum-pattern algorithm he developed in class. He set up the web page with a nice, crowd-pleasing pink background, so rather then destroy this bold artistic stroke, you can click here to access his web pages.

### Chris Bailey's Amazing Bicycle Spokes

Chris has put his set of examples showing how he developed the "bicycle spoke" sound on-line. In his never-ending quest to inject a bit of artistic sensibility into this class, Chris colored these pages a truly astounding yellow color. Click here to access these pages. [mp3 sounds coming soon...]

Assignments:

1. Make the bugs sound more like bugs!

2. Certain species of insects will occasionally engage in a single "group" event, like a 'unison' waver in pitch or abrupt amplitude shift. How could this be modelled?

3. Map a pitch set onto the bicycle spokes.