-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #752 from tjingboem/7.0
musical example & 2 x Mathews samples
- Loading branch information
Showing
7 changed files
with
274 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters