Monday, June 08, 2015

Episode 12: 100 Yards

A counting exercise.

mp3 file: 100 Yards (1:08 min)

sc source: paces.scd

My pace (i.e. two steps) is pretty close to 5 feet. That means in 6 paces I walk 10 yards. This morning I was walking at about 108 steps per minute and trying to count feet and yards along with my paces. I couldn't really do it, but I thought I could make a piece of music that did. Here the bass represents footsteps, the tinkly sound is feet and the bells represent yards.

Tuesday, February 10, 2015

Episode 11: In the Mountains and in the Tombs

A further continuation of the rhythmic idea used in Episodes 7 and 8, this time implemented as a sctweet.

mp3 file: In the Mountains and in the Tombs (sctweet 20150210) (3.1 MB)
Full supercollider source: play{l=LFSaw;a=Decay.ar(Impulse.ar(1/8),0.2,l.ar(l.kr(2/25,0,88,176)));[16,10,4,3].do({|t|a=CombN.ar(a,6,t/8+[3,4],20,1,a)});a}//#sctweets (138 characters)

I managed to create an even shorter tweet, which differs only in the amplitude envelope of the notes. I didn't think it sounded quite as pretty, though:

play{l=LFSaw;a=HPF.ar(l.ar(1/8),8,l.ar(l.kr(2/25,0,88,176)));[16,10,4,3].do{|d|a=CombN.ar(a,6,d/8+[3,4],24,1,a)};a}// #sc140 #supercollider

The notes of this composition follow a cycle of 25 pitches, taking 3 minutes and 20 seconds to perform a single repeat. Each note is echoed in a complex rhythm, creating the arpeggios you hear. This recording follows one complete cycle of pitches.

Here's an expanded version of the tweet that explains what's going on:
(
{
 var pitch=LFSaw.kr(2/25,0,88,176);
 // the pitch rises from 88Hz to 264Hz (an octave and a fifth) in 12.5 seconds
 var tone=LFSaw.ar(pitch);
 // generate a sawtooth wave following the pitch
 var env=Decay.ar(Impulse.ar(1/8),0.2);
 // 0.2 second percussive envelope that repeats once every 8 seconds
 var note=env*tone;
 /* the original tweet performs the same multiplication in the
  * mul: parameter of the Decay ugen
  *
  * this combination produces the 25 note cycle. The notes
  * are harmonically related because the pitch rises in a linear
  * fashion. If the pitch doesn't wrap around before the next note,
  * it will be 32/25 * 88Hz higher. If it does wrap around, it
  * will be 18/25 * 88Hz lower. The total set of all notes played
  * consists of harmonic partials 13-37 of a fundamental frequency
  * of 7.04 Hz. (41 cents above A-6)
  */
 var delaytimes=[16,10,4,3];
 // delaytimes measured in 16th notes at 120bpm
 var out = note;
 // chain all the delays:
 delaytimes.do{|delay|
  var delayinseconds=delay/8;
  var stereodelay=[3,4];
  // left channel delays an additional 6 beats at 120bpm,
  // right channel delays an additional 8 beats
  out=CombN.ar(out,6,delayinseconds+stereodelay,24,1,out);
 };
 // uncomment this line to see what frequencies are being used:
 // Poll.ar(Impulse.ar(1/8),ZeroCrossing.ar(tone),"freq");
 out;
}.play
)

The multiple long delay times consume quite a bit of memory. To run these in supercollider, you may have to increase the server's memory capacity. This worked for me (run before booting the server):

s.options.memSize=(2**15)

As usual, the title of this track is chosen from a randomly selected Bible passage. By total coincidence, the song Legion by Severed Heads refers to the same passage.

Episode 10: sctweet 20131004 (POKEY filter simulation)

I did this over a year ago, but I must have forgotten to post it here...

mp3 file: capmikee_sctweet_20131004.mp3 (4.1 MB)
Full Supercollider source: play{i=Impulse;f=Stepper.kr(i.kr(5),0,[57,66],75,LFClipNoise.kr(2,12,7)).midicps;SetResetFF.ar(i.ar(f),i.ar(f.rotate*2));}// #sctweets (134 characters)

Inspired by the "high-pass filter" on the Atari POKEY chip and rendered using Supercollider, this is not 8-bit music but 1-bit music. No post-processing of any kind was applied before mp3 conversion, not even to remove DC offset.

A note on the POKEY "high-pass filter." For years I was mystified by what this effect actually does. It clearly has beating or sweep effects not consistent with its description in "De Re Atari." After looking at some waveforms, doing some experiments and reading the sparse information available online about the chip, I concluded that what it is actually doing is a sort of pulse-width modulation. This synth, I believe, will perfectly emulate the effect in Supercollider:

(
{
    var inputFreq = MouseX.kr(100, 1000, warp:1);
    var cutoffFreq = MouseY.kr(100, 1000, warp:1);
    var in = Impulse.ar(inputFreq);
    var modulator = Impulse.ar(cutoffFreq) + Impulse.ar(inputFreq, phase:0.5);
    SetResetFF.ar(in, modulator);
}.scope
)

For the tweet, I have eliminated code that is only really relevant when the "cutoff" frequency is lower than the "input" frequency.

Twitter: @capmikee #sctweets #supercollider #sc140