/****MIXDOWN PLAYER ****/
;joachim heintz june 2010
;Mixes N mono soundfiles
;to M channels, with panning.
;If N=M, it's a 1:1 player.
sr = 44100
ksmps = 64
nchnls = 2; change here if your device has more channels
0dbfs = 1
chn_S "_MBrowse", 1
opcode StrayGetEl, ii, Sijj
;returns the startindex and the endindex (= the first space after the element) for ielindex in String. if startindex returns -1, the element has not been found
Stray, ielindx, isepA, isepB xin
;;DEFINE THE SEPARATORS
isep1 = (isepA== -1? 32 : isepA)
isep2 = (isepA== -1&& isepB== -1? 9 : (isepB == -1 ? isep1 : isepB))
Sep1 sprintf "%c",isep1
Sep2 sprintf "%c",isep2
;;INITIALIZE SOME PARAMETERS
ilen strlen Stray
istartsel = -1;startindex for searched element
iendsel = -1;endindex for searched element
iel = 0;actual number of element while searching
iwarleer = 1
indx = 0
if ilen == 0 igoto end ;don't go into the loop if Stray is empty
loop:
Snext strsub Stray,indx, indx+1; next sign
isep1p strcmp Snext,Sep1; returns 0 if Snext is sep1
isep2p strcmp Snext,Sep2; 0 if Snext is sep2
;;NEXT SIGN IS NOT SEP1 NOR SEP2
if isep1p != 0 && isep2p != 0 then
if iwarleer == 1 then; first character after a separator
if iel == ielindx then; if searched element index
istartsel = indx;set it
iwarleer = 0
else ;ifnot searched element index
iel = iel+1;increase it
iwarleer = 0;log thatit's not a separator
endif
endif
;;NEXT SIGN IS SEP1 OR SEP2
else
if istartsel > -1 then; if this is first selector after searched element
iendsel = indx;set iendsel
igoto end;break
else
iwarleer = 1
endif
endif
loop_lt indx,1, ilen, loop
end: xout istartsel,iendsel
endop
opcode StrayLen, i, Sjj
;returns the number of elements in Stray. elements are defined by two separators as ASCII coded characters: isep1 defaults to 32 (= space), isep2 defaults to 9 (= tab). if just one separator is used, isep2 equals isep1
Stray, isepA, isepB xin
;;DEFINE THE SEPARATORS
isep1 = (isepA== -1? 32 : isepA)
isep2 = (isepA== -1&& isepB== -1? 9 : (isepB == -1 ? isep1 : isepB))
Sep1 sprintf "%c",isep1
Sep2 sprintf "%c",isep2
;;INITIALIZE SOME PARAMETERS
ilen strlen Stray
icount = 0;number of elements
iwarsep = 1
indx = 0
if ilen == 0 igoto end ;don't go into the loop if String is empty
loop:
Snext strsub Stray,indx, indx+1; next sign
isep1p strcmp Snext,Sep1; returns 0 if Snext is sep1
isep2p strcmp Snext,Sep2; 0 if Snext is sep2
if isep1p == 0 || isep2p == 0 then; if sep1 or sep2
iwarsep = 1;tell the log so
else ;if not
if iwarsep == 1 then ; and has been sep1 or sep2 before
icount = icount+ 1; increase counter
iwarsep = 0;and tell you are ot sep1 nor sep2
endif
endif
loop_lt indx,1, ilen, loop
end: xout icount
endop
opcode MxdwnPlay, 0, Siiiiki
Stray, ilen, ichnls, ifirstchn, iel, kvol, iskip xin
ipan = iel* ((ichnls-1)/(ilen-1))
ioutch1 = int(ipan)+ifirstchn
ioutch2 = ioutch1+1
Soutch1 sprintf "outchn%d",ioutch1
Soutch2 sprintf "outchn%d",ioutch2
ipan2 = frac(ipan)
ist, ien StrayGetEl Stray,iel, 124
Sel strsub Stray,ist, ien
asig soundin Sel,iskip
iscale = ichnls/ ilen
a1, a2 pan2 asig*iscale*kvol,ipan2
chnmix a1,Soutch1
if ipan != 0 then
chnmix a2,Soutch2
endif
if iel < ilen-1 then
MxdwnPlay Stray,ilen, ichnls, ifirstchn, iel+1, kvol, iskip
endif
endop
opcode ShowLED_a, 0, Sakkk
;Shows an audio signal in an outvalue channel. You can choose to show the value in dB or in raw amplitudes.
;;Input:
;Soutchan: string with the name of the outvalue channel
;asig: audio signal which is to displayed
;kdispfreq: refresh frequency (Hz)
;kdb: 1 = show in dB, 0 = show in raw amplitudes (both in the range 0-1)
;kdbrange: if idb=1: how many db-steps are shown (e.g. if 36 you will not see anything from a signal below -36 dB)
Soutchan, asig, kdispfreq, kdb, kdbrange xin
kdispval max_k asig,kdispfreq, 1
if kdb != 0 then
kdb = dbfsamp(kdispval)
kval = (kdbrange+ kdb) / kdbrange
else
kval = kdispval
endif
outvalue Soutchan,kval
endop
opcode ShowOver_a, 0, Sakk
;Shows if the incoming audio signal was more than 1 and stays there for some time
;;Input:
;Soutchan: string with the name of the outvalue channel
;asig: audio signal which is to displayed
;kdispfreq: refresh frequency (Hz)
;khold: time in seconds to "hold the red light"
Soutchan, asig, kdispfreq, khold xin
kon init 0
ktim times
kstart init 0
kend init 0
khold = (khold< .01? .01 : khold); avoiding too short hold times
kmax max_k asig,kdispfreq, 1
if kon == 0 && kmax > 1 then
kstart = ktim
kend = kstart+ khold
outvalue Soutchan,kmax
kon = 1
endif
if kon == 1 && ktim > kend then
outvalue Soutchan,0
kon = 0
endif
endop
opcode CollectShowClear, 0, iiikiii
;collect the audio channels, sends them to the display, and clears the global audio channel
ichnls, ifirstout, icount, ktrigdisp, idboramp, idbrange, icliphold xin
Soutchn sprintf "outchn%d",icount+ifirstout
Sdisp sprintf "out%d",icount+1
Sover sprintf "over%d",icount+1
Schn sprintf "chn%d",icount+1
Schnval sprintf "%d",ifirstout+icount
acollect chnget Soutchn
outch ifirstout+icount,acollect
ShowLED_a Sdisp,acollect, ktrigdisp, idboramp, idbrange
ShowOver_a Sover,acollect, ktrigdisp, icliphold
outvalue Schn,Schnval
chnclear Soutchn
if icount+1 < ichnls then
CollectShowClear ichnls, ifirstout, icount+1, ktrigdisp, idboramp, idbrange, icliphold
endif
endop
instr 1
;input values
Stray chnget "_MBrowse"
ist, ien StrayGetEl Stray,0, 124; get duration from the first element
Sfirst strsub Stray,ist, ien
idur filelen Sfirst
ilen StrayLen Stray,124
kchnls invalue "numoutch"
kfirstout invalue "firstout"
kskip invalue "skip"
kdb invalue "db"
kvol = ampdb(kdb)
ichnls = i(kchnls)
ifirstout = i(kfirstout)
iskip = i(kskip)
p3 = idur- iskip
;play as many channels as there are monofiles given, and pan to the output channels
MxdwnPlay Stray,ilen, ichnls, ifirstout, 0, kvol, iskip
;;display time
ktim timeinsts
kplaypos = iskip+ ktim
kposmin = floor(kplaypos/60)
kpossec = floor(kplaypos%60)
Smin sprintfk "%02d",kposmin
Ssec sprintfk "%02d",kpossec
outvalue "min",Smin
outvalue "sec",Ssec
;;collect and display mixdown audio signals
idboramp = 1;0=raw amps, 1=db
idbrange = 48
icliphold = 2
ktrigdisp metro 10
CollectShowClear ichnls, ifirstout, 0, ktrigdisp, idboramp, idbrange, icliphold
endin
i 1 0 1
e
00473587true1701701273056399124{e7d12ace-4150-46b5-929b-12b1cb9665aa}true0-3center
Arial
103000255255255border113243169676{1bfffffe-61dc-4355-8d70-96591bf074a2}true0-3left
Arial
103000255255255border113753623728{d7ca2aae-1384-4486-9c52-8c527b828211}true0-3center
Arial
123000255255255noborder113333623728{52f700e3-1b22-4bc9-b53f-f1125ea6f976}true0-3center
Arial
123000255255255noborder113643391727{a9d9274f-379f-4db8-86a2-1d04781b8628}true0-3center
Arial
143000255255255noborder11sec3793393326{a3a1342d-dd5b-419c-8b75-982f9d4c9592}true0-3left
Arial
143000255255255noborder11min3333393326{0e9ebddd-002b-4d81-9f3e-31d8174a9824}true0-3right
Arial
143000255255255noborder113243169426{a82a80c2-a91d-4602-b7b9-f7a43bf27c9f}true0-3center
Arial
123000255255255noborder11numoutch2303194328{fa061585-35fe-4b3e-8430-ab36d8832901}true0-3left
Arial
120002552552551.0000000001e+12false22931920327{26b0c8cc-b398-4ff3-9808-b0d8ba7287ba}true0-3left
Arial
123000255255255noborder11firstout1843504427{b2a47df0-7f7f-4758-b32d-6e630f52968d}true0-3left
Arial
120002552552551.0000000001e+12false12935015627{6b0b43c9-be40-4456-9e0f-292305d8c4e0}true0-3left
Arial
123000255255255noborder113521183329{e5582d70-8ce5-4c13-b3cf-1881b90a64ac}true0-3center
Arial
123000255255255noborder113161193329{b53ba656-e24c-4e19-b691-046114065a73}true0-3center
Arial
123000255255255noborder112781193329{94b9f142-532b-4c7d-ab6b-59b855371762}true0-3center
Arial
123000255255255noborder112411193329{56576ebf-1348-4ed8-bbf8-98040716404f}true0-3center
Arial
123000255255255noborder112051193329{b1dda0f4-3208-42cf-8dce-9fa4c5b84291}true0-3center
Arial
123000255255255noborder111681193329{cc6164c0-5283-4586-b272-0965f8af304c}true0-3center
Arial
123000255255255noborder111311193329{c12d11bc-4e9f-4cca-a214-87fe8decef1f}true0-3center
Arial
123000255255255noborder11941193329{f07326a2-2d40-4520-a3c4-cb13f0e6a4aa}true0-3center
Arial
123000255255255noborder113521483329{04836764-ae09-40d9-a9e1-3f83dce56fa5}true0-3center
Arial
123000255255255noborder11941473329{82a72ce3-b186-482b-976d-944b8f7d785c}true0-3center
Arial
123000255255255noborder11291465229{c24d1300-e14b-40de-b04a-b811acd9fefe}true0-3center
Arial
123000255255255noborder11291185229{7cc2eebb-6511-40e4-9da1-af23fe354c21}true0-3center
Arial
123000255255255noborder11305939759{eac54750-f5e9-4b16-a34e-a692ad43125f}true0-3center
Arial
123000255255255noborder11731130842{e23734f1-521f-4e65-9d55-58f2751ebc8b}true0-3center
Arial
223000255255255noborder11422776727{06c607cd-5822-47bb-9ecf-977bebb09709}true0-3right
Arial
123000255255255noborder113702784727{940a92e4-9d25-4003-9578-7ca125f0b716}true0-3left
Arial
123000255255255noborder11db3202775228{b91f69a5-a47c-4ea1-9d0f-046e44defbd8}true0-3left
Arial
123000255255255noborder112531888025{6d596540-3556-428d-bf81-e3302d85780c}true0-3right
Arial
103000255255255noborder11db10927721228{25d39018-0dcb-4f63-a4b6-519ef8219aa7}true0-3-12.0000000012.000000000.00000000lincontinuous-1.00000000falseskip3361876527{1eeb0757-ffae-471e-a3fa-4210eaa86a53}true0-3left
Arial
120002552552550.0010000001e+12false0_MBrowse1922841727{ea4bc9f6-b558-4a2a-9410-25edec264224}true0-3left
Lucida Grande
123000353535nobackground_MBrowse7118610030{368327a9-899a-403b-a55b-95357c3dbafe}true0-3value1.00000000Select Files/falsefalseout13241925100{496461c8-c3d7-47f7-8492-0468174480e7}true0-3out10.000000001.000000000.000000001.00000000-0.75150371-0.75150371fill10.00000000jump02340false000over1323952525{37e14c1d-f864-4d2d-a955-3ef825e77185}true0-3over10.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out26441925100{b8737139-8ae2-4743-98db-a80e11912ca3}true0-3out20.000000001.000000000.000000001.00000000-0.80731731-0.80731731fill10.00000000jump02340false000over2643952525{a8e39457-553c-41c5-bf44-ccf3379bc584}true0-3over20.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out39741925100{605082ea-44b3-4aed-9dad-b54709f3b8f9}true0-3out30.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over3973952525{48db23f6-2e0d-4d1e-974e-c9487c4c3138}true0-3over30.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out412941925100{9e16567b-0059-4f86-9b4d-300aa5bf2afe}true0-3out40.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over41293952525{26355726-dad2-44a1-8043-e4620741fd15}true0-3over40.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out516341925100{81470802-54bd-4a6c-be49-daa9a478552d}true0-3out50.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over51633952525{8db2e10f-1624-4d72-b4fe-1778191df70e}true0-3over50.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out619541925100{e83b3c5d-c1bc-4d3f-85c5-856165c8bb9d}true0-3out60.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over61953952525{8714d646-5805-4fc5-848c-00eb7e3dc30e}true0-3over60.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out722841925100{dc9eba00-b83d-4179-802b-b91532fd134a}true0-3out70.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over72283952525{6d0b2991-eed8-4871-947f-67bc67313855}true0-3over70.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000out826041925100{99e658f1-d30b-415a-8a60-528f39dfd1e6}true0-3out80.000000001.000000000.000000001.00000000-inf-inffill10.00000000jump02340false000over82603952525{85b38a7f-e962-4601-bced-83da2ddb45fd}true0-3over80.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jump15530false000chn1325272628{93704853-a825-47eb-8ebe-f98787fc5f93}true0-3center
Arial
143000255255255noborder11chn2655272628{7eac2f72-d419-4170-aae4-ae86c93a883d}true0-3center
Arial
143000255255255noborder11chn3965272628{e65ccd55-3ea5-4533-98a9-2cbb7522c808}true0-3center
Arial
143000255255255noborder11chn41295272628{b623e5e3-f099-48fa-bf4d-47d1ce8740aa}true0-3center
Arial
143000255255255noborder11chn51625272628{56cd1e29-4de0-4afd-b397-dfdfd0706ad5}true0-3center
Arial
143000255255255noborder11chn61955272628{342db427-ee50-4a2d-89a2-1e4019a29082}true0-3center
Arial
143000255255255noborder11chn72265272628{de3febd8-3541-47b8-b52a-64f587255123}true0-3center
Arial
143000255255255noborder11chn82595272628{754a616e-23e5-4592-ac5e-14644c8261af}true0-3center
Arial
143000255255255noborder113245318025{197181c4-cd2d-4977-bf2e-f6570b96c4a3}true0-3left
Arial
123000255255255noborder11319396116123{5fc86a90-3ef0-4d41-a138-8342b66ec8b9}true0-3left
Arial
103000255255255noborder11