SuperCollider Forum
May 21, 2013, 11:59:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The SuperCollider forum is currently experiencing a rash of spambot registrations. New user requests may not be approved quickly as a result -- and if your email address looks like spam, it might not be approved at all. We are working to improve the security of the registration process, and to provide alternate means to contact the administrators to get a new account. Thanks for your patience.
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: simple sound file loop  (Read 5625 times)
0 Members and 1 Guest are viewing this topic.
raygunvirus
Newbie
*

Karma: 0
Posts: 9


View Profile
« on: January 20, 2007, 05:45:02 PM »

What I'm trying to do is simply to loop the very short sound file on every second. My aim is to create independent  tempi in 2  channels, but with the same sound file. But I can't even  get one sound file to loop!!! my initial attempt :

s.boot;
b = Buffer.read(s, "sounds/cospuls.wav");

 (
 SynthDef("Pulsar", {arg out, bufnum = 2, trig = 1;
       Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)))};
       Trig.ar("Pulsar", 1).loop).play
       (s, [\out, 0, \bufnum, b.bufnum]);
 )

//This threw back "DoesNotUnderstandError, bla, bla" (neither did I..). another method I tried was:

t = TempoClock;
(
SynthDef.new("Pulsar", {arg out, bufnum = 1;
            Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)))};
            (s, [\out, 0, \bufnum, b.bufnum, \t, 2.0]));
)

//also to no avail... thanks for any help!

Ray
Logged
raygunvirus
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #1 on: January 21, 2007, 03:50:35 PM »

OK, I have the simple loop  i was initially looking for:
SynthDef("help_PlayBuf", {arg out = 0, bufnum = 0,
Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)))};
(s, [/out, 0, /bufnum, b.bufnum]);
)

Only, I can't yet articulate soundfile to a Tempo of my choosing. The step afterwards being : two separate tempi in two different channels...
much obliged for any help!

Ray   
Logged
joshp
AdminGroup
Full Member
*

Karma: 5
Posts: 121



View Profile WWW
« Reply #2 on: January 21, 2007, 06:20:49 PM »

i think you want something like this?

Code:
a = Buffer.read(s, "sounds/a11wlk01.wav");

SynthDef(\playBuf, {arg out = 0, bufnum = 0, rate1 = 1, rate2 = 1;
Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * [rate1, rate2]))}).load(s);

Synth(\playBuf, [\out, 0, \bufnum, a.bufnum, \rate1, 0.9, \rate2, 1.1], target: s);
best,
Josh

Logged
raygunvirus
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #3 on: January 22, 2007, 09:24:39 AM »

Hi Josh,
thanks a lot for looking at that.
I tried your patch, but unfortunaltely it gave me the following message:
Buffer(0, nil, nil, nil, sounds/cospuls.wav)

WARNING: keyword arg 'target' not found in call to Meta_SynthDef:new
ERROR: Message 'def' not understood.
RECEIVER:
Instance of Array {    (06F13090, gc=48, fmt=01, flg=00, set=03)
  indexed slots [8]
      0 : Symbol 'out'
      1 : Integer 0
      2 : Symbol 'bufnum'
      3 : Integer 0
      4 : Symbol 'rate1'
      5 : Float 0.9   3FECCCCC CCCCCCCD
      6 : Symbol 'rate2'
      7 : Float 1.1   3FF19999 9999999A
}
ARGS:
CALL STACK:
   DoesNotUnderstandError:reportError   06E9D310
      arg this = <instance of DoesNotUnderstandError>
   Nil:handleError   06EA0850
      arg this = nil
      arg error = <instance of DoesNotUnderstandError>
   Object:throw   06EA2650
      arg this = <instance of DoesNotUnderstandError>
   Object:doesNotUnderstand   06EE4D90
      arg this = [*8]
      arg selector = 'def'
      arg args = [*0]
   SynthDef:addControlsFromArgsOfFunc   069C54B0
      arg this = <instance of SynthDef>
      arg func = [*8]
      arg rates = nil
      arg skipArgs = 0
      var def = nil
      var names = nil
      var values = nil
      var argNames = nil
   SynthDef:buildUgenGraph   069D0DF0
      arg this = <instance of SynthDef>
      arg func = [*8]
      arg rates = nil
      arg prependArgs = [*0]
      var result = nil
      var saveControlNames = nil
   SynthDef:build   06F17C90
      arg this = <instance of SynthDef>
      arg ugenGraphFunc = [*8]
      arg rates = nil
      arg prependArgs = nil
   Interpreter:interpretPrintCmdLine   06EE76B0
      arg this = <instance of Interpreter>
      var res = nil
      var func = <instance of Function>
   Process:interpretPrintCmdLine   06EE88F0
      arg this = <instance of Main>

...so I don't quite know yet what went wrong there...
best,
R
Logged
joshp
AdminGroup
Full Member
*

Karma: 5
Posts: 121



View Profile WWW
« Reply #4 on: January 22, 2007, 10:24:46 AM »

hmm... try this... boot the server, then select all, and hit enter:
Code:
a = Buffer.read(s, "sounds/cospuls.wav");

SynthDef(\playBuf, {arg out = 0, bufnum = 0, rate1 = 1, rate2 = 1;
Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * [rate1, rate2]))}).load(s);

Synth(\playBuf, [\out, 0, \bufnum, a.bufnum, \rate1, 0.9, \rate2, 1.1], target: s);
Josh
Logged
raygunvirus
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #5 on: January 22, 2007, 12:30:46 PM »

Great, it works now. Thanks a lot!

 
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!