{
   "ancestor_list" : [],
   "description" : "Telegraph Incantation [disquiet0050-morsebeat]\r\n\r\nBy Schemawound\r\n\r\n\r\nAll code by Jonathan Siemasko\r\n\r\nBlog post about this track: http://schemawound.com/post/38127291200/telegraph-incantation-disquiet0050-morsebeat\r\n\r\nDESCRIPTION:\r\n\r\nThis week’s project explores invokes Morse Code for its rhythmic content. The instructions are as follows: Select a word or phrase. \r\nEncode that word or phrase by the Morse method. Record a rhythmic foundation in which the dash is represented by a long beat and the \r\ndot by a brief one. Use that rhythmic foundation as a loop for the length of your track, at the speed you desire — speed can vary over \r\nthe length of the recording. Record accompanying drone/melodic material that takes the underlying rhythm as its compositional foundation.\r\n\r\n\r\nMore on this 50th Disquiet Junto project at: http://disquiet.com/2012/12/13/disquiet0050-morsebeat/\r\n\r\n\r\nMore details on the Disquiet Junto at: http://soundcloud.com/groups/disquiet-junto/info/",
   "author" : "Schemawound",
   "name" : "Telegraph Incantation [disquiet0050-morsebeat]",
   "code" : "/*\r\nTelegraph Incantation [disquiet0050-morsebeat]\r\nBy Schemawound\r\n\r\nAll code by Jonathan Siemasko\r\n\r\nBlog post about this track: http://schemawound.com/post/38127291200/telegraph-incantation-disquiet0050-morsebeat\r\n\r\nDESCRIPTION:\r\nThis week’s project explores invokes Morse Code for its rhythmic content. The instructions are as follows: Select a word or phrase. \r\nEncode that word or phrase by the Morse method. Record a rhythmic foundation in which the dash is represented by a long beat and the \r\ndot by a brief one. Use that rhythmic foundation as a loop for the length of your track, at the speed you desire — speed can vary over \r\nthe length of the recording. Record accompanying drone/melodic material that takes the underlying rhythm as its compositional foundation.\r\n\r\nMore on this 50th Disquiet Junto project at: http://disquiet.com/2012/12/13/disquiet0050-morsebeat/\r\n\r\nMore details on the Disquiet Junto at: http://soundcloud.com/groups/disquiet-junto/info/\r\n*/\r\n\r\n(\r\nfork{\r\n\tvar phrase = \"LYRA\";\r\n\tvar fxSynth, group, bus, mainOut, patBass, patBassLoop, patMorse, patMorseDeci, patMorseDeciLoop, patMorseFast, patKick, patPad, patKickAndPad, patMainLoop, patFullSong;\r\n\tvar morse;  //Holds the main object used by the song\r\n\tvar songClock = TempoClock(11);\r\n\tvar createMorse = {|inString, spaceBetweenLetters = 3, spaceBetweenWords = 7|\r\n\t\t/* Function to take a string and convert it an event that can create morse code duration streams. Handles a-z, A-Z and 0-9.\r\n\t\t   Parameters allow you to adjust the space between letters and words. These parameters default to international morse code as shown on http://en.wikipedia.org/wiki/Morse_code\r\n\t\t   NOTE: outEvent.wordSpace must be equal to or greater than outEvent.letterSpace. */\r\n\r\n\t\tvar charToMorse;\r\n\t\tvar outEvent = (message: inString, code: \"\", letterSpace: \"\", wordSpace: \"\");\r\n\r\n\t\t//Fill letterSpace and wordspace per number specified in input args.\r\n\t\t//outEvent.wordSpace reduced by the size of outEvent.letterSpace to account for that will occur before it.\r\n\t\t(spaceBetweenLetters - 1).do{outEvent.letterSpace = outEvent.letterSpace ++ \" \"};\r\n\t\t(spaceBetweenWords - spaceBetweenLetters).do{outEvent.wordSpace = outEvent.wordSpace ++ \" \"};\r\n\r\n\t\t//Function to convert a single character to morse code\r\n\t\tcharToMorse = {|inChar|\r\n\t\t\tswitch(inChar,\r\n\t\t\t\t$A, {\".-\"},\t\t$B, {\"-...\"},\t$C, {\"-.-.\"},\t$D, {\"-..\"},\t$E, {\".\"},\t    $F, {\"..-.\"},  $G, {\"--.\"},    $H, {\"....\"},\r\n\t\t\t\t$I, {\"..\"},\t\t$J, {\".---\"},\t$K, {\"-.-\"},\t$L, {\".-..\"},   $M, {\"--\"},\t\t$N, {\"-.\"},\t   $O, {\"---\"},\t   $P, {\".--.\"},\r\n\t\t\t\t$Q, {\"--.-\"},\t$R, {\".-.\"},    $S, {\"...\"},\t$T, {\"-\"},\t\t$U, {\"..-\"},\t$V, {\"...-\"},  $W, {\".--\"},    $X, {\"-..-\"},\r\n\t\t\t\t$Y, {\"-.--\"},\t$Z, {\"--..\"},   $1, {\".----\"},\t$2, {\"..---\"},\t$3, {\"...--\"},\t$4, {\"....-\"}, $5, {\".....\"},  $6, {\"-....\"},\r\n\t\t\t\t$7, {\"--...\"},\t$8, {\"---..\"},\t$9, {\"----.\"},\t$0, {\"-----\"},  $ , {outEvent.wordSpace}\r\n\t\t\t);\r\n\t\t};\r\n\r\n\t\t//Take the input string, convert to uppercase and convert one letter at a time.  Add outEvent.letterSpace between letters\r\n\t\tinString.toUpper.do{|char, i|\r\n\t\t\tvar isFinalChar = (i != (inString.size - 1));\r\n\t\t\tvar isWordSpace = (char != $ );\r\n\t\t\toutEvent.code = outEvent.code ++ charToMorse.(char);\r\n\t\t\t//Include outEvent.letterSpace after each character except outEvent.wordSpaces and the final letter.\r\n\t\t\tif(isFinalChar && isWordSpace, {outEvent.code = outEvent.code + outEvent.letterSpace});\r\n\t\t};\r\n\r\n\t\t//Create a Prout that duration streams can be generated from\r\n\t\toutEvent.prout = Prout{|in|\r\n\t\t\tinf.do{|i|\r\n\t\t\t\tvar char = outEvent.code.wrapAt(i);\r\n\t\t\t\tswitch(char,\r\n\t\t\t\t\t$., {in = 1.embedInStream(in)},\r\n\t\t\t\t\t$-, {in = 3.embedInStream(in)},\r\n\t\t\t\t\t$ , {in = Rest(1).embedInStream(in)}\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\t//Function to create a new duration stream\r\n\t\toutEvent.durStream = {outEvent.prout.asStream;};\r\n\r\n\t\t//Count number of events in the stream\r\n\t\toutEvent.numEvents = outEvent.code.size;\r\n\r\n\t\t//Calculate the number of beats in the stream\r\n\t\toutEvent.numBeats = 0;\r\n\t\toutEvent.code.do{|val,i|\r\n\t\t\tvar char = outEvent.code[i];\r\n\t\t\t\tswitch(char,\r\n\t\t\t\t\t$., {outEvent.numBeats = outEvent.numBeats + 1},\r\n\t\t\t\t\t$-, {outEvent.numBeats = outEvent.numBeats + 3},\r\n\t\t\t\t\t$ , {outEvent.numBeats = outEvent.numBeats + 1}\r\n\t\t\t\t);\r\n\t\t\t};\r\n\r\n\r\n\t\t//Return event\r\n\t\toutEvent;\r\n\t};\r\n\r\n\t//--------------------SynthDef--------------------\r\n\tSynthDef(\\morseTone, {|out = 0, freq = 400, gate = 1, pan = 0, wobbleDepth = 10, wobbleRate = 3, amp = 1, attack = 0.03, decay = 0.03, release = 0.03|\r\n\t\tvar env = EnvGen.ar(Env.adsr(attack, decay, 1, release), gate, doneAction: 2);\r\n\t\tvar wobble = SinOsc.ar(wobbleRate).range(0, wobbleDepth);\r\n\t\tvar osc = SinOsc.ar(freq) * SinOsc.ar(freq + 1 + wobble);\r\n\t\tvar output = Pan2.ar(osc * env, pan, amp);\r\n\t\tOut.ar(out, output);\r\n\t}).add;\r\n\r\n\tSynthDef(\\AEKick, {|\r\n\t\tout = 0, amp = 1,\r\n\t\tattack = 0.01, decay = 0.7, curve = 3,\r\n\t\tpEnvMul = 20, pEnvAdd = 40, pEnvAtk = 0.01, pEnvDecay = 0.25, pEnvCurve = -4\r\n\t\tfmAmp = 1, fmpEnvMul = 100, fmpEnvAdd = 10, fmpEnvAtk = 0.001, fmpEnvDecay = 0.10, fmpEnvCurve = -2\r\n\t\t|\r\n\t\tvar ampEvn = EnvGen.ar(Env.perc(attack, decay, amp, curve), doneAction: 2);\r\n\t\tvar pitchEnv = EnvGen.kr(Env.perc(pEnvAtk, pEnvDecay, pEnvMul, pEnvCurve)) + pEnvAdd;\r\n\t\tvar fmpitchEnv = EnvGen.kr(Env.perc(fmpEnvAtk, fmpEnvDecay, fmpEnvMul, fmpEnvCurve)) + fmpEnvAdd;\r\n\t\tvar fmMod = SinOsc.ar(fmpitchEnv) * fmAmp;\r\n\t\tvar sin = SinOsc.ar(pitchEnv) * fmMod;\r\n\t\tsin = sin + (LFNoise0.ar(10000) * EnvGen.ar(Env.perc(0.01, 0.02, 0.001, 0)));\r\n\t\tOut.ar(out, sin * ampEvn!2);\r\n\t}).add;\r\n\r\n\tSynthDef(\\slowPad, {\r\n\t\t|\r\n\t\t    out = 0, gate = 1, freq = 400, amp = 0.1,\r\n\t\t    sawLfoAmount = 0.1, sawLfoLFreq = 0.1, sawLfoRFreq = 0.25, sawAmp = 0.5,\r\n\t\t    squareLfoDepth = 0.4, squareLfoFreq = 0.034, squareDetune = -0.3, squareAmp = 0.5,\r\n\t\t    combFreqMult = 0.0003, combDecay = 0.5,\r\n\t\t    filterMult = 4, filterAttack = 7, filterDecay = 5, filterSustain = 0.5, filterRelease = 3, filterRQ = 1, filterAmp = 0.5,\r\n\t\t    ampAttack = 2, ampDecay = 4, ampSustain = 0.5, ampRelease = 0.8\r\n\t\t|\r\n\t    //Saws\r\n\t    var sawLfo = SinOsc.kr([sawLfoLFreq, sawLfoRFreq]).range(sawLfoAmount * -1, sawLfoAmount);\r\n\t    var saws = (Saw.ar(freq) + Saw.ar((freq.cpsmidi + sawLfo).midicps)) * sawAmp;\r\n\t    //Square\r\n\t\tvar defaultSquarePW = 0.5;\r\n\t    var squareLfo = SinOsc.kr(squareLfoFreq).range(defaultSquarePW - squareLfoDepth, defaultSquarePW + squareLfoDepth);\r\n\t    var square = PulseDPW.ar(freq + squareDetune, squareLfo) * squareAmp;\r\n\t    //Comb\r\n\t\tvar combMaxDecay = 1;\r\n\t\tvar comb = CombC.ar(saws + square, combMaxDecay, combFreqMult * freq, combDecay) + (saws + square);\r\n\t\tvar comb2 = CombC.ar(comb, combMaxDecay, (combFreqMult / 3) * freq, combDecay / 2) + comb;\r\n\t\t//Filter\r\n\t\tvar filterEnv = EnvGen.kr(Env.adsr(filterAttack, filterDecay, filterSustain, filterRelease), gate) * filterMult;\r\n\t\tvar filter = BLowPass.ar(comb2, freq * filterEnv, filterRQ) * filterAmp;\r\n\t\t//Out\r\n\t\tvar ampEnv = EnvGen.kr(Env.adsr(ampAttack, ampDecay, ampSustain, ampRelease), gate, doneAction:2) * amp;\r\n\t\tOut.ar(out, filter * ampEnv);\r\n    }).add;\r\n\r\n\tSynthDef(\\slowFX, {|out = 0, in, amp = 0.1|\r\n\t\tvar inSig = In.ar(in, 2);\r\n\t\tinSig = GVerb.ar(inSig);\r\n\t\tinSig = Compander.ar(inSig, inSig, 0.5, 1, 1/16);\r\n\t\tinSig = HPF.ar(inSig, 100) * SinOsc.ar(80);\r\n\t\tOut.ar(out, inSig * amp);\r\n\t}).add;\r\n\r\n\tSynthDef(\\verb, {|out = 0, in, amp = 0.3, roomsize = 10, revtime = 3|\r\n\t\tvar inSig = In.ar(in, 2);\r\n\t\tinSig = inSig + (GVerb.ar(inSig, roomsize, revtime) * 0.3);\r\n\t\tinSig = Compander.ar(inSig, inSig, 0.5, 1, 1/16);\r\n\t\tOut.ar(out, inSig * amp);\r\n\t}).add;\r\n\r\n\tSynthDef(\\deciVerb, {|out = 0, in, amp = 0.2|\r\n\t\tvar inSig = In.ar(in, 2);\r\n\t\tinSig = Decimator.ar(inSig, 5e3, 16);\r\n\t\tinSig = Compander.ar(inSig, inSig, 0.5, 1, 1/16);\r\n\t\tOut.ar(out, inSig * amp);\r\n\t}).add;\r\n\r\n\t//--------------------Sync--------------------\r\n\ts.sync;\r\n\r\n\t//--------------------Create Morse--------------------\r\n\tmorse = createMorse.(phrase);\r\n\r\n\t//-----Groups and Busses-----\r\n\tgroup = ();\r\n\tgroup.synths = Group.new;\r\n    group.fx = Group.after(group.synths);\r\n    mainOut = 0;\r\n\tbus = ();\r\n\tbus.modVerb = Bus.audio(s, 2);\r\n\tbus.smallVerb = Bus.audio(s, 2);\r\n\tbus.verb = Bus.audio(s, 2);\r\n\tbus.deciVerb = Bus.audio(s, 2);\r\n\r\n\t//--------------------Cleanup--------------------\r\n\tCmdPeriod.doOnce{\r\n\t\tbus.modVerb.free;\r\n\t\tbus.verb.free;\r\n\t\tbus.deciVerb.free;\r\n\t\tbus.smallVerb.free;\r\n\t};\r\n\r\n\t//--------------------FX Synths--------------------\r\n\tfxSynth = ();\r\n\tfxSynth.deciVerb = Synth(\\deciVerb, [\\in, bus.deciVerb, \\out, mainOut], target: group.fx);\r\n\tfxSynth.modVerb = Synth(\\slowFX, [\\in, bus.modVerb, \\out, mainOut], target: group.fx);\r\n\tfxSynth.smallVerb = Synth(\\verb, [\\in, bus.smallVerb, \\out, mainOut, \\roomsize, 10, \\revtime, 1.5], target: group.fx);\r\n\tfxSynth.verb = Synth(\\verb, [\\in, bus.verb, \\out, mainOut], target: group.fx);\r\n\r\n\t//--------------------Pattern--------------------\r\n\tpatBass = Pbind(*[instrument: \\morseTone, freq: 60, wobbleDepth: 0, dur: morse.durStream * 0.25, amp: 0.3, pan: Pseq((1!morse.numEvents).add(-1!morse.numEvents).flatten, 4), out: bus.deciVerb ]);\r\n\tpatMorse = Pbind(*[instrument: \\morseTone, wobbleDepth: Pwhite(3.0, 10.0), dur: morse.durStream, amp: 0.3, pan: Pseq((1!morse.numEvents).add(-1!morse.numEvents).flatten, 2), out: bus.smallVerb ]);\r\n\tpatMorseFast = Pbind(*[instrument: \\morseTone, freq: 600, wobbleDepth: Pwhite(3.0, 10.0), dur: morse.durStream * 0.5, amp: 0.2, pan: Pseq((1!morse.numEvents).add(-1!morse.numEvents).flatten, 4), out: bus.smallVerb]);\r\n\tpatMorseDeci = Pbind(*[instrument: \\morseTone, wobbleDepth: Pwhite(3.0, 10.0), dur: morse.durStream, amp: 0.2, pan: Pseq((1!morse.numEvents).add(-1!morse.numEvents).flatten, 2), out: bus.deciVerb ]);\r\n\tpatKick = Pbind(*[instrument: \\AEKick, dur: Pseq((morse.numBeats/2!2).add(Rest(morse.numBeats/2)!2).flatten, 4), amp: 0.2, decay: 0.3, out: bus.verb]);\r\n\tpatPad = Pbind(*[instrument: \\slowPad, dur: Pn(morse.numBeats * 4, 2), amp: 0.7, out: bus.modVerb]);\r\n\tpatKickAndPad = Ppar([patKick, patPad]);\r\n\tpatMainLoop = Ptpar([\r\n\t\t000.0, patMorse,\r\n\t\t000.0, patKick,\r\n\t\t000.0, patPad,\r\n\t\tmorse.numBeats * 4, patMorse,\r\n\t\tmorse.numBeats * 4, patMorseFast\r\n\t]);\r\n\tpatBassLoop = Ptpar([\r\n\t\t000.0, patBass,\r\n\t\tmorse.numBeats * 4, patBass\r\n\t]);\r\n\tpatMorseDeciLoop = Ptpar([\r\n\t\t000.0, patMorseDeci,\r\n\t\tmorse.numBeats * 4, patMorseDeci\r\n\t]);\r\n\tpatFullSong = Ptpar([\r\n\t\t000.0, patKickAndPad,\r\n\t\tmorse.numBeats * 8, patMainLoop,\r\n\t\tmorse.numBeats * 16, patMainLoop, morse.numBeats * 16, patBassLoop,\r\n\t\tmorse.numBeats * 24, patMainLoop, morse.numBeats * 24, patBassLoop, morse.numBeats * 24, patMorseDeciLoop,\r\n\t\tmorse.numBeats * 32, patPad, morse.numBeats * 32, patMorseDeciLoop\r\n\t]);\r\n\r\n\t//--------------------Output--------------------\r\n\t'-----MORSE-----'.postln; morse.dopostln;\r\n\t'-----GROUPS-----'.postln; group.dopostln;\r\n\t'-----BUSSES-----'.postln; bus.dopostln;\r\n\t'-----FX SYNTHS-----'.postln; fxSynth.dopostln;\r\n\r\n\t//--------------------Play--------------------\r\n\tpatFullSong.play(songClock)\r\n}\r\n)",
   "is_private" : null,
   "id" : "1-4RT",
   "labels" : [
      "disquiet junto",
      "disquiet",
      "junto",
      "disquiet0050morsebeat",
      "morse code"
   ]
}
