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

« back to all changes in this revision

Viewing changes to examples/cos.csd

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Sateler
  • Date: 2011-08-01 22:21:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110801222158-90kslkp5ujci2f5d
Tags: 1:5.13~dfsg-1
* New upstream release
 - Add Menno Knevel to the copyright file
 - Refresh patch 2000-stripped-opcodes.diff
 - Update copyright hints file
* Update Vcs-* headers
* Bump Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<CsoundSynthesizer>
2
2
<CsOptions>
3
3
; Select audio/midi flags here according to platform
4
 
; Audio out   Audio in
5
 
-odac           -iadc    ;;;RT audio I/O
 
4
-odac     ;;;RT audio out
 
5
;-iadc    ;;;uncomment -iadc if RT audio input is needed too
6
6
; For Non-realtime ouput leave only the line below:
7
7
; -o cos.wav -W ;;; for file output any platform
8
8
</CsOptions>
9
9
<CsInstruments>
10
10
 
11
 
; Initialize the global variables.
12
11
sr = 44100
13
 
kr = 4410
14
 
ksmps = 10
15
 
nchnls = 1
 
12
ksmps = 32
 
13
nchnls = 2
 
14
0dbfs = 1
16
15
 
17
 
; Instrument #1.
18
16
instr 1
19
 
  irad = 25
20
 
  i1 = cos(irad)
21
 
 
22
 
  print i1
23
 
endin
24
 
 
 
17
icos1     =          cos(0) ;cosine of 0 is 1
 
18
icos2     =          cos($M_PI_2) ;cosine of pi/2 (1.5707...) is 0
 
19
icos3     =          cos($M_PI) ;cosine of pi (3.1415...) is -1
 
20
icos4     =          cos($M_PI_2 * 3) ;cosine of 3/2pi (4.7123...) is 0
 
21
icos5     =          cos($M_PI * 2) ;cosine of 2pi (6.2831...) is 1
 
22
icos6     =          cos($M_PI * 4) ;cosine of 4pi is also 1 as it is periodically to 2pi
 
23
          print      icos1, icos2, icos3, icos4, icos5, icos6
 
24
endin
 
25
 
 
26
instr 2 ;cos used in panning, after an example from Hans Mikelson
 
27
aout      vco2       0.8, 220 ; sawtooth
 
28
kpan      linseg     p4, p3, p5 ;0 = left, 1 = right
 
29
kpan      =          kpan*$M_PI_2 ;range 0-1 becomes 0-pi/2
 
30
kpanl     =          cos(kpan)
 
31
kpanr     =          sin(kpan)
 
32
          outs       aout*kpanl, aout*kpanr
 
33
endin
25
34
 
26
35
</CsInstruments>
27
36
<CsScore>
28
 
 
29
 
; Play Instrument #1 for one second.
30
 
i 1 0 1
 
37
i 1 0 0
 
38
i 2 0 5 0 1 ;move left to right
 
39
i 2 6 5 1 0 ;move right to left
31
40
e
32
 
 
33
 
 
34
41
</CsScore>
35
 
</CsoundSynthesizer>
 
42
</CsoundSynthesizer>
 
 
b'\\ No newline at end of file'