~ubuntu-branches/ubuntu/trusty/csound-manual/trusty-proposed

1 by Jonas Smedegaard
Import upstream version 5.10~dfsg
1
<CsoundSynthesizer>
2
<CsOptions>
3
; Select audio/midi flags here according to platform
4
; Audio out   Audio in    No messages
5
-odac           -iadc     -d     ;;;RT audio I/O
6
; For Non-realtime ouput leave only the line below:
7
; -o FLbutton.wav -W ;;; for file output any platform
8
</CsOptions>
9
<CsInstruments>
10
11
; Using FLbuttons to create on screen controls for play, 
12
; stop, fast forward and fast rewind of a sound file
13
; This example also makes use of a preset graphic for buttons.
14
15
sr = 44100
16
kr = 44100
17
ksmps = 1
18
nchnls = 2
19
20
FLpanel "Buttons", 240, 400, 100, 100
21
    ion = 0
22
    ioff = 0
23
    itype = 1
24
    iwidth = 50
25
    iheight = 50
26
    ix = 10
27
    iy = 10
28
    iopcode = 0
29
    istarttim = 0
30
    idur = -1  ;Turn instruments on idefinitely
31
32
    ; Normal speed forwards
33
    gkplay, ihb1 FLbutton "@>", ion, ioff, itype, iwidth, iheight, ix, iy, iopcode, 1, istarttim, idur, 1 
34
    ; Stationary 
35
    gkstop, ihb2 FLbutton "@square", ion,ioff, itype, iwidth, iheight, ix+55, iy, iopcode, 2, istarttim, idur
36
    ; Double speed backwards
37
    gkrew, ihb3 FLbutton "@<<", ion, ioff, itype, iwidth, iheight, ix + 110, iy, iopcode, 1, istarttim, idur, -2
38
    ; Double speed forward
39
    gkff, ihb4 FLbutton "@>>", ion, ioff, itype, iwidth, iheight, ix+165, iy, iopcode, 1, istarttim, idur, 2
40
    ; Type 1
41
    gkt1, iht1 FLbutton "1-Normal Button", ion, ioff, 1, 200, 40, ix, iy + 65, -1 
42
    ; Type 2
43
    gkt2, iht2 FLbutton "2-Light Button", ion, ioff, 2, 200, 40, ix, iy + 110, -1 
44
    ; Type 3
45
    gkt3, iht3 FLbutton "3-Check Button", ion, ioff, 3, 200, 40, ix, iy + 155, -1 
46
    ; Type 4
47
    gkt4, iht4 FLbutton "4-Round Button", ion, ioff, 4, 200, 40, ix, iy + 200, -1 
48
    ; Type 21
49
    gkt5, iht5 FLbutton "21-Plastic Button", ion, ioff, 21, 200, 40, ix, iy + 245, -1 
50
    ; Type 22
51
    gkt6, iht6 FLbutton "22-Plastic Light Button", ion, ioff, 22, 200, 40, ix, iy + 290, -1
52
    ; Type 23
53
    gkt7, iht7 FLbutton "23-Plastic Check Button", ion, ioff, 23, 200, 40, ix, iy + 335, -1 
54
FLpanelEnd
55
FLrun
56
57
; Ensure that only 1 instance of instr 1
58
; plays even if the play button is clicked repeatedly
59
insnum = 1
60
icount = 1
61
maxalloc insnum, icount
62
63
instr 1
1.1.1 by Felipe Sateler
Import upstream version 5.13~dfsg
64
    asig diskin2 "beats.wav", p4, 0, 1
1 by Jonas Smedegaard
Import upstream version 5.10~dfsg
65
    outs asig, asig
66
endin
67
68
instr 2
69
    turnoff2 1, 0, 0   ;Turn off instr 1
70
    turnoff   ;Turn off this instrument
71
endin
72
73
</CsInstruments>
74
<CsScore>
75
76
; Real-time performance for 1 hour.
77
f 0 3600
78
e
79
80
81
</CsScore>
82
</CsoundSynthesizer>