Tied Note Example Steven Yi Example instruments and score written for "Exploring Tied Notes in Csound" article in The Csound Journal, Volume 1, Issue 1. 44100 10 2 44100 1 2 true false false false true true true true csound true test.wav false true true true true false true 0 false Normal Instrument idur = abs(p3) ipch = cpspch(p4) iamp = ampdb(p5) kenv adsr .05, .05, .9, .05 kvibEnv linseg 0, .05, 3, idur - .05, 4 kvib lfo kvibEnv, 4.5 afeedback init 0 aout vco2 1, ipch + kvib aout moogladder aout, 4000, 0.5 aout = aout + afeedback adelay delay aout * .2, 0.02 aout = aout + adelay afeedback = aout * .2 aout = aout * iamp * kenv outs aout, aout Type 1 Instrument (Monosynth) idur = abs(p3) ipch = cpspch(p4) iamp = ampdb(p5) itiestatus tieStatus iskip tival tigoto skipInit ioldpch init ipch afeedback init 0 ioldamp init iamp skipInit: inewpch = ipch inewamp = iamp kpchline linseg ioldpch, .05, inewpch, idur - .05, inewpch kampline linseg ioldamp, .05, inewamp, idur - .05, inewamp ioldpch = inewpch ioldamp = inewamp print itiestatus if (itiestatus == -1) then kenv adsr .05, .05, .9, .05 elseif (itiestatus == 0) then kenv linseg 0, .05, 1, .2, 1 elseif (itiestatus == 1) then kenv init 1 elseif (itiestatus == 2) then kenv linseg 1, idur - .05, 1, .05, 0 endif kvibEnv linseg 0, .2, 3, idur - .2, 4 kvib lfo kvibEnv, 4.5 aout vco2 1, kpchline + kvib, iskip aout moogladder aout, 4000, 0.5, iskip aout = aout + afeedback adelay delay aout * .2, 0.02, iskip aout = aout + adelay afeedback = aout * .2 aout = aout * kampline * kenv outs aout, aout Type 2 Instrument (Glissandi) p3 = (p3 < 0) ? p3 - 1 : p3 + 1 idur = abs(p3) ipch = p4 ipch2 = p5 ipch = (ipch < 15 ? cpspch(ipch) : ipch) ipch2 = (ipch2 < 15 ? cpspch(ipch2) : ipch2) ;kpchline line ipch, p3, ipch2 iamp = ampdb(p6) iSpace = p7 ienvType = p8 imode = 1 istor = 1 itiestatus tieStatus iskip tival tigoto skipInit ioldpch init ipch afeedback init 0 skipInit: ;print itiestatus if (itiestatus == -1) then kenv adsr .05, .05, .9, .05 kpchline init ipch kamp init iamp elseif (itiestatus == 0) then kenv linseg 0, .05, 1, .2, 1 kpchline init ipch kamp init iamp ioldpch = ipch ioldamp = iamp elseif (itiestatus == 1) then kenv init 1 kpchline line ioldpch, idur, ipch kamp line ioldamp, idur, iamp ioldpch = ipch ioldamp = iamp elseif (itiestatus == 2) then kenv linseg 1, idur - .05, 1, .05, 0 kpchline line ioldpch, idur, ipch kamp line ioldamp, idur, iamp endif ;print itiestatus aout vco2 1, kpchline, iskip aout moogladder aout, 4000, 0.5, iskip aout = aout + afeedback print iskip adelay delay aout * .2, 0.02, iskip aout = aout + adelay afeedback = aout * .2 aout = aout * iamp * kenv iSpace = iSpace * 3.14159265359 * .5 krtl = sqrt(2) / 2 * (cos(iSpace) + sin(iSpace)) ; CONSTANT POWER PANNING krtr = sqrt(2) / 2 * (cos(iSpace) - sin(iSpace)) ; FROM C.ROADS "CM TUTORIAL" pp460 aLeft = aout * krtl aRight = aout * krtr outs aLeft, aRight false 0.0 1 Master 0.0 false false 2 Master 0.0 false false 3 Master 0.0 false false Master Master 0.0 false false tieStatus i 0 itie tival if (itie == 0 && p3 < 0) ithen ; this is an initial note within a group of tied notes itiestatus = 0 elseif (p3 < 0 && itie == 1) ithen ; this is a middle note within a group of tied notes itiestatus = 1 elseif (p3 > 0 && itie == 1) ithen ; this is an end note out of a group of tied notes itiestatus = 2 elseif (p3 > 0 && itie == 0) ithen ; this note is a standalone note itiestatus = -1 endif xout itiestatus csound -Wdo devaudio -L stdin true true 2.0 0.0 root -10066279 0 true 26 1 true 1.0 1 4 6.0 0.0 GenericScore -12566464 0 i1 0 .25 9.04 80 i1 + . 8.07 > i1 + . 9.04 > i1 + . 8.07 > i1 + . 9.04 > i1 + . 8.07 > i1 + . 9.04 > i1 + . 8.07 70 i1 + . 9.02 80 i1 + . 8.07 > i1 + . 9.02 > i1 + . 8.07 > i1 + . 9.02 > i1 + . 8.07 > i1 + . 9.02 > i1 + . 8.07 70 6.0 7.0 GenericScore -12566464 0 i1.1 0 -.25 9.04 80 i1.1 + . 8.07 > i1.1 + . 9.04 > i1.1 + . 8.07 > i1.1 + . 9.04 > i1.1 + . 8.07 > i1.1 + . 9.04 > i1.1 + .25 8.07 70 i1.1 + -.25 9.02 80 i1.1 + . 8.07 > i1.1 + . 9.02 > i1.1 + . 8.07 > i1.1 + . 9.02 > i1.1 + . 8.07 > i1.1 + . 9.02 > i1.1 + .25 8.07 70 6.0 14.0 GenericScore -12566464 0 i2 0 .25 9.04 80 i2 + . 8.07 > i2 + . 9.04 > i2 + . 8.07 > i2 + . 9.04 > i2 + . 8.07 > i2 + . 9.04 > i2 + . 8.07 70 i2 + . 9.02 80 i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 70 6.0 21.0 GenericScore -12566464 0 i2 0 -.25 9.04 80 i2 + . 8.07 > i2 + . 9.04 > i2 + . 8.07 > i2 + . 9.04 > i2 + . 8.07 > i2 + . 9.04 > i2 + .25 8.07 70 i2 + -.25 9.02 80 i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + .25 8.07 70 6.0 27.0 GenericScore -12566464 0 i2 0 -.25 9.00 80 i2 + . 8.07 > i2 + . 9.00 > i2 + . 8.07 > i2 + . 9.00 > i2 + . 8.07 > i2 + . 9.00 > i2 + .25 8.07 70 i2 + -.25 9.02 80 i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + . 8.07 > i2 + . 9.02 > i2 + .25 8.07 70 6.0 34.0 PythonObject -12566464 0 from orchestra import * score = "test" def getXValue(index, numNotes): x = index halfNum = numNotes / 2.0 if x > halfNum: x = 1 - ((x - halfNum) / halfNum) else: x = x / halfNum return x def createUnstableGroup(numNotes, pch, ampStart, ampEnd): dur = .4 ampM = ampEnd - ampStart retVal = "0 -%f %f 1 %f 3\n"%(dur, pch,ampStart) for i in range(1, numNotes): x = getXValue(i, numNotes) ampVal = (ampM * x) + ampStart pchVal = pch + (random.random() * .01 * x) if(i == (numNotes - 1)): retVal += "+ %f %f . %f .\n"%(dur, pchVal, ampVal) else: retVal += "+ . %f . %f .\n"%(pchVal, ampVal) notes = createNoteList(retVal) return notes # SETUP PERFORMERGROUPS groupA = PerformerGroup() for i in range(8): performerNum = "3.0%d" % i print performerNum groupA.append( Performer(performerNum, 1, -.3 + (i / 12.0) * .6) ) groupB = PerformerGroup() for i in range(8): performerNum = "3.%2d" % (i + 10) print performerNum groupB.append( Performer(performerNum, 1, -.3 + (i / 12.0) * .6) ) groupC = PerformerGroup() for i in range(12): performerNum = "3.%2d" % (i + 20) groupC.append( Performer(performerNum, 1, -.3 + (i / 12.0) * .6) ) groupD = PerformerGroup() for i in range(12): performerNum = "3.%2d" % (i + 35) print performerNum groupD.append( Performer(performerNum, 1, -.3 + (i / 12.0) * .6) ) 6.0 21.0 Chords -12566464 0 i1 0 1 7.07 70 i1 0 . 8.00 70 i1 0 . 8.04 70 i1 1 1 7.07 70 i1 1 . 7.11 70 i1 1 . 8.04 70 6.0 27.0 Chords -12566464 0 i1 0 1 7.00 70 i1 0 . 8.00 70 i1 0 . 8.04 70 i1 1 1 7.07 70 i1 1 . 7.11 70 i1 1 . 8.04 70 6.0 0.0 Chords -12566464 0 i1 0 1 7.07 70 i1 0 . 8.00 70 i1 0 . 8.04 70 i1 1 1 7.07 70 i1 1 . 7.11 70 i1 1 . 8.04 70 6.0 7.0 Chords -12566464 0 i1 0 1 7.07 70 i1 0 . 8.00 70 i1 0 . 8.04 70 i1 1 1 7.07 70 i1 1 . 7.11 70 i1 1 . 8.04 70 6.0 14.0 Chords -12566464 0 i1 0 1 7.07 70 i1 0 . 8.00 70 i1 0 . 8.04 70 i1 1 1 7.07 70 i1 1 . 7.11 70 i1 1 . 8.04 70 6.0 34.0 Group A -12566464 0 notes = createUnstableGroup(20, 8.00, 63, 74) score = groupA.performAleatorically(notes, .2, .05, 0, blueDuration, 3) 6.0 35.0 Group B -12566464 0 notes = createUnstableGroup(20, 8.01, 63, 74) score = groupB.performAleatorically(notes, .2, .05, 0, blueDuration, 3) 6.0 38.0 Group C -12566464 0 notes = createUnstableGroup(20, 9.02, 63, 74) score = groupC.performAleatorically(notes, .2, .05, 0, blueDuration, 3) 6.0 39.0 Group D -12566464 0 notes = createUnstableGroup(20, 9.01, 63, 74) score = groupD.performAleatorically(notes, .2, .05, 0, blueDuration, 3) true 0.0 -1.0 false false false PCH MIDI 12TET 261.62558 2.0 1.0 1.0594631 1.122462 1.1892071 1.2599211 1.3348398 1.4142135 1.4983071 1.587401 1.6817929 1.7817974 1.8877486