Debian Codegraph @

examples/strrindex.csd

raw
1 <CsoundSynthesizer>
2 <CsOptions>
3 ; Select audio/midi flags here according to platform
4 -n ;;;no sound output
5 ;-iadc ;;;uncomment -iadc if realtime audio input is needed too
6 </CsOptions>
7 <CsInstruments>
8 ;example by Joachim Heintz
9
10 opcode FilNam, S, S
11 ;returns the name of a file path
12 Spath xin
13 ipos strrindex Spath, "/" ;look for the rightmost '/'
14 Snam strsub Spath, ipos+1 ;extract the substring
15 xout Snam
16 endop
17
18 instr name
19 prints "Printing name:\n"
20 Snam FilNam "/my/dir/my/file.WAV"
21 puts Snam, 1
22
23 endin
24 </CsInstruments>
25 <CsScore>
26 i "name" 0 0
27 e
28 </CsScore>
29 </CsoundSynthesizer>
30