[RTcmix-discuss] Translation from MINC to Python
John Gibson
johgibso at indiana.edu
Thu Dec 18 13:18:40 EST 2008
Hi Peter,
How about this? Uses STRUM2 instead of STRUM, since then you have the
option later of changing some params dynamically during the note.
JG
------------------------------------
from rtcmix import *
rtsetparams(44100, 2)
load("STRUM2")
pitches = (7.07, 7.09, 7.10, 8.00, 8.02, 8.03, 8.05, 8.07, 8.09)
plength = len(pitches)
dur = 1.0
amp = 10000
squish = 1
decay = 1.0
st = 0
for i in range(1000):
pchindex = int(trand(plength))
pitch = pitches[pchindex]
pan = random()
STRUM2(st, dur, amp, pitch, squish, decay, pan)
st += irand(0.01, 0.3)
On Dec 18, 2008, at 12:06 PM, Peter O'Doherty wrote:
> Hi List,
>
> Could someone possibly help me translate this example from the
> tutorial into Python code.
>
> rtsetparams(44100, 2)
> load("STRUM")
>
> pitches = { 7.07, 7.09, 7.10, 8.00, 8.02, 8.03, 8.05, 8.07,
> 8.09 }
> plength = len(pitches)
>
> st = 0
> for (i = 0; i < 1000; i = i+1)
> {
> pchindex = trunc(irand(0, plength))
> pitch = pitches[pchindex]
> START(st, 1.0, pitch, 1.0, 0.1, 10000, 1, random())
> st = st + irand(0.01, 0.3)
> }
>
>
> So far I have this ... and it's not quite there...
>
> from rtcmix import *
> import random
>
> rtsetparams(44100, 2)
> load("STRUM")
> reset(44100)
>
> pitches = [7.07, 7.09, 7.10, 8.00, 8.02, 8.03, 8.05, 8.07, 8.09]
> plength = len(pitches)
>
> st = 0.0
>
> while st < 1000:
> pchindex = random.randint(0, plength)
> pitch = pitches[pchindex]
> START(st, 1.0, pitch, 1.0, 0.1, 10000, 1, random.random())
> st = st + random.uniform(0.01, 0.3)
>
> Thanks a lot,
> Peter
>
> _______________________________________________
> RTcmix-discuss mailing list
> RTcmix-discuss at music.columbia.edu
> http://music.columbia.edu/mailman/listinfo/rtcmix-discuss
More information about the RTcmix-discuss
mailing list