| 1 |
<CsoundSynthesizer> |
| 2 |
<CsOptions> |
| 3 |
; Select audio/midi flags here according to platform |
| 4 |
-odac ;;;realtime audio out |
| 5 |
;-iadc ;;;uncomment -iadc for RT audio input as well |
| 6 |
; For Non-realtime ouput leave only the line below: |
| 7 |
; -o fareyleni.wav -W ;;; for file output any platform |
| 8 |
</CsOptions> |
| 9 |
<CsInstruments> |
| 10 |
|
| 11 |
sr = 44100 |
| 12 |
ksmps = 32 |
| 13 |
nchnls = 2 |
| 14 |
0dbfs = 1 |
| 15 |
|
| 16 |
; initialise integer n for Farey Sequence F_8 |
| 17 |
gifarn init 8 |
| 18 |
|
| 19 |
; calculate length of F_8, it should return 23 for |F_8| |
| 20 |
gires fareyleni gifarn |
| 21 |
|
| 22 |
; convert to negative number for the GEN routine because |
| 23 |
; the table length won't be a power of 2 |
| 24 |
; (The length of a Farey Sequence of n > 1 is always an odd number) |
| 25 |
gilen init gires * -1 |
| 26 |
|
| 27 |
; create F_8 with GENfarey, the negative table number prevents |
| 28 |
; unnecessary normalisation (F_8 IS already normalised) |
| 29 |
; n mode: |
| 30 |
gifarey ftgen 100, 0, gilen, "farey", gifarn, 4 |
| 31 |
; if mode=4 then 1 is added to each element of F_n. |
| 32 |
; Useful for creating just tuning tables that can be read by the cps2pch opcode. |
| 33 |
|
| 34 |
instr 1 |
| 35 |
; the very last element of F_n is not needed in the case of tuning tables |
| 36 |
ires = gires - 1 |
| 37 |
; read out and print to file |
| 38 |
kndx init 0 |
| 39 |
if (kndx < ires) then |
| 40 |
kelem tab kndx, gifarey |
| 41 |
fprintks "farey8_tuning.txt", "%2.6f\\n", kelem |
| 42 |
kndx = kndx+1 |
| 43 |
endif |
| 44 |
|
| 45 |
endin |
| 46 |
|
| 47 |
instr 2 |
| 48 |
|
| 49 |
ip cps2pch p4, -100 |
| 50 |
asig poscil .5, ip, 1 |
| 51 |
aenv linseg 0, 0.1, 1, p3-0.2, 1, 0.1, 0 |
| 52 |
outs asig * aenv, asig * aenv |
| 53 |
|
| 54 |
endin |
| 55 |
</CsInstruments> |
| 56 |
<CsScore> |
| 57 |
f1 0 8192 10 1 ;sine wave |
| 58 |
|
| 59 |
i1 0 .1 |
| 60 |
|
| 61 |
i2 1 .5 8.00 |
| 62 |
i2 + . > |
| 63 |
i2 + . > |
| 64 |
i2 + . > |
| 65 |
i2 + . > |
| 66 |
i2 + . > |
| 67 |
i2 + . > |
| 68 |
i2 + . > |
| 69 |
i2 + . > |
| 70 |
i2 + . > |
| 71 |
i2 + . > |
| 72 |
i2 + . > |
| 73 |
i2 + . > |
| 74 |
i2 + . > |
| 75 |
i2 + . > |
| 76 |
i2 + . > |
| 77 |
i2 + . > |
| 78 |
i2 + . > |
| 79 |
i2 + . > |
| 80 |
i2 + . > |
| 81 |
i2 + . > |
| 82 |
i2 + . > |
| 83 |
i2 + 1 8.22 |
| 84 |
|
| 85 |
|
| 86 |
e |
| 87 |
</CsScore> |
| 88 |
</CsoundSynthesizer> |
| 89 |
|