Skip to content

Commit

Permalink
Merge pull request #752 from tjingboem/7.0
Browse files Browse the repository at this point in the history
musical example & 2 x Mathews samples
  • Loading branch information
tjingboem authored Jun 25, 2024
2 parents 68d09e2 + 3919beb commit 4b89669
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 23 deletions.
16 changes: 8 additions & 8 deletions examples/allpole-2.csd
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
<CsInstruments>
sr = 44100
ksmps = 64
nchnls = 1
0dbfs = 1
ksmps = 32
nchnls = 2
0dbfs = 1
gifn ftgen 0,0,0,1,"fox.wav",0,0,1
gifn ftgen 0,0,0,1,"Mathews.wav",0,0,1
gifw ftgen 0,0,1024,20,2,1
instr 1
k1 init 0
kts = p4
kcfs[],krms,kerr,kcps lpcanal k1,1,gifn,1024,ksmps,gifw
if kcps > 180 then
kcps = 180
if kcps > 120 then
kcps = 120
endif
a1 buzz 0dbfs, kcps, sr/(kcps*2), -1
a3 allpole a1*krms*kerr,kcfs
Expand All @@ -26,13 +26,13 @@ if k1 > ftlen(gifn) then
k1 = 0
endif
a3 dcblock a3
out a3
outs a3*10, a3*10
endin
</CsInstruments>
<CsScore>
i1 0 10 1
i1 10 10 .75
i1 10 10 .2
i1 20 10 1.5
</CsScore>
</CsoundSynthesizer>
103 changes: 103 additions & 0 deletions examples/musical/TivalNstrnum_Yi.csd
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac ;;;realtime audio out
;-iadc ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o TivalNstrnum_Yi.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
;; Author: Steven Yi
;; Date: 2020.10.18
;; Description: Simple 2-sine tone with modulations and random-walk melody generation
instr Sine
ifreq = p4
iamp = p5
ipan = p6
itied = tival()
kamp = port(iamp, 0.1, (itied == 1) ? -1 : iamp)
if (itied == 0 && p3 < 0) then
kamp *= linseg(0, .1, 1, 1, 1)
elseif (itied == 1 && p3 > 0) then
kamp *= linsegr(1, 0.1, 1, 0.75, 0)
elseif (itied == 0 && p3 > 0) then
kamp *= linsegr(0, 0.5, 1, 0.75, 0)
endif
kfreq = port(ifreq, 0.1, itied == 1 ? -1 : ifreq)
;; Vibrato with delayed swell in
ivibamt = random:i(0.13, 0.17)
klfo = lfo(linseg(0, .3, 0, 1, ivibamt, 1, ivibamt), 4.7)
kmod = port(semitone(klfo), 0.01, -itied)
kfreq *= kmod
asig = oscili(1, kfreq, -1, -itied)
asig += oscili(0.15, kfreq * 2, -1, -itied)
asig *= kamp * 0.9
a1, a2 pan2 asig, ipan
out(a1, a2)
endin
;; Random Walk Melody generator
instr Run
ivoice = p4
inote_offset = limit(p5, -24, 24)
ipan = p6
print ivoice, inote_offset
inum = nstrnum("Sine") + (ivoice % 100) / 100
icount = int(random:i(4, 8))
indx = 0
istart = 0
while (indx < icount) do
idur = int(random:i(2, 5)) * .5
ilast = (indx < icount - 1) ? -1 : 1
inn = 72 + inote_offset
iamp = -18 - limit(inote_offset, 0, 24) / 2
schedule(inum, istart, idur * ilast, cpsmidinn(inn), ampdbfs(iamp), ipan)
iadj = int(random:i(2, 5))
inote_offset += (random:i(0, 1) > 0.5) ? iadj : -iadj
istart += idur
indx +=1
od
schedule(p1, istart + int(random:i(4, 8)) * .5, 0, (ivoice + 3) % 100, inote_offset, ipan)
endin
instr Main
;; run 3 voices
schedule("Run", 0, 0, 1, 0, 0.25)
schedule("Run", 0, 0, 2, 4, 0.5)
schedule("Run", 0, 0, 3, -7, 0.75)
endin
;; RUN PROJECT
seed(-1)
schedule("Main", 0, 0)
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
144 changes: 144 additions & 0 deletions examples/musical/Vibes_Pena.csd
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<CsoundSynthesizer>
<CsOptions>
-odac -d -A -m0 -+msg_color=0
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1.0
seed 0
garev1 init 0
garev2 init 0
gktime init 0
alwayson 99 ;; reverb
instr 1 ;make chord
iamp = p4
ifm = p5
itime = p6 ;phasor time
ifreq1 = p7
ifreq2 = p8
iint1 = p9
iint2 = p10
innotes = p11 ;number of notes in chord
kfm randomi ifm, ifm*1.05, 1
km metro kfm
kdur = 1/kfm
afreq phasor 1/itime
gkfreq downsamp (ifreq1+afreq*(ifreq2-ifreq1))
printks "\n freq: %.2f", 1, gkfreq
;; p1 p2 p3 p4 p5 p6 p7
schedkwhen km, 0, 0, 10, 0, kfm, iamp, iint1, iint2, innotes
endin
instr 10; vibes
indx init 0
incr = 1
imax = p7-1
iamp = db(p4)
ifreq = i(gkfreq)
loopit:
iint=round(random(p5, p6))
iint=(indx>0?iint:0)
iffactor = 2^((iint)/12)
ifreq = ifreq * iffactor
iamp random iamp, iamp*1.05
schedule 11, 0, p3, iamp, ifreq, iffactor, iint
;;print ifreq, iffactor, indx
loop_le indx, incr, imax, loopit
prints "\n "
endin
instr 11
iamp = p4
ifreq = p5
ifactor = p6
iint = p7
ifreq = ifreq * ifactor
ihrd random 0.1, 0.9
ipos random 0.0, 1
imp = 1
kvibf = 6.0
kvamp = 0.05
ivibfn = 2
idec = 0.1
ares vibes iamp, ifreq, ihrd, ipos, imp, kvibf, kvamp, ivibfn, idec
;;
if nchnls == 2 then
irpan random 0, 1
aout1, aout2 pan2 ares, irpan
ich2 = (nchnls == 2 ? 2: 3)
outch 1, aout1
outch ich2, aout2
else
irpan random 1, nchnls
ichn = round(irpan)
outch ichn, ares
endif
;;send to reverb
irsend random 0.2, 0.4
garev1 += irsend * aout1
garev2 += irsend * aout2
prints " %.2f: %.2f int: %.2f", gktime, ifreq, iint
endin
instr 99 ;;; reverb
gktime timeinsts
arev1, arev2 reverbsc garev1, garev2, 0.85, sr/2
ich1 = (nchnls == 2 ? 1: 7)
ich2 = (nchnls == 2 ? 2: 8)
outch ich1, arev1
outch ich2, arev2
clear garev1, garev2
endin
</CsInstruments>
<CsScore>
; Table #1, the "marmstk1.wav" audio file.
f 1 0 256 1 "marmstk1.wav" 0 0 0
; Table #2, a sine wave for the vibrato.
f 2 0 128 10 1
;;
; amp[dB] metro[Hz] phasor[s] freq1 freq2 int1 int2 nnotes
i1 0 20 -15 5 1 110 110 5 5 4
i1 + 10 -15 . 1 55 220 4 5 6
i1 30 10 -15 . 10 220 220 4 4 2
i1 + 10 -15 . 10 220 220 3 5 3
i1 + 20 -18 . 20 220 55 2 8 7
i1 + 10 -12 2 10 55 55 3 5 3
i1 71 30 -9 6 30 330 330 2 3 2
i1 + 10 -18 6 10 330 330 1 4 5
i1 + 9 -18 2 10 30 20 4 8 6
e
</CsScore>
</CsoundSynthesizer>
22 changes: 10 additions & 12 deletions examples/partikkel-2.csd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
; Audio out
-odac ;;;RT audio
; For Non-realtime ouput leave only the line below:
; -o partikkel.wav -W ;;; for file output any platform
; -o partikkel-2.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
Expand All @@ -16,7 +16,7 @@ nchnls = 2
giCosine ftgen 0, 0, 8193, 9, 1, 1, 90 ; cosine
giDisttab ftgen 0, 0, 32768, 7, 0, 32768, 1 ; for kdistribution
giFile ftgen 0, 0, 0, 1, "fox.wav", 0, 0, 0 ; soundfile for source waveform
giFile ftgen 0, 0, 0, 1, "Mathews.wav", 0, 0, 0 ; soundfile for source waveform
giWin ftgen 0, 0, 4096, 20, 9, 1 ; grain envelope
giPan ftgen 0, 0, 32768, -21, 1 ; for panning (random values between 0 and 1)
Expand Down Expand Up @@ -131,21 +131,19 @@ endin
</CsInstruments>
<CsScore>
;i1 st dur speed grate gsize cent posrnd cntrnd pan dist
i1 0 2.757 1 200 15 0 0 0 0 0
i1 0 3 1 200 15 0 0 0 0 0
s
i1 0 2.757 1 200 15 400 0 0 0 0
i1 0 3 1 200 15 400 0 0 0 0
s
i1 0 2.757 1 15 450 400 0 0 0 0
i1 0 3 1 15 450 400 0 0 0 0
s
i1 0 2.757 1 15 450 400 0 0 0 0.4
i1 0 3 1 15 450 400 0 0 0 0.4
s
i1 0 2.757 1 200 15 0 400 0 0 1
i1 0 3 1 200 15 0 400 0 0 1
s
i1 0 5.514 .5 200 20 0 0 600 .5 1
i1 0 6 .5 200 20 0 0 600 .5 1
s
i1 0 11.028 .25 200 15 0 1000 400 1 1
i1 0 12 .25 200 15 0 1000 400 1 1
e
</CsScore>

</CsoundSynthesizer>
3 changes: 3 additions & 0 deletions opcodes/nstrnum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
<xi:include href="examples-xml/nstrnum_nstrstr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
<para>
A musical examples featuring the nstrnum opcode: <ulink url="examples/musical/TivalNstrnum_Yi.csd"><citetitle>TivalNstrnum_Yi.csd</citetitle></ulink> by Steven Yi.
</para>
</para>

<para>
Expand Down
3 changes: 3 additions & 0 deletions opcodes/tival.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
<xi:include href="examples-xml/tival.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
<para>
A musical examples featuring the tival opcode: <ulink url="examples/musical/TivalNstrnum_Yi.csd"><citetitle>TivalNstrnum_Yi.csd</citetitle></ulink> by Steven Yi.
</para>
</para>
</refsect1>

Expand Down
6 changes: 3 additions & 3 deletions opcodes/vibes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ url="ftp://ftp.cs.bath.ac.uk/pub/dream/documentation/sounds/modelling/"><citetit

<example>
<title>Example of the vibes opcode.</title>



<para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
<xi:include href="examples-xml/vibes.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
</para>
<para>
A musical examples featuring the vibes opcode: <ulink url="examples/musical/Vibes_Pena.csd"><citetitle>Vibes_Pena.csd</citetitle></ulink>, by luis Antunes Pena.
</para>
</refsect1>

<refsect1>
Expand Down

0 comments on commit 4b89669

Please sign in to comment.