UntiteledJan Jacob Hofmann
; *******************************************************************************************************************************
; Version 0.56 , Feb 2nd 2012 coded 1999-2012 by Jan Jacob Hofmann
; jjh@sonicarchitecture.de +++ http://www.sonicarchitecture.de
; Comments and suggestions welcome.
; For non-comercial, artistic, scientific and educational use only - all rights reserved
; *******************************************************************************************************************************
; This is a sequence of instruments for periphonic spatialisation of any sound input using the 2nd order Ambisonics
; and the Furse- Malham set of equations. It was conceived and coded 1999-2005 by Jan Jacob Hofmann.
; The Instrument is able to spatialize up to 20 soundsources simultaneously (this can be enhanced). To each
; source a trajectory is assigned, so independent movement of the sounds is possible.
; Besides assigning a position in space via Ambisonics, several distance clues are coded separately to enhance
; the perception of distance and depth. These are: lowpassfiltering according to distance, attenuation
; according to distance, ratio of global and local reverb, ratio of reverberated and direct sound, first 6 specular
; early reflections with position and energy of reflections changing according to the position of the sound in space,
; first 6 diffuse early reflections with position and energy of reflections changing according to the position of the sound in space.
; The early reflections also do increase the transparency of the perceived image. Also Doppler Frequency Shift is
; applied to the source.
; Remember that distribution of the sound works best with multi- speaker arrays. You do definitely need more than
; two speakers, this is not binauralisation, which would work with headphones and only two channels. Minimum for panphony
; is 4 speakers, although 5 are recomended. For periphony the minimum is an eight speakers cube, but twelve speakers
; are highly recomended. The speakers have to be same type, in-phase, and at the exact geometric location for which the decoding
; was made for.
; Setting up the test
; To get a quick overview please use the soundfile "test1" (e.g. Dr. Boulangers Speech)
; and put them into the "Sound Sample Directory". Now make 7 copies of the file "Test1" and
; name them "test2" through "test8". They represent your audio tracks to be fed into the "Soundfile Reader". Then set the number
; of decoding- channels ("nchnls ") to "2" for stereo listening .
; make sure that you specify for every track a continouus trajectory in Instr. 42/46
; Now render. If you have chosen more speakers than two, it is important to pass the generated encoded files to the decoder (see "Ambidec.orc")
; and decode according to your listening conditions (stereo? eight speakers? sixteen?). it shoud generate files that
; can be read by your sound editor. Import them into your editor and assign the channels to the speakers according to the position
; of the speaker. See "Ambidec.orc" for correct assignment. Now play the soundfiles simultaneously, each feeding one speaker.
; How to use this orchestra
; This orchestra works in several steps:
; - First a trajectory is generated (xyz is converted to angle, elevation and distance automatically by instr. 42)
; - Optional: trajectory may be modulated (instr 47 +48)
; - the soundfile is read, Doppler shift is applied (instr 50)
; - Local reverb is generated (instr 60)
; - The sound is spatially encoded, local reverb is added to the sound (instr 72)
; - Global reverb is added
; - Early reflections are added (instr 74+75)
; - Sound is collected and written to disk (instr 80)
; You may read up to 16 tracks into the orchestra simultaneously. The name of the track has to be specified in instr 50.
; To each track you have to generate a trajectory by using either Cartesian coordinates (instr. 40) or polar co-ordinates (instr 46).
; You may divide up the total time of the soundfile for several trajectories and positions in space, but these must sum up at the end to
; an equivalent to the total duration of the track processed. There must be neither overlaps nor gaps in the sequence of trajectories generated,
; one trajectory should follow the other. you may modulate any trajectory by any amount using the "Modulator" (instr. 47) or the
; Randomiser (instr. 48) This modulation may be used at any time. Also multiple instances of this modulations are possible to generate
; complex movements in space automatically by the sum of the modulating waveforms. Instr. 50 is the soundfile reader, you can specify the
; duration and track -number of the soundfile to be processed. This Instrument also triggers the local reverb and the first reflections (Instr. 74 and 75)
; adjust the parameters to taste.
; Instr. 73 is the Global Spatial Reverb. Reverberation occurs from 12 different positions in space, equaly distributed at the unit-sphere. It also
; triggers the output (Instr. 80), so make sure it is running all the time.
; Instr 74 and 75 do add specular and diffuse early reflections, also spatially distributed to each track independently. To save computing
; time these instruments should be activated only for the final rendering.
; Note: The output soundfiles may distort. You can scale them by dividing 32768 by the highest peak of them and put the result into
; "girescale", close to the header.
; **************************************************************************************
; Please send comments and bug reports to jjh@sonicarchitecture.de on http://www.sonicarchitecture.de you will also find a small Ambisonic-tutorial.
; More info:
; To find out more about Ambisonics, see
; http://www.ambisonic.net/
; http://www.york.ac.uk/inst/mustech/3d_audio/ambison.htm (University of York)
; http://www.york.ac.uk/inst/mustech/3d_audio/ambison.htm (Richard Furse's pages)
; Credits:
; Thanks to Richard Furse and Dave Malham for the wonderful 2nd order equations. Also special thanks to Nora Bluhme,
; Ingo Herwig and Christoph Schuller for helping me with the math. Last not least thanks to all csounders who made this
; possible by their contribution of work and thoughts!!!480001024800012truefalsefalsefalsetruetruetruefalse-3 -AfalseName.aiftruetruetruetruefalse-3 -A falsetrue0falseFrozen SoundObject Player InstrumentaChannel1, aChannel2, aChannel3, aChannel4, aChannel5, aChannel6, aChannel7, aChannel8 diskin p4, 1
outc aChannel1, aChannel2, aChannel3, aChannel4, aChannel5, aChannel6, aChannel7, aChannel8Reverb SC
israte = sr
keffmix = <effmix>
krvbdecay = <reverbdecay>
kcutofffreq = <cuttofffreq>
irandpchmod = <randompitchmodulation>
; INPUT OF CHANNELS
; read in signal to effect-position 1
asig inleta "aeff_1_in" ; input signal
; SIGNAL MODIFICATION
aL, aR reverbsc asig, asig, krvbdecay, kcutofffreq, israte, irandpchmod, 1 ; generate effect
aeff sum aL , aR ; sum channels
aeff = aeff * keffmix + asig * ( 1 - keffmix) ; mix of direct / effect signal
outleta "aeff_1_out", aeff
reverbdecay6760true0.011.00.890932260true57153191153cuttofffreq39364true0.022000.018582.44160true386153randompitchmodulation22394150effmix62228true0.01.00.10.4200true62268Envelope Generator (sigmoid); FUNCTION TABLE READING ENVELOPE GENERATOR
idur = p3
idurprolong = p4
idur = idur - idurprolong ; use original duration
katt = <attack> * 0.01 ; attack [%]
ienvfn = <envfn> ; envelope fn 1 of grain [e.g. 8 = sigmoid rising]
ktrig init 1
cycle: ; start of (re)init pass
iatt = i(katt) ; convert k- to i-rate
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
endif
ktrig = 0 ; avoid repeating this every k-cycle
; ENVELOPE
aenvndx linseg 0, idur * iatt, 1, idur - idur * iatt, 0 ; moving pointer for envelope fn
rireturn ; end of (re)init pass
aenv tablei aenvndx, ienvfn, 1 ; creating the sigmoid envelope
outc aenv25484envfn9819685098226attack3245true0.0199.90.183.21001400trueEnvelope Generator ADSR (absolute time); ADSR ENVELOPE WITH ABSOLUTE TIME
ienv = p4
katt = <attack> ; attack [s]
kdec = <decay> ; decay [s]
kslev = <sustain> ; sustain level [0-1]
krel = <release> ; decay [s]
ktrig init 1
cycle: ; start of (re)init pass
iatt = i(katt) ; convert k- to i-rate
idec = i(kdec) ; convert k- to i-rate
islev = i(kslev) ; convert k- to i-rate
irel = i(krel) ; convert k- to i-rate
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
ktrig = 0 ; avoid repeating this every k-cycle
endif
; ENVELOPE
aenv adsr iatt, idec, islev, irel ; creating the adsr envelope
rireturn ; end of (re)init pass
; OUTPUT
outc aenv ; output of EG
92477attack9231true0.0110.01.02.01400true181477decay18031true0.0110.01.01.01400true241477sustain26831true0.01.00.11.0400true352477release35931true0.0110.01.03.01400trueEnvelope Generator ADSR (relative time; ADSR ENVELOPE WITH RELATIVE TIME
idur = p3
idurprolong = p4 ; instrument duration
katt = <attack> * 0.01 ; attack [%]
kdec = <decay> * 0.01 ; decay [%]
kslev = <sustain> ; sustain level [0-1]
krel = <release> * 0.01 ; decay [%]
idur = idur - idurprolong ; no extra instrument performance
ktrig init 1
cycle: ; start of (re)init pass
iatt = i(katt) ; convert k- to i-rate
idec = i(kdec) ; convert k- to i-rate
islev = i(kslev) ; convert k- to i-rate
irel = i(krel) ; convert k- to i-rate
; ENVELOPE
aenv adsr iatt * idur, idec * idur, islev, irel * idur ; creating the adsr envelope
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
ktrig = 0 ; avoid repeating this every k-cycle
endif
rireturn ; end of (re)init pass
; OUTPUT
outc aenv91476attack9331true0.0199.01.010.01400true181477decay18032true0.0199.01.031.01400true241477sustain26831true0.01.00.11.0400true352477release35931true0.0199.01.00.01400trueEnvelope Generator Expsegidur = p3
idurprolong = p4
idur = idur - idurprolong ; no extra instrument performance
katt = <Attack> * 0.01 ; attack [percent of note duration]
kdec = <Decay> * 0.01 ; decay [percent of note duration]
krel = <Release> * 0.01 ; release [percent of note duration]
ktrig init 1
cycle: ; start of (re)init pass
aenv expseg .001, idur * i(katt), 1.001, idur * i(kdec), .001, idur - i(katt + kdec), .001
rireturn ; end of (re)init pass
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
ktrig = 0 ; avoid repeating this every k-cycle
endif
; OUTPUT
outc aenv ; output of EG
Attack8496true0.0100.00.10.0300false48449265452Decay30196true0.0100.00.10.0300falseEnvelope Generator Sweepidur = p3 ; duration
ienvfn = abs(p4) ; envfn
ifndir = p4 / ienvfn ; negative fn causes backwards reading
ifnamp = p5
aenv oscil ifnamp, ifndir * (1/idur), ienvfn ; generation of envelope during note
; OUTPUT
outc aenv ; output of EG
Additive Synth (inharmonic)0dbfs = 1; Written by Iain McCurdy, 2006
; Modified for QuteCsound by Ren?, September 2010
; Tested on Ubuntu 10.04 with csound-double cvs August 2010 and QuteCsound svn rev 733
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0 --midi-key-oct=4 --midi-velocity-amp=5
ktrig init 1
cyclestart:
;GUI
kPartAmp_1 = <PartAmp_0> ; amplitude of partial
kPartAmp_2 = <PartAmp_1> ; amplitude of partial
kPartAmp_3 = <PartAmp_2> ; amplitude of partial
kPartAmp_4 = <PartAmp_3> ; amplitude of partial
kPartAmp_5 = <PartAmp_4> ; amplitude of partial
kPartAmp_6 = <PartAmp_5> ; amplitude of partial
kPartAmp_7 = <PartAmp_6> ; amplitude of partial
kPartAmp_8 = <PartAmp_7> ; amplitude of partial
kPartAmp_9 = <PartAmp_8> ; amplitude of partial
kPartAmp_10 = <PartAmp_9> ; amplitude of partial
kfund = <FundFreq> ; fundamental frequency
kamp = <Amplitude> ; overall amplitude
kratio_1 = <Ratio_0> ; ratio of the fundamental
kratio_2 = <Ratio_1> ; ratio of the fundamental
kratio_3 = <Ratio_2> ; ratio of the fundamental
kratio_4 = <Ratio_3> ; ratio of the fundamental
kratio_5 = <Ratio_4> ; ratio of the fundamental
kratio_6 = <Ratio_5> ; ratio of the fundamental
kratio_7 = <Ratio_6> ; ratio of the fundamental
kratio_8 = <Ratio_7> ; ratio of the fundamental
kratio_9 = <Ratio_8> ; ratio of the fundamental
kratio_10 = <Ratio_9> ; ratio of the fundamental
kampatt_1 = <Attack_0> * 0.01 ; attack [percent of note duration]
kampatt_2 = <Attack_1> * 0.01 ; attack [percent of note duration]
kampatt_3 = <Attack_2> * 0.01 ; attack [percent of note duration]
kampatt_4 = <Attack_3> * 0.01 ; attack [percent of note duration]
kampatt_5 = <Attack_4> * 0.01 ; attack [percent of note duration]
kampatt_6 = <Attack_5> * 0.01 ; attack [percent of note duration]
kampatt_7 = <Attack_6> * 0.01 ; attack [percent of note duration]
kampatt_8 = <Attack_7> * 0.01 ; attack [percent of note duration]
kampatt_9 = <Attack_8> * 0.01 ; attack [percent of note duration]
kampatt_10 = <Attack_9> * 0.01 ; attack [percent of note duration]
kampdec_1 = <Decay_0> * 0.01 ; decay [percent of note duration]
kampdec_2 = <Decay_1> * 0.01 ; decay [percent of note duration]
kampdec_3 = <Decay_2> * 0.01 ; decay [percent of note duration]
kampdec_4 = <Decay_3> * 0.01 ; decay [percent of note duration]
kampdec_5 = <Decay_4> * 0.01 ; decay [percent of note duration]
kampdec_6 = <Decay_5> * 0.01 ; decay [percent of note duration]
kampdec_7 = <Decay_6> * 0.01 ; decay [percent of note duration]
kampdec_8 = <Decay_7> * 0.01 ; decay [percent of note duration]
kampdec_9 = <Decay_8> * 0.01 ; decay [percent of note duration]
kampdec_10 = <Decay_9> * 0.01 ; decay [percent of note duration]
kamprel_1 = <Release_0> * 0.01 ; release [percent of note duration]
kamprel_2 = <Release_1> * 0.01 ; release [percent of note duration]
kamprel_3 = <Release_2> * 0.01 ; release [percent of note duration]
kamprel_4 = <Release_3> * 0.01 ; release [percent of note duration]
kamprel_5 = <Release_4> * 0.01 ; release [percent of note duration]
kamprel_6 = <Release_5> * 0.01 ; release [percent of note duration]
kamprel_7 = <Release_6> * 0.01 ; release [percent of note duration]
kamprel_8 = <Release_7> * 0.01 ; release [percent of note duration]
kamprel_9 = <Release_8> * 0.01 ; release [percent of note duration]
kamprel_10 = <Release_9> * 0.01 ; release [percent of note duration]
;SYNTHESIS INSTRUMENT
idur = p3 ; duration
ifn = 1 ; function nr for the oscilator (sine)
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
idurprolong = p6
idur = idur - idurprolong ; no extra time in performance of this instrument
kamp = kamp * iampdev ; apply deviation on this instrument
kfund = kfund * ifreqdev ; apply deviation on this instrument
printk 0.1, kfund
iporttime = 0.05 ;PORTAMENTO TIME VARIABLE
kporttime linseg 0,0.001,iporttime,1,iporttime ;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
kfund portk kfund, kporttime ;APPLY PORTAMENTO SMOOTHING
kamp portk kamp, kporttime ;APPLY PORTAMENTO SMOOTHING
; endif
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
aenv_1 expsegr .001, idur * i(kampatt_1), 1.001, idur * i(kampdec_1), .001, idur * i(kamprel_1), .001
aenv_2 expsegr .001, idur * i(kampatt_2), 1.001, idur * i(kampdec_2), .001, idur * i(kamprel_2), .001
aenv_3 expsegr .001, idur * i(kampatt_3), 1.001, idur * i(kampdec_3), .001, idur * i(kamprel_3), .001
aenv_4 expsegr .001, idur * i(kampatt_4), 1.001, idur * i(kampdec_4), .001, idur * i(kamprel_4), .001
aenv_5 expsegr .001, idur * i(kampatt_5), 1.001, idur * i(kampdec_5), .001, idur * i(kamprel_5), .001
aenv_6 expsegr .001, idur * i(kampatt_6), 1.001, idur * i(kampdec_6), .001, idur * i(kamprel_6), .001
aenv_7 expsegr .001, idur * i(kampatt_7), 1.001, idur * i(kampdec_7), .001, idur * i(kamprel_7), .001
aenv_8 expsegr .001, idur * i(kampatt_8), 1.001, idur * i(kampdec_8), .001, idur * i(kamprel_8), .001
aenv_9 expsegr .001, idur * i(kampatt_9), 1.001, idur * i(kampdec_9), .001, idur * i(kamprel_9), .001
aenv_10 expsegr .001, idur * i(kampatt_10), 1.001, idur * i(kampdec_10),.001, idur * i(kamprel_10), .001
;SEPARATE OSCILLATORS CREATE EACH OF THE PARTIALS (NOTE THAT FLTK VERTICAL SLIDERS ARE INVERTED TO ALLOW MINIMUM VALUES TO BE LOWEST ON THE SCREEN)
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | FUNCTION_TABLE
apart_1 oscili kamp * (aenv_1 - 0.001) * kPartAmp_1, kfund * kratio_1, ifn
apart_2 oscili kamp * (aenv_2 - 0.001) * kPartAmp_2, kfund * kratio_2, ifn
apart_3 oscili kamp * (aenv_3 - 0.001) * kPartAmp_3, kfund * kratio_3, ifn
apart_4 oscili kamp * (aenv_4 - 0.001) * kPartAmp_4, kfund * kratio_4, ifn
apart_5 oscili kamp * (aenv_5 - 0.001) * kPartAmp_5, kfund * kratio_5, ifn
apart_6 oscili kamp * (aenv_6 - 0.001) * kPartAmp_6, kfund * kratio_6, ifn
apart_7 oscili kamp * (aenv_7 - 0.001) * kPartAmp_7, kfund * kratio_7, ifn
apart_8 oscili kamp * (aenv_8 - 0.001) * kPartAmp_8, kfund * kratio_8, ifn
apart_9 oscili kamp * (aenv_9 - 0.001) * kPartAmp_9, kfund * kratio_9, ifn
apart_10 oscili kamp * (aenv_10 - 0.001) * kPartAmp_10, kfund * kratio_10, ifn
if ktrig == 1 then ; at first k-cycle ...
ktrig = 0 ; avoid repeating this every k-cycle
reinit cyclestart ; ... and reinit "cyclestart"
endif
rireturn ; end of (re)init pass
;SUM THE 10 OSCILLATORS:
amix sum apart_1, apart_2, apart_3, apart_4, apart_5, apart_6, apart_7, apart_8, apart_9, apart_10
outc amix ;SEND MIXED SIGNAL TO THE OUTPUTSPartAmp1830true0.01.00.12506true00true0.01.00.10.6250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.2250true00true0.01.00.10.2250true85293341350FundFreq181324true20.010000.01.04640.0500trueAmplitude187376true0.01.00.010.35500true366404Ratio170416true0.12530.00.00103006true00true0.12530.00.00102.64300true00true0.12530.00.00105.26300true00true0.12530.00.00109.035001300true00true0.12530.00.001012.703001300true00true0.12530.00.001015.743001300true00true0.12530.00.001017.106300true00true0.12530.00.001017.839300true00true0.12530.00.001018.783300true00true0.12530.00.001019.307001300true00true0.12530.00.001021.088001300true121753Attack166792true0.0199.91.01506true00true0.0199.91.027.01150true00true0.0199.91.025.01150true00true0.0199.91.019.01150true00true0.0199.91.026.01150true00true0.0199.91.027.01150true00true0.0199.91.023.01150true00true0.0199.91.031.01150true00true0.0199.91.026.01150true00true0.0199.91.030.01150true00true0.0199.91.029.01150true0979Decay1651021true0.0199.91.01506true00true0.0199.91.062.01150true00true0.0199.91.037.01150true00true0.0199.91.049.01150true00true0.0199.91.071.01150true00true0.0199.91.017.01150true00true0.0199.91.037.01150true00true0.0199.91.063.01150true00true0.0199.91.059.01150true00true0.0199.91.048.01150true00true0.0199.91.062.01150true01209Release1661258true0.0199.91.01506true00true0.0199.91.014.01150true00true0.0199.91.08.01150true00true0.0199.91.011.01150true00true0.0199.91.010.01150true00true0.0199.91.017.01150true00true0.0199.91.022.01150true00true0.0199.91.012.01150true00true0.0199.91.07.01150true00true0.0199.91.013.01150true00true0.0199.91.026.01150true014450.440.01:0.01:5.01:12.01:23.01:31.01:32.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.01534.01.0:0.90000004:0.8:0.6:0.4:0.3:0.0:0.0:0.0:0.01.0090001:2.3260002:4.2130003:6.623:9.348001:12.493001:15.429001:19.622002:23.289001:25.91000214.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.010.3527.01:25.01:19.01:26.01:27.01:23.01:31.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.011378.39580.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.60.84700006:0.54:0.65000004:0.49800003:0.41700003:0.56700003:0.55300003:0.81700003:0.40300003:0.4980000314.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.01Additive Synth (inharmonic) + Reverb0dbfs = 1; Written by Iain McCurdy, 2006
; Modified for QuteCsound by Ren?, September 2010
; Tested on Ubuntu 10.04 with csound-double cvs August 2010 and QuteCsound svn rev 733
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0 --midi-key-oct=4 --midi-velocity-amp=5
israte = sr ; specification of sample rate for reverb
ktrig init 1
cyclestart:
;GUI - Additive Synth
kPartAmp_1 = <PartAmp_0> ; amplitude of partial
kPartAmp_2 = <PartAmp_1> ; amplitude of partial
kPartAmp_3 = <PartAmp_2> ; amplitude of partial
kPartAmp_4 = <PartAmp_3> ; amplitude of partial
kPartAmp_5 = <PartAmp_4> ; amplitude of partial
kPartAmp_6 = <PartAmp_5> ; amplitude of partial
kPartAmp_7 = <PartAmp_6> ; amplitude of partial
kPartAmp_8 = <PartAmp_7> ; amplitude of partial
kPartAmp_9 = <PartAmp_8> ; amplitude of partial
kPartAmp_10 = <PartAmp_9> ; amplitude of partial
kfund = <FundFreq> ; fundamental frequency
kamp = <Amplitude> ; overall amplitude
kratio_1 = <Ratio_0> ; ratio of the fundamental
kratio_2 = <Ratio_1> ; ratio of the fundamental
kratio_3 = <Ratio_2> ; ratio of the fundamental
kratio_4 = <Ratio_3> ; ratio of the fundamental
kratio_5 = <Ratio_4> ; ratio of the fundamental
kratio_6 = <Ratio_5> ; ratio of the fundamental
kratio_7 = <Ratio_6> ; ratio of the fundamental
kratio_8 = <Ratio_7> ; ratio of the fundamental
kratio_9 = <Ratio_8> ; ratio of the fundamental
kratio_10 = <Ratio_9> ; ratio of the fundamental
kampatt_1 = <Attack_0> * 0.01 ; attack [percent of note duration]
kampatt_2 = <Attack_1> * 0.01 ; attack [percent of note duration]
kampatt_3 = <Attack_2> * 0.01 ; attack [percent of note duration]
kampatt_4 = <Attack_3> * 0.01 ; attack [percent of note duration]
kampatt_5 = <Attack_4> * 0.01 ; attack [percent of note duration]
kampatt_6 = <Attack_5> * 0.01 ; attack [percent of note duration]
kampatt_7 = <Attack_6> * 0.01 ; attack [percent of note duration]
kampatt_8 = <Attack_7> * 0.01 ; attack [percent of note duration]
kampatt_9 = <Attack_8> * 0.01 ; attack [percent of note duration]
kampatt_10 = <Attack_9> * 0.01 ; attack [percent of note duration]
kampdec_1 = <Decay_0> * 0.01 ; decay [percent of note duration]
kampdec_2 = <Decay_1> * 0.01 ; decay [percent of note duration]
kampdec_3 = <Decay_2> * 0.01 ; decay [percent of note duration]
kampdec_4 = <Decay_3> * 0.01 ; decay [percent of note duration]
kampdec_5 = <Decay_4> * 0.01 ; decay [percent of note duration]
kampdec_6 = <Decay_5> * 0.01 ; decay [percent of note duration]
kampdec_7 = <Decay_6> * 0.01 ; decay [percent of note duration]
kampdec_8 = <Decay_7> * 0.01 ; decay [percent of note duration]
kampdec_9 = <Decay_8> * 0.01 ; decay [percent of note duration]
kampdec_10 = <Decay_9> * 0.01 ; decay [percent of note duration]
kamprel_1 = <Release_0> * 0.01 ; release [percent of note duration]
kamprel_2 = <Release_1> * 0.01 ; release [percent of note duration]
kamprel_3 = <Release_2> * 0.01 ; release [percent of note duration]
kamprel_4 = <Release_3> * 0.01 ; release [percent of note duration]
kamprel_5 = <Release_4> * 0.01 ; release [percent of note duration]
kamprel_6 = <Release_5> * 0.01 ; release [percent of note duration]
kamprel_7 = <Release_6> * 0.01 ; release [percent of note duration]
kamprel_8 = <Release_7> * 0.01 ; release [percent of note duration]
kamprel_9 = <Release_8> * 0.01 ; release [percent of note duration]
kamprel_10 = <Release_9> * 0.01 ; release [percent of note duration]
; GUI - Reverb
keffmix = <effmix>
krvbdecay = <reverbdecay>
kcutofffreq = <cutofffreq>
irandpchmod = <randompitchmodulation>
;SYNTHESIS INSTRUMENT
idur = p3 ; duration
ifn = 1 ; function nr for the oscilator (sine)
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
idurprolong = p6
idur = idur - idurprolong ; no extra time in performance of this instrument
kamp = kamp * iampdev ; apply deviation on this instrument
kfund = kfund * ifreqdev ; apply deviation on this instrument
printk 0.1, kfund
iporttime = 0.05 ;PORTAMENTO TIME VARIABLE
kporttime linseg 0,0.001,iporttime,1,iporttime ;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
kfund portk kfund, kporttime ;APPLY PORTAMENTO SMOOTHING
kamp portk kamp, kporttime ;APPLY PORTAMENTO SMOOTHING
; endif
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
aenv_1 expsegr .001, idur * i(kampatt_1), 1.001, idur * i(kampdec_1), .001, idur * i(kamprel_1), .001
aenv_2 expsegr .001, idur * i(kampatt_2), 1.001, idur * i(kampdec_2), .001, idur * i(kamprel_2), .001
aenv_3 expsegr .001, idur * i(kampatt_3), 1.001, idur * i(kampdec_3), .001, idur * i(kamprel_3), .001
aenv_4 expsegr .001, idur * i(kampatt_4), 1.001, idur * i(kampdec_4), .001, idur * i(kamprel_4), .001
aenv_5 expsegr .001, idur * i(kampatt_5), 1.001, idur * i(kampdec_5), .001, idur * i(kamprel_5), .001
aenv_6 expsegr .001, idur * i(kampatt_6), 1.001, idur * i(kampdec_6), .001, idur * i(kamprel_6), .001
aenv_7 expsegr .001, idur * i(kampatt_7), 1.001, idur * i(kampdec_7), .001, idur * i(kamprel_7), .001
aenv_8 expsegr .001, idur * i(kampatt_8), 1.001, idur * i(kampdec_8), .001, idur * i(kamprel_8), .001
aenv_9 expsegr .001, idur * i(kampatt_9), 1.001, idur * i(kampdec_9), .001, idur * i(kamprel_9), .001
aenv_10 expsegr .001, idur * i(kampatt_10), 1.001, idur * i(kampdec_10),.001, idur * i(kamprel_10), .001
;SEPARATE OSCILLATORS CREATE EACH OF THE PARTIALS (NOTE THAT FLTK VERTICAL SLIDERS ARE INVERTED TO ALLOW MINIMUM VALUES TO BE LOWEST ON THE SCREEN)
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | FUNCTION_TABLE
apart_1 oscili kamp * (aenv_1 - 0.001) * kPartAmp_1, kfund * kratio_1, ifn
apart_2 oscili kamp * (aenv_2 - 0.001) * kPartAmp_2, kfund * kratio_2, ifn
apart_3 oscili kamp * (aenv_3 - 0.001) * kPartAmp_3, kfund * kratio_3, ifn
apart_4 oscili kamp * (aenv_4 - 0.001) * kPartAmp_4, kfund * kratio_4, ifn
apart_5 oscili kamp * (aenv_5 - 0.001) * kPartAmp_5, kfund * kratio_5, ifn
apart_6 oscili kamp * (aenv_6 - 0.001) * kPartAmp_6, kfund * kratio_6, ifn
apart_7 oscili kamp * (aenv_7 - 0.001) * kPartAmp_7, kfund * kratio_7, ifn
apart_8 oscili kamp * (aenv_8 - 0.001) * kPartAmp_8, kfund * kratio_8, ifn
apart_9 oscili kamp * (aenv_9 - 0.001) * kPartAmp_9, kfund * kratio_9, ifn
apart_10 oscili kamp * (aenv_10 - 0.001) * kPartAmp_10, kfund * kratio_10, ifn
if ktrig == 1 then ; at first k-cycle ...
ktrig = 0 ; avoid repeating this every k-cycle
reinit cyclestart ; ... and reinit "cyclestart"
endif
rireturn ; end of (re)init pass
;SUM THE 10 OSCILLATORS:
asig sum apart_1, apart_2, apart_3, apart_4, apart_5, apart_6, apart_7, apart_8, apart_9, apart_10
; SIGNAL MODIFICATION
aL, aR reverbsc asig, asig, krvbdecay, kcutofffreq, israte, irandpchmod, 1 ; generate effect
aeff sum aL , aR ; sum channels
aeff = aeff * keffmix + asig * ( 1 - keffmix) ; mix of direct / effect signal
outc aeff ;SEND MIXED SIGNAL TO THE OUTPUTSPartAmp1830true0.01.00.12506true00true0.01.00.10.6250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.2250true00true0.01.00.10.2250true85293341350FundFreq181324true20.010000.05.05910.0500trueAmplitude187376true0.01.00.010.0500true366404Ratio170416true0.12530.00.00103006true00true0.12530.00.00102.64300true00true0.12530.00.00105.26300true00true0.12530.00.00109.035001300true00true0.12530.00.001012.703001300true00true0.12530.00.001015.743001300true00true0.12530.00.001017.106300true00true0.12530.00.001017.839300true00true0.12530.00.001018.783300true00true0.12530.00.001019.307001300true00true0.12530.00.001021.088001300true121753Attack166792true0.0199.91.01506true00true0.0199.91.027.01150true00true0.0199.91.025.01150true00true0.0199.91.019.01150true00true0.0199.91.026.01150true00true0.0199.91.027.01150true00true0.0199.91.023.01150true00true0.0199.91.031.01150true00true0.0199.91.026.01150true00true0.0199.91.030.01150true00true0.0199.91.029.01150true0979Decay1651021true0.0199.91.01506true00true0.0199.91.062.01150true00true0.0199.91.037.01150true00true0.0199.91.049.01150true00true0.0199.91.071.01150true00true0.0199.91.017.01150true00true0.0199.91.037.01150true00true0.0199.91.063.01150true00true0.0199.91.059.01150true00true0.0199.91.048.01150true00true0.0199.91.062.01150true01209Release1661258true0.0199.91.01506true00true0.0199.91.014.01150true00true0.0199.91.08.01150true00true0.0199.91.011.01150true00true0.0199.91.010.01150true00true0.0199.91.017.01150true00true0.0199.91.022.01150true00true0.0199.91.012.01150true00true0.0199.91.07.01150true00true0.0199.91.013.01150true00true0.0199.91.026.01150true01445randompitchmodulation7872513074055cutofffreq773103true200.016000.08054.305760truereverbdecay777202true0.01.00.9348724560true756185767295effmix767329true0.01.00.11.0150true7943610.440.01:0.01:5.01:12.01:23.01:31.01:32.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.01534.01.0:0.90000004:0.8:0.6:0.4:0.3:0.0:0.0:0.0:0.01.0090001:2.3260002:4.2130003:6.623:9.348001:12.493001:15.429001:19.622002:23.289001:25.91000214.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.010.3527.01:25.01:19.01:26.01:27.01:23.01:31.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.011378.39580.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.60.84700006:0.54:0.65000004:0.49800003:0.41700003:0.56700003:0.55300003:0.81700003:0.40300003:0.4980000314.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.01Additive Synth (inharmonic) + Mode0dbfs = 1; Written by Iain McCurdy, 2006
; Modified for QuteCsound by Ren?, September 2010
; Tested on Ubuntu 10.04 with csound-double cvs August 2010 and QuteCsound svn rev 733
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0 --midi-key-oct=4 --midi-velocity-amp=5
ktrig init 1
cyclestart:
;GUI
kPartAmp_1 = <PartAmp_0> ; amplitude of partial
kPartAmp_2 = <PartAmp_1> ; amplitude of partial
kPartAmp_3 = <PartAmp_2> ; amplitude of partial
kPartAmp_4 = <PartAmp_3> ; amplitude of partial
kPartAmp_5 = <PartAmp_4> ; amplitude of partial
kPartAmp_6 = <PartAmp_5> ; amplitude of partial
kPartAmp_7 = <PartAmp_6> ; amplitude of partial
kPartAmp_8 = <PartAmp_7> ; amplitude of partial
kPartAmp_9 = <PartAmp_8> ; amplitude of partial
kPartAmp_10 = <PartAmp_9> ; amplitude of partial
kfund = <FundFreq> ; fundamental frequency
kamp = <Amplitude> ; overall amplitude
kratio_1 = <Ratio_0> ; ratio of the fundamental
kratio_2 = <Ratio_1> ; ratio of the fundamental
kratio_3 = <Ratio_2> ; ratio of the fundamental
kratio_4 = <Ratio_3> ; ratio of the fundamental
kratio_5 = <Ratio_4> ; ratio of the fundamental
kratio_6 = <Ratio_5> ; ratio of the fundamental
kratio_7 = <Ratio_6> ; ratio of the fundamental
kratio_8 = <Ratio_7> ; ratio of the fundamental
kratio_9 = <Ratio_8> ; ratio of the fundamental
kratio_10 = <Ratio_9> ; ratio of the fundamental
kampatt_1 = <Attack_0> * 0.01 ; attack [percent of note duration]
kampatt_2 = <Attack_1> * 0.01 ; attack [percent of note duration]
kampatt_3 = <Attack_2> * 0.01 ; attack [percent of note duration]
kampatt_4 = <Attack_3> * 0.01 ; attack [percent of note duration]
kampatt_5 = <Attack_4> * 0.01 ; attack [percent of note duration]
kampatt_6 = <Attack_5> * 0.01 ; attack [percent of note duration]
kampatt_7 = <Attack_6> * 0.01 ; attack [percent of note duration]
kampatt_8 = <Attack_7> * 0.01 ; attack [percent of note duration]
kampatt_9 = <Attack_8> * 0.01 ; attack [percent of note duration]
kampatt_10 = <Attack_9> * 0.01 ; attack [percent of note duration]
kampdec_1 = <Decay_0> * 0.01 ; decay [percent of note duration]
kampdec_2 = <Decay_1> * 0.01 ; decay [percent of note duration]
kampdec_3 = <Decay_2> * 0.01 ; decay [percent of note duration]
kampdec_4 = <Decay_3> * 0.01 ; decay [percent of note duration]
kampdec_5 = <Decay_4> * 0.01 ; decay [percent of note duration]
kampdec_6 = <Decay_5> * 0.01 ; decay [percent of note duration]
kampdec_7 = <Decay_6> * 0.01 ; decay [percent of note duration]
kampdec_8 = <Decay_7> * 0.01 ; decay [percent of note duration]
kampdec_9 = <Decay_8> * 0.01 ; decay [percent of note duration]
kampdec_10 = <Decay_9> * 0.01 ; decay [percent of note duration]
kamprel_1 = <Release_0> * 0.01 ; release [percent of note duration]
kamprel_2 = <Release_1> * 0.01 ; release [percent of note duration]
kamprel_3 = <Release_2> * 0.01 ; release [percent of note duration]
kamprel_4 = <Release_3> * 0.01 ; release [percent of note duration]
kamprel_5 = <Release_4> * 0.01 ; release [percent of note duration]
kamprel_6 = <Release_5> * 0.01 ; release [percent of note duration]
kamprel_7 = <Release_6> * 0.01 ; release [percent of note duration]
kamprel_8 = <Release_7> * 0.01 ; release [percent of note duration]
kamprel_9 = <Release_8> * 0.01 ; release [percent of note duration]
kamprel_10 = <Release_9> * 0.01 ; release [percent of note duration]
;SYNTHESIS INSTRUMENT
idur = p3 ; duration
ifn = 1 ; function nr for the oscilator (sine)
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
idurprolong = p6
idur = idur - idurprolong ; no extra time in performance of this instrument
kamp = kamp; * iampdev ; apply deviation on this instrument
kfund = kfund; * ifreqdev ; apply deviation on this instrument
iporttime = 0.05 ;PORTAMENTO TIME VARIABLE
kporttime linseg 0,0.001,iporttime,1,iporttime ;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
kfund portk kfund, kporttime ;APPLY PORTAMENTO SMOOTHING
kamp portk kamp, kporttime ;APPLY PORTAMENTO SMOOTHING
; endif
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
print i(kampatt_10)
aenv_1 expsegr .001, idur * i(kampatt_1), 1.001, idur * i(kampdec_1), .001, idur * i(kamprel_1), .001
aenv_2 expsegr .001, idur * i(kampatt_2), 1.001, idur * i(kampdec_2), .001, idur * i(kamprel_2), .001
aenv_3 expsegr .001, idur * i(kampatt_3), 1.001, idur * i(kampdec_3), .001, idur * i(kamprel_3), .001
aenv_4 expsegr .001, idur * i(kampatt_4), 1.001, idur * i(kampdec_4), .001, idur * i(kamprel_4), .001
aenv_5 expsegr .001, idur * i(kampatt_5), 1.001, idur * i(kampdec_5), .001, idur * i(kamprel_5), .001
aenv_6 expsegr .001, idur * i(kampatt_6), 1.001, idur * i(kampdec_6), .001, idur * i(kamprel_6), .001
aenv_7 expsegr .001, idur * i(kampatt_7), 1.001, idur * i(kampdec_7), .001, idur * i(kamprel_7), .001
aenv_8 expsegr .001, idur * i(kampatt_8), 1.001, idur * i(kampdec_8), .001, idur * i(kamprel_8), .001
aenv_9 expsegr .001, idur * i(kampatt_9), 1.001, idur * i(kampdec_9), .001, idur * i(kamprel_9), .001
aenv_10 expsegr .001, idur * i(kampatt_10), 1.001, idur * i(kampdec_10),.001, idur * i(kamprel_10), .001
;SEPARATE OSCILLATORS CREATE EACH OF THE PARTIALS (NOTE THAT FLTK VERTICAL SLIDERS ARE INVERTED TO ALLOW MINIMUM VALUES TO BE LOWEST ON THE SCREEN)
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | FUNCTION_TABLE
apart_1 oscili kamp * (aenv_1 - 0.001) * kPartAmp_1, kfund * kratio_1, ifn
apart_2 oscili kamp * (aenv_2 - 0.001) * kPartAmp_2, kfund * kratio_2, ifn
apart_3 oscili kamp * (aenv_3 - 0.001) * kPartAmp_3, kfund * kratio_3, ifn
apart_4 oscili kamp * (aenv_4 - 0.001) * kPartAmp_4, kfund * kratio_4, ifn
apart_5 oscili kamp * (aenv_5 - 0.001) * kPartAmp_5, kfund * kratio_5, ifn
apart_6 oscili kamp * (aenv_6 - 0.001) * kPartAmp_6, kfund * kratio_6, ifn
apart_7 oscili kamp * (aenv_7 - 0.001) * kPartAmp_7, kfund * kratio_7, ifn
apart_8 oscili kamp * (aenv_8 - 0.001) * kPartAmp_8, kfund * kratio_8, ifn
apart_9 oscili kamp * (aenv_9 - 0.001) * kPartAmp_9, kfund * kratio_9, ifn
apart_10 oscili kamp * (aenv_10 - 0.001) * kPartAmp_10, kfund * kratio_10, ifn
if ktrig == 1 then ; at first k-cycle ...
ktrig = 0 ; avoid repeating this every k-cycle
reinit cyclestart ; ... and reinit "cyclestart"
endif
rireturn ; end of (re)init pass
;SUM THE 10 OSCILLATORS:
asig sum apart_1, apart_2, apart_3, apart_4, apart_5, apart_6, apart_7, apart_8, apart_9, apart_10
kfreq = <freqfilter>
kQ = <quality>
keffmix = <modeeffmix>
; SIGNAL MODIFICATION
aeff mode asig, kfreq, kQ ; mode filter
asig = aeff * keffmix + asig * ( 1 - keffmix) ; mix of direct / effect signal
outc asig ;SEND MIXED SIGNAL TO THE OUTPUTSPartAmp16162true0.01.00.12506true00true0.01.00.10.8250true00true0.01.00.10.6250true00true0.01.00.10.6250true00true0.01.00.10.6250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.3250true63354323427FundFreq163393true20.010000.01.04948.0500trueAmplitude167483true0.01.00.010.8500true360510Ratio165560true0.1252.00.00101506true00true0.1252.00.00100.84700006150true00true0.1252.00.00100.54150true00true0.1252.00.00100.651150true00true0.1252.00.00100.499150true00true0.1252.00.00100.41700003150true00true0.1252.00.00100.568150true00true0.1252.00.00101.2900001150true00true0.1252.00.00100.818150true00true0.1252.00.00100.40300003150true00true0.1252.00.00100.499150true121753Attack166792true0.0199.91.01506true00true0.0199.91.027.01150true00true0.0199.91.029.01150true00true0.0199.91.019.987001150true00true0.0199.91.026.646002150true00true0.0199.91.027.386002150true00true0.0199.91.023.687002150true00true0.0199.91.032.565150true00true0.0199.91.026.646002150true00true0.0199.91.030.347002150true00true0.0199.91.029.607002150true0979Decay1661021true0.0199.91.01506true00true0.0199.91.062.163002150true00true0.0199.91.037.745150true00true0.0199.91.049.584150true00true0.0199.91.071.04201150true00true0.0199.91.017.028002150true00true0.0199.91.037.745150true00true0.0199.91.063.643150true00true0.0199.91.059.203003150true00true0.0199.91.048.845150true00true0.0199.91.062.902150true01209Release1661258true0.0199.91.01506true00true0.0199.91.014.807001150true00true0.0199.91.08.148001150true00true0.0199.91.011.109001150true00true0.0199.91.010.368001150true00true0.0199.91.017.028002150true00true0.0199.91.022.946001150true00true0.0199.91.012.588001150true00true0.0199.91.07.4080005150true00true0.0199.91.013.328001150true00true0.0199.91.026.646002150true01445freqfilter1871510true20.05000.0879.183160true1881594quality3271511true0.01.00.10.4250true3131811modeeffmix5171536true0.01.00.10.4150true52615890.827.01:29.01:19.987001:26.646002:27.386002:23.687002:32.565:26.646002:30.347002:29.60700262.163002:37.745:49.584:71.04201:17.028002:37.745:63.643:59.203003:48.845:62.9024948.00.8:0.6:0.6:0.6:0.4:0.4:0.4:0.3:0.3:0.30.84700006:0.54:0.651:0.499:0.41700003:0.568:1.2900001:0.818:0.40300003:0.49914.807001:8.148001:11.109001:10.368001:17.028002:22.946001:12.588001:7.4080005:13.328001:26.646002ver2:879.18310546880.40.4Additive Synth (inharmonic) + Reverb0dbfs = 1; Written by Iain McCurdy, 2006
; Modified for QuteCsound by Ren?, September 2010
; Tested on Ubuntu 10.04 with csound-double cvs August 2010 and QuteCsound svn rev 733
;my flags on Ubuntu: -odac -b1024 -B2048 -+rtaudio=alsa -+rtmidi=alsa -Ma -m0 --midi-key-oct=4 --midi-velocity-amp=5
israte = sr ; specification of sample rate for reverb
ktrig init 1
cyclestart:
;GUI - Additive Synth
kPartAmp_1 = <PartAmp_0> ; amplitude of partial
kPartAmp_2 = <PartAmp_1> ; amplitude of partial
kPartAmp_3 = <PartAmp_2> ; amplitude of partial
kPartAmp_4 = <PartAmp_3> ; amplitude of partial
kPartAmp_5 = <PartAmp_4> ; amplitude of partial
kPartAmp_6 = <PartAmp_5> ; amplitude of partial
kPartAmp_7 = <PartAmp_6> ; amplitude of partial
kPartAmp_8 = <PartAmp_7> ; amplitude of partial
kPartAmp_9 = <PartAmp_8> ; amplitude of partial
kPartAmp_10 = <PartAmp_9> ; amplitude of partial
kfund = <FundFreq> ; fundamental frequency
kamp = <Amplitude> ; overall amplitude
kratio_1 = <Ratio_0> ; ratio of the fundamental
kratio_2 = <Ratio_1> ; ratio of the fundamental
kratio_3 = <Ratio_2> ; ratio of the fundamental
kratio_4 = <Ratio_3> ; ratio of the fundamental
kratio_5 = <Ratio_4> ; ratio of the fundamental
kratio_6 = <Ratio_5> ; ratio of the fundamental
kratio_7 = <Ratio_6> ; ratio of the fundamental
kratio_8 = <Ratio_7> ; ratio of the fundamental
kratio_9 = <Ratio_8> ; ratio of the fundamental
kratio_10 = <Ratio_9> ; ratio of the fundamental
kampatt_1 = <Attack_0> * 0.01 ; attack [percent of note duration]
kampatt_2 = <Attack_1> * 0.01 ; attack [percent of note duration]
kampatt_3 = <Attack_2> * 0.01 ; attack [percent of note duration]
kampatt_4 = <Attack_3> * 0.01 ; attack [percent of note duration]
kampatt_5 = <Attack_4> * 0.01 ; attack [percent of note duration]
kampatt_6 = <Attack_5> * 0.01 ; attack [percent of note duration]
kampatt_7 = <Attack_6> * 0.01 ; attack [percent of note duration]
kampatt_8 = <Attack_7> * 0.01 ; attack [percent of note duration]
kampatt_9 = <Attack_8> * 0.01 ; attack [percent of note duration]
kampatt_10 = <Attack_9> * 0.01 ; attack [percent of note duration]
kampdec_1 = <Decay_0> * 0.01 ; decay [percent of note duration]
kampdec_2 = <Decay_1> * 0.01 ; decay [percent of note duration]
kampdec_3 = <Decay_2> * 0.01 ; decay [percent of note duration]
kampdec_4 = <Decay_3> * 0.01 ; decay [percent of note duration]
kampdec_5 = <Decay_4> * 0.01 ; decay [percent of note duration]
kampdec_6 = <Decay_5> * 0.01 ; decay [percent of note duration]
kampdec_7 = <Decay_6> * 0.01 ; decay [percent of note duration]
kampdec_8 = <Decay_7> * 0.01 ; decay [percent of note duration]
kampdec_9 = <Decay_8> * 0.01 ; decay [percent of note duration]
kampdec_10 = <Decay_9> * 0.01 ; decay [percent of note duration]
kamprel_1 = <Release_0> * 0.01 ; release [percent of note duration]
kamprel_2 = <Release_1> * 0.01 ; release [percent of note duration]
kamprel_3 = <Release_2> * 0.01 ; release [percent of note duration]
kamprel_4 = <Release_3> * 0.01 ; release [percent of note duration]
kamprel_5 = <Release_4> * 0.01 ; release [percent of note duration]
kamprel_6 = <Release_5> * 0.01 ; release [percent of note duration]
kamprel_7 = <Release_6> * 0.01 ; release [percent of note duration]
kamprel_8 = <Release_7> * 0.01 ; release [percent of note duration]
kamprel_9 = <Release_8> * 0.01 ; release [percent of note duration]
kamprel_10 = <Release_9> * 0.01 ; release [percent of note duration]
; GUI - Reverb
keffmix = <effmix>
krvbdecay = <reverbdecay>
kcutofffreq = <cutofffreq>
irandpchmod = <randompitchmodulation>
;SYNTHESIS INSTRUMENT
idur = p3 ; duration
ifn = 1 ; function nr for the oscilator (sine)
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
idurprolong = p6
idur = idur - idurprolong ; no extra time in performance of this instrument
kamp = kamp * iampdev ; apply deviation on this instrument
kfund = kfund * ifreqdev ; apply deviation on this instrument
printk 0.1, kfund
iporttime = 0.05 ;PORTAMENTO TIME VARIABLE
kporttime linseg 0,0.001,iporttime,1,iporttime ;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
kfund portk kfund, kporttime ;APPLY PORTAMENTO SMOOTHING
kamp portk kamp, kporttime ;APPLY PORTAMENTO SMOOTHING
; endif
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
;AMPLITUDE ENVELOPES (WITH MIDI RELEASE SEGMENT)
aenv_1 expsegr .001, idur * i(kampatt_1), 1.001, idur * i(kampdec_1), .001, idur * i(kamprel_1), .001
aenv_2 expsegr .001, idur * i(kampatt_2), 1.001, idur * i(kampdec_2), .001, idur * i(kamprel_2), .001
aenv_3 expsegr .001, idur * i(kampatt_3), 1.001, idur * i(kampdec_3), .001, idur * i(kamprel_3), .001
aenv_4 expsegr .001, idur * i(kampatt_4), 1.001, idur * i(kampdec_4), .001, idur * i(kamprel_4), .001
aenv_5 expsegr .001, idur * i(kampatt_5), 1.001, idur * i(kampdec_5), .001, idur * i(kamprel_5), .001
aenv_6 expsegr .001, idur * i(kampatt_6), 1.001, idur * i(kampdec_6), .001, idur * i(kamprel_6), .001
aenv_7 expsegr .001, idur * i(kampatt_7), 1.001, idur * i(kampdec_7), .001, idur * i(kamprel_7), .001
aenv_8 expsegr .001, idur * i(kampatt_8), 1.001, idur * i(kampdec_8), .001, idur * i(kamprel_8), .001
aenv_9 expsegr .001, idur * i(kampatt_9), 1.001, idur * i(kampdec_9), .001, idur * i(kamprel_9), .001
aenv_10 expsegr .001, idur * i(kampatt_10), 1.001, idur * i(kampdec_10),.001, idur * i(kamprel_10), .001
;SEPARATE OSCILLATORS CREATE EACH OF THE PARTIALS (NOTE THAT FLTK VERTICAL SLIDERS ARE INVERTED TO ALLOW MINIMUM VALUES TO BE LOWEST ON THE SCREEN)
;OUTPUT OPCODE AMPLITUDE | FREQUENCY | FUNCTION_TABLE
apart_1 oscili kamp * (aenv_1 - 0.001) * kPartAmp_1, kfund * kratio_1, ifn
apart_2 oscili kamp * (aenv_2 - 0.001) * kPartAmp_2, kfund * kratio_2, ifn
apart_3 oscili kamp * (aenv_3 - 0.001) * kPartAmp_3, kfund * kratio_3, ifn
apart_4 oscili kamp * (aenv_4 - 0.001) * kPartAmp_4, kfund * kratio_4, ifn
apart_5 oscili kamp * (aenv_5 - 0.001) * kPartAmp_5, kfund * kratio_5, ifn
apart_6 oscili kamp * (aenv_6 - 0.001) * kPartAmp_6, kfund * kratio_6, ifn
apart_7 oscili kamp * (aenv_7 - 0.001) * kPartAmp_7, kfund * kratio_7, ifn
apart_8 oscili kamp * (aenv_8 - 0.001) * kPartAmp_8, kfund * kratio_8, ifn
apart_9 oscili kamp * (aenv_9 - 0.001) * kPartAmp_9, kfund * kratio_9, ifn
apart_10 oscili kamp * (aenv_10 - 0.001) * kPartAmp_10, kfund * kratio_10, ifn
if ktrig == 1 then ; at first k-cycle ...
ktrig = 0 ; avoid repeating this every k-cycle
reinit cyclestart ; ... and reinit "cyclestart"
endif
rireturn ; end of (re)init pass
;SUM THE 10 OSCILLATORS:
asig sum apart_1, apart_2, apart_3, apart_4, apart_5, apart_6, apart_7, apart_8, apart_9, apart_10
; SIGNAL MODIFICATION
aL, aR reverbsc asig, asig, krvbdecay, kcutofffreq, israte, irandpchmod, 1 ; generate effect
aeff sum aL , aR ; sum channels
aeff = aeff * keffmix + asig * ( 1 - keffmix) ; mix of direct / effect signal
outc aeff ;SEND MIXED SIGNAL TO THE OUTPUTSPartAmp1830true0.01.00.12506true00true0.01.00.10.6250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.4250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.3250true00true0.01.00.10.2250true00true0.01.00.10.2250true85293341350FundFreq181324true20.010000.01.05911.0500trueAmplitude187376true0.01.00.010.48500true366404Ratio170416true0.12530.00.00103006true00true0.12530.00.00102.64300true00true0.12530.00.00105.26300true00true0.12530.00.00109.035001300true00true0.12530.00.001012.703001300true00true0.12530.00.001015.743001300true00true0.12530.00.001017.106300true00true0.12530.00.001017.839300true00true0.12530.00.001018.783300true00true0.12530.00.001019.307001300true00true0.12530.00.001021.088001300true121753Attack166792true0.0199.91.01506true00true0.0199.91.027.01150true00true0.0199.91.025.01150true00true0.0199.91.019.01150true00true0.0199.91.026.01150true00true0.0199.91.027.01150true00true0.0199.91.023.01150true00true0.0199.91.031.01150true00true0.0199.91.026.01150true00true0.0199.91.030.01150true00true0.0199.91.029.01150true0979Decay1651021true0.0199.91.01506true00true0.0199.91.062.01150true00true0.0199.91.037.01150true00true0.0199.91.049.01150true00true0.0199.91.071.01150true00true0.0199.91.017.01150true00true0.0199.91.037.01150true00true0.0199.91.063.01150true00true0.0199.91.059.01150true00true0.0199.91.048.01150true00true0.0199.91.062.01150true01209Release1661258true0.0199.91.01506true00true0.0199.91.014.01150true00true0.0199.91.08.01150true00true0.0199.91.011.01150true00true0.0199.91.010.01150true00true0.0199.91.017.01150true00true0.0199.91.022.01150true00true0.0199.91.012.01150true00true0.0199.91.07.01150true00true0.0199.91.013.01150true00true0.0199.91.026.01150true01445randompitchmodulation7872513074055cutofffreq773103true200.016000.08054.305760truereverbdecay777202true0.01.00.9348724560true756185767295effmix767329true0.01.00.11.0150true7943610.440.01:0.01:5.01:12.01:23.01:31.01:32.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.01534.01.0:0.90000004:0.8:0.6:0.4:0.3:0.0:0.0:0.0:0.01.0090001:2.3260002:4.2130003:6.623:9.348001:12.493001:15.429001:19.622002:23.289001:25.91000214.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.010.3527.01:25.01:19.01:26.01:27.01:23.01:31.01:26.01:30.01:29.0162.01:37.01:49.01:71.01:17.01:37.01:63.01:59.01:48.01:62.011378.39580.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.4:0.60.84700006:0.54:0.65000004:0.49800003:0.41700003:0.56700003:0.55300003:0.81700003:0.40300003:0.4980000314.01:8.01:11.01:10.01:17.01:22.01:12.01:7.01:13.01:26.01Noise + ResonFilter
kamp = <amplitude>
kcf = <centerfreq>
kbw = <bandwith>
; ENVELOPE GENERATOR
idur = p3
idurprolong = p6
idur = idur - idurprolong ; no extra instrument performance
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
kamp = kamp * iampdev ; apply deviation on this instrument
kcf = kcf * ifreqdev ; apply deviation on this instrument
katt = <Attack> * 0.01 ; attack [percent of note duration]
kdec = <Decay> * 0.01 ; decay [percent of note duration]
ktrig init 1
cycle: ; start of (re)init pass
kenv expseg .001, idur * i(katt), 1.001, idur * i(kdec), .001, idur - i(katt + kdec), .001
rireturn ; end of (re)init pass
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
ktrig = 0 ; avoid repeating this every k-cycle
endif
; SOUND PRODUCTION (NOISE)
asig pinkish kamp
; FILTER
asig reson asig, kcf * kenv, kbw ;[, iscl] [, iskip]
; OUTPUT
outc asigcenterfreq9277true20.015000.020.060true74169bandwith26878true20.01500.020.060true273170amplitude89271true0.01.00.010.85999995300true75619Attack286275true0.0100.00.150.9300false250628467631Decay503275true0.0100.00.10.0300falseNoise + LPF18Filter
kamp = <amplitude>
kfco = <cuttoff_freq>
kres = <resonance>
isweepfn = <isweepfn>
; ENVELOPE GENERATOR
idur = p3
idurprolong = p6
idur = idur - idurprolong ; no extra instrument performance
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
isweepfn = abs(isweepfn) ; E movement function nr
isweepfndir = <isweepfn> / isweepfn ; negative fn causes backwards reading
kamp = kamp * iampdev ; apply deviation on this instrument
kfco = kfco * ifreqdev ; apply deviation on this instrument
idist init 0 ; distortion
; SOUND PRODUCTION (NOISE)
anoise pinkish kamp
; FILTER
ksweep oscil 1, isweepfndir * (1/idur), isweepfn
afilt lpf18 anoise, kfco + kfco * ksweep, kres, idist
asig balance afilt, anoise
; OUTPUT
outc asigcuttoff_freq9277true20.08000.0412.3842860true74168resonance26879true0.01.01.060true273169amplitude412253true0.02.00.010.45987657300true394604isweepfn812103110074241Noise + LPF18Filter
kamp = <amplitude_2>
kfco = <cuttoff_freq_2>
kres = <resonance_2>
isweepfn = <isweepfn_2>
; ENVELOPE GENERATOR
idur = p3
idurprolong = p6
idur = idur - idurprolong ; no extra instrument performance
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
isweepfn = abs(isweepfn) ; E movement function nr
isweepfndir = <isweepfn_2> / isweepfn ; negative fn causes backwards reading
kamp = kamp * iampdev ; apply deviation on this instrument
kfco = kfco * ifreqdev ; apply deviation on this instrument
idist init 0
; SOUND PRODUCTION (NOISE)
anoise pinkish kamp
; FILTER
ksweep oscil 1, isweepfndir * (1/idur), isweepfn
afilt lpf18 anoise, kfco + kfco * ksweep, kres, idist
asig balance afilt, anoise
; OUTPUT
outc asigcuttoff_freq_29277true20.08000.0658.3998460true74168resonance_226880true0.01.01.060true273169amplitude_2412247true0.02.00.011.2141799300true394604isweepfn_2812103110074241Noise + ModeFilter
kamp = <amplitude_29>
kfreq = <freqfilter_29>
kQ = <quality_29>
isweepfn = <isweepfn_29>
; ENVELOPE GENERATOR
idur = p3
idurprolong = p6
idur = idur - idurprolong ; no extra instrument performance
iampdev = p4 ; amplitude deviation from master instrument
ifreqdev = p5 ; frequency deviation from master instrument
isweepfn = abs(isweepfn) ; E movement function nr
isweepfndir = <isweepfn_29> / isweepfn ; negative fn causes backwards reading
kamp = kamp * iampdev ; apply deviation on this instrument
kfreq = kfreq * ifreqdev ; apply deviation on this instrument
idist init 0
; SOUND PRODUCTION (NOISE)
anoise pinkish kamp
; FILTER
; SIGNAL MODIFICATION
ksweep oscil 1, isweepfndir * (1/idur), isweepfn
afilt mode anoise, kfreq * ksweep, kQ ; mode filter
asig balance afilt, anoise
; OUTPUT
outc asigamplitude_2939734true0.02.00.011.99300true379390isweepfn_29812102110074241freqfilter_299445true20.05000.03392.02860true72129quality_2924430true0.01.00.10.8250true242322Sine Oscillator
kamp = 0dbfs * <amplitude>
kfreq = <freq> ; frequency (pitch) of grain
iampdev = p4
ifreqdev = p5
idurprolong = p6
adry oscil kamp * iampdev, kfreq * ifreqdev, 1
outc adry
freq9333true20.05000.0571.6091360true94116amplitude101159true0.01.00.010.51250true77477Sawtooth Oscillator
ifn = <ifn>
kamp = <amplitude>
kfreq = <freq> ; frequency (pitch) of grain
isweepfn_1 = <sweepfn_1>
ksweepamp_1 = <sweepamp_1>
iampdev = p4
ifreqdev = p5
kvdepth = <Vibratodepth>
kvrate = <Vibratofreq>
asweep init 1
kcf = <cutofffreq>
kres = <resonance>
isweepfn_2 = <sweepfn_2>
ksweepamp_2 = <sweepamp_2>
kfiltermix = <filtermix>
idist init 0
ktrig init 1
cycle: ; start of (re)init pass
isweepamp_1 = i(ksweepamp_1)
isweepamp_2 = i(ksweepamp_2)
if ktrig == 1 then ; at first k-cycle ...
reinit cycle ; start reinit-pass from label "cycle"
ktrig = 0 ; avoid repeating this every k-cycle
endif
; SOUND PRODUCTION
asweep_1 subinstr 15, isweepfn_1, isweepamp_1
rireturn ; end of (re)init pass
ksweep_1 downsamp asweep_1
ksweep_1 = ksweep_1 + 1
kvib oscili kvdepth, kvrate, 1
adry oscili kamp * iampdev * kvib, kfreq * ifreqdev * ksweep_1, ifn
; FILTERING
asweep_2 subinstr 15, isweepfn_2, isweepamp_2
rireturn ; end of (re)init pass
ksweep_2 downsamp asweep_2
ksweep_2 = ksweep_2 + 1
afilt lpf18 adry, kcf * ksweep_2, kres, idist
asig balance afilt, adry
asig = adry * (1 - kfiltermix) + asig * kfiltermix
; OUTPUT
outc asig
freq20215true20.05000.01897.124160true203103amplitude9019true0.01.00.010.83400true74456cutofffreq49318true20.015000.0477.1677260true472106resonance491138true0.01.01.060true490226sweepfn_26351911140612225sweepamp_2633264true-0.51.00.11.0150true585454filtermix484271true0.01.00.080true498375ifn211133340210164sweepfn_12101921140196220sweepamp_1213263true-0.51.00.11.0150false181455Vibratodepth31119true0.01.01.080true311120Vibratofreq311165true0.020.015.50605980true316260fmrhode iampdev = p4
ifreqdev = p5
kamp = <Amplitude>
kfreq = <Frequency>
kc1 = <KC_1>
kc2 = <KC_2>
kvdepth = <Vibratodepth>
kvrate = <Vibratofreq>
ifn1 = <ifn_1>
ifn2 = <ifn_2>
ifn3 = <ifn_3>
ifn4 = <ifn_4>
ivfn = <ivfn_5>
asig fmrhode kamp * iampdev, kfreq * ifreqdev, kc1, kc2, kvdepth, kvrate, ifn1, ifn2, ifn3, ifn4, ivfn
outc asig
Amplitude6897true0.01.00.10.6300true63436Frequency15897true0.010000.01.05439.0300true153436KC_125697true0.010.00.16.1300true264436KC_234797true0.010.00.10.8300true358436Vibratodepth478163true0.01.00.02392098780true478264Vibratofreq478310true0.020.00.080true483404ifn_1637114140694115ifn_2637157140694158ifn_3637200140694201ifn_4637243140694244ivfn_5637287140694288Soundfile Granulator
idopp = p4 ; import of factor for doppler effect from host instrument
iamp = <amplitude> ; amplitude of grain
ifn = <fn> ; function number to play
ispeed = <speed> ; speed (pitch of function)
ilps = <loopstart> ; loop start [0-1]
ilpdur = <loopdur> ; loop length [0-1]
; CALCULATION OF SAMPLE LENGTH
ilen = ftlen(ifn) / sr ; calculation of lenth of the used tabele [sec]
; CALCULATION OF LOOP LENGTH
ilps = ilen * ilps * sr ; loop start [sec]
ilpdur = ilen * ilpdur * sr - ilps ; loop length [sec]
; CALCULATION OF SAMPLE END
ilpe = ilps + ilpdur ; calculation of loop end
; SAMPLE READ-OUT
asig lposcil iamp, ispeed * idopp, ilps, ilpe, ifn; [, iphs]
amplitude7262true0.032767.01.04369.0150truefn1858310010072254185112speed185172true0.02.00.10.90000004300true306210loopstart72343true0.01.00.10.0150trueloopdur335343true0.01.00.10.0150true118381402381Mode Filter
kfreq = <freqfilter>
kQ = <quality>
keffmix = <modeeffmix>
; SIGNAL MODIFICATION
aeff mode asig, kfreq, kQ ; mode filter
asig = aeff * keffmix + asig * ( 1 - keffmix) ; mix of direct / effect signal
freqfilter7677true20.05000.0521.8091460truequality21678true0.01.00.10.4250true77161202378modeeffmix406103true0.01.00.10.0150true4151562 Modes Excitatoriampdev = p4
ifreqdev = p5
kfreq_1 = <Frequency_0>
kfreq_2 = <Frequency_1>
kfreq_3 = <Frequency_2>
kfreq_4 = <Frequency_3>
kfreqfact = <FreqDev> * ifreqdev
kfreq_1 = kfreq_1 * kfreqfact
kfreq_2 = kfreq_2 * kfreqfact
kfreq_3 = kfreq_3 * kfreqfact
kfreq_4 = kfreq_4 * kfreqfact
kQ_1 = <Quality_0>
kQ_2 = <Quality_1>
kQ_3 = <Quality_2>
kQ_4 = <Quality_3>
kampulse = <AmpImp>
kampexc = <AmpExcite>
kamp = <Amplitude>
printk 1, kampulse
printk 1, kampexc
printk 1, kamp
; EXCITATOR
; to simulate the shock between the excitator and the resonator
ashock mpulse kampulse, 0
aexc1 mode ashock, kfreq_1 ,kQ_1
aexc1 = aexc1 * kamp
aexc2 mode ashock, kfreq_2 ,kQ_2
aexc2 = aexc2 * kamp
aexc = ( aexc1 + aexc2 ) * 0.5
;"Contact" condition : when aexc reaches 0, the excitator looses
;contact with the resonator, and stops "pushing it"
aexc limit aexc, 0, kampexc * kamp
; RESONATOR
; 2modes resonator
ares1 mode aexc,kfreq_3, kQ_3
ares2 mode aexc,kfreq_4, kQ_4
ares = (ares1 + ares2) * 0.5
asig = (aexc + ares) * iampdev
outs asig, asig
Frequency011true20.010000.01.03005true00true20.010000.01.05623.0300true00true20.010000.01.01946.0300true00true20.010000.01.04572.0300true00true20.010000.01.06043.0300trueQuality29511true0.0500.01.03005true00true0.0500.01.0160.0300true00true0.0500.01.0256.0300true00true0.0500.01.0167.0300true00true0.0500.01.0230.0300true735962359113358170358300358355358410358465358FreqDev61130true0.02.00.998928480true587131765358853358938357AmpImp77811true0.010.00.17.2000003300trueAmpExcite86311true0.010.00.17.6300trueAmplitude94714true0.020.00.12.0300trueMode 6 - PercussionDescription: 6 Mode instrument using mpulse as striking force
Based on work by Scott Lindroth and Francois Blanc
NOTE: Mode frequency multiplier should be carefully set so that sr/freq < pi (see documentation on for mode opcode)
Author: Steven Yi
[HISTORY]
v1.0 - Initial Releaseiampdev = p4 ; Amplitude deviation passed over from the host instrument
ifreqdev = p5 ; Frequency deviation passed over from the host instrument
kamp = <Amp> ; Amplitude from interface of the instrument
kfreq = <Freq> ; Frequency from interface of the instrument
iQ = <baseQ>
ktrig init 1
cycle: ; start of (re)init pass
iamp = i(kamp) * iampdev ; conversion of amplitude and application of deviation
ifreq = i(kfreq) * ifreqdev ; conversion of freqency and application of deviation
;INSERT SOUND GENERATION CODE HERE
inummodes = <modeOn0> + <modeOn1> + <modeOn2> + <modeOn3> + <modeOn4> + <modeOn5> ; switch on and off the mode filters
aexc mpulse inummodes, 0
if ktrig == 1 then ; at first k-cycle ...
ktrig = 0 ; avoid repeating this every k-cycle
reinit cycle ; start reinit-pass from label "cycle"
endif
print ifreq
aout init 0
aout = 0
if (<modeOn0> == 1) then
aout0 mode aexc * <gain0>, ifreq * <freqMultiply0>, iQ * <qMultiply0>
aout sum aout, aout0
endif
if (<modeOn1> == 1) then
aout1 mode aexc * <gain1>, ifreq * <freqMultiply1>, iQ * <qMultiply1>
aout sum aout, aout1
endif
if (<modeOn2> == 1) then
aout2 mode aexc * <gain2>, ifreq * <freqMultiply2>, iQ * <qMultiply2>
aout sum aout, aout2
endif
if (<modeOn3> == 1) then
aout3 mode aexc * <gain3>, ifreq * <freqMultiply3>, iQ * <qMultiply3>
aout sum aout, aout3
endif
if (<modeOn4> == 1) then
aout4 mode aexc * <gain4>, ifreq * <freqMultiply4>, iQ * <qMultiply4>
aout sum aout, aout4
endif
if (<modeOn5> == 1) then
aout5 mode aexc * <gain5>, ifreq * <freqMultiply5>, iQ * <qMultiply5>
aout sum aout, aout5
endif
;END SOUND GENERATION CODE
aout = aout * iamp
print iamp
rireturn ; end of (re)init pass
outc aout
111132384baseQ99366false0.0100.061.895760truefreqMultiply099161false1.016.02.57852860trueqMultiply0100240false0.01.00.4084362760true191813626012357freqMultiply1168161false1.016.03.24502860trueqMultiply1168238false0.01.00.288025460truefreqMultiply2237161false1.016.01.97580660trueqMultiply2237238false0.01.00.205135260truefreqMultiply3306161false1.016.02.1099860trueqMultiply3306238false0.01.00.01439852260truefreqMultiply4375161false1.016.03.21148660trueqMultiply4375238false0.01.00.1439614660true19257261573305739957freqMultiply5444161false1.016.03.792793360trueqMultiply5444238false0.01.00.04864245760true46857modeOn0109319falsetruetruemodeOn1180319falsetruetruemodeOn2247319falsetruetruemodeOn3316319falsetruetruemodeOn4385319falsetruetruemodeOn5454319falsetruetruegain09984false0.01.00.966540260true34104gain116884false0.01.00.924782560truegain223784false0.01.00.966483160truegain330684false0.01.00.7728376460truegain437584false0.01.00.8503824560truegain544484false0.01.00.9654200760trueFreq58155true20.010000.01.0772.0400true579490Amp67156true0.01000.00.1220.8400true669490ver2:0.099999994ver2:37.0705451965ver2:0.0145723308ver2:0.0175071973ver2:1ver2:2ver2:3ver2:4ver2:6ver2:8ver2:1ver2:1ver2:1ver2:1ver2:1ver2:1truetruetruetruetruefalsever2:1ver2:0.400000006ver2:0.5ver2:0.6000000238ver2:0.3000000119ver2:0.200000003ver2:0.1461223066ver2:0.896673739ver2:0.099999994ver2:11.485004425ver2:0.0145723308ver2:0.0175071973ver2:1ver2:2ver2:3.0099999905ver2:4.0100002289ver2:4.6900000572ver2:5.6300001144ver2:1ver2:1ver2:1ver2:1ver2:1ver2:1truetruetruetruetruetruever2:1ver2:0.400000006ver2:0.5ver2:0.6000000238ver2:0.3000000119ver2:0.3000000119ver2:0.1461223066ver2:0.896673739ver2:0.099999994ver2:33.1700668335ver2:0.0145723308ver2:0.0111588016ver2:1ver2:1.4700000286ver2:2.0899999142ver2:2.5599999428ver2:4.6900000572ver2:5.6300001144ver2:1ver2:1ver2:1ver2:1ver2:1ver2:1truetruetruetruefalsefalsever2:1ver2:1ver2:0.2509221435ver2:0.2812690735ver2:0.3000000119ver2:0.3000000119ver2:0.1461223066ver2:0.896673739ver2:0.099999994ver2:33.1700668335ver2:0.0145723308ver2:0.0111588016ver2:1ver2:1.4700000286ver2:2.0899999142ver2:2.5599999428ver2:4.6900000572ver2:5.6300001144ver2:1ver2:1ver2:1ver2:1ver2:1ver2:1truetruetruetruefalsefalsever2:1ver2:1ver2:0.2509221435ver2:0.2812690735ver2:0.3000000119ver2:0.3000000119ver2:0.1461223066ver2:0.896673739getFrequencyiiipch xin
iout = (ipch < 15 ? cpspch(ipch) : ipch)
xout iout
SPATIAL AED GRANULATOR (complex); COPYING UNIT
icpydel = p18 ; delay of copy [s]
imaxcnt = p19 ; maximum number of copies
icnt = p20 ; count of number of copys, has to be "0" at the score
icpyampatt init 1 ; initialisation of the variable responsible for attenuation of a copy
icpyfreqshift init 1 ; initialisation of the variable responsible for shift of frequency of a copy
if icnt != 0 goto endcopy ; skip creation of a copy if this instance of the instrument is already a copy or if no copies are requested
if imaxcnt == 0 goto nocopy ; no creation of a copy if maximum number of copies = 0
copy:
icnt = icnt + 1 ; count the number of copies
if icnt > imaxcnt goto nocopy ; stop copying if the maximum number of copies is reached
icpyampatt = i(<Copy_ampattenuation>) ^ icnt ; atennuate each copy by this factor
icpyfreqshift = i(<Copy_frequencyshift>) ^ icnt ; shift the frequency of each copy by this factor
icpydelay = icpydel * icnt ; shift the start time of each copy by the amount of icpydelay
iA_cpydev = p21 * icnt ; shift the angle of each copy by the amount of iAcpydev
iE_cpydev = p22 * icnt ; shift the elevation of each copy by the amount of iAcpydev
iD_cpydev = p23 * icnt ; shift the distance of each copy by the amount of iAcpydev
schedule p1, icpydelay, p3, p4, p5 * icpyampatt, p6* icpyfreqshift, p7, p8 + iA_cpydev, p9 + iE_cpydev, p10 + iD_cpydev, p11, p12, p13, p14, p15 , p16, p17, p18, p19, icnt, p21, p22, p23 ; generate the copy
goto copy
endcopy:
nocopy:
; INSTRUMENT
idur = p3 ; duration
iinst = p4 ; instrument number of sound producing instrument
iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
ienvinst = p7 ; instrument number of envelope instrument
iA_dev = p8 ; deviation of position of grain - angle [¡] (amount of schifting of copy included)
iE_dev = p9 ; deviation of position of grain - elevation [¡] (amount of schifting of copy included)
iD_dev = p10 ; deviation of position of grain - distance [unit] (amount of schifting of copy included)
iA_move = p11 ; amount of movement of a single grain in regard to the cloud [¡]
iE_move = p12 ; amount of movement of a single grain in regard to the cloud [¡]
iD_move = p13 ; amount of movement of a single grain in regard to the cloud [unit]
iA_range = p14 ; possible range of deviation of angle [¡]
iE_range = p15 ; possible range of deviation of elevation [¡]
iD_range = p16 ; possible range of deviation of distance [unit]
icrtlfn = p17 ; control distribution fn
kA_centre = <Angle> ; position (centre) of the cloud - angle [¡]
kE_centre = <Elevation> ; position (centre) of the cloud - elevation [¡]
kD_centre = <Distance> ; position (centre) of the cloud - distance [unit]
iA_modctrl = i(<Angle_mod_ctrl>) ; angle modification controller [0 = no correlation; 1 = full correlation regarding angle]
iE_modctrl = i(<Elevation_mod_ctrl>) ; elevation modification controller [0 = no correlation; 1 = full correlation regarding elevation]
iD_modctrl = i(<Distance_mod_ctrl>) ; distance modification controller [0 = no correlation; 1 = full correlation regarding distance]
ifreqctrl = i(<freqdevmixctrl>) ; ifreq dev mix controller [0= frequency as assigned, 1= frequency according to position]
iampctrl = i(<ampdevmixctrl>) ; iamp dev mix controller [0= amplitude as assigned, 1= amplitude according to position]
iADcorr = i(<Distance_CorrelationX>) ; angle-distance correllation factor [0 = no correlation; 1 = full correlation between angle and distance]
iEDcorr = i(<Distance_CorrelationY>) ; elevation-distance correllation factor [0 = no correlation; 1 = full correlation between elevation and distance]
; INSTRUMENT PROLONGATION
idurprolong = gidurprolong ; extra duration for reverb tail of local reverb
p3 = p3 + idurprolong ; add extra duration to this instrument
; CALCULATION OF LOCATION
kA_grain line iA_dev, idur, iA_dev + iA_move ; creation of a trajectory of the grain during note
kE_grain line iE_dev, idur, iE_dev + iE_move ; creation of a trajectory of the grain during note
kD_grain line iD_dev, idur, iD_dev + iD_move ; creation of a trajectory of the grain during note
kA = kA_centre + kA_grain ; adding up movement of the cloud and movement of the grain
kE = kE_centre + kE_grain ; adding up movement of the cloud and movement of the grain
kD = kD_centre + kD_grain ; adding up movement of the cloud and movement of the grain
kD = (kD < 0.3 ? 0.3 : kD ) ; limits kD to a minimum of 0.3 unit to prevent overflow
kDrev = 1 / kD
kDrev = (kD < 1 ? 1 : kDrev ) ; keeps 1/kD < 1
; A/E/D - CORRELATION
iDcorr_A = iADcorr * sin(iA_dev * 0.01745329252) ; correlation of angle and distance by sinus of the position of the sound (angle - converted in radians)
iDcorr_E = iEDcorr * sin(iE_dev * 0.01745329252) ; correlation of angle and elevation by sinus of the position of the sound (elevation - converted in radians)
kD = kD + iDcorr_A + iDcorr_E ; correlating distance with angle and/or elevation
; AMPLITUDE AND FREQUENCY MODIFICATION BY POSITION
indx_A divz iA_dev * iA_modctrl, iA_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Anglemodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_E divz iE_dev * iE_modctrl, iE_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Elevationmodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_D divz iD_dev * iD_modctrl, iD_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Distancemodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_A = indx_A * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_A table abs(indx_A), icrtlfn, 1 ; reading out the control factor from the function-table regarding angle
iampfreqmod_A = (indx_A < 0 ? 1- (iampfreqmod_A * 0.5) : iampfreqmod_A + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
indx_E = indx_E * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_E table abs(indx_E), icrtlfn, 1 ; reading out the control factor from the function-table regarding elevation
iampfreqmod_E = (indx_E < 0 ? 1- (iampfreqmod_E * 0.5) : iampfreqmod_E + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
indx_D = indx_D * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_D table abs(indx_D), icrtlfn, 1 ; reading out the control factor from the function-table regarding distance
iampfreqmod_D = (indx_D < 0 ? 1- (iampfreqmod_D * 0.5) : iampfreqmod_D + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
;0,5-2 0,5 | 2 + 0,5 | 2 + 0,5 | 2
imodfact = (iampfreqmod_A + iampfreqmod_E + iampfreqmod_D) / 3; adding up angle, elevation and distance partial of modification and calculating the average of them
iampdev = iampdev * (1 - iampctrl) + iampdev * imodfact^2 * iampctrl ; altering amplitude by ammount of A,E or D deviation
ifreqdev = ifreqdev * (1 - ifreqctrl) + ifreqdev * imodfact^2 * ifreqctrl ; altering frequency by ammount of A,E or D deviation
; ******************************************************************************
; SOUND PRODUCTION
; ******************************************************************************
adry subinstr iinst, iampdev, ifreqdev, idurprolong ; invocation of the sound generating instrument
adry = adry * girescale ; scaling of signal
; ******************************************************************************
; ENVELOPE
; ******************************************************************************
aenv subinstr ienvinst, idurprolong ; invocation of the the envelope generator
asig = adry * aenv ; apply envelope to the signal
; APPLICATION OF DOPPLER EFFECT
; Note: giunit = distance from a listener in the middle to the unit sphere in meters
asig doppler asig, kD * giunit, 0, 345, 6 ; application of doppler effect
; FILTERING UNIT [distance]
afilt butterlp asig, 22000 * sqrt(kDrev) ; filtering according to distance
asig balance afilt, asig
; DIFFUSE EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
diffref:
if gidiffref == 0 goto specref ; skip (switch off) the diffuse reflections || kcontrol == 0
Diffuse_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
; SPECULAR EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
specref:
if gispecref == 0 goto scaling ; skip (switch off) the specular reflections || kcontrol == 0
Specular_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
scaling:
; SCALING AND DELAYING UNIT
; this unit is based upon the example in the Charles Dodge/Thomas Jerse book, Computer Music, page 320
; attenuation according to distance and ratio of reverberation/direct signal according to distance is applied to the sound material of each track.
; SCALING ACCORDING TO DISTANCE FOR ATTENUATION AND LOCAL + GLOBAL REVERB -SEND
arevsend = asig * sqrt(kDrev) * gireverbsend ; scaling for reverb according to distance and gaincontrol
asig = asig * kDrev ; scaling of signal acording to distance
irevdel = giunit * gifrontwall * 0.00293255132 ; caculation of time of a reflection (reverb) traveling from the wall to the center [s]
arevsend delay arevsend, irevdel ; feeding a delayed signal to global reverbsend to simulate the size of the room
; by delaying the response of the room according to its size
aglrevsend = arevsend * kDrev ; ratio between global and local reverb
zaw aglrevsend, 0 ; global reverb send gets written to Zak-channel 0
; LOCAL REVERB
if gilocalrev = 0 goto encoding; no local reverb send if localreverb is switched off
arevsig = arevsend * (1 - kDrev) ; ratio between global and local reverb
aeffL, aeffR reverbsc arevsig, arevsig, girvbdecay, gicutofffreq, sr, girandpchmod, 1 ; apply local reverb
arevsig = aeffL + aeffR
asig = arevsig + asig
print gilocalrev
encoding:
; ENCODING + OUTPUT UNIT
Encoding_2nd_3rd_Order_zak asig, kA, kE ; read in UDO
end:
Angle6277true-360.0360.01.01.0300true131383Elevation25477true-90.090.01.00.0300true314384Distance44677true0.315.00.11.2300true510386Angle_mod_ctrl63466true-1.01.00.051.0150true65656Elevation_mod_ctrl257466true-1.01.00.05-0.050000012150true257655Distance_mod_ctrl451466true-1.01.00.05-0.050000012150true450656Distance_Correlation697127true2002000.03.00.03.00.0150.0truefreqdevmixctrl54757true0.01.00.10.0200true56789ampdevmixctrl385757true0.01.00.11.0200true38478965421190421076992764341740361678228791320905227793111Copy_ampattenuation838474true0.01.00.550867580trueCopy_frequencyshift704474true0.52.01.017916280true657582824584SPATIAL XYZ GRANULATOR (complex); COPYING UNIT
icpydel = p18 ; delay of copy [s]
imaxcnt = p19 ; maximum number of copies
icnt = p20 ; count of number of copys, has to be "0" at the score
icpyampatt init 1 ; initialisation of the variable responsible for attenuation of a copy
icpyfreqshift init 1 ; initialisation of the variable responsible for shift of frequency of a copy
if icnt != 0 goto endcopy ; skip creation of a copy if this instance of the instrument is already a copy or if no copies are requested
if imaxcnt == 0 goto nocopy ; no creation of a copy if maximum number of copies = 0
copy:
icnt = icnt + 1 ; count the number of copies
if icnt > imaxcnt goto nocopy ; stop copying if the maximum number of copies is reached
icpyampatt = i(<Copy_ampattenuation>) ^ icnt ; atennuate each copy by this factor
icpyfreqshift = i(<Copy_frequencyshift>) ^ icnt ; shift the frequency of each copy by this factor
icpydelay = icpydel * icnt ; shift the start time of each copy by the amount of icpydelay
iXcpydev = p21 * icnt ; shift the angle of each copy by the amount of iAcpydev
iYcpydev = p22 * icnt ; shift the elevation of each copy by the amount of iAcpydev
iZcpydev = p23 * icnt ; shift the distance of each copy by the amount of iAcpydev
schedule p1, icpydelay, p3, p4, p5 * icpyampatt, p6* icpyfreqshift, p7, p8 + iXcpydev, p9 + iYcpydev, p10 + iZcpydev, p11, p12, p13, p14, p15 , p16, p17, p18, p19, icnt, p21, p22, p23 ; generate the copy
goto copy
endcopy:
nocopy:
; INSTRUMENT
idur = p3 ; duration
iinst = p4 ; instrument number of sound producing instrument
iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
ienvinst = p7 ; instrument number of envelope instrument
iX_dev = p8 ; deviation of position of grain - angle [¡] (amount of schifting of copy included)
iY_dev = p9 ; deviation of position of grain - elevation [¡] (amount of schifting of copy included)
iZ_dev = p10 ; deviation of position of grain - distance [unit] (amount of schifting of copy included)
iX_move = p11 ; amount of movement of a single grain in regard to the cloud [¡]
iY_move = p12 ; amount of movement of a single grain in regard to the cloud [¡]
iZ_move = p13 ; amount of movement of a single grain in regard to the cloud [unit]
iX_range = p14 ; possible range of deviation of angle [¡]
iY_range = p15 ; possible range of deviation of elevation [¡]
iZ_range = p16 ; possible range of deviation of distance [unit]
icrtlfn = p17 ; control distribution fn
kX_centre = <X-position> ; position (centre) of the cloud at the X-axis [unit]
kY_centre = <Y-position> ; position (centre) of the cloud at the Y-axis [unit]
kZ_centre = <Z-position> ; position (centre) of the cloud at the Z-axis [unit]
iA_modctrl = i(<Angle_mod_ctrl>) ; angle modification controller [0 = no correlation; 1 = full correlation regarding angle]
iE_modctrl = i(<Elevation_mod_ctrl>) ; elevation modification controller [0 = no correlation; 1 = full correlation regarding elevation]
iD_modctrl = i(<Distance_mod_ctrl>) ; distance modification controller [0 = no correlation; 1 = full correlation regarding distance]
ifreqctrl = i(<freqdevmixctrl>) ; ifreq dev mix controller [0= frequency as assigned, 1= frequency according to position]
iampctrl = i(<ampdevmixctrl>) ; iamp dev mix controller [0= amplitude as assigned, 1= amplitude according to position]
iADcorr = i(<Distance_CorrelationX>) ; angle-distance correllation factor [0 = no correlation; 1 = full correlation between angle and distance]
iEDcorr = i(<Distance_CorrelationY>) ; elevation-distance correllation factor [0 = no correlation; 1 = full correlation between elevation and distance]
; INSTRUMENT PROLONGATION
idurprolong = gidurprolong ; extra duration for reverb tail of local reverb
p3 = p3 + idurprolong ; add extra duration to this instrument
; CALCULATION OF LOCATION
kX_move line 0, idur, iX_move ; creation of a trajectory of the grain during note
kY_move line 0, idur, iY_move ; creation of a trajectory of the grain during note
kZ_move line 0, idur, iZ_move ; creation of a trajectory of the grain during note
kX = kX_centre + kX_move + iX_dev ; adding up movement of the cloud with deviation and movement of the grain
kY = kY_centre + kY_move + iY_dev ; adding up movement of the cloud with deviation and movement of the grain
kZ = kZ_centre + kZ_move + iZ_dev ; adding up movement of the cloud with deviation and movement of the grain
; CONVERSION OF X, Y, Z
iX_centre = i(kX_centre) ; x-position of the clout at init-time
iY_centre = i(kY_centre) ; Y-position of the clout at init-time
iZ_centre = i(kZ_centre) ; z-position of the clout at init-time
iX_range = iX_centre + iX_range ; adding the range in x-direction to the specific position of the cloud
iY_range = iY_centre + iY_range ; adding the range in y-direction to the specific position of the cloud
iZ_range = iZ_centre + iZ_range ; adding the range in z-direction to the specific position of the cloud
iX_dev = iX_centre + iX_dev ; adding the deviation in x-direction to the specific position of the cloud
iY_dev = iY_centre + iY_dev ; adding the deviation in y-direction to the specific position of the cloud
iZ_dev = iZ_centre + iZ_dev ; adding the deviation in z-direction to the specific position of the cloud
iA_centre, iE_centre, iD_centre XYZ_Conversion_i_time iX_centre, iY_centre, iZ_centre ;conversion of initial (centre) position of the cloud from carthesian to polar coordinates
iA_range, iE_range, iD_range XYZ_Conversion_i_time iX_range, iY_range, iZ_range ;conversion of possible range of the postion of the sound from carthesian to polar coordinates
iA_dev, iE_dev, iD_dev XYZ_Conversion_i_time iX_dev, iY_dev, iZ_dev ;conversion of deviation of the postion of the sound from carthesian to polar coordinates
iA_range = abs(iA_centre - iA_range) ; calculation of the maximum range at the specific position of the cloud
iE_range = abs(iE_centre - iE_range) ; calculation of the maximum range at the specific position of the cloud
iD_range = abs(iD_centre - iD_range) ; calculation of the maximum range at the specific position of the cloud
iA_dev = iA_dev - iA_centre ; calculation of the deviation at the specific position of the cloud
iE_dev = iE_dev - iE_centre ; calculation of the deviation at the specific position of the cloud
iD_dev = iD_dev - iD_centre ; calculation of the deviation at the specific position of the cloud
kA, kE, kD XYZ_Conversion_k_time kX, kY, kZ ;conversion of the position of the cloud from carthesian to polar coordinates
kD = (kD < 0.3 ? 0.3 : kD ) ; limits kD to a minimum of 0.3 unit to prevent overflow
kDrev = 1 / kD
kDrev = (kD < 1 ? 1 : kDrev ) ; keeps 1/kD < 1
; A/E/D - CORRELATION
iDcorr_A = iADcorr * sin(iA_dev * 0.01745329252) ; correlation of angle and distance by sinus of the position of the sound (angle - converted in radians)
iDcorr_E = iEDcorr * sin(iE_dev * 0.01745329252) ; correlation of angle and elevation by sinus of the position of the sound (elevation - converted in radians)
kD = kD + iDcorr_A + iDcorr_E ; correlating distance with angle and/or elevation
; AMPLITUDE AND FREQUENCY MODIFICATION BY POSITION
indx_A divz iA_dev * iA_modctrl, iA_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Anglemodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_E divz iE_dev * iE_modctrl, iE_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Elevationmodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_D divz iD_dev * iD_modctrl, iD_range, 0.01 ; calculation of sound location within the "range" and controling the signal by an "Distancemodificationconrol" -slider. Negative values of the slider cause the deviation to be flipped
indx_A = indx_A * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_A table abs(indx_A), icrtlfn, 1 ; reading out the control factor from the function-table regarding angle
iampfreqmod_A = (indx_A < 0 ? 1- (iampfreqmod_A * 0.5) : iampfreqmod_A + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
indxE = indx_E * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_E table abs(indx_E), icrtlfn, 1 ; reading out the control factor from the function-table regarding elevation
iampfreqmod_E = (indx_E < 0 ? 1- (iampfreqmod_E * 0.5) : iampfreqmod_E + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
indx_D = indx_D * 0.999999 ; reducing the index slightly to prevent "flipping over"
iampfreqmod_D table abs(indx_D), icrtlfn, 1 ; reading out the control factor from the function-table regarding distance
iampfreqmod_D = (indx_D < 0 ? 1- (iampfreqmod_D * 0.5) : iampfreqmod_D + 1) ; transformation of iampfreqctrl_A to range between 0.5 and 2 for amplitude and frequencymodification
imodfact = (iampfreqmod_A + iampfreqmod_E + iampfreqmod_D) / 3; adding up angle, elevation and distance partial of modification and calculating the average of them
iampdev = iampdev * (1 - iampctrl) + iampdev * imodfact^2 * iampctrl ; altering amplitude by ammount of A,E or D deviation
ifreqdev = ifreqdev * (1 - ifreqctrl) + ifreqdev * imodfact^2 * ifreqctrl ; altering frequency by ammount of A,E or D deviation
; ******************************************************************************
; SOUND PRODUCTION
; ******************************************************************************
adry subinstr iinst, iampdev, ifreqdev, idurprolong ; invocation of the sound generating instrument
adry = adry * girescale ; scaling of signal
; ******************************************************************************
; ENVELOPE
; ******************************************************************************
aenv subinstr ienvinst, idurprolong ; invocation of the the envelope generator
asig = adry * aenv ; apply envelope to the signal
; APPLICATION OF DOPPLER EFFECT
; Note: giunit = distance from a listener in the middle to the unit sphere in meters
asig doppler asig, kD * giunit, 0, 345, 6 ; application of doppler effect
; FILTERING UNIT [distance]
afilt butterlp asig, 22000 * sqrt(kDrev) ; filtering according to distance
asig balance afilt, asig
; DIFFUSE EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
diffref:
if gidiffref == 0 goto specref ; skip (switch off) the diffuse reflections || kcontrol == 0
Diffuse_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
; SPECULAR EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
specref:
if gispecref == 0 goto scaling ; skip (switch off) the specular reflections || kcontrol == 0
Specular_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
scaling:
; SCALING AND DELAYING UNIT
; this unit is based upon the example in the Charles Dodge/Thomas Jerse book, Computer Music, page 320
; attenuation according to distance and ratio of reverberation/direct signal according to distance is applied to the sound material of each track.
; SCALING ACCORDING TO DISTANCE FOR ATTENUATION AND LOCAL + GLOBAL REVERB -SEND
arevsend = asig * sqrt(kDrev) * gireverbsend ; scaling for reverb according to distance and gaincontrol
asig = asig * kDrev ; scaling of signal acording to distance
irevdel = giunit * gifrontwall * 0.00293255132 ; caculation of time of a reflection (reverb) traveling from the wall to the center [s]
arevsend delay arevsend, irevdel ; feeding a delayed signal to global reverbsend to simulate the size of the room
; by delaying the response of the room according to its size
aglrevsend = arevsend * kDrev ; ratio between global and local reverb
zaw aglrevsend, 0 ; global reverb send gets written to Zak-channel 0
; LOCAL REVERB
if gilocalrev = 0 goto encoding; no local reverb send if localreverb is switched off
arevsig = arevsend * (1 - kDrev) ; ratio between global and local reverb
aeffL, aeffR reverbsc arevsig, arevsig, girvbdecay, gicutofffreq, sr, girandpchmod, 1 ; apply local reverb
arevsig = aeffL + aeffR
asig = arevsig + asig
print gilocalrev
encoding:
; ENCODING + OUTPUT UNIT
Encoding_2nd_3rd_Order_zak asig, kA, kE ; read in UDO
end:
X-position6345true-20.020.00.20.80000114300true138357Y-position28648true-20.020.00.2-0.19999886300true358356Z-position51048true-20.020.00.2-0.19999886300true586359Angle_mod_ctrl65439true-1.01.00.051.0150true70628Elevation_mod_ctrl287440true-1.01.00.05-0.050000012150true290628Distance_mod_ctrl510440true-1.01.00.05-0.050000012150true505628Distance_Correlation79197true2002000.03.00.03.00.00.0falsefreqdevmixctrl62705true0.01.00.11.0200true62738ampdevmixctrl461706true0.01.00.10.0200true4607397471829981808626285831083333177119888528999919788581Copy_ampattenuation909434true0.01.00.550867580trueCopy_frequencyshift784433true0.52.01.017561880true741540903540SIMPLE SPATIAL AED-GRANULATOR
idur = p3 ; duration
iinst = p4 ; instrument number of sound producing instrument
iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
ienvinst = p7 ; instrument number of envelope instrument
iA_dev = p8 ; deviation of position of grain - angle [¡]
iE_dev = p9 ; deviation of position of grain - elevation [¡]
iD_dev = p10 ; deviation of position of grain - distance [unit]
iA_move = p11 ; amount of movement of a single grain in regard to the cloud [¡]
iE_move = p12 ; amount of movement of a single grain in regard to the cloud [¡]
iD_move = p13 ; amount of movement of a single grain in regard to the cloud [unit]
kA_centre = <Angle> ; position (centre) of the cloud - angle [¡]
kE_centre = <Elevation> ; position (centre) of the cloud - elevation [¡]
kD_centre = <Distance> ; position (centre) of the cloud - distance [unit]
; INSTRUMENT PROLONGATION
idurprolong = gidurprolong ; extra duration for reverb tail of local reverb
p3 = p3 + idurprolong ; add extra duration to this instrument
; CALCULATION OF CHANGE OF POSITION DUE TO VELOCITY
kA_grain line iA_dev, idur, iA_dev + iA_move ; creation of a trajectory of the grain during note
kE_grain line iE_dev, idur, iE_dev + iE_move ; creation of a trajectory of the grain during note
kD_grain line iD_dev, idur, iD_dev + iD_move ; creation of a trajectory of the grain during note
kA = kA_centre + kA_grain ; adding up movement of the cloud and movement of the grain
kE = kE_centre + kE_grain ; adding up movement of the cloud and movement of the grain
kD = kD_centre + kD_grain ; adding up movement of the cloud and movement of the grain
kD = (kD < 0.3 ? 0.3 : kD) ; limits kD to a minimum of 0.3 unit to prevent overflow
kDrev = 1 / kD
kDrev = (kD < 1 ? 1 : kDrev ) ; keeps 1/kD < 1
; ******************************************************************************
; SOUND PRODUCTION
; ******************************************************************************
adry subinstr iinst, iampdev, ifreqdev, idurprolong ; invocation of the sound generating instrument
adry = adry * girescale ; scaling of signal
; ******************************************************************************
; ENVELOPE
; ******************************************************************************
aenv subinstr ienvinst, idurprolong ; invocation of the the envelope generator
asig = adry * aenv ; apply envelope to the signal
; APPLICATION OF DOPPLER EFFECT
; Note: giunit = distance from a listener in the middle to the unit sphere in meters
asig doppler asig, kD * giunit, 0 ; application of doppler effect
; FILTERING UNIT [distance]
afilt butterlp asig, 22000 * sqrt(kDrev) ; filtering according to distance
asig balance afilt, asig
; DIFFUSE EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
diffref:
if gidiffref == 0 goto specref ; skip (switch off) the diffuse reflections
Diffuse_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
; SPECULAR EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
specref:
if gispecref == 0 goto scaling ; skip (switch off) the specular reflections
Specular_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
scaling:
; SCALING AND DELAYING UNIT
; this unit is based upon the example in the Charles Dodge/Thomas Jerse book, Computer Music, page 320
; attenuation according to distance and ratio of reverberation/direct signal according to distance is applied to the sound material of each track.
; SCALING ACCORDING TO DISTANCE FOR ATTENUATION AND LOCAL + GLOBAL REVERB -SEND
arevsend = asig * sqrt(kDrev) * gireverbsend ; scaling for reverb according to distance and gaincontrol
asig = asig * kDrev ; scaling of signal acording to distance
irevdel = giunit * gifrontwall * 0.00293255132 ; caculation of time of a reflection (reverb) traveling from the wall to the center [s]
arevsend delay arevsend, irevdel ; feeding a delayed signal to global reverbsend to simulate the size of the room
; by delaying the response of the room according to its size
aglrevsend = arevsend * kDrev ; ratio between global and local reverb
zaw aglrevsend, 0 ; global reverb send gets written to Zak-channel 0
; LOCAL REVERB
if gilocalrev = 0 goto encoding; no local reverb send if localreverb is switched off
arevsig = arevsend * (1 - kDrev) ; ratio between global and local reverb
aeffL, aeffR reverbsc arevsig, arevsig, girvbdecay, gicutofffreq, sr, girandpchmod, 1 ; apply local reverb
arevsig = aeffL + aeffR
asig = arevsig + asig
print gilocalrev
encoding:
; ENCODING + OUTPUT UNIT
Encoding_2nd_3rd_Order_zak asig, kA, kE ; read in UDO
end:
Angle5449true-360.0360.01.01.0300true128356Elevation35549true-90.090.01.00.0300true436356Distance65749true0.315.00.11.2300true740355SIMPLE SPATIAL XYZ-GRANULATOR
idur = p3 ; duration
iinst = p4 ; instrument number of sound producing instrument
iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
ienvinst = p7 ; instrument number of envelope instrument
iX_dev = p8 ; deviation of position of grain - angle [¡]
iY_dev = p9 ; deviation of position of grain - elevation [¡]
iZ_dev = p10 ; deviation of position of grain - distance [unit]
iX_move = p11 ; ammount of movement of a single grain in regard to the cloud [unit]
iY_move = p12 ; ammount of movement of a single grain in regard to the cloud [unit]
iZ_move = p13 ; ammount of movement of a single grain in regard to the cloud [unit]
kX_centre = <X-position> ; position (centre) of the cloud at the X-axis [unit]
kY_centre = <Y-position> ; position (centre) of the cloud at the Y-axis [unit]
kZ_centre = <Z-position> ; position (centre) of the cloud at the Z-axis [unit]
; INSTRUMENT PROLONGATION
idurprolong = gidurprolong ; extra duration for reverb tail of local reverb
p3 = p3 + idurprolong ; add extra duration to this instrument
; CALCULATION OF LOCATION
kX_move line 0, idur, iX_move ; creation of a trajectory of the grain during note
kY_move line 0, idur, iY_move ; creation of a trajectory of the grain during note
kZ_move line 0, idur, iZ_move ; creation of a trajectory of the grain during note
kX = kX_centre + kX_move + iX_dev ; adding up movement of the cloud with deviation and movement of the grain
kY = kY_centre + kY_move + iY_dev ; adding up movement of the cloud with deviation and movement of the grain
kZ = kZ_centre + kZ_move + iZ_dev ; adding up movement of the cloud with deviation and movement of the grain
; CONVERSION OF X, Y, Z
kA, kE, kD XYZ_Conversion_k_time kX, kY, kZ ;conversion of the position of the cloud from carthesian to polar coordinates
kD = (kD < 0.3 ? 0.3 : kD ) ; limits kD to a minimum of 0.3 unit to prevent overflow
kDrev = 1 / kD
kDrev = (kD < 1 ? 1 : kDrev ) ; keeps 1/kD < 1
; ******************************************************************************
; SOUND PRODUCTION
; ******************************************************************************
adry subinstr iinst, iampdev, ifreqdev, idurprolong ; invocation of the sound generating instrument
adry = adry * girescale ; scaling of signal
; ******************************************************************************
; ENVELOPE
; ******************************************************************************
aenv subinstr ienvinst, idurprolong ; invocation of the the envelope generator
asig = adry * aenv ; apply envelope to the signal
; APPLICATION OF DOPPLER EFFECT
; Note: giunit = distance from a listener in the middle to the unit sphere in meters
asig doppler asig, kD * giunit, 0, 345, 6 ; application of doppler effect
; FILTERING UNIT [distance]
afilt butterlp asig, 22000 * sqrt(kDrev) ; filtering according to distance
asig balance afilt, asig
; DIFFUSE EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
diffref:
if gidiffref == 0 goto specref ; skip (switch off) the diffuse reflections || kcontrol == 0
Diffuse_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
; SPECULAR EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
specref:
if gispecref == 0 goto scaling ; skip (switch off) the specular reflections || kcontrol == 0
Specular_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
scaling:
; SCALING AND DELAYING UNIT
; this unit is based upon the example in the Charles Dodge/Thomas Jerse book, Computer Music, page 320
; attenuation according to distance and ratio of reverberation/direct signal according to distance is applied to the sound material of each track.
; SCALING ACCORDING TO DISTANCE FOR ATTENUATION AND LOCAL + GLOBAL REVERB -SEND
arevsend = asig * sqrt(kDrev) * gireverbsend ; scaling for reverb according to distance and gaincontrol
asig = asig * kDrev ; scaling of signal acording to distance
irevdel = giunit * gifrontwall * 0.00293255132 ; caculation of time of a reflection (reverb) traveling from the wall to the center [s]
arevsend delay arevsend, irevdel ; feeding a delayed signal to global reverbsend to simulate the size of the room
; by delaying the response of the room according to its size
aglrevsend = arevsend * kDrev ; ratio between global and local reverb
zaw aglrevsend, 0 ; global reverb send gets written to Zak-channel 0
; LOCAL REVERB
if gilocalrev = 0 goto encoding; no local reverb send if localreverb is switched off
arevsig = arevsend * (1 - kDrev) ; ratio between global and local reverb
aeffL, aeffR reverbsc arevsig, arevsig, girvbdecay, gicutofffreq, sr, girandpchmod, 1 ; apply local reverb
arevsig = aeffL + aeffR
asig = arevsig + asig
print gilocalrev
encoding:
; ENCODING + OUTPUT UNIT
Encoding_2nd_3rd_Order_zak asig, kA, kE ; read in UDO
end:
X-position4546true-20.020.00.20.80000114300true120352Y-position34648true-20.020.00.2-0.19999886300true428355Z-position64849true-20.020.00.2-0.19999886300true728354SIMPLE SPATIAL AED-PLAYER
itime = p2 ; start time of grain
idur = p3 ; duration
iinst = p4 ; instrument number of sound producing instrument
iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
ienvinst = p7 ; instrument number of envelope instrument
idurprolong = gidurprolong ; extra duration for reverb tail of local reverb
p3 = p3 + idurprolong ; add extra duration to this instrument
; CALCULATION OF CHANGE OF POSITION DUE TO VELOCITY
kA = <angle>
kE = <elevation>
kD = <distance>
; LIMITING PROXIMITY TO PREVENT OVERFLOW
kD = (kD < 0.3 ? 0.3 : kD) ; limits kD to a minimum of 0.3 unit to prevent overflow
kDrev = 1 / kD
kDrev = (kD < 1 ? 1 : kDrev ) ; keeps 1/kD < 1
; ******************************************************************************
; SOUND PRODUCTION
; ******************************************************************************
adry subinstr iinst, iampdev, ifreqdev, idurprolong ; invocation of the sound generating instrument
adry = adry * girescale ; scaling of signal
; ******************************************************************************
; ENVELOPE
; ******************************************************************************
aenv subinstr ienvinst, idurprolong ; invocation of the the envelope generator
asig = adry * aenv ; apply envelope to the signal
; FILTERING UNIT [distance]
afilt butterlp asig, 22000 * sqrt(kDrev) ; filtering according to distance
asig balance afilt, asig
; REFLECTIONS UNIT
envfollow:
acontrol follow2 asig, 0.0000001, 0.1 ; checks for periods of sound / silence to switch off the reflections
kcontrol downsamp acontrol ; downsampling to k-rate
; DIFFUSE EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
diffref:
if gidiffref == 0 || kcontrol == 0 goto specref ; skip (switch off) the diffuse reflections
Diffuse_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
; SPECULAR EARLY REFLECTIONS conceived and coded 1999-2001 by Jan Jacob Hofmann, using the Furse-Malham-Set (FMH) of encoding equations.
specref:
if gispecref == 0 || kcontrol == 0 goto scaling ; skip (switch off) the specular reflections
Specular_Early_Reflections_zak asig, kA, kE, kD ; read in UDO
scaling:
; SCALING AND DELAYING UNIT
; this unit is based upon the example in the Charles Dodge/Thomas Jerse book, Computer Music, page 320
; attenuation according to distance and ratio of reverberation/direct signal according to distance is applied to the sound material of each track.
; SCALING ACCORDING TO DISTANCE FOR ATTENUATION AND LOCAL + GLOBAL REVERB -SEND
arevsend = asig * sqrt(kDrev) * gireverbsend ; scaling for reverb according to distance and gaincontrol
asig = asig * kDrev ; scaling of signal acording to distance
irevdel = giunit * gifrontwall * 0.00293255132 ; caculation of time of a reflection (reverb) traveling from the wall to the center [s]
arevsend delay arevsend, irevdel ; feeding a delayed signal to global reverbsend to simulate the size of the room
; by delaying the response of the room according to its size
aglrevsend = arevsend * kDrev ; ratio between global and local reverb
zaw aglrevsend, 0 ; global reverb send gets written to Zak-channel 0
; LOCAL REVERB
if gilocalrev = 0 || kcontrol == 0 goto encoding ; no local reverb send if localreverb is switched off
arevsig = arevsend * (1 - kDrev) ; ratio between global and local reverb
aeffL, aeffR reverbsc arevsig, arevsig, girvbdecay, gicutofffreq, sr, girandpchmod, 1 ; apply local reverb
arevsig = aeffL + aeffR
asig = arevsig + asig
print gilocalrev
encoding:
; ENCODING + OUTPUT UNIT
Encoding_2nd_3rd_Order_zak asig, kA, kE ; read in UDO
end:
angle73137true-360.0360.01.0206.67848300true34487elevation255137true-90.090.01.01.0300true216486distance461141true0.310.00.12.3300982300true422490SPATIAL GLOBAL REVERB conceived and coded 1999-2005 by Jan Jacob Hofmann
#define GLOBALREVERBENCODING(W) #
kchnlw = 0.707107
kchnlx = cos(iA$W.) * cos(iE$W.)
kchnly = sin(iA$W.) * cos(iE$W.)
kchnlz = sin(iE$W.)
kchnlr = 1.5 * sin(iE$W.) * sin(iE$W.) -0.5
kchnls = cos(iA$W.) * sin(2 * iE$W.)
kchnlt = sin(iA$W.) * sin(2 * iE$W.)
kchnlu = cos(2 * iA$W.) * cos(iE$W.) * cos(iE$W.)
kchnlv = sin(2 * iA$W.) * cos(iE$W.) * cos(iE$W.)
aw = afilt$W. * kchnlw ;(A,E)
ax = afilt$W. * kchnlx ;(A,E)
ay = afilt$W. * kchnly ;(A,E)
az = afilt$W. * kchnlz ;(A,E)
ar = afilt$W. * kchnlr ;(A,E)
as = afilt$W. * kchnls ;(A,E)
at = afilt$W. * kchnlt ;(A,E)
au = afilt$W. * kchnlu ;(A,E)
av = afilt$W. * kchnlv ;(A,E)
zawm aw, 1 ; rewrite and mix zak-location 1 with ambisonics w-channel output of spatial global reverb
zawm ax, 2 ; rewrite and mix zak-location 2 with ambisonics x-channel output of spatial global reverb
zawm ay, 3 ; rewrite and mix zak-location 3 with ambisonics y-channel output of spatial global reverb
zawm az, 4 ; rewrite and mix zak-location 4 with ambisonics z-channel output of spatial global reverb
zawm ar, 5 ; rewrite and mix zak-location 5 with ambisonics r-channel output of spatial global reverb
zawm as, 6 ; rewrite and mix zak-location 6 with ambisonics s-channel output of spatial global reverb
zawm at, 7 ; rewrite and mix zak-location 7 with ambisonics t-channel output of spatial global reverb
zawm au, 8 ; rewrite and mix zak-location 8 with ambisonics u-channel output of spatial global reverb
zawm av, 9 ; rewrite and mix zak-location 9 with ambisonics v-channel output of spatial global reverb
#
; ******************************************************************************************************
; using the Furse-Malham-Set (FMH) of encoding equations.
; ******************************************************************************************************
;girvbdecay ; gain of reverb. Adjust empirically
; for desired reverb time. .6 gives
; a good small "live" room sound, .8
; a small hall, .9 a large hall,
; .99 an enormous stone cavern.
;girandpchmod ; amount of random pitch modulation
; for the delay lines. 1 is the "normal"
; amount, but this may be too high for
; held pitches such as piano tones.
; Adjust to taste.
;gicutofffreq ; Cutoff frequency of lowpass filters
; in feedback loops of delay lines,
; in Hz. Lower cutoff frequencies results
; in a sound with more high-frequency
; damping.
arevsig zar 0 ; reading global reverb send as written to Zak-channel 0 in instr. 50
afilt1, afilt2, afilt3, afilt4, afilt5, afilt6, afilt7, afilt8, afilt9, afilt10, afilt11, afilt12 Spatial_Global_Reverb arevsig, girvbdecay, girandpchmod, gicutofffreq
; iA1-iA12 are the angles pointing to the 12 corners of an ikosaeder
; iE1-iE12 are the elevations pointing to the 12 corners of an ikosaeder
iA1 = 0 ; angle reverberant point 1
iA2 = 0.6238 ; angle reverberant point 2
iA3 = 1.2566 ; angle reverberant point 3
iA4 = 1.8849 ; angle reverberant point 4
iA5 = 2.5132 ; angle reverberant point 5
iA6 = 3.1415 ; angle reverberant point 6
iA7 = 3.7699 ; angle reverberant point 7
iA8 = 4.3982 ; angle reverberant point 8
iA9 = 5.0265 ; angle reverberant point 9
iA10 = 5.6548 ; angle reverberant point 10
iA11 = 0 ; angle reverberant point 11
iA12 = 0 ; angle reverberant point 12
iE1 = 0.463646 ; height reverberant point 1 ( 26.565¡)
iE2 = -0.463646 ; height reverberant point 2 ( -26.565¡)
iE3 = 0.463646 ; height reverberant point 3 ( 26.565¡)
iE4 = -0.463646 ; height reverberant point 4 ( -26.565¡)
iE5 = 0.463646 ; height reverberant point 5 ( 26.565¡)
iE6 = -0.463646 ; height reverberant point 6 ( -26.565¡)
iE7 = 0.463646 ; height reverberant point 7 ( 26.565¡)
iE8 = -0.463646 ; height reverberant point 8 ( -26.565¡)
iE9 = 0.463646 ; height reverberant point 9 ( 26.565¡)
iE10 = -0.463646 ; height reverberant point 10 ( -26.565¡)
iE11 = 1.570796 ; height reverberant point 11 ( 90¡)
iE12 = -1.570796 ; height reverberant point 12 ( -90¡)
$GLOBALREVERBENCODING(1)
$GLOBALREVERBENCODING(2)
$GLOBALREVERBENCODING(3)
$GLOBALREVERBENCODING(4)
$GLOBALREVERBENCODING(5)
$GLOBALREVERBENCODING(6)
$GLOBALREVERBENCODING(7)
$GLOBALREVERBENCODING(8)
$GLOBALREVERBENCODING(9)
$GLOBALREVERBENCODING(10)
$GLOBALREVERBENCODING(11)
$GLOBALREVERBENCODING(12)
#undef GLOBALREVERBENCODING(W)
Spatial_Global_Reverbaaaaaaaaaaaaaiii
; 12 delay line FDN reverb, with feedback matrix based upon
; physical modeling scattering junction of 12 lossless waveguides
; of equal characteristic impedance. Based on Julius O. Smith III,
; "A New Approach to Digital Reverberation using Closed Waveguide
; Networks," Proceedings of the International Computer Music
; Conference 1985, p. 47-53 (also available as a seperate
; publication from CCRMA), as well as some more recent papers by
; Smith and others.
;
; Coded by Sean Costello, October 1999/ modified by Jan Jacob Hofmann August 2005
; Note: arevsig is the global input to the reverb.
setksmps 1 ; seting ksmps to 1 as feedback lines are used
arevsig, irvbdecay, irandpchmod, icutofffreq xin
afilt1 init 0
afilt2 init 0
afilt3 init 0
afilt4 init 0
afilt5 init 0
afilt6 init 0
afilt7 init 0
afilt8 init 0
afilt9 init 0
afilt10 init 0
afilt11 init 0
afilt12 init 0
; Delay times chosen to be prime numbers.
; Works with sr=44100/ sr=48000 ONLY. If you wish to
; use a different delay time, find some new
; prime numbers that will give roughly the
; same delay times for the new sampling rate.
; Or adjust to taste.
if sr = 48000 goto delaytime48000 ; delaytime chosen for sr=44100
idel1 = (1237.000/sr)
idel2 = (1381.000/sr)
idel3 = (1609.000/sr)
idel4 = (1777.000/sr)
idel5 = (1951.000/sr)
idel6 = (2063.000/sr)
idel7 = (1069.000/sr)
idel8 = ( 967.000/sr)
idel9 = (1889.000/sr)
idel10 = (1693.000/sr)
idel11 = (1453.000/sr)
idel12 = (1291.000/sr)
goto contin
delaytime48000: ; delaytime for sr=48000
idel1 = (1361.000/sr)
idel2 = (1499.000/sr)
idel3 = (1753.000/sr)
idel4 = (1933.000/sr)
idel5 = (2129.000/sr)
idel6 = (2243.000/sr)
idel7 = (1163.000/sr)
idel8 = (1051.000/sr)
idel9 = (2053.000/sr)
idel10 = (1693.000/sr)
idel11 = (1847.000/sr)
idel12 = (1409.000/sr)
contin:
igain = irvbdecay ; gain of reverb. Adjust empirically
; for desired reverb time. .6 gives
; a good small "live" room sound, .8
; a small hall, .9 a large hall,
; .99 an enormous stone cavern.
ipitchmod = irandpchmod ; amount of random pitch modulation
; for the delay lines. 1 is the "normal"
; amount, but this may be too high for
; held pitches such as piano tones.
; Adjust to taste.
itone = icutofffreq ; Cutoff frequency of lowpass filters
; in feedback loops of delay lines,
; in Hz. Lower cutoff frequencies results
; in a sound with more high-frequency
; damping.
; k1-k8 are used to add random pitch modulation to the
; delay lines. Helps eliminate metallic overtones
; in the reverb sound.
k1 randi .001, 3.1, .06
k2 randi .0011, 3.5, .9
k3 randi .0017, 1.11, .7
k4 randi .0006, 3.973, .3
k5 randi .001, 2.341, .63
k6 randi .0011, 1.897, .17
k7 randi .0017, 0.891, .19
k8 randi .0006, 3.221, .44
k9 randi .001, 1.891, .88
k10 randi .0011, 2.317, .95
k11 randi .0017, 1.091, .36
k12 randi .0006, 2.821, .41
; apj is used to calculate "resultant junction pressure" for
; the scattering junction of e.g. 8 lossless waveguides
; of equal characteristic impedance. If you wish to
; add more delay lines, simply add them to the following
; equation, and replace the .25 by 2/N, where N is the
; number of delay lines.
apj = .16666666667 * (afilt1 + afilt2 + afilt3 + afilt4 + afilt5 + afilt6 +afilt7 + afilt8 + afilt9 + afilt10 +afilt11 + afilt12)
adum1 delayr 1
adel1 deltapi idel1 + k1 * ipitchmod
delayw arevsig + apj - afilt1
adum2 delayr 1
adel2 deltapi idel2 + k2 * ipitchmod
delayw arevsig + apj - afilt2
adum3 delayr 1
adel3 deltapi idel3 + k3 * ipitchmod
delayw arevsig + apj - afilt3
adum4 delayr 1
adel4 deltapi idel4 + k4 * ipitchmod
delayw arevsig + apj - afilt4
adum5 delayr 1
adel5 deltapi idel5 + k5 * ipitchmod
delayw arevsig + apj - afilt5
adum6 delayr 1
adel6 deltapi idel6 + k6 * ipitchmod
delayw arevsig + apj - afilt6
adum7 delayr 1
adel7 deltapi idel7 + k7 * ipitchmod
delayw arevsig + apj - afilt7
adum8 delayr 1
adel8 deltapi idel8 + k8 * ipitchmod
delayw arevsig + apj - afilt8
adum9 delayr 1
adel9 deltapi idel9 + k9 * ipitchmod
delayw arevsig + apj - afilt9
adum10 delayr 1
adel10 deltapi idel10 + k10 * ipitchmod
delayw arevsig + apj - afilt10
adum11 delayr 1
adel11 deltapi idel11 + k11 * ipitchmod
delayw arevsig + apj - afilt11
adum12 delayr 1
adel12 deltapi idel12 + k12 * ipitchmod
delayw arevsig + apj - afilt12
; 1st order lowpass filters in feedback
; loops of delay lines.
afilt1 tone adel1 * igain, itone
afilt2 tone adel2 * igain, itone
afilt3 tone adel3 * igain, itone
afilt4 tone adel4 * igain, itone
afilt5 tone adel5 * igain, itone
afilt6 tone adel6 * igain, itone
afilt7 tone adel7 * igain, itone
afilt8 tone adel8 * igain, itone
afilt9 tone adel9 * igain, itone
afilt10 tone adel10 * igain, itone
afilt11 tone adel11 * igain, itone
afilt12 tone adel12 * igain, itone
xout afilt1 , afilt2 , afilt3 , afilt4 , afilt5 , afilt6 , afilt7 , afilt8, afilt9 , afilt10 , afilt11 , afilt12
OUTPUT & DECODING UNIT, 3rd ORDER AMBISONICS coded 1999-2012 by Jan Jacob Hofmann. ; FURSE - MALHAM - SET OF EQUATIONS Thanks to Richard Furse and Dave Malham
; More sets of speaker- layouts may be discovered at
; http://www.muse.demon.co.uk/ref/speakers.html
; *****************************************************************************************************************
krelcoef = 1 ; 0-1 (0= Spherichal Harmonics; 1 = (Controlled Opposites)
aw zar 1 ; zak ambisonics w-channel input
ax zar 2 ; zak ambisonics x-channel input
ay zar 3 ; zak ambisonics y-channel input
az zar 4 ; zak ambisonics z-channel input
ar zar 5 ; zak ambisonics s-channel input
as zar 6 ; zak ambisonics t-channel input
at zar 7 ; zak ambisonics u-channel input
au zar 8 ; zak ambisonics v-channel input
av zar 9 ; zak ambisonics w-channel input
ak zar 10 ; zak ambisonics w-channel input
al zar 11 ; zak ambisonics x-channel input
am zar 12 ; zak ambisonics y-channel input
an zar 13 ; zak ambisonics z-channel input
ao zar 14 ; zak ambisonics s-channel input
ap zar 15 ; zak ambisonics t-channel input
aq zar 16 ; zak ambisonics t-channel input
zacl 0, 16 ; clear all a-rate channels
zkcl 0, 2 ; clear all k-rate channels
idecchnls = int(gidecchnls)
if idecchnls == 2 goto stereo ; goto 2chnl decode
if idecchnls == 8 goto eight ; goto 8chnl decode
; UNIT FOR WRITING 9 2ND ORRDER / 16 3RD ORDER AMBISONIC ENCODED SOUNDFILES
; **************************************************************************************
kpeak1 peak aw
kpeak2 peak ax
kpeak3 peak ay
kpeak4 peak az
kpeak5 peak ar
kpeak6 peak as
kpeak7 peak at
kpeak8 peak au
kpeak9 peak av
printk p3 - 2, kpeak1,0
printk p3 - 2, kpeak2,3
printk p3 - 2, kpeak3,6
printk p3 - 2, kpeak4,9
printk p3 - 2, kpeak5,12
printk p3 - 2, kpeak6,15
printk p3 - 2, kpeak7,18
printk p3 - 2, kpeak8,21
printk p3 - 2, kpeak9,24
fout "$FILE.w.$HEADER.", giformat,aw ; output of a soundfile with header as specified in the options
fout "$FILE.x.$HEADER.", giformat,ax ; output of a soundfile with header as specified in the options
fout "$FILE.y.$HEADER.", giformat,ay ; output of a soundfile with header as specified in the options
fout "$FILE.z.$HEADER.", giformat,az ; output of a soundfile with header as specified in the options
fout "$FILE.r.$HEADER.", giformat,ar ; output of a soundfile with header as specified in the options
fout "$FILE.s.$HEADER.", giformat,as ; output of a soundfile with header as specified in the options
fout "$FILE.t.$HEADER.", giformat,at ; output of a soundfile with header as specified in the options
fout "$FILE.u.$HEADER.", giformat,au ; output of a soundfile with header as specified in the options
fout "$FILE.v.$HEADER.", giformat,av ; output of a soundfile with header as specified in the options
if giorder == 2 goto encodeend ; write files in 2nd order Ambisonic
kpeak10 peak ak
kpeak11 peak al
kpeak12 peak am
kpeak13 peak an
kpeak14 peak ao
kpeak15 peak ap
kpeak16 peak aq
printk p3 - 2, kpeak10,0
printk p3 - 2, kpeak11,3
printk p3 - 2, kpeak12,6
printk p3 - 2, kpeak13,9
printk p3 - 2, kpeak14,12
printk p3 - 2, kpeak15,15
printk p3 - 2, kpeak16,18
fout "$FILE.k.$HEADER.", giformat,ak ; output of a soundfile with header as specified in the options
fout "$FILE.l.$HEADER.", giformat,al ; output of a soundfile with header as specified in the options
fout "$FILE.m.$HEADER.", giformat,am ; output of a soundfile with header as specified in the options
fout "$FILE.n.$HEADER.", giformat,an ; output of a soundfile with header as specified in the options
fout "$FILE.o.$HEADER.", giformat,ao ; output of a soundfile with header as specified in the options
fout "$FILE.p.$HEADER.", giformat,ap ; output of a soundfile with header as specified in the options
fout "$FILE.q.$HEADER.", giformat,aq ; output of a soundfile with header as specified in the options
encodeend:
if gidecchnls == 9 || gidecchnls == 16 goto skipend ; just encode the sound -comment this out if encoded+decoded files are wanted
; ********************************************************************************************************
stereo: ; 2chnl (stereo ) decode, 2nd order Ambisonics (second order controlled opposites) output
; ********************************************************************************************************
if gidecchnls == 2.1 goto uhj ; goto 2chnl UHJ decode
if gidecchnls == 2.2 goto binaural_2nd_order ; goto 2chnl Binaural 2nd order decode
if gidecchnls == 2.3 goto binaural_3rd_order ; goto 2chnl Binaural 3rd order decode
achnl_1, achnl_2 Stereo_Decode aw, ay
goto peak_2
uhj:
achnl_1, achnl_2 UHJ_Decode aw, ax, ay ;UHJ Stereo output
goto peak_2
binaural_2nd_order:
achnl_1, achnl_2 Binaural_Decode_2nd_order aw, ax, ay, az, ar, as, at, au, av, krelcoef ;binaural with height in 2nd order resolution
goto peak_2
binaural_3rd_order:
achnl_1, achnl_2 Binaural_Decode_3rd_order aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq ;binaural in a plane with 3rd order resolution
peak_2:
kpeak_1 peak achnl_1
kpeak_2 peak achnl_2
printk p3, kpeak_1, 0
printk p3, kpeak_2, 3
if idecchnls == 2 goto skipend ; stereo output
; ********************************************************************************************************
eight: ; 8chnl decode, 2nd/3rd order Ambisonics (controlled opposites) output
; ********************************************************************************************************
if gidecchnls == 8 goto cube ; goto 8chnl cube decode
if gidecchnls == 8.1 goto octogon_1 ; goto 8chnl cube decode
cube:
achnl_1, achnl_2, achnl_3, achnl_4, achnl_5, achnl_6, achnl_7, achnl_8 Cube_Decode_2nd_order aw, ax, ay, az, as, at, av
goto peak_8
octogon_1:
achnl_1, achnl_2, achnl_3, achnl_4, achnl_5, achnl_6, achnl_7, achnl_8 Octogon1_Decode_3rd_order aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq
peak_8:
kpeak_1 peak achnl_1
kpeak_2 peak achnl_2
kpeak_3 peak achnl_3
kpeak_4 peak achnl_4
kpeak_5 peak achnl_5
kpeak_6 peak achnl_6
kpeak_7 peak achnl_7
kpeak_8 peak achnl_8
printk p3, kpeak_1,0
printk p3, kpeak_2,3
printk p3, kpeak_3,6
printk p3, kpeak_4,9
printk p3, kpeak_5,12
printk p3, kpeak_6,15
printk p3, kpeak_7,18
printk p3, kpeak_8,21
skipend:
blueMixerOut achnl_1, achnl_2, achnl_3, achnl_4, achnl_5, achnl_6, achnl_7, achnl_8
false0.01Master0.0falsefalse3Master0.0falsefalse11Master0.0falsefalse12Master0.0falsefalse13Master0.0falsefalse14Master0.0falsefalse15Master0.0falsefalse23Master0.0falsefalse24Master0.0falsefalse25Master0.0falsefalse26Master0.0falsefalse27Master0.0falsefalse28Master0.0falsefalse29Master0.0falsefalse30Master0.0falsefalse32Master0.0falsefalse41Master0.0falsefalse50Master0.0falsefalse60Master0.0falsefalse61Master0.0falsefalse65Master0.0falsefalse70Master0.0falsefalse71Master0.0falsefalse72Master0.0falsefalse73Master0.0falsefalse75Master0.0falsefalse78Master0.0falsefalse80Master0.0falsefalseMasterMaster-1.1falsefalse f1 0 8192 10 1 /* sine */
f3 0 8192 10 1 0.5 0.333 0.25 0.2 0.166 0.142 0.125 0.111 0.1 0.09 0.083 0.076 0.071 0.066 0.062 /* sawtooth */
f7 0 32768 14 1 1 0 1 0 0.6 0 0.4 0 0.1 /* hyperbolid */
f8 0 32769 19 0.5 0.5 270 0.5 /* sigmoid rising */
f9 0 8192 19 0.5 1 180 1 /* paraboloid */
f10 0 8192 20 2 1 /* hanning */
/*f11-f20=straight lines */
f11 0 4 7 0 4 0
f12 0 4 7 0.1 4 0.1
f13 0 4 7 0.2 4 0.2
f14 0 4 7 0.4 4 0.4
f15 0 4 7 0.5 4 0.5
f16 0 4 7 0.6 4 0.6
f17 0 4 7 0.8 4 0.8
f18 0 4 7 0.9 4 0.9
f19 0 4 7 1 4 1
f20 0 4 -7 10 4 10
/*f21-f30=slopes and linsegs*/
f21 0 8192 7 0 8192 1 /*slope up*/
f22 0 8192 7 0 8192 -1
f23 0 4 7 0 1 0 0 1 2 1 0 0 1 0 /* rectangle unipolar, symmetric*/
f24 0 4 7 1 2 1 0 -1 2 -1 /* rectangle bipolar*/
f25 0 1024 7 0 512 1 512 0 /* triangle unipolar*/
f26 0 4 7 0 2 0 0 1 2 1 /* rectangle unipolar*/
f27 0 1024 7 0 512 1 0 -1 512 0 /* sawtooth bipolar */
f28 0 1024 7 0 256 1 512 -1 256 0 /* tiangle bipolar */
f29 0 1024 7 0 100 1 824 1 100 0 /* enveloped 19*/
/*f31-f40=exponentials */
f31 0 65537 5 0.001 65537 1
f32 0 65537 5 1 65537 0.001
9.218750.0Simple-AED-Granulator-125664640
; iinst = p4 ; instrument number of sound producing instrument
; iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
; ifreqdev = p6 ; frequency deviation (0.5 = 50% frequency, 2 = 200% frequency deviation)
; ienvinst = p7 ; function number for envelope generating instrument
; ieff_1 = p8 ; attack [%]
; ieff_2 = p9 ; instrument number of effect instrument 1
; ieff_3 = p10 ; instrument number of effect instrument 2
; iA = p11 ; position - angle(start)
; iE = p12 ; position - elevation:(start)
; iD = p13 ; distance of grain (start)
; iAdiff = p14 ; proportion of movement of a single grain in regard to the cloud [%]
; iEdiff = p15 ; proportion of movement of a single grain in regard to the cloud [%]
; iDdiff = p16 ; proportion of movement of a single grain in regard to the cloud [%]
;p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16
i52 0 2 25 1 1 33 0 0 0 0 0 0 0 0 0
zakinit 16, 2 ; isizea, isizek
0dbfs = 1
; SOUNDFILE OUTPUT SETTINGS
#define FILE #Spatial_Granulator-# ; insert filename for name of output file here (note that the extension is just for the
; generation of the filename, the header of the file is specified below.
#define HEADER #aif# ; insert filetype for output file name here
giformat = 8 ; 1 = 16 bit integers without header (binary PCM multichannel file) for "fout"
; 2 = 16-bit integers with a header.
; The header type depends on the render format.
; The default header type is the IRCAM format.
; If the user chooses the AIFF format (using the -A flag),
; the header format will be a AIFF type. If the user chooses the WAV
; format (using the -W flag), the header format will be a WAV type.
; 8 = 24 bit integer with header like specified in options . For "fout".
giorder = 3 ; 2 = 2nd order encode
; 3 = 3rd order encode
; GLOBAL SCALING OF THE AMPLITUDE
girescale = 1 ; no amplitude scaling for test decoding
;girescale = 1.6 ; amplitude scaling for 2chnl decoding
; girescale = 0.95 ; amplitude scaling for 16-chnl encoding
;LAYOUT OF SPEAKERS
gidecchnls = 2 ; specifies the speaker setup:
; 2 = stereo speaker setup
; 8 = cube
; 8.1 = octogon1
; 9 = encoding 2nd order
; 16 = encoding 3rd order
; OVERALL DURATION
gidurprolong init 0.5 ; prolong duration of generated instrument to perserve reverberation of early reflections and local reverb
; UNITS ON/ OFF
gilocalrev init 1 ; switch on/off local reverb [0=off, 1=on]
gispecref init 1 ; switch on/off specular reflections [0=off, 1=on] and adjust gain of reflection (e.g.: 1= normal gain, 2= twice as loud, 0.5 = half as loud)
gidiffref init 0 ; switch on/off diffuse reflections [0=off, 1=on] and adjust gain of reflection (e.g.: 1= normal gain, 2= twice as loud, 0.5 = half as loud)
; EARLY REFLECTIONS PARAMETERS
gifrontwall = 1.6 ; position of frontwall at the x-axis [units] for calculation of early reflections
gisidewall = 1.3 ; position of sidewall at the y-axis [units] for calculation of early reflections
giceiling = 1.1 ; height of the ceiling measured from the zero-point of the coordinate-system [units] for calculation of early reflections
gidamp = 0.1 ; damping factor of the reflecting surface (gain of reverb)
gihighdamp = 15000 ; absorbtion characteristics of the wall in respect to high frequencies: frequencies above ihighdamp get filtered out
gilfboost = 1 ; low frequency boost for sources near a wall
giunit = 4 ; radius of the "unit- sphere" (distance of the speaker from the center- point [m])
; LOCAL AND SPATIAL GLOBAL REVERB PARAMETERS
gireverbsend init 0.2 ; amount of direct signal sent to local + global reverb
girvbdecay init 0.5 ; gain of reverb. Adjust empirically
; for desired reverb time. .6 gives
; a good small "live" room sound, .8
; a small hall, .9 a large hall,
; .99 an enormous stone cavern.
girandpchmod init 1 ; amount of random pitch modulation
; for the delay lines. 1 is the "normal"
; amount, but this may be too high for
; held pitches such as piano tones.
; Adjust to taste.
gicutofffreq init 8000 ; Cutoff frequency of lowpass filters
; in feedback loops of delay lines,
; in Hz. Lower cutoff frequencies results
; in a sound with more high-frequency
; damping.
; VELOCITY OF GRAIN
giAmove init 0 ; initilal value for movement of a single grain to calculate velocity
giEmove init 0 ; initilal value for movement of a single grain to calculate velocity
giDmove init 0 ; initilal value for movement of a single grain to calculate velocity
gitime init 0 ; initilal value for movement of a single grain to calculate velocity
#define GLOBALREVERBENCODING(W) #
kchnlw = 0.707107
kchnlx = cos(iA$W.) * cos(iE$W.)
kchnly = sin(iA$W.) * cos(iE$W.)
kchnlz = sin(iE$W.)
kchnlr = 1.5 * sin(iE$W.) * sin(iE$W.) -0.5
kchnls = cos(iA$W.) * sin(2 * iE$W.)
kchnlt = sin(iA$W.) * sin(2 * iE$W.)
kchnlu = cos(2 * iA$W.) * cos(iE$W.) * cos(iE$W.)
kchnlv = sin(2 * iA$W.) * cos(iE$W.) * cos(iE$W.)
aw = afilt$W. * kchnlw ;(A,E)
ax = afilt$W. * kchnlx ;(A,E)
ay = afilt$W. * kchnly ;(A,E)
az = afilt$W. * kchnlz ;(A,E)
ar = afilt$W. * kchnlr ;(A,E)
as = afilt$W. * kchnls ;(A,E)
at = afilt$W. * kchnlt ;(A,E)
au = afilt$W. * kchnlu ;(A,E)
av = afilt$W. * kchnlv ;(A,E)
zawm aw, 1 ; rewrite and mix zak-location 1 with ambisonics w-channel output of spatial global reverb
zawm ax, 2 ; rewrite and mix zak-location 2 with ambisonics x-channel output of spatial global reverb
zawm ay, 3 ; rewrite and mix zak-location 3 with ambisonics y-channel output of spatial global reverb
zawm az, 4 ; rewrite and mix zak-location 4 with ambisonics z-channel output of spatial global reverb
zawm ar, 5 ; rewrite and mix zak-location 5 with ambisonics r-channel output of spatial global reverb
zawm as, 6 ; rewrite and mix zak-location 6 with ambisonics s-channel output of spatial global reverb
zawm at, 7 ; rewrite and mix zak-location 7 with ambisonics t-channel output of spatial global reverb
zawm au, 8 ; rewrite and mix zak-location 8 with ambisonics u-channel output of spatial global reverb
zawm av, 9 ; rewrite and mix zak-location 9 with ambisonics v-channel output of spatial global reverb
#
i78 0 [<TOTAL_DUR> + 10]
i80 0 [<TOTAL_DUR> + 10]
XYZ_Conversion_k_timekkkkkk
; CONVERSION OF X, Y, Z, k-rate
kx, ky, kz xin ; input
kx = (kx < 0.01 && kx > -0.01 ? 0.01 : kx) ; fix for that strange y-axis noise
; Distance calculation
kD = sqrt( kx^2 + ky^2 + kz^2) ; calculates the distance
kx = kx / kD ; this operation generates a vector equivalent at the unit sphere
ky = ky / kD ; this operation generates a vector equivalent at the unit sphere
kz = kz / kD ; this operation generates a vector equivalent at the unit sphere
; Elevation calculation
kE = cosinv ( sqrt( 1 - kz^2)) ; calculation of Elevation
kE = ( kz < 0 ? -kE : kE) ; if z is negative make Elevation- vector negative too
; Angle calculation
kA = sininv (ky / sqrt(kx^2 + ky^2)) - 6.2831 ; calculation of Angle
kA = (kx >= 0 ? kA : 3.1415 - kA) ; distinction of positive and negative y
kA = (ky <= 0 && kx >= 0 ? 6.2831 + kA : kA) ; distinction of positive and negative y and x
kA = kA * 57.295779513 ; conversion from rad to deg
kE = kE * 57.295779513 ; conversion from rad to deg
xout kA, kE, kD ; output
XYZ_Conversion_i_timeiiiiii
; CONVERSION OF X, Y, Z
ix, iy, iz xin ; input
ix = (ix < 0.01 && ix > -0.01 ? 0.01 : ix) ; fix for that strange y-axis noise
; Distance calculation
iD = sqrt( ix^2 + iy^2 + iz^2) ; calculates the distance
ix = ix / iD ; this operation generates a vector equivalent at the unit sphere
iy = iy / iD ; this operation generates a vector equivalent at the unit sphere
iz = iz / iD ; this operation generates a vector equivalent at the unit sphere
; Elevation calculation
iE = cosinv ( sqrt( 1 - iz^2)) ; calculation of Elevation
iE = ( iz < 0 ? -iE : iE) ; if z is negative make Elevation- vector negative too
; Angle calculation
iA = sininv (iy / sqrt(ix^2 + iy^2)) - 6.2831 ; calculation of Angle
iA = (ix >= 0 ? iA : 3.1415 - iA) ; distinction of positive and negative y
iA = (iy <= 0 && ix >= 0 ? 6.2831 + iA : iA) ; distinction of positive and negative y and x
iA = iA * 57.295779513 ; conversion from rad to deg
iE = iE * 57.295779513 ; conversion from rad to deg
xout iA, iE, iD ; output
Doppler_Shift_Calculationkki; DOPPLER SHIFT CALCULATION
; calculation of velocity
; Note: giunit = distance from a listener in the middle to the unit sphere in meters
kD, giunit xin
kDdelayed delayk kD, 0.001,2 ; delay distance - amount for 1 ms
kV = kDdelayed - kD ; calculate the difference of distances
kV = (kV * giunit) * 1000 ; speed in m/s
; calculation of doppler
kpitch = 345 / (345 - kV)
xout kpitch
Encoding_2nd_3rd_Order_zak0akk
asig, kA, kE xin
aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq bformenc1 asig, kA, kE ;3rd order Ambisonics encoding
zawm aw, 1 ; rewrite and mix zak-location 1 with ambisonics w-channel output
zawm ax, 2 ; rewrite and mix zak-location 2 with ambisonics x-channel output
zawm ay, 3 ; rewrite and mix zak-location 3 with ambisonics y-channel output
zawm az, 4 ; rewrite and mix zak-location 4 with ambisonics z-channel output
zawm ar, 5 ; rewrite and mix zak-location 5 with ambisonics r-channel output
zawm as, 6 ; rewrite and mix zak-location 6 with ambisonics s-channel output
zawm at, 7 ; rewrite and mix zak-location 7 with ambisonics t-channel output
zawm au, 8 ; rewrite and mix zak-location 8 with ambisonics u-channel output
zawm av, 9 ; rewrite and mix zak-location 9 with ambisonics v-channel output
if giorder == 2 goto skipend ; just encode the sound -comment this out if encoded+decoded files are wanted
zawm ak, 10 ; rewrite and mix zak-location 10 with ambisonics k-channel output
zawm al, 11 ; rewrite and mix zak-location 11 with ambisonics l-channel output
zawm am, 12 ; rewrite and mix zak-location 12 with ambisonics m-channel output
zawm an, 13 ; rewrite and mix zak-location 13 with ambisonics n-channel output
zawm ao, 14 ; rewrite and mix zak-location 14 with ambisonics o-channel output
zawm ap, 15 ; rewrite and mix zak-location 15 with ambisonics p-channel output
zawm aq, 16 ; rewrite and mix zak-location 16 with ambisonics q-channel output
skipend:
Diffuse_Early_Reflections_zak0akkk
#define DIFFREFLECTION(R)#
icnt = $R.
; calculation of points of reflection
; frontwall= 1
; backwall = 2
; left sidewall =3
; right sidewall = 4
; ceiling = 5
; floor = 6
krefx = ( icnt = 1 ? gifrontwall : kx) ; asigning a position of the reflection at the x-axis
if icnt = 1 kgoto yrefcalc$R.
krefx = ( icnt = 2 ? -gifrontwall : kx) ; asigning a position of the reflection at the x-axis
yrefcalc$R.:
krefy = ( icnt = 3 ? gisidewall : ky) ; asigning a position of the reflection at the y-axis
if icnt = 3 kgoto zrefcalc$R.
krefy = ( icnt = 4 ? -gisidewall : ky) ; asigning a position of the reflection at the y-axis
zrefcalc$R.:
krefz = ( icnt = 5 ? giceiling : kz) ; asigning a position of the reflection at the z-axis
if icnt = 5 kgoto refout$R.
krefz = ( icnt = 6 ? -giceiling : kz) ; asigning a position of the reflection at the z-axis
refout$R.:
; A, E, D - calculation of the reflecting point
kDref = sqrt(krefx^2 + krefy^2 + krefz^2) ; calculates the distance of the reflection
kxref = krefx / kDref ; this operation generates a vector equivalent at the unit sphere
kyref = krefy / kDref ; this operation generates a vector equivalent at the unit sphere
kzref = krefz / kDref ; this operation generates a vector equivalent at the unit sphere
; Elevation calculation
kEref = cosinv ( sqrt( 1- kzref^2)) ; calculation of elevation
kEref = (kzref < 0 ? -kEref : kEref) ; if z is negative make Elevation- vector negative too
; Angle calculation
kAref = sininv (kyref / sqrt(kxref^2 + kyref^2)) ; calculation of angle
kAref = (kxref >= 0 ? kAref : 3.1415 - kAref) ; distinction of positive and negative y
kAref = (kyref <= 0 && kxref >= 0 ? 6.2831 + kAref : kAref); distinction of positive and negative y and x
; calculation of distance- difference (m/s) and delaytime
kDdiff = sqrt((kx - krefx)^2 + (ky-krefy)^2 + (kz - krefz)^2 ) ; calculation of the difference of kreflection and ksound
kDist = kDdiff + kDref ; distance sourcesurface + distance surface listener
kDmtr = kDist * giunit ; calculation of difference in meters
kdel = kDmtr / 0.345 ; calculation of the delaytime [ms]
; reflection behind the source
kAdist = abs(kA - kAref)
kEdist = abs(kE - kEref)
kAdist = (kAdist > 6.2831 ? kAdist - 6.2831 : kAdist) ; reduces the angle kAdist to values between 0 and 6,2831
kmute = kAdist + kEdist
kmute = ( kmute < 1.5707 ? sin (kmute) : 1) ; if the reflection gets behind the source, it is muted
; calculation of attenuation (gain of delay)
kgain = 1 / kDist * gidamp * kmute ; gain of early reflection according calculation of attenuation
; FILTERING UNIT
kDdiff = ( kDdiff < 0.05 ? 0.05 : kDdiff) ; limit the distance source reflection
klfboost = (sqrt(1 / kDdiff ) + kD) * gilfboost
afilt tone asig, (sqrt(1 / kDist)) * sr ; filtering of high frequencies according to distance
afilt pareq afilt, 174, klfboost, 0.7071, 1 ; boosting low frequencies for souces near the wall
afilt balance afilt, asig ; balancing the output
adel interp kdel
asigref vdelay3 afilt, adel, 200 ; creating a reflection
asigref = asigref * kgain ; assigning a gain
; ENCODING UNIT
; RADIANT - DEGREE CONVERSION
kAref = kAref * 57.2958 ; convert angle from radiant to degree
kEref = kEref * 57.2958 ; convert elevation from radiant to degree
; ENCODING 2nd/3rd ORDER + ZAK-WRITING UNIT
Encoding_2nd_3rd_Order_zak asigref, kAref, kEref ; encoding the sound in 2nd order ambisonic if nchnls = 9 and 3rd order if nchnls = 16
#
; gifrontwall - position of frontwall at the x-axis
; gisidewall - position of sidewall at the y-axis
; giceiling - height of the ceiling measured from the zero-point of the coordinate-system
; giunit - radius of the unit- sphere[m]
; TRAJECTORY AND SIGNAL READ IN
asig, kA, kE, kD xin
; DEGREE - RADIANT CONVERSION
kA = kA * 0.01745329252 ; convert 0-360 degrees to radiant-expression
kE = kE * 0.01745329252 ; convert 0-90 degrees to radiant-expression
kA = (kA < 0 ? kA + 6.283185 : kA) ; prevent negative angle kA
kA = (kA > 6.283185 ? kA - 6.283185 : kA) ; prevent angle kA > 360
; Polar converter -source as cartesian representation
kx = kD * cos(kA) * cos(kE) ; position of sound in kartesian coordinates
ky = kD * sin(kA) * cos(kE) ; position of sound in kartesian coordinates
kz = kD * sin(kE) ; position of sound in kartesian coordinates
kx = (kx < 0.01 && kx > -0.01 ? 0.01 : kx) ; fix for that strange y-axis noise
asig tone asig, gihighdamp ; filtering of high frequencies due to absorbtion characteristics of the wall
$DIFFREFLECTION(1)
$DIFFREFLECTION(2)
$DIFFREFLECTION(3)
$DIFFREFLECTION(4)
$DIFFREFLECTION(5)
$DIFFREFLECTION(6)
#undef DIFFREFLECTION(R)Specular_Early_Reflections_zak0akkk
#define SPECREFLECTION(R)#
; calculation of points of reflection
icnt = $R.
ksum$R. = abs(iwall$R. ) + abs(kdiff$R.) ; distance source wall listener (x,y,z-component)
krefx = (kx/ ksum$R. ) * abs(iwall$R.) ; x- position of the reflection
krefy = (ky/ ksum$R. ) * abs(iwall$R.) ; y- position of the reflection
krefz = (kz/ ksum$R. ) * abs(iwall$R.) ; z- position of the reflection
krefx = (icnt = 1 ? iwall1 : (kx/ ksum$R. ) * abs(iwall$R.)) ; x- position of the reflection
krefx = (icnt = 2 ? -iwall1 : (kx/ ksum$R. ) * abs(iwall$R.)) ; x- position of the reflection
krefy = (ky/ ksum$R. ) * abs(iwall$R.) ; y- position of the reflection
krefz = (kz/ ksum$R. ) * abs(iwall$R.) ; z- position of the reflection
; assignment of x-,y-,z- component at the wall
; frontwall = 1
; backwall = 2
; left sidewall =3
; right sidewall = 4
; ceiling = 5
; floor = 6
krefx = ( icnt = 1 ? iwall1 : krefx) ; asigning a position of the reflection at the x-axis
if icnt = 1 igoto ycalc$R.
krefx = ( icnt = 2 ? iwall2 : krefx) ; asigning a position of the reflection at the x-axis
ycalc$R.:
krefy = ( icnt = 3 ? iwall3 : krefy) ; asigning a position of the reflection at the y-axis
if icnt = 3 igoto zcalc$R.
krefy = ( icnt = 4 ? iwall4 : krefy) ; asigning a position of the reflection at the y-axis
zcalc$R.:
krefz = ( icnt = 5 ? iwall5 : krefz) ; asigning a position of the reflection at the z-axis
if icnt = 5 igoto labelout$R.
krefz = ( icnt = 6 ? iwall6 : krefz) ; asigning a position of the reflection at the z-axis
labelout$R.:
krefx = (krefx < 0.001 && krefx > -0.001 ? 0.001 : krefx) ; avoid zero to avoid division by zero error (NaN) later
krefy = (krefy < 0.001 && krefy > -0.001 ? 0.001 : krefy) ; avoid zero to avoid division by zero error (NaN) later
krefz = (krefz < 0.001 && krefz > -0.001 ? 0.001 : krefz) ; avoid zero to avoid division by zero error (NaN) later
; A, E, D - calculation of the reflecting point
kDref = sqrt (krefx^2 + krefy^2 + krefz^2) ; calculates the distance of the reflection
kxref = krefx / kDref ; this operation generates a vector equivalent at the unit sphere
kyref = krefy / kDref ; this operation generates a vector equivalent at the unit sphere
kzref = krefz / kDref ; this operation generates a vector equivalent at the unit sphere
; Elevation calculation
kEref = cosinv ( sqrt( 1 - kzref^2)) ; calculation of elevation
kEref = (kzref < 0 ? -kEref : kEref) ; if z is negative make elevation- vector negative too
; Angle calculation
kAref = sininv (kyref / sqrt(kxref^2 + kyref^2)) ; calculation of angle
kAref = (kxref >= 0 ? kAref : 3.1415 - kAref) ; distinction of positive and negative y
kAref = (kyref <= 0 && kxref >= 0 ? 6.2831 + kAref : kAref); distinction of positive and negative y and x
; calculation of distance- difference (m/s) and delaytime
kDdiff = sqrt((kx - krefx)^2 + (ky - krefy)^2 + (kz - krefz)^2 ) ; calculation of the difference of kreflection and ksound
kDist = kDdiff + kDref ; distance sourcesurface + distance surface listener
kDmtr = kDist * giunit ; calculation of difference in meters
kdel = kDmtr / 0.345 ; calculation of the delaytime [ms]
; calculation of attenuation (gain of delay)
kgain = 1 / kDist * gidamp ; gain of early reflection according calculation of attenuation
; reflection behind the source
kAdist = abs(kA - kAref) ; distance of angle between source and reflection
kEdist = abs(kE - kEref) ; distance of elevation between source and reflection
kAdist = (kAdist > 6.2831 ? kAdist - 6.2831 : kAdist) ; reduces the angle kAdist to values between 0 and 6,2831
kmute = kAdist + kEdist
kmute = (kmute < 1.5707 ? sin (kmute) : 1) ; if the reflection gets behind the source, it is muted
; filtering unit
kDdiff = ( kDdiff < 0.05 ? 0.05 : kDdiff) ; limit the distance source reflection
klfboost = sqrt(1 / kDdiff) * gilfboost
afilt tone asig, (sqrt(1 / kDist)) * sr ; filtering of high frequencies due to absorbtion characteristics of the air
; according to distance
afilt pareq afilt, 174, klfboost, 0.7071, 1 ; boosting low frequencies for souces near the wall
afilt balance afilt, asig ; balancing the output
adel interp kdel
asigref vdelay3 afilt, adel, 200 ; creation of a reflection
asigref = asigref * kgain * kmute ; assigning a gain
; ENCODING UNIT
; RADIANT - DEGREE CONVERSION
kAref = kAref * 57.2958 ; convert angle from radiant to degree
kEref = kEref * 57.2958 ; convert elevation from radiant to degree
;printk 1, kAref, 23
;printk 1, kEref, 23
; ENCODING 2nd/3rd ORDER + ZAK-WRITING UNIT
Encoding_2nd_3rd_Order_zak asigref, kAref, kEref ; encoding the sound in 2nd order ambisonic if nchnls = 9 and 3rd order if nchnls = 16
end$R.:
#
; gifrontwall - position of frontwall at the x-axis
; gisidewall - position of sidewall at the y-axis
; giceiling - height of the ceiling measured from the zero-point of the coordinate-system
; giunit - radius of the unit- sphere[m]
asig, kA, kE, kD xin
; DEGREE - RADIANT CONVERSION
kA = kA * 0.01745329252 ; convert 0-360 degrees to radiant-expression
kE = kE * 0.01745329252 ; convert 0-90 degrees to radiant-expression
kA = (kA < 0 ? kA + 6.283185 : kA) ; prevent negative angle kA
kA = (kA > 6.283185 ? kA - 6.283185 : kA) ; prevent angle kA > 360
; Polar converter -source as cartesian representation
kx = kD * cos(kA) * cos(kE) ; convert polar to carthesian representation
ky = kD * sin(kA) * cos(kE) ; convert polar to carthesian representation
kz = kD * sin(kE) ; convert polar to carthesian representation
kx = (kx < 0.01 && kx > -0.01 ? 0.01 :kx) ; fix for that strange y-axis noise
iwall1 = gifrontwall ; assign distance of the wall
iwall2 = -gifrontwall ; assign distance of the wall
iwall3 = gisidewall ; assign distance of the wall
iwall4 = -gisidewall ; assign distance of the wall
iwall5 = giceiling ; assign distance of the wall
iwall6 = -giceiling ; assign distance of the wall
kdiff1 = iwall1 - kx ; distance of reflection to the frontwall
kdiff2 = iwall2 - kx ; distance of reflection to the backwall
kdiff3 = iwall3 - ky ; distance of reflection to the left sidewall
kdiff4 = iwall4 - ky ; distance of reflection to the right sidewall
kdiff5 = iwall5 - kz ; distance of reflection to the ceiling
kdiff6 = iwall6 - kz ; distance of reflection to the floor
asig tone asig, gihighdamp ; filtering of high frequencies due to absorbtion characteristics of the wall
print gispecref
$SPECREFLECTION(1)
$SPECREFLECTION(2)
$SPECREFLECTION(3)
$SPECREFLECTION(4)
$SPECREFLECTION(5)
$SPECREFLECTION(6)
#undef SPECREFLECTION(R)Stereo_Decodeaaaa
aw, ay xin ;input
;Rig `Controlled Opposites' Decode Matrix (second Order)
; w x y z r s t u v
; Speaker1 <0.0000,1.0000,0.0000>
achnl1 sum aw * 0.7071, ay * 0.5000
; Speaker2 <0.0000,-1.0000,0.0000>
achnl2 sum aw * 0.7071, ay * -0.5000
xout achnl1, achnl2 ; outputUHJ_Decodeaaaaa
aw, ax, ay xin ;input
ajw1, ajw0 hilbert aw
ajx1, ajx0 hilbert ax
ajy1, ajy0 hilbert ay
achnl1 = 0.0928 * ajx1 + 0.255 * ajx0 + 0.4699 * ajw1 - 0.171 * ajw0 + 0.3277 * ajy1
achnl2 = 0.0928 * ajx1 - 0.255 * ajx0 + 0.4699 * ajw1 + 0.171 * ajw0 - 0.3277 * ajy1
xout achnl1, achnl2 ; output
Converts b-format ambisonics to uhj stereo.
SYNTAX
achnl1, achnel2 UHJ_Decode aW, aX, aY, aZ
INITIALIZATION
aw, ax, ay
CREDITS
Joseph Anderson and ma++, jan 2005
slightly modified by Jan Jacob Hofmann April 2009Cube_Decode_2nd_orderaaaaaaaaaaaaaaa
; 8chnl decode (cube),2nd order (second order controlled opposites), Furse-Malham Set Of Equations
aw, ax, ay, az, as, at, av xin ; input
; Rig `Controlled Opposites' Decode Matrix (Second Order)
; w x y z r s t u v
; Speaker1 <0.5774,0.5774,-0.5774> front left lower
achnl_co_1 sum aw * 0.1768, ax * 0.114, ay * 0.114, az * -0.114, as * -0.0369, at * -0.0369, av * 0.0369
; Speaker2 <0.5774,-0.5774,-0.5774> front right lower
achnl_co_2 sum aw * 0.1768, ax * 0.114, ay * -0.114, az * -0.114, as * -0.0369, at * 0.0369, av * -0.0369
; Speaker3 <-0.5774,-0.5774,-0.5774> back right lower
achnl_co_3 sum aw * 0.1768, ax * -0.114, ay * -0.114, az * -0.114, as * 0.0369, at * 0.0369, av * 0.0369
; Speaker4 <-0.5774,0.5774,-0.5774> back left lower
achnl_co_4 sum aw * 0.1768, ax * -0.114, ay * 0.114, az * -0.114, as * 0.0369, at * -0.0369, av * -0.0369
; Speaker5 <0.5774,0.5774,0.5774> front left upper
achnl_co_5 sum aw * 0.1768, ax * 0.114, ay * 0.114, az * 0.114, as * 0.0369, at * 0.0369, av * 0.0369
; Speaker6 <0.5774,-0.5774,0.5774> front right upper
achnl_co_6 sum aw * 0.1768, ax * 0.114, ay * -0.114, az * 0.114, as * 0.0369, at * -0.0369, av * -0.0369
; Speaker7 <-0.5774,-0.5774,0.5774> back right upper
achnl_co_7 sum aw * 0.1768, ax * -0.114, ay * -0.114, az * 0.114, as * -0.0369, at * -0.0369, av * 0.0369
; Speaker8 <-0.5774,0.5774,0.5774> back left upper
achnl_co_8 sum aw * 0.1768, ax * -0.114, ay * 0.114, az * 0.114, as * -0.0369, at * 0.0369, av * -0.0369
xout achnl_co_1, achnl_co_2, achnl_co_3, achnl_co_4, achnl_co_5, achnl_co_6, achnl_co_7, achnl_co_8 ; outputFurse - Malham set of controlled opposites decoding equation
CREDITS to Dave Malham and Richard FurseOctogon1_Decode_3rd_orderaaaaaaaaaaaaaaaaaaaaaaaa
aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq xin ; input
achnl_1, achnl_2, achnl_3, achnl_4, achnl_5, achnl_6, achnl_7, achnl_8 bformdec1 4, aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq
xout achnl_1, achnl_2, achnl_3, achnl_4, achnl_5, achnl_6, achnl_7, achnl_8 ; output **************************************************************************************
octagon1: ; 8chnl decode (octagon 1),3rd order (third order controlled opposites)
**************************************************************************************
This rig configuration produces an `in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
Speaker 1 <0.9239,0.3827,0.0000>
Speaker 2 <0.3827,0.9239,0.0000>
Speaker 3 <-0.3827,0.9239,0.0000>
Speaker 4 <-0.9239,0.3827,0.0000>
Speaker 5 <-0.9239,-0.3827,0.0000>
Speaker 6 <-0.3827,-0.9239,0.0000>
Speaker 7 <0.3827,-0.9239,0.0000>
Speaker 8 <0.9239,-0.3827,0.0000>
CREDITS to Dave Malham, Richard Furse and Fons AdriaensenBinaural_Decode_2nd_orderaaaaaaaaaaak
aw, ax, ay, az, ar, as, at, au, av, krelcoef xin
; decode 2ns order ambisonic for 12 channel dodecahedron1 loudspeaker setup
; ************************************************************************************************************
; dodecahedron1 to binaural ;Rig `Controlled Opposites' Decode Matrix (Second Order) to binaural
; ************************************************************************************************************
;This rig configuration produces an 'in-phase' response and each speaker will have only a single maximum given a moving virtual sound source.
; w x y z r s t u v
; Speaker 1 <0.0000,0.0000,1.0000> centre top
achnl_co_1 sum aw * 0.1179, az * 0.1316, ar * 0.0491
; Speaker 2 <0.0000,0.0000,-1.0000> centre bottom
achnl_co_2 sum aw * 0.1179, az * -0.1316, ar * 0.0491
; Speaker 3 <0.7236,0.5257,0.4472>
achnl_co_3 sum aw * 0.1179, ax * 0.0952, ay * 0.0692, az * 0.0589, ar * -0.0098, as * 0.0238, at * 0.0173, au * 0.0091, av * 0.0280
; Speaker 4 <-0.7236,-0.5257,-0.4472>
achnl_co_4 sum aw * 0.1179, ax * -0.0952, ay * -0.0692, az * -0.0589, ar * -0.0098, as * 0.0238, at * 0.0173, au * 0.0091, av * 0.0280
; Speaker 5 <0.7236,-0.5257,0.4472>
achnl_co_5 sum aw * 0.1179, ax * 0.0952, ay * -0.0692, az * 0.0589, ar * -0.0098, as * 0.0238, at * -0.0173, au * 0.0091, av * -0.0280
; Speaker 6 <-0.7236,0.5257,-0.4472>
achnl_co_6 sum aw * 0.1179, ax * -0.0952, ay * 0.0692, az * -0.0589, ar * -0.0098, as * 0.0238, at * -0.0173, au * 0.0091, av * -0.0280
; Speaker 7 <-0.2764,0.8507,0.4472>
achnl_co_7 sum aw * 0.1179, ax * -0.0364, ay * 0.1119, az * 0.0589, ar * -0.0098, as * -0.0091, at * 0.0280, au * -0.0238, av * -0.0173
; Speaker 8 <0.2764,-0.8507,-0.4472>
achnl_co_8 sum aw * 0.1179, ax * 0.0364, ay * -0.1119, az * -0.0589, ar * -0.0098, as * -0.0091, at * 0.0280, au * -0.0238, av * -0.0173
; Speaker 9 <-0.2764,-0.8507,0.4472>
achnl_co_9 sum aw * 0.1179, ax * -0.0364, ay * -0.1119, az * 0.0589, ar * -0.0098, as * -0.0091, at * -0.0280, au * -0.0238, av * 0.0173
; Speaker 10 <0.2764,0.8507,-0.4472>
achnl_co_10 sum aw * 0.1179, ax * 0.0364, ay * 0.1119, az * -0.0589, ar * -0.0098, as * -0.0091, at * -0.0280, au * -0.0238, av * 0.0173
; Speaker 11 <-0.8944,0.0000,0.4472>
achnl_co_11 sum aw * 0.1179, ax * -0.1177, az * 0.0589, ar * -0.0098, as * -0.0295, au * 0.0295
; Speaker 12 <0.8944,0.0000,-0.4472>
achnl_co_12 sum aw * 0.1179, ax * 0.1177, az * -0.0589, ar * -0.0098, as * -0.0295, au * 0.0295
; Rig Decode Matrix to Reproduce Spherical Harmonics (Second Order)
; This rig configuration produces a strict idealised response that satisfies the Ambisonic matching equations. Generally this type of configuration produces a relatively small stable listening area.
; w x y z r s t u v
; Speaker 1 <0.0000,0.0000,1.0000> centre top
achnl_sh_1 sum aw * 0.1179, az * 0.2500, ar * 0.4167
; Speaker 2 <0.0000,0.0000,-1.0000> centre bottom
achnl_sh_2 sum aw * 0.1179, az * -0.2500, ar * 0.4167
; Speaker 3 <0.7236,0.5257,0.4472>
achnl_sh_3 sum aw * 0.1179, ax * 0.1809, ay * 0.1314, az * 0.1118, ar * -0.0833, as * 0.2023, at * 0.1469, au * 0.0773, av * 0.2378
; Speaker 4 <-0.7236,-0.5257,-0.4472>
achnl_sh_4 sum aw * 0.1179, ax * -0.1809, ay * -0.1314, az * -0.1118, ar * -0.0833, as * 0.2023, at * 0.1469, au * 0.0773, av * 0.2378
; Speaker 5 <0.7236,-0.5257,0.4472>
achnl_sh_5 sum aw * 0.1179, ax * 0.1809, ay * -0.1314, az * 0.1118, ar * -0.0833, as * 0.2023, at * -0.1469, au * 0.0773, av * -0.2378
; Speaker 6 <-0.7236,0.5257,-0.4472>
achnl_sh_6 sum aw * 0.1179, ax * -0.1809, ay * 0.1314, az * -0.1118, ar * -0.0833, as * 0.2023, at * -0.1469, au * 0.0773, av * -0.2378
; Speaker 7 <-0.2764,0.8507,0.4472>
achnl_sh_7 sum aw * 0.1179, ax * -0.0691, ay * 0.2127, az * 0.1118, ar * -0.0833, as * -0.0773, at * 0.2378, au * -0.2023, av * -0.1469
; Speaker 8 <0.2764,-0.8507,-0.4472>
achnl_sh_8 sum aw * 0.1179, ax * 0.0691, ay * -0.2127, az * -0.1118, ar * -0.0833, as * -0.0773, at * 0.2378, au * -0.2023, av * -0.1469
; Speaker 9 <-0.2764,-0.8507,0.4472>
achnl_sh_9 sum aw * 0.1179, ax * -0.0691, ay * -0.2127, az * 0.1118, ar * -0.0833, as * -0.0773, at * -0.2378, au * -0.2023, av * 0.1469
; Speaker 10 <0.2764,0.8507,-0.4472>
achnl_sh_10 sum aw * 0.1179, ax * 0.0691, ay * 0.2127, az * -0.1118, ar * -0.0833, as * -0.0773, at * -0.2378, au * -0.2023, av * 0.1469
; Speaker 11 <-0.8944,0.0000,0.4472>
achnl_sh_11 sum aw * 0.1179, ax * -0.2236, az * 0.1118, ar * -0.0833, as * -0.2500, au * 0.2500
; Speaker 12 <0.8944,0.0000,-0.4472>
achnl_sh_12 sum aw * 0.1179, ax * 0.2236, az * -0.1118, ar * -0.0833, as * -0.2500, au * 0.2500
achnl_1 = achnl_co_1 * krelcoef + achnl_sh_1 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_2 = achnl_co_2 * krelcoef + achnl_sh_2 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_3 = achnl_co_3 * krelcoef + achnl_sh_3 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_4 = achnl_co_4 * krelcoef + achnl_sh_4 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_5 = achnl_co_5 * krelcoef + achnl_sh_5 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_6 = achnl_co_6 * krelcoef + achnl_sh_6 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_7 = achnl_co_7 * krelcoef + achnl_sh_7 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_8 = achnl_co_8 * krelcoef + achnl_sh_8 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_9 = achnl_co_9 * krelcoef + achnl_sh_9 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_10 = achnl_co_10 * krelcoef + achnl_sh_10 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_11 = achnl_co_11 * krelcoef + achnl_sh_11 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
achnl_12 = achnl_co_12 * krelcoef + achnl_sh_12 * (1 - krelcoef) ; ratio between controlled opposites and spherical harmonic coefficients
if sr != 44100 goto sr48000 ; skip to different sr
; Processing with Head Related Transfer Function
; (hrtf phase truncation...)
aleft_1, aright1 hrtfstat achnl_1, 1, 89.99, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_2, aright2 hrtfstat achnl_2, -1, -89.99, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_3, aright_3 hrtfstat achnl_3, -36, 26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_4, aright_4 hrtfstat achnl_4, 144, -26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_5, aright_5 hrtfstat achnl_5, 36, 26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_6, aright_6 hrtfstat achnl_6, -144, -26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_7, aright_7 hrtfstat achnl_7, -108, 26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_8, aright_8 hrtfstat achnl_8, 72, -26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_9, aright_9 hrtfstat achnl_9, 108, 26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_10, aright_10 hrtfstat achnl_10, -72, -26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_11, aright_11 hrtfstat achnl_11, 180, 26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
aleft_12, aright_12 hrtfstat achnl_12, 0, -26.565, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
goto output
sr48000:
if sr = 96000 goto sr96000 ; skip to sr =96000
aleft_1, aright_1 hrtfstat achnl_1, 1, 89.99, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_2, aright_2 hrtfstat achnl_2, -1, -89.99, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_3, aright_3 hrtfstat achnl_3, -36, 26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_4, aright_4 hrtfstat achnl_4, 144, -26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_5, aright_5 hrtfstat achnl_5, 36, 26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_6, aright_6 hrtfstat achnl_6, -144, -26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_7, aright_7 hrtfstat achnl_7, -108, 26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_8, aright_8 hrtfstat achnl_8, 72, -26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_9, aright_9 hrtfstat achnl_9, 108, 26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_10, aright_10 hrtfstat achnl_10, -72, -26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_11, aright_11 hrtfstat achnl_11, 180, 26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
aleft_12, aright_12 hrtfstat achnl_12, 0, -26.565, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
goto output
sr96000:
aleft_1, aright_1 hrtfstat achnl_1, 1, 89.99, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_2, aright_2 hrtfstat achnl_2, -1, -89.99, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_3, aright_3 hrtfstat achnl_3, -36, 26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_4, aright_4 hrtfstat achnl_4, 144, -26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_5, aright_5 hrtfstat achnl_5, 36, 26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_6, aright_6 hrtfstat achnl_6, -144, -26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_7, aright_7 hrtfstat achnl_7, -108, 26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_8, aright_8 hrtfstat achnl_8, 72, -26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_9, aright_9 hrtfstat achnl_9, 108, 26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_10, aright_10 hrtfstat achnl_10, -72, -26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_11, aright_11 hrtfstat achnl_11, 180, 26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
aleft_12, aright_12 hrtfstat achnl_12, 0, -26.565, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
output:
; Adding Inter Aural Time Delay ITD
aleft_1 delay aleft_1, 0.00028986
aleft_2 delay aleft_2, 0.00028986
aleft_3 delay aleft_3, 0.00020974
aleft_4 delay aleft_4, 0.00036997
aleft_5 delay aleft_5, 0.00036997
aleft_6 delay aleft_6, 0.00020974
aleft_7 delay aleft_7, 0.00008011
aleft_8 delay aleft_8, 0.00049960
aleft_9 delay aleft_9, 0.00049960
aleft_10 delay aleft_10, 0.00008011
aleft_11 delay aleft_11, 0.00028986
aleft_12 delay aleft_12, 0.00028986
aright_1 delay aright_1, 0.00028986
aright_2 delay aright_2, 0.00028986
aright_3 delay aright_3, 0.00036997
aright_4 delay aright_4, 0.00020974
aright_5 delay aright_5, 0.00020974
aright_6 delay aright_6, 0.00036997
aright_7 delay aright_7, 0.000499597
aright_8 delay aright_8, 0.00008011
aright_9 delay aright_9, 0.00008011
aright_10 delay aright_10, 0.000499597
aright_11 delay aright_11, 0.00028986
aright_12 delay aright_12, 0.00028986
; mixing all spacial signals together
aright sum aright_1, aright_2, aright_3, aright_4, aright_5, aright_6, aright_7, aright_8, aright_9, aright_10, aright_11, aright_12
aleft sum aleft_1, aleft_2, aleft_3, aleft_4, aleft_5, aleft_6, aleft_7, aleft_8, aleft_9, aleft_10, aleft_11, aleft_12
outs aleft, aright ; output of the binaural mix
Note: The files "HRTFcompact" should reside in the same folder as the soundfiles to be read in. Make sure the Directory points there. Else there will be an instant crash of Csound without a warning message.
**************************************************************************************************************************
; 2nd ORDER AMBISONICS TO BINAURAL DECODER- coded 1999-2009 by Jan Jacob Hofmann.
; FURSE - MALHAM - SET OF EQUATIONS Version 2.0 April. 12th 2009
; This decodes 2nd Order Ambisonic to Binaural http://www.sonicarchitecture.de
; by using 12 virtual speakers Thanks to Richard Furse, Dave Malham and Bruce Wiggins
**************************************************************************************************************************
Binaural_Decode_3rd_orderaaaaaaaaaaaaaaaaaa
aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq xin
; decode B format for 8 channel circle loudspeaker setup
a1, a2, a3, a4, a5, a6, a7, a8 bformdec1 4, aw, ax, ay, az, ar, as, at, au, av, ak, al, am, an, ao, ap, aq
;FFL(22.5),FLL(67.5),BLL(112.5),BBL(157.5),BBR(-157.5),BRR(-112.5),FRR(-67.5),FFR(-22.5)
if sr != 44100 goto sr48000 ; skip to different sr
; binaural_ly encode each channel
; (hrtf phase truncation...)
al_1, ar_1 hrtfstat a1, 22.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_2, ar_2 hrtfstat a2, 67.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_3, ar_3 hrtfstat a3, 112.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_4, ar_4 hrtfstat a4, 157.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_5, ar_5 hrtfstat a5, 202.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_6, ar_6 hrtfstat a6, 247.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_7, ar_7 hrtfstat a7, 292.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
al_8, ar_8 hrtfstat a8, 337.5, 0, "hrtf-44100-left.dat", "hrtf-44100-right.dat"
goto output
sr48000:
if sr = 96000 goto sr96000 ; skip to sr =96000
; binaural_ly encode each channel
; (hrtf phase truncation...)
al_1, ar_1 hrtfstat a1, 22.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_2, ar_2 hrtfstat a2, 67.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_3, ar_3 hrtfstat a3, 112.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_4, ar_4 hrtfstat a4, 157.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_5, ar_5 hrtfstat a5, 202.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_6, ar_6 hrtfstat a6, 247.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_7, ar_7 hrtfstat a7, 292.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
al_8, ar_8 hrtfstat a8, 337.5, 0, "hrtf-48000-left.dat", "hrtf-48000-right.dat"
goto output
sr96000:
; binaural_ly encode each channel
; (hrtf phase truncation...)
al_1, ar_1 hrtfstat a1, 22.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_2, ar_2 hrtfstat a2, 67.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_3, ar_3 hrtfstat a3, 112.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_4, ar_4 hrtfstat a4, 157.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_5, ar_5 hrtfstat a5, 202.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_6, ar_6 hrtfstat a6, 247.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_7, ar_7 hrtfstat a7, 292.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
al_8, ar_8 hrtfstat a8, 337.5, 0, "hrtf-96000-left.dat", "hrtf-96000-right.dat"
output:
; Adding Inter Aural_ Time Delay ITD
al_1 delay al_1, 0.00028986
al_2 delay al_2, 0.00028986
al_3 delay al_3, 0.00020974
al_4 delay al_4, 0.00036997
al_5 delay al_5, 0.00036997
al_6 delay al_6, 0.00020974
al_7 delay al_7, 0.00008011
al_8 delay al_8, 0.00049960
ar_1 delay ar_1, 0.00028986
ar_2 delay ar_2, 0.00028986
ar_3 delay ar_3, 0.00036997
ar_4 delay ar_4, 0.00020974
ar_5 delay ar_5, 0.00020974
ar_6 delay ar_6, 0.00036997
ar_7 delay ar_7, 0.000499597
ar_8 delay ar_8, 0.00008011
aleft sum al_1, al_2, al_3, al_4, al_5, al_6, al_7, al_8
aright sum ar_1, ar_2, ar_3, ar_4, ar_5, ar_6, ar_7, ar_8
xout aleft, aright ; write binaural audio out Note: The "HRTF" -files should reside in the same folder as the soundfiles to be read in. Make sure the Directory points there. Else there will be an instant crash of Csound without a warning message.
**************************************************************************************************************************
2nd ORDER AMBISONICS TO BINAURAL DECODER- coded 1999-2009 by Jan Jacob Hofmann.
FURSE - MALHAM - SET OF EQUATIONS Version 2.0 April 12th 2009
This decodes 3rd Order Ambisonic to Binaural http://www.sonicarchitecture.de
by using 8 virtual speakers Thanks to Richard Furse, Dave Malham and Bruce Wiggins
**************************************************************************************************************************
csound -Wdo devaudio -L stdinfalsefalse2.00.0root-100662790true483false1.00510.1250.0Complex AED-Granulator-125664642
; iinst = p4 ; instrument number of sound producing instrument
; iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
; ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
; ENVELOPES
; ienvinst = p7 ; instrument number of envelope generating instrument
; POSITION AND MOVEMENT
; iAdev = p8 ; deviation of position of grain - angle [¡]
; iEdev = p9 ; deviation of position of grain - elevation [¡]
; iDdev = p10 ; deviation of position of grain - distance [unit]
; iAmove = p11 ; A - amount of movement of a single grain in regard to the cloud [¡]
; iEmove = p12 ; E - amount of movement of a single grain in regard to the cloud [¡]
; iDmove = p13 ; D - amount of movement of a single grain in regard to the cloud [unit]
; iArange = p14 ; maximum possible range of deviation of angle [¡]
; iErange = p15 ; maximum possible range of deviation of elevation [¡]
; iDrange = p16 ; maximum possible range of deviation of distance [unit]
; CONTROL DISTRIBUTION FN
; icrtlfn = p17 ; control distribution fn [21/31]
; COPIES
; icpydel = p18 ; delay time of copy [s]
; imaxcnt = p19 ; density of copy (number of instances)
; icnt = p20 ; count of copies (= initial count of original instrument: must always be 0 here)
; iAcpydev = p21 ; angle deviation (shift) of each copy [¡]
; iEcpydev = p22 ; elevation deviation (shift) of each copy [¡]
; iDcpydev = p23 ; distance deviation (shift) of each copy [unit]
; *****************************************************************************************************************************************************
f 0 10.00
p1 const 70
p2 const 10 prec 2 ; density of grains
p3 const 0.1 prec 2 ; duration of grains
; SOUND PRODUCTION
; Instrument for sound generation
p4 const 32 ; instrument number of sound producing instrument
p5 const 1 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation 1 = no deviation)
p6 const 1 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation 1 = no deviation)
; Envelopes
p7 const 11 ; instrument number of envelope generating instrument
p8 const 0 ; deviation of position - angle [degrees] (start)
p9 const 0 ; deviation of position - elevation [degrees](start)
p10 const 0 ; deviation of position - distance (start)
; MOVEMENT OF GRAIN
p11 const 0 ; A: amount of movement of a single grain in regard to the cloud [¡]
p12 const 0 ; E: amount of movement of a single grain in regard to the cloud [¡]
p13 const 0 ; D: amount of movement of a single grain in regard to the cloud [¡]
; MAXIMUM RANGE OF LOCATION DEVIATION
p14 const 90 ; A: maximum angle deviation [¡]
p15 const 0 ; E: maximum elevation deviation [¡]
p16 const 0 ; D: maximum distance deviation [¡]
; CONTROL DISTRIBUTION FN
p17 const 21 ; control distribution fn
; CORRELATED COPY DEVICE
p18 const 1 ; delay time of copy [s]
p19 const 8 ; number of copies
p20 const 0 ; count of copies (= initial count of original instrument: must always be 0)
p21 const 10 ; angle deviation (shift) of each copy [¡]
p22 const 0 ; elevation deviation (shift) of each copy [¡]
p23 const 0 ; distance deviation (shift) of each copy [unit]/usr/local/bin/cmask $infile $outfilePython10.1250.0Complex XYZ-Granulator-125664642
; iinst = p4 ; instrument number of sound producing instrument
; iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
; ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
; ENVELOPES
; ienvinst = p7 ; instrument number of envelope generating instrument
; POSITION AND MOVEMENT
; iXdev = p8 ; deviation of position of grain - X-coordinate [unit]
; iYdev = p9 ; deviation of position of grain - Y-coordinate [unit]
; iZdev = p10 ; deviation of position of grain - Z-coordinate [unit]
; iXmove = p11 ; X amount of movement of a single grain in regard to the cloud [unit]
; iYmove = p12 ; Y amount of movement of a single grain in regard to the cloud [unit]
; iZmove = p13 ; Z amount of movement of a single grain in regard to the cloud [unit]
; iXrange = p14 ; possible range of deviation of Y - coordinate [unit]
; iYrange = p15 ; possible range of deviation of X - coordinate [unit]
; iZrange = p16 ; possible range of deviation of Z - coordinate [unit]
; CONTROL DISTRIBUTION FN
; icrtlfn = p17 ; control distribution fn [21/31]
; COPIES
; icpydel = p18 ; delay time of copy [s]
; imaxcnt = p19 ; density of copy (number of instances)
; icnt = p20 ; count of copies (= initial count of original instrument: must always be 0 here)
; iXcpydev = p21 ; X - deviation (shift) of each copy [unit]
; iYcpydev = p22 ; Y - deviation (shift) of each copy [unit]
; iZcpydev = p23 ; Z - deviation (shift) of each copy [unit]
; *****************************************************************************************************************************************************
f 0 10.00
p1 const 71
p2 const 10 prec 2 ; density of grains
p3 const 0.1 prec 2 ; duration of grains
; SOUND PRODUCTION
; Instrument for sound generation
p4 const 30 ; instrument number of sound producing instrument
p5 const 1 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation 1 = no deviation)
p6 const 1 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation 1 = no deviation)
; Envelopes
p7 const 11 ; instrument number of envelope generating instrument
; DEVIATION OF POSITION
p8 const 0 ; deviation of position - X with carthesian coordinate invocation [unit]
p9 const 0 ; deviation of position - Y with carthesian coordinate invocation [unit]
p10 const 0 ; deviation of position - Z with carthesian coordinate invocation [unit]
; MOVEMENT OF GRAIN
p11 const 0 ; X: amount of movement of a single grain in regard to the cloud [unit]
p12 const 0 ; Y: amount of movement of a single grain in regard to the cloud [unit]
p13 const 0 ; Z: amount of movement of a single grain in regard to the cloud [unit]
; FULL RANGE OF LOCATION DEVIATION
p14 const 8 ; X-range: maximum angle deviation with carthesian coordinate invocation [units]
p15 const 0 ; Y-range of elevation deviation [¡] / Y-dev with carthesian coordinate invocation [units]
p16 const 0 ; Z-range of distance deviation [¡] / Z-dev with carthesian coordinate invocation [units]
; CONTROL DISTRIBUTION FN
p17 const 21 ; control distribution fn
; CORRELATED COPY DEVICE
p18 const 1 ; delay time of copy [s]
p19 const 8 ; number of copies
p20 const 0 ; count of copies (= initial count of original instrument: must always be 0)
p21 const 1 ; X deviation (shift) of each copy with carthesian coordinate invocation [unit]
p22 const 0 ; Y deviation (shift) of each copy with carthesian coordinate invocation [unit]
p23 const 0 ; Z deviation (shift) of each copy with carthesian coordinate invocation [unit]
/usr/local/bin/cmask $infile $outfilePython10.1250.0Simple AED-Granulator-125664642
; iinst = p4 ; instrument number of sound producing instrument
; iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
; ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
; ENVELOPES
; ienvinst = p7 ; instrument number of envelope generating instrument
; POSITION AND MOVEMENT
; iAdev = p8 ; deviation of position of grain - angle [¡]
; iEdev = p9 ; deviation of position of grain - elevation [¡]
; iDdev = p10 ; deviation of position of grain - distance [unit]
; iAmove = p11 ; A - amount of movement of a single grain in regard to the cloud [¡]
; iEmove = p12 ; E - amount of movement of a single grain in regard to the cloud [¡]
; iDmove = p13 ; D - amount of movement of a single grain in regard to the cloud [unit]
; *****************************************************************************************************************************************************
f 0 10.00
p1 const 72
p2 const 10 prec 2 ; density of grains
p3 const 0.1 prec 2 ; duration of grains
; SOUND PRODUCTION
; Instrument for sound generation
p4 const 30 ; instrument number of sound producing instrument
p5 const 1 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation 1 = no deviation)
p6 const 1 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation 1 = no deviation)
; Envelopes
p7 const 11 ; instrument number of envelope generating instrument
p8 const 0 ; deviation of position - angle [degrees] (start)
p9 const 0 ; deviation of position - elevation [degrees](start)
p10 const 0 ; deviation of position - distance (start)
; MOVEMENT OF GRAIN
p11 const 0 ; A: amount of movement of a single grain in regard to the cloud [¡]
p12 const 0 ; E: amount of movement of a single grain in regard to the cloud [¡]
p13 const 0 ; D: amount of movement of a single grain in regard to the cloud [¡]
/usr/local/bin/cmask $infile $outfilePython10.1250.0Simple XYZ-Granulator-125664642
; iinst = p4 ; instrument number of sound producing instrument
; iampdev = p5 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation)
; ifreqdev = p6 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation)
; ENVELOPES
; ienvinst = p7 ; instrument number of envelope generating instrument
; POSITION AND MOVEMENT
; iXdev = p8 ; deviation of position of grain - X-coordinate [unit]
; iYdev = p9 ; deviation of position of grain - Y-coordinate [unit]
; iZdev = p10 ; deviation of position of grain - Z-coordinate [unit]
; iXmove = p11 ; X amount of movement of a single grain in regard to the cloud [unit]
; iYmove = p12 ; Y amount of movement of a single grain in regard to the cloud [unit]
; iZmove = p13 ; Z amount of movement of a single grain in regard to the cloud [unit]
; *****************************************************************************************************************************************************
f 0 10.00
p1 const 73
p2 const 10 prec 2 ; density of grains
p3 const 0.1 prec 2 ; duration of grains
; SOUND PRODUCTION
; Instrument for sound generation
p4 const 30 ; instrument number of sound producing instrument
p5 const 1 ; amplitude deviation factor (0.5 = 50% amplitude, 2 = 200% amplitude deviation 1 = no deviation)
p6 const 1 ; frequency deviation factor (0.5 = 50% frequency, 2 = 200% frequency deviation 1 = no deviation)
; Envelopes
p7 const 11 ; instrument number of envelope generating instrument
; DEVIATION OF POSITION
p8 const 0 ; deviation of position - X with carthesian coordinate invocation [unit]
p9 const 0 ; deviation of position - Y with carthesian coordinate invocation [unit]
p10 const 0 ; deviation of position - Z with carthesian coordinate invocation [unit]
; MOVEMENT OF GRAIN
p11 const 0 ; X: amount of movement of a single grain in regard to the cloud [unit]
p12 const 0 ; Y: amount of movement of a single grain in regard to the cloud [unit]
p13 const 0 ; Z: amount of movement of a single grain in regard to the cloud [unit]
/usr/local/bin/cmask $infile $outfilePython2.00.0GenericScore-125664640i66 0 2 90 2000trueVersion 3
- setksmps 1 in GLOBALREVERB UDO
- Extension to 3rd order in the encoding-UDO
- Extension to 3rd order in the soundfile wrting orc instr 80
- Reorder of Zak a-Rate channels in initialisation, the global code section, instr 78 (spatial global reverb) and in instr 80
- Reorder of global init section
Version 6
- Reorder of k-rate zak-channels
- Instr. 53: bugfix - p 13-15 translated to x,y,z
- effect added in instr. 12 and 54
Version 7
Bugfix: Channel y and z were merged in versions 3-6
Version 8
UDO opcode UHJ_Decode added
Binaural_Decode_2nd_order added
Binaural_Decode_3rd_order added
Version 9
Import of Stevens instr.2
Version 10
final version to present at the LAC
Version 11
alligning of code
renaming of XYZ Conversion UDO and
Encoding UDO
Version 12
Moved definition of Diffreflection and Specrflection from global orc to UDO
Version 13
Changed all instruments to degree instead of pi
Version 14
Version 15
Reorganisation of Instruments: Subinstruments get inroduced
Version 16
Zak-Patch to Subinstr
Version 17
Duration control ajustment:
zak patch does not work for several instances, adressing different dur of subinstr only with schedule-opcode
sound: short (= p3)
effect: longer (+ reverbtime)
spatialisation : even longer (+giprolong)
Version 18
introduction of lnleta and connect opcodes
Version 19
Separation of instr. 52 into 2 parts: before and after effects due to source-sink restrictions.
Version 20
Rewireing of the signal flow. if then else-modifications. Failed to introdiuce of different durartions for the effects.
Version 21
Envelope 1 * 2 to effects.
Different durations and prolongation now work.
Version 22
Added Simple xyz spatializer
Version23
Reordering of parameter
Complex AED Granulator
Version 24 : Test
Version 25:
changed schedule to alwayson in most cases
amplitude discontinuety + feedback resolved
iskip = 1 on reverbsc
Version 26
additive synth introduced
Version 51
k rate automatisation-line for AED Granulator, siple and complex. Copy device changed.
BUGS
Command z does not work in scratchpad
Blue Manual does not start up
[] and || do not work in orchestra - window, sound object editor0.0-1.0falsefalsefalsePCHMIDI12TET261.625582.01.01.05946311.1224621.18920711.25992111.33483981.41421351.49830711.5874011.68179291.78179741.8877486