| 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 of Joachim Heintz |
| 9 |
|
| 10 |
opcode FilSuf, S, So |
| 11 |
;returns the suffix of a filename or path, optional in lower case |
| 12 |
Spath,ilow xin |
| 13 |
ipos strrindex Spath, "." ;look for the rightmost '.' |
| 14 |
Suf strsub Spath, ipos+1 ;extract the substring after "." |
| 15 |
if ilow != 0 then ;if ilow input is not 0 then |
| 16 |
Suf strlower Suf ;convert to lower case |
| 17 |
endif |
| 18 |
xout Suf |
| 19 |
endop |
| 20 |
|
| 21 |
instr suff |
| 22 |
|
| 23 |
ilow = p4 |
| 24 |
prints "Printing suffix:\n" |
| 25 |
Suf FilSuf "/my/dir/my/file.WAV", ilow |
| 26 |
puts Suf, 1 |
| 27 |
|
| 28 |
endin |
| 29 |
</CsInstruments> |
| 30 |
<CsScore> |
| 31 |
i "suff" 0 1 0 ;do not convert to lower case |
| 32 |
i "suff" 3 1 1 ;convert to lower case |
| 33 |
e |
| 34 |
</CsScore> |
| 35 |
</CsoundSynthesizer> |
| 36 |
|