[commit?] PlayBuf and RecordBuf control rate

View: New views
4 Messages — Rating Filter:   Alert me  

[commit?] PlayBuf and RecordBuf control rate

by nescivi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hiho,

I am just now looking into control rate versions of PlayBuf and RecordBuf.
The latter would be really useful for proper control rate scoping.

So, looking at the source code (Source/plugins/DelayUGens.cpp), it seems that
there is already an audio rate PlayBuf version, but this is not accessible
from the lang, but as far as I can see the methods are in place in the source
code ( there is a next_aa, next_ak, next_ka and next_kk method).
Is there any reason there is no matching *kr for PlayBuf in the class file?

(a little bit later...)

It seems that just adding the kr methods to the class interface allow both
record and playback on control rate, without problems.

Ok to commit?

sincerely,
Marije


Index: build/SCClassLibrary/Common/Audio/BufIO.sc
===================================================================
--- build/SCClassLibrary/Common/Audio/BufIO.sc  (revision 7516)
+++ build/SCClassLibrary/Common/Audio/BufIO.sc  (working copy)
@@ -6,6 +6,10 @@
        *ar { arg numChannels, bufnum=0, rate=1.0, trigger=1.0, startPos=0.0,
loop = 0.0;
                ^this.multiNew('audio', numChannels, bufnum, rate, trigger,
startPos, loop)
        }
+
+       *kr { arg numChannels, bufnum=0, rate=1.0, trigger=1.0, startPos=0.0,
loop = 0.0;
+               ^this.multiNew('control', numChannels, bufnum, rate, trigger,
startPos, loop)
+       }

        init { arg argNumChannels ... theInputs;
                inputs = theInputs;
@@ -91,6 +95,9 @@
        *ar { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
                ^this.multiNewList(['audio', bufnum, offset, recLevel,
preLevel, run, loop, trigger ] ++ inputArray.asArray);
        }
+       *kr { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
+               ^this.multiNewList(['control', bufnum, offset, recLevel,
preLevel, run, loop, trigger ] ++ inputArray.asArray);
+       }
 }
_______________________________________________
Sc-devel mailing list
Sc-devel@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

Re: [commit?] PlayBuf and RecordBuf control rate

by ronald kuivila :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

absolutely!
It's pretty funny that the method was there all the time...

RJK

On Apr 21, 2008, at 1:48 PM, nescivi wrote:

> Hiho,
>
> I am just now looking into control rate versions of PlayBuf and  
> RecordBuf.
> The latter would be really useful for proper control rate scoping.
>
> So, looking at the source code (Source/plugins/DelayUGens.cpp), it  
> seems that
> there is already an audio rate PlayBuf version, but this is not  
> accessible
> from the lang, but as far as I can see the methods are in place in  
> the source
> code ( there is a next_aa, next_ak, next_ka and next_kk method).
> Is there any reason there is no matching *kr for PlayBuf in the  
> class file?
>
> (a little bit later...)
>
> It seems that just adding the kr methods to the class interface  
> allow both
> record and playback on control rate, without problems.
>
> Ok to commit?
>
> sincerely,
> Marije
>
>
> Index: build/SCClassLibrary/Common/Audio/BufIO.sc
> ===================================================================
> --- build/SCClassLibrary/Common/Audio/BufIO.sc  (revision 7516)
> +++ build/SCClassLibrary/Common/Audio/BufIO.sc  (working copy)
> @@ -6,6 +6,10 @@
>         *ar { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,  
> startPos=0.0,
> loop = 0.0;
>                 ^this.multiNew('audio', numChannels, bufnum, rate,  
> trigger,
> startPos, loop)
>         }
> +
> +       *kr { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,  
> startPos=0.0,
> loop = 0.0;
> +               ^this.multiNew('control', numChannels, bufnum,  
> rate, trigger,
> startPos, loop)
> +       }
>
>         init { arg argNumChannels ... theInputs;
>                 inputs = theInputs;
> @@ -91,6 +95,9 @@
>         *ar { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
>                 ^this.multiNewList(['audio', bufnum, offset, recLevel,
> preLevel, run, loop, trigger ] ++ inputArray.asArray);
>         }
> +       *kr { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
> +               ^this.multiNewList(['control', bufnum, offset,  
> recLevel,
> preLevel, run, loop, trigger ] ++ inputArray.asArray);
> +       }
>  }
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>

_______________________________________________
Sc-devel mailing list
Sc-devel@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

Re: [commit?] PlayBuf and RecordBuf control rate

by nescivi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hiho,

On Monday 21 April 2008 13:59:39 ronald kuivila wrote:
> absolutely!
> It's pretty funny that the method was there all the time...

yes :)

I'm only guessing that the RecordBuf one could be written shorter for greater
efficiency.

Sincerely,
Marije

>
> RJK
>
> On Apr 21, 2008, at 1:48 PM, nescivi wrote:
> > Hiho,
> >
> > I am just now looking into control rate versions of PlayBuf and
> > RecordBuf.
> > The latter would be really useful for proper control rate scoping.
> >
> > So, looking at the source code (Source/plugins/DelayUGens.cpp), it
> > seems that
> > there is already an audio rate PlayBuf version, but this is not
> > accessible
> > from the lang, but as far as I can see the methods are in place in
> > the source
> > code ( there is a next_aa, next_ak, next_ka and next_kk method).
> > Is there any reason there is no matching *kr for PlayBuf in the
> > class file?
> >
> > (a little bit later...)
> >
> > It seems that just adding the kr methods to the class interface
> > allow both
> > record and playback on control rate, without problems.
> >
> > Ok to commit?
> >
> > sincerely,
> > Marije
> >
> >
> > Index: build/SCClassLibrary/Common/Audio/BufIO.sc
> > ===================================================================
> > --- build/SCClassLibrary/Common/Audio/BufIO.sc  (revision 7516)
> > +++ build/SCClassLibrary/Common/Audio/BufIO.sc  (working copy)
> > @@ -6,6 +6,10 @@
> >         *ar { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,
> > startPos=0.0,
> > loop = 0.0;
> >                 ^this.multiNew('audio', numChannels, bufnum, rate,
> > trigger,
> > startPos, loop)
> >         }
> > +
> > +       *kr { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,
> > startPos=0.0,
> > loop = 0.0;
> > +               ^this.multiNew('control', numChannels, bufnum,
> > rate, trigger,
> > startPos, loop)
> > +       }
> >
> >         init { arg argNumChannels ... theInputs;
> >                 inputs = theInputs;
> > @@ -91,6 +95,9 @@
> >         *ar { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> > preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
> >                 ^this.multiNewList(['audio', bufnum, offset, recLevel,
> > preLevel, run, loop, trigger ] ++ inputArray.asArray);
> >         }
> > +       *kr { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> > preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
> > +               ^this.multiNewList(['control', bufnum, offset,
> > recLevel,
> > preLevel, run, loop, trigger ] ++ inputArray.asArray);
> > +       }
> >  }
> > _______________________________________________
> > Sc-devel mailing list
> > Sc-devel@...
> > http://lists.create.ucsb.edu/mailman/listinfo/sc-devel


_______________________________________________
Sc-devel mailing list
Sc-devel@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel

Re: [commit?] PlayBuf and RecordBuf control rate

by nescivi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

committed the additions.
Maybe someone could add this example to the RecordBuf helpfile? and mention
the kr version in there as well? Also for PlayBuf?

sincerely,
Marije

(
// allocate a Buffer
s = Server.local.boot;
b = Buffer.alloc(s, 4096, 1); //
)

(
x = SynthDef("help-RecordBuf",{ arg out=0,bufnum=0;
        var sine;
        // XLine will free the Synth when done
        sine = SinOsc.kr( 10 );
        RecordBuf.kr(sine, bufnum);
}).play(s,[\out, 0, \bufnum, b]);
)

x.free;

(
y = SynthDef("help-RecordBuf play",{ arg out=0,bufnum=0;
        var playbuf;
        playbuf = PlayBuf.kr(1,bufnum);
        FreeSelfWhenDone.kr(playbuf); // frees the synth when the PlayBuf is finished
        Out.ar(out, SinOsc.ar( 400 + (50*playbuf), 0, 0.1 ) );

}).play(s,[\out, 0, \bufnum, b]);

)


b.plot
b.free;

On Monday 21 April 2008 14:18:36 nescivi wrote:

> Hiho,
>
> On Monday 21 April 2008 13:59:39 ronald kuivila wrote:
> > absolutely!
> > It's pretty funny that the method was there all the time...
>
> yes :)
>
> I'm only guessing that the RecordBuf one could be written shorter for
> greater efficiency.
>
> Sincerely,
> Marije
>
> > RJK
> >
> > On Apr 21, 2008, at 1:48 PM, nescivi wrote:
> > > Hiho,
> > >
> > > I am just now looking into control rate versions of PlayBuf and
> > > RecordBuf.
> > > The latter would be really useful for proper control rate scoping.
> > >
> > > So, looking at the source code (Source/plugins/DelayUGens.cpp), it
> > > seems that
> > > there is already an audio rate PlayBuf version, but this is not
> > > accessible
> > > from the lang, but as far as I can see the methods are in place in
> > > the source
> > > code ( there is a next_aa, next_ak, next_ka and next_kk method).
> > > Is there any reason there is no matching *kr for PlayBuf in the
> > > class file?
> > >
> > > (a little bit later...)
> > >
> > > It seems that just adding the kr methods to the class interface
> > > allow both
> > > record and playback on control rate, without problems.
> > >
> > > Ok to commit?
> > >
> > > sincerely,
> > > Marije
> > >
> > >
> > > Index: build/SCClassLibrary/Common/Audio/BufIO.sc
> > > ===================================================================
> > > --- build/SCClassLibrary/Common/Audio/BufIO.sc  (revision 7516)
> > > +++ build/SCClassLibrary/Common/Audio/BufIO.sc  (working copy)
> > > @@ -6,6 +6,10 @@
> > >         *ar { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,
> > > startPos=0.0,
> > > loop = 0.0;
> > >                 ^this.multiNew('audio', numChannels, bufnum, rate,
> > > trigger,
> > > startPos, loop)
> > >         }
> > > +
> > > +       *kr { arg numChannels, bufnum=0, rate=1.0, trigger=1.0,
> > > startPos=0.0,
> > > loop = 0.0;
> > > +               ^this.multiNew('control', numChannels, bufnum,
> > > rate, trigger,
> > > startPos, loop)
> > > +       }
> > >
> > >         init { arg argNumChannels ... theInputs;
> > >                 inputs = theInputs;
> > > @@ -91,6 +95,9 @@
> > >         *ar { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> > > preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
> > >                 ^this.multiNewList(['audio', bufnum, offset, recLevel,
> > > preLevel, run, loop, trigger ] ++ inputArray.asArray);
> > >         }
> > > +       *kr { arg inputArray, bufnum=0, offset=0.0, recLevel=1.0,
> > > preLevel=0.0, run=1.0, loop=1.0, trigger=1.0;
> > > +               ^this.multiNewList(['control', bufnum, offset,
> > > recLevel,
> > > preLevel, run, loop, trigger ] ++ inputArray.asArray);
> > > +       }
> > >  }
> > > _______________________________________________
> > > Sc-devel mailing list
> > > Sc-devel@...
> > > http://lists.create.ucsb.edu/mailman/listinfo/sc-devel
>
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-devel


_______________________________________________
Sc-devel mailing list
Sc-devel@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-devel