-m128
/*****OUTPUT TEST*****/
/*example for CsoundQt
written by joachim heintz
jan 2009, revised aug 2023*/
sr = 44100
ksmps = 64
nchnls = 2; change here if your output device has more channels
0dbfs = 1
opcode ShowLED_a, 0, Sakii
/*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 outvaluechannel
asig: audio signal which is to displayed
kdispfreq: refresh frequency (Hz)
idb: 1 = show in dB,0 = show in raw amplitudes (both in the range 0-1)
idbrange: 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, idb, idbrange xin
kdispval = max_k(asig,kdispfreq,1)
if (idb != 0) then
kdb = dbfsamp(kdispval)
kval = (idbrange+kdb) / idbrange
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 outvaluechannel
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
instr Control
;GUI input
gkSel = invalue:k("signal") //0-4 for the selected signals2
kChnA = invalue:k("chnA") //first channel to be tested
iChnA = invalue:i("chnA")
kChnZ = invalue:k("chnZ") //last channel to be tested
gkVol = invalue:k("vol") //volume in dB
kSigDur = invalue:k("sigdur") //duration of the test signal
kPausDur = invalue:k("pausdur");duration of the pause
kAll = invalue:k("all") //1 = send to all available channels
kChn init iChnA
kThisTime init 0
kSound init 1
kPaus init 0
kWasAll init 0
//test signal to all channels as constant sound
if kAll == 1 then
//if this is the first run ...
if kWasAll == 0 then
//... avoid duplicating an already running signal in one channel
turnoff2("PlayOneChannel",0,0)
//... then call all selected channels
kIndx = kChnA
while kIndx <= kChnZ do
schedulek("PlayOneChannel",0,99999,kIndx)
kIndx += 1
od
endif
kWasAll = 1
//test signal circulating with pauses in between
else
//turn off the signal to all channels if it runs
if kWasAll == 1 then
turnoff2("PlayOneChannel",0,0)
kWasAll = 0
endif
//perform the circulation
if kThisTime <= 0 then
if kSound == 1 then
schedulek("PlayOneChannel",0,kSigDur,kChn)
kSound = 0
kPaus = 1
kThisTime = kPausDur
kChn += 1
kChn = kChn > kChnZ ? kChnA : kChn
else
kSound = 1
kPaus = 0
kThisTime = kSigDur
endif
endif
endif
//clock counts backwards in every k-cycle
kThisTime -= 1/kr
endin
schedule("Control",0,-1)
instr PlayOneChannel
iChan = p4
if gkSel == 0 then //white noise
asig = rnd31:a(ampdbfs(gkVol),0)
elseif gkSel == 1 then //pink noise
asig = pinkish(ampdbfs(gkVol))
elseif gkSel == 2 then //10 KHz
asig = oscili:a(ampdbfs(gkVol),10000)
asig = linen:a(asig,.005,p3,.005)
elseif gkSel == 3 then //1 kHz
asig = oscili:a(ampdbfs(gkVol),1000)
asig = linen:a(asig,.005,p3,.005)
else //100Hz
asig = oscili:a(ampdbfs(gkVol),100)
asig = linen:a(asig,.005,p3,.005)
endif
outch(iChan,asig)
endin
instr Display
gkTrigDisp = metro(20) //refresh rate for the LED's
gaOut[] monitor
//create as many instances for single display as there are channels
indx = 0
while indx < nchnls do
schedule("DisplayOneChannel",0,99999,indx)
indx += 1
od
endin
schedule("Display",0,-1)
instr DisplayOneChannel
indx = p4
iOutChn = indx+1
Sout = sprintf("out%d",iOutChn)
Soutover = sprintf("outover%d",iOutChn)
ShowLED_a(Sout,gaOut[indx], gkTrigDisp,1,48)
ShowOver_a(Soutover,gaOut[indx],gkTrigDisp,0)
endin
579229628414true17017012719646748{ef87fe39-e572-4798-9cb3-cbe048f0f2a1}true0-3centertop
Lucida Grande
143000255255255noborder1089646748{4b922e5e-df26-4a7c-b3c1-ae8728e8f0f0}true0-3centertop
Lucida Grande
143000255255255noborder10158656748{600ebfd8-4b99-4470-9224-47f77bb3a3ef}true0-3centertop
Lucida Grande
143000255255255noborder10240666047{aa28566e-4c23-4d95-b429-612873e097c7}true0-3centertop
Lucida Grande
143000255255255noborder10signal23011011130{a01428ab-46ca-40ec-813e-c76935e30df9}true00white noise0pink noise1sine 10kHz2sine1kHz3sine 100Hz40false27293555108{f22c4e8e-8443-4969-8932-d4c2893c5bf7}true0-3lefttop
Lucida Grande
143000255255255noborder101451829944{9d40ffda-1958-45d6-a51c-b7b926c03a1f}true0-3centertop
Lucida Grande
263000255255255noborder10hor8251922080{2ed32768-860a-423f-b523-934ea06878ff}true0-3out10.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute251742020{31b56916-0bcd-4b36-b43f-7f966a6ccee2}true0-3out1over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor8471922080{b91cdede-2da4-4a9d-bac8-0a8808c984a4}true0-3out20.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute471742020{c5d6861d-8929-420c-a9d5-56326b4dc383}true0-3out2over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor8691922080{3aea2f21-236b-4dc6-8459-0408e186c4ce}true0-3out30.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute691742020{9686aefa-4dc4-46c3-85b9-fb0b9db87902}true0-3out3over0.000000001.000000000.000000001.000000000.450000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor8911922080{a6b53253-4267-4104-a450-63e7c5e66120}true0-3out40.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute911742020{c712da5b-b481-44d5-9200-86cc309d7444}true0-3out4over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor81131922080{c408b146-0339-465e-8929-44ac357da3ef}true0-3out50.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute1131742020{14a8ed6c-a628-4c49-9188-6e63ebb2cf9d}true0-3out5over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor81351922080{2796d482-838a-4335-a3c8-ad2d49acd173}true0-3out60.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute1351742020{f44998b2-d6c9-4a83-aa4c-c756589f04bb}true0-3out6over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor81571922080{a98f49f3-32ad-4b29-8439-6b063fe7f879}true0-3out70.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute1571742020{aa5a8d62-45c5-45b6-b13b-d872b4233f1d}true0-3out7over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor81791922080{b63b5989-fc20-44b5-b6ba-326fd381c5b8}true0-3out80.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute1791742020{a7669180-8018-49b2-a0b6-ab9e5c83d0ef}true0-3out8over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor82131922080{75214755-37fb-41a9-b613-38374fbdb47a}true0-3out90.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute2131742020{8f13b5f2-a9c5-4a61-b570-9fad829bf34e}true0-3out9over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor82351922080{beaa40cb-578e-4f4f-b373-c7e475cf0ee3}true0-3out100.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute2351742020{7b54f16e-15db-46aa-9eed-3cadb326e5f2}true0-3out10over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor82571922080{19e42af3-7988-4b89-88b3-970e8a3dd79b}true0-3out110.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute2571742020{d4d7c92f-c830-4231-ae72-2169855711ac}true0-3out11over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor82801912080{3ed00f7b-f1db-4794-92fe-f9933a042c6b}true0-3out120.000000001.000000000.000000001.000000000.95000000-inffill10.00000000jumpnoborder#00FF0002340false000trueDelayMute2801732020{78a5de93-b698-4e5d-9f6d-a27b809375ee}true0-3out12over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor83021912080{d6cc5490-cf85-46fb-bc36-eaf4137f54f7}true0-3out130.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute3021732020{0d719007-08ef-4e06-a0fb-1be3b70b4fbd}true0-3out13over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor83241912080{8e2080ef-0b46-4c7a-856e-7f78a5de28ba}true0-3out140.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute3241732020{d22a7203-1e97-43e2-b010-d6acf53b7563}true0-3out14over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor83461912080{3a95c4ee-4fb6-484f-bb4b-1de8e0d51a81}true0-3out150.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute3461732020{a93136f9-6c2c-411c-a131-f2e40b16451c}true0-3out15over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor83681912080{08771241-f545-461d-8441-98eb87425a77}true0-3out160.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute3681732020{c5ac8b71-1cd3-4df2-9df8-3a1e71f6ad45}true0-3out16over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor84021912080{937aecf0-a3f6-4d72-95e8-b1d55d0da7d8}true0-3out170.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute4021732020{4634f8c2-6a63-47b1-a960-e5e30a6697c3}true0-3out17over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor84241912080{e680d9de-e476-4122-9f36-b7f59e42a2b3}true0-3out180.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute4241732020{78acf52b-ee56-47d6-9685-5360d90fb9bd}true0-3out18over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor84461912080{639ce73d-7398-4d54-b04c-9eb4db2230fc}true0-3out190.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute4461732020{f4ff3d5f-41db-4cbc-a0ca-653085d731fd}true0-3out19over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor84681912080{2dcf1244-f195-4f82-b0a9-9448b504fe44}true0-3out200.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute4681732020{09059bc8-ed20-46f3-99ce-ea9f9727f294}true0-3out20over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor84901912080{361281d7-ba02-4bb3-b03c-c4b648c4f2fd}true0-3out210.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute4901732020{d0f592e3-77a9-4be7-aa3f-efd879c1ad19}true0-3out21over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor85121912080{d3d69495-1d5d-45fc-8086-cd38e8e7de5e}true0-3out220.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute5121732020{6a53d91b-6444-4404-ab2d-f84533c6401a}true0-3out22over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor85361912080{0128f3f8-a441-4a4c-ba45-caaeb3f0add2}true0-3out230.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute5361732020{a4d75f56-cf05-4fd0-81d9-074bf7eb4ad0}true0-3out23over0.000000001.000000000.000000001.000000000.350000000.00000000fill10.00000000jumpnoborder#00FF001961412false000truehor85581912080{e4fb3d92-cd1b-4b86-9c5f-8198ebd01611}true0-3out240.000000001.000000000.000000001.000000000.950000000.00000000fill10.00000000jumpnoborder#00FF0002340false000trueDelayMute5581732020{6a98b798-cbe8-463e-b89e-a5a2af74cc21}true0-3out24over0.000000001.000000000.000000001.000000000.000000000.00000000fill10.00000000jumpnoborder#00FF001961412false000true251462023{b54fd9b5-fc44-488d-b638-051573c572fa}true0-3centertop
Lucida Grande
123000255255255noborder10471462023{e4fb69e0-89e5-47b0-93ca-ba04a82ad09b}true0-3centertop
Lucida Grande
123000255255255noborder10691462023{c2198910-de8c-4def-969f-e6a3f1db3315}true0-3centertop
Lucida Grande
123000255255255noborder10911462023{a356fccf-d4a8-4783-9f4d-3e31537a291f}true0-3centertop
Lucida Grande
123000255255255noborder101131462023{665aca9f-b380-47d4-a194-af942deada43}true0-3centertop
Lucida Grande
123000255255255noborder101351462023{aeebc751-09bf-419d-839c-c103ef6dc14b}true0-3centertop
Lucida Grande
123000255255255noborder101571462023{f940fac4-c822-421a-b8b3-d01bf7fd00cb}true0-3centertop
Lucida Grande
123000255255255noborder101791462023{92ee52ac-8646-4b73-b147-9b5c558ac7ce}true0-3centertop
Lucida Grande
123000255255255noborder102081472824{7214120d-33fd-40c4-bb64-44bb6b455caf}true0-3centertop
Lucida Grande
123000255255255noborder102301472824{b59efad7-ac08-4855-8905-a7119460dbe6}true0-3centertop
Lucida Grande
123000255255255noborder102521472824{0b483377-b3f1-4696-961c-72683e7846a6}true0-3centertop
Lucida Grande
123000255255255noborder102741472824{c68df1b3-f0e5-477d-83b2-919a5d519771}true0-3centertop
Lucida Grande
123000255255255noborder102971462824{8559b873-15f6-4c5c-8f28-894c86eb4cd9}true0-3centertop
Lucida Grande
123000255255255noborder103191462824{1b01e7f6-f18a-4d07-93df-208fc8dd163e}true0-3centertop
Lucida Grande
123000255255255noborder103411462824{126f6772-912e-46b2-baa6-80ce348b8a26}true0-3centertop
Lucida Grande
123000255255255noborder103631462824{96a97b5c-406c-4dd5-9cde-2e3ffefd0834}true0-3centertop
Lucida Grande
123000255255255noborder103981452824{422d0d25-018a-4093-8d66-07c4d116639d}true0-3centertop
Lucida Grande
123000255255255noborder104201452824{1b2f064f-2d00-49bf-85e8-844344250657}true0-3centertop
Lucida Grande
123000255255255noborder104421452824{e10045df-f1c4-47e9-a67e-55924b365078}true0-3centertop
Lucida Grande
123000255255255noborder104641452824{6d0eeb43-bd50-402d-9a3d-7a06caae42c6}true0-3centertop
Lucida Grande
123000255255255noborder104861452824{fa0af2bf-f4e9-4771-8ec1-dd4da40cb3f4}true0-3centertop
Lucida Grande
123000255255255noborder105081452824{1b1a4cb8-396e-4a77-a95c-3128a76c05cb}true0-3centertop
Lucida Grande
123000255255255noborder105321452824{d3c8c146-d417-441f-b776-6f28428f849e}true0-3centertop
Lucida Grande
123000255255255noborder105541452824{d07a0703-0195-4b69-a776-ead0462151d7}true0-3centertop
Lucida Grande
123000255255255noborder10chnA321105030{a1a30d49-0926-48ff-9f69-6134c5398f7f}true00left
Noto Sans
120002552552551.00000000-1e+121e+12false1chnZ1001105030{1a617cb1-0312-43c6-820f-6aa779b9f4ca}true00left
Noto Sans
120002552552551.00000000-1e+121e+12false2all5291142020{7d89eee1-faba-4f50-b0c1-07b1f4b45136}true0-3false1false4886410447{02bde9d8-80d0-4cf1-87f7-483468643638}true0-3centertop
Lucida Grande
143000255255255noborder10sigdur3441105030{4efdf128-b777-468e-b5ef-7a026cdd856a}true00left
Noto Sans
120002552552550.100000000.110false1327637648{0c6ed6e6-1078-41ba-bd84-c62c14d81504}true0-3centertop
Lucida Grande
143000255255255noborder10pausdur4211105030{f296adcf-e3ba-4b4a-9386-9c6fb3c8f0b3}true00left
Noto Sans
120002552552550.100000000.00110false1404637748{bf974332-af27-42ff-9523-8d26c26dc04e}true0-3centertop
Lucida Grande
143000255255255noborder10vol1551097032{8a92e62e-1f97-4826-9342-7f5427ed40fd}true00right
Liberation Sans
140002552552550.10000000-1000false-20