aboutsummaryrefslogtreecommitdiff
path: root/examples/example.csd
blob: 9c510832d86ebd10b4ee9ee5a06bfce7757d6662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<CsoundSynthesizer>
<CsOptions>
-n ; no audio
</CsOptions>
<CsInstruments>
/*
	Demonstration of nstrexists.
	Check through a range of instrument numbers and report if they are
	known to the Csound engine.

*/
sr = 44100
ksmps = 1
nchnls = 2
0dbfs = 1

/* 
	Empty instruments to test for existence 
*/
instr 92
endin

instr 93
endin

instr 95
endin

instr testinstr1
endin

instr testinstr3
endin

instr testinstr4
endin


/*
	Go through instrument numbers 1 to 10 and check for existence
*/
instr 98

	; test the numeric i-rate opcode: look for instruments numbered between 91 and 98
	inum = 91
loop:
	prints(sprintf("(i-rate) Instr %d : %d\n", inum, nstrexists(inum)))
	loop_lt inum, 1, 99, loop
	turnoff
endin


instr 99

	; test the numeric k-rate opcode: look for instruments numbered between 91 and 98
	knum = 91
loop:
	printks2(sprintfk("(k-rate) Instr %d: %d\n", knum, nstrexists(knum)), knum)
	loop_lt knum, 1, 99, loop
	turnoff
endin

</CsInstruments>
<CsScore>
i98 0 1
i99 1 1
</CsScore>
</CsoundSynthesizer>