Unstill Light Dave Seidel For Greg Schiemer and Warren Burt. Copyright (c) 2008 Dave Seidel, some rights reserved. This work is licensed under a Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0/). For more information, go to http://mysterybear.net/article/30/unstill-light Add the following lines after <CsoundSynthesizer> and before <CsInstruments> below, uncomment by removing the leading semicolons, then edit as desired. *** START OF OPTIONS *** <CsOptions> ;; 96K/24-bit ;--sample-rate=96000 --control-rate=96000 --format=wav:24bit -o "UnstillLight-(96-24).wav" ;; 44.1K/16-bit --sample-rate=44100 --control-rate=44100 --format=wav:short -o "UnstillLight-(44-16).wav" </CsOptions> *** END OF OPTIONS *** 44100 100 2 96000 1 2 true false false false true true true true false render\UnstillLight.wav false true true true true false false 0 false modified Scheimer epimoric chorus The is based on an instrument designed by Greg Scheimer (http://www.uow.edu.au/crearts/staff/schiemer.html) for his wonderful piece "Tempered Dekanies" (http://www.uow.edu.au/crearts/staff/schiemer/ICMPC7.pdf). idur = p3 iamp = ampdb(p4) ifreq = p5 itable = p6 irise = p7 ifall = p8 kfreq = ifreq Smsg strget p9 puts Smsg, 1, 1 prints ": %f\\n", ifreq ibend1 = 1021/1020 ibend2 = 1020/1019 kover linen iamp, irise, idur, ifall k5 = ifreq * ibend1 k6 = ifreq * ibend2 k7 = ifreq * (2-ibend1) k8 = ifreq * (2-ibend2) a0 poscil3 kover, kfreq, itable a1 poscil3 kover, k5, itable a2 poscil3 kover, k6, itable a3 poscil3 kover, k7, itable a4 poscil3 kover, k8, itable asigl = a0 + a1 + a4 asigr = a0 + a2 + a3 blueMixerOut asigl, asigr simple ring modulator idur = p3 iamp = ampdb(p4) ifreq1 = p5 ifreq2 = p6 itable = p7 irise = p8 ifall = p9 ipan = p10 kenv linen iamp, irise, idur, ifall a1 poscil3 kenv, ifreq1, itable a2 poscil3 kenv, ifreq2, itable a3 = a1 * a2 asigl, asigr yipan ipan, a3 blueMixerOut asigl, asigr true 2.0 4 Master -2.0 false false 5 Master 3.0 false false ReverbSC true 2 2 aout1, aout2 reverbsc ain1, ain2, <feedback>, <cutoff> aout1 = (ain1 * <wetdry>) + (aout1 * (1 - <wetdry>)) aout2 = (ain2 * <wetdry>) + (aout2 * (1 - <wetdry>)) 7 7 feedback 8 55 true 0.0 1.0 0.8896358 60 true 11 36 cutoff 72 55 true 20.0 20000.0 8000.0 60 true 80 36 wetdry 136 55 true 0.0 1.0 0.5209015 60 true 139 36 Master Master -0.5 false false ; sine wave table gifn1 ftgen 1, 0, 1048577, 10, 1 yipan aa ia iSpace,aout xin iSpace = iSpace * 3.14159265359 * .5 krtl = sqrt(2) / 2 * (cos(iSpace) + sin(iSpace)) krtr = sqrt(2) / 2 * (cos(iSpace) - sin(iSpace)) aLeft = aout * krtl aRight = aout * krtr xout aLeft, aRight csound -Wdo devaudio -L stdin false false 2.0 0.0 root -10066279 0 true 12 0 true 1.0 0 5 11.0 0.0 PythonObject -16737895 0 '''rational.py: Module to do rational arithmetic. For full documentation, see http://www.nmt.edu/tcc/help/lang/python/examples/rational/. Exports: gcd ( a, b ): [ a and b are integers -> return the greatest common divisor of a and b ] Rational ( a, b ): [ (a is a nonnegative integer) and (b is a positive integer) -> return a new Rational instance with numerator a and denominator b ] .n: [ the numerator ] .d: [ the denominator ] .__add__(self, other): [ other is a Rational instance -> return the sum of self and other as a Rational instance ] .__sub__(self, other): [ other is a Rational instance -> return the difference of self and other as a Rational instance ] .__mul__(self, other): [ other is a Rational instance -> return the product of self and other as a Rational instance ] .__div__(self, other): [ other is a Rational instance -> return the quotient of self and other as a Rational instance ] .__str__(self): [ return a string representation of self ] .__float__(self): [ return a float approximation of self ] .mixed(self): [ return a string representation of self as a mixed fraction ] ''' def gcd ( a, b ): '''Greatest common divisor function; Euclid's algorithm. [ a and b are integers -> return the greatest common divisor of a and b ] ''' if b == 0: return a else: return gcd(b, a%b) class Rational: """An instance represents a rational number. """ def __init__ ( self, a, b ): """Constructor for Rational. """ if b == 0: raise ZeroDivisionError, ( "Denominator of a rational " "may not be zero." ) else: g = gcd ( a, b ) self.n = a / g self.d = b / g def __add__ ( self, other ): """Add two rational numbers. """ return Rational ( self.n * other.d + other.n * self.d, self.d * other.d ) def __sub__ ( self, other ): """Return self minus other. """ return Rational ( self.n * other.d - other.n * self.d, self.d * other.d ) def __mul__ ( self, other ): """Implement multiplication. """ return Rational ( self.n * other.n, self.d * other.d ) def __div__ ( self, other ): """Implement division. """ return Rational ( self.n * other.d, self.d * other.n ) def __str__ ( self ): '''Display self as a string. ''' return "%d/%d" % ( self.n, self.d ) def __float__ ( self ): """Implement the float() conversion function. """ return float ( self.n ) / float ( self.d ) def mixed ( self ): """Render self as a mixed fraction in string form. """ #-- 1 -- # [ whole := self.n / self.d, truncated # n2 := self.n % self.d ] whole, n2 = divmod ( self.n, self.d ) #-- 2 -- # [ if (whole is zero) and (n2 is zero) -> # return "0" # else if (whole is zero) and (n2 is nonzero) -> # return str(n2)+"/"+str(self.d) # else if n2 is zero -> # return str(whole) # else -> # return str(whole)+" and "+str(n2)+"/"+str(self.d) ] if whole == 0: if n2 == 0: return "0" else: return ("%s/%s" % (n2, self.d) ) else: if n2 == 0: return str(whole) else: return ("%s and %s/%s" % (whole, n2, self.d) ) 11.0 0.0 PythonObject -16737895 0 class Epimore: def __init__(self, numerator): # by definition, this instance represents numerator/numerator-1 denominator = numerator - 1 # save the original value self.source = Rational(numerator, denominator) self.source_s = "%d/%d" % (numerator, denominator) # compute harmonic mean (hm) and arithmetic mean (am) n2 = numerator*2 d2 = denominator*2 middle = d2 + ((n2 - d2) / 2) self.hm = Rational(middle, d2) self.hm_s = "%d/%d" % (middle, d2) self.am = Rational(n2, middle) self.am_s = "%d/%d" % (n2, middle) # compute Tiepstra's "significant relation" (difference between am and hm) temp = self.am / self.hm self.sr = Rational(temp.d, temp.n) self.sr_s = "%d/%d" % (temp.d, temp.n) 11.0 0.0 PythonObject -16737895 0 # base frequency _base = 480 # array of Epimore instances _epimores = [ Epimore(2), Epimore(3), Epimore(4), Epimore(5), Epimore(6), Epimore(7), Epimore(8), Epimore(9), ] def getSource(i): epi = _epimores[i] return _base * (float(epi.source.n) / float(epi.source.d)) def getSource_s(i): return _epimores[i].source_s def getSourceInv(i): epi = _epimores[i] return _base * (float(epi.source.d) / float(epi.source.n)) def getHM(i): epi = _epimores[i] return _base * (float(epi.hm.n) / float(epi.hm.d)) def getHM_s(i): return _epimores[i].hm_s def getHMInv(i): epi = _epimores[i] return _base * (float(epi.hm.d) / float(epi.hm.n)) 60.0 15.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(1), getSource_s(1)) 60.0 75.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(2), getSource_s(2)) 60.0 135.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(3), getSource_s(3)) 60.0 195.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(4), getSource_s(4)) 60.0 255.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(5), getSource_s(5)) 60.0 315.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(6), getSource_s(6)) 82.0 375.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper epimore: %s\"" % (getSource(7), getSource_s(7)) 60.0 25.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(1), getHM_s(1)) 60.0 85.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(2), getHM_s(2)) 60.0 145.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(3), getHM_s(3)) 60.0 205.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(4), getHM_s(4)) 60.0 265.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(5), getHM_s(5)) 60.0 325.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(6), getHM_s(6)) 60.0 385.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"upper harmonic mean: %s\"" % (getHM(7), getHM_s(7)) 467.0 0.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"1/1\"" % (_base) 8.0 469.0 Comment -12566464 was 405 start, 62 length 60.0 20.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(1)) 60.0 80.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(2)) 60.0 140.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(3)) 60.0 200.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(4)) 60.0 260.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(5)) 60.0 320.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(6)) 60.0 380.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted harmonic mean\"" % (getHMInv(7)) 60.0 10.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(1)) 60.0 70.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(2)) 60.0 130.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(3)) 60.0 190.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(4)) 60.0 250.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(5)) 60.0 310.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(6)) 87.0 370.0 PythonObject -12566464 0 score = "i4 0.0 1.0 69 %f 1 2.0 2.0 \"inverted epimore\"" % (getSourceInv(7)) 467.0 0.0 PythonObject -12566464 0 i = 0 db = 31 f1 = getSourceInv(i) f2 = getHMInv(i) f3 = getSource(i) f4 = getHM(i) s1 = "i5 0.0 1.0 %f %f %f 1 4.0 2.0 0.0\n" % (db, _base, f1) s2 = "i5 0.0 1.0 %f %f %f 1 4.0 2.0 0.0\n" % (db, _base, f2) s3 = "i5 0.0 1.0 %f %f %f 1 4.0 2.0 0.0\n" % (db, _base, f3) s4 = "i5 0.0 1.0 %f %f %f 1 4.0 2.0 0.0\n" % (db, _base, f4) score = s1 + s2 + s3 + s4 true 0.0 -1.0 false false false