[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] wooh-kiki-woohwooh - Sequencing from text, using BufRd and Phasor




On Tuesday, December 30, 2003, at 08:00 AM, Andrew Robinson wrote:

Thanks ccos, that was very helpful.


By "your arguments to BufRd are wrong", I assume you mean I should have

BufRd.ar(numChannels, bufnum, phase, loop)

retval = BufRd.ar(1,buf, Phasor.ar(0, BufRateScale.kr(0), start, end),0);


actually i just misread your code.

instead of just

retval = BufRd.ar(1,buf, Phasor.ar(0, BufRateScale.kr(0), start, end));

Am I right, or is it something else?

With the change above, I still have the looping problem.


I would like to understand how Phasor works too though.
My usage of it is just pasted straight from the BufRd helpfile.

Apple J on Phasor shows me:

Phasor : UGen {
*ar { arg trig = 0.0, rate = 1.0, start = 0.0, end = 1.0, resetPos = 0.0;
^'audio', trig, rate, start, end, resetPos)
}
*kr { arg trig = 0.0, rate = 1.0, start = 0.0, end = 1.0, resetPos = 0.0;
^'control', trig, rate, start, end, resetPos)
}
}

I can trace this to

Ugen.SC, and *multiNewList

you don't really need to look into that method for this problem,
but it is interesting stuff to look into anyway imho.

Where to from there though?
At what point do things become objective C?

when you see a primitive, which looks like this _FooBar,
then a C function is being called. of course the entire
language is written in C so there is always compiled C running.
Objective C is only used for OSX specific stuff like the GUI.

Where would I look to see the code for that? On Sourceforge?

yes


{
var foo, time, argDict;
s=Server.local; if(not(s.serverRunning), {s.boot});
s.sendMsg("/b_allocRead", 0, "sounds/a11wlk01.wav");

SynthDef("playWord", { arg buf, start, end;
var retval;
retval = BufRd.ar(1,buf, Phasor.ar(0, BufRateScale.kr(0), start, end),0);
Out.ar(0, retval); // send output to audio bus zero.
}).load(s);


// here you are initializing argDict twice, you don't need this line
// argDict = Dictionary.new(10);


argDict = (
\beep : [ \buf, 0, \start, 0, \end, 4800 ],
\columbia : [ \buf, 0, \start, 4800, \end, 8900 ],
\this : [ \buf, 0, \start, 8900, \end, 11000 ],
\is : [ \buf, 0, \start, 11000, \end, 13000 ],
\houston : [ \buf, 0, \start, 13000, \end, 17000 ],
\over : [ \buf, 0, \start, 17000, \end, 20000 ]
);

foo = "over beep this is beep this is houston columbia".split($ ); // note the space after $

//foo = "beep".split($ );
//Synth("playWord", argDict["columbia".asSymbol] );

Task({
foo.do({ arg word;
word.postln;
Synth("playWord", a[word.asSymbol] );
time = 1;
time.wait
})
}).play;

}

here is one way of doing it, maybe not the best:

(
var bufid=0, foo, time, dict, words, breakPoints;
s=Server.local; if(not(s.serverRunning), {s.boot});
s.sendMsg("/b_allocRead", bufid, "sounds/a11wlk01.wav");

"playWord", { arg buf, start, end, i_dur;
var retval;
retval = BufRd.ar(1,buf, Line.ar( start, end, dur/BufSampleRate.ir(buf), doneAction: 2 ));
Out.ar(0, retval); // send output to audio bus zero.
}).load(s);

breakPoints = [ 0, 4800, 8900, 11000, 13000, 17000, 20000 ];
words = [\beep, \columbia, \this, \is, \houston, \over];
dict = IdentityDictionary.new(8);

words.do({ arg word, i;
var b1, b2, dur;
b1 = breakPoints[i];
b2 = breakPoints[i+1];
dur = b2 - b1;
dict[word] = [ \buf, bufid, \start, b1, \end, b2, \dur, dur ];
});

foo = "over beep this is beep this is houston columbia".split($ ); // note the space after $

Task({
foo.do({ arg word;
word.postln;
"playWord", dict[word.asSymbol] );
time = 1;
time.wait
})
}).play;

)

_______________________________________________
sc-users mailing list
sc-users@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-users