Debian Codegraph @

src/Examples/FLOSS Manual Examples/12 Csound and other Languages/12G02_Minimal_HTML.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 -odac -d
4 </CsOptions>
5 <html>
6 <head> </head>
7 <body bgcolor="lightblue">
8 <script>
9 function onGetControlChannel(value) {
10 document.getElementById(
11 'testChannel'
12 ).innerHTML = value;
13 } // to test csound.getControlChannel with QtWebEngine
14 </script>
15 <h2>Minimal Csound-Html5 example</h2>
16 <br />
17 <br />
18 Frequency:
19 <input
20 type="range"
21 id="slider"
22 oninput='csound.setControlChannel("testChannel",this.value/100.0); '
23 />
24 <br />
25 <button
26 id="button"
27 onclick='csound.readScore("i 1 0 3")'
28 >
29 Event
30 </button>
31 <br /><br />
32 Get channel from csound with callback (QtWebchannel):
33 <label id="getchannel"></label>
34 <button
35 onclick='csound.getControlChannel("testChannel", onGetControlChannel)'
36 >
37 Get</button
38 ><br />
39 Value from channel "testChannel":
40 <label id="testChannel"></label><br />
41 <br />
42 Get as return value (QtWebkit)
43 <button
44 onclick='alert("TestChannel: "+csound.getControlChannel("testChannel"))'
45 >
46 Get as retrun value
47 </button>
48
49 <br />
50 </body>
51 </html>
52
53 <CsInstruments>
54
55 sr = 44100
56 nchnls = 2
57 0dbfs = 1
58 ksmps = 32
59
60 chnset 0.5, "testChannel" ; to test chnget in the host
61
62 instr 1
63 kfreq= 200+chnget:k("testChannel")*500
64 printk2 kfreq
65 aenv linen 1,0.1,p3,0.25
66 out poscil(0.5,kfreq)*aenv
67 endin
68
69 ; schedule 1,0,0.1, 1
70
71 </CsInstruments>
72 <CsScore>
73 i 1 0 0.5 ; to hear if Csound is loaded
74 f 0 3600
75 </CsScore>
76 </CsoundSynthesizer>
77 ;example by Tarmo Johannes
78 ;reformatted for flossmanual by Hlödver Sigurdsson