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

Re: [sc-users] Filling buffers with envelopes



Hi there-
Came across this post recently and wanted to try it myself.

What I noticed was that with different values, the envelope seems to translate in a pretty non-linear way.  I've added a single frame offset, also - since "frame 0" might not exist.
Any idea how to make this behave correctly?

e= Env([0, 0.1, 0.2, 0.3, 0.4, 0.5], ([0, 0.1, 0.2, 0.3, 0.4, 1]*512)+1/s.sampleRate, \lin);
a= Buffer.loadCollection(s, e.asSignal);
a.plot;



On Tue, Oct 9, 2018 at 8:59 PM <klipklipklapklap@xxxxxxxxx> wrote:
Fantastic, thank you Fredrik. This is exactly what I was hoping for. There was no specific reason to use BufWr. I am just learning how to work with buffers

Am Di., 9. Okt. 2018 um 08:18 Uhr schrieb <f@xxxxxxxxxxxxxxxxxxx>:
do you have a particular reason to record (BufWr) the envelope into the buffer like that, or will this technique work...

e= Env([0, 0, 0.5, 1, -1, 0], [0, 50, 200, 100, 100].normalize*512/s.sampleRate, \lin)
a= Buffer.loadCollection(s, e.asSignal)
a.plot
{|buf| SinOsc.ar*PlayBuf.ar(1, buf, doneAction:2)!2}.play(args: [\buf, a])

?
_f

> 9 okt. 2018 kl. 05:45 skrev klipklipklapklap@xxxxxxxxx:
>
> Dear list,
>
> This is a beginner question about buffers. I am trying to fill a buffer with an envelope.
>
> This comes close to the result I am looking for:
> (
> a = Buffer.alloc(s, 512, 1);
>
> (
> y={arg rate=1;
>     var in;
>     in=EnvGen.ar(
>         Env(
>         [0, 0, 0.5, 1, -1, 0],
>         [0, 50, 200, 100, 100].normalize*512/SampleRate.ir,
>         \lin
>     ), Impulse.ar(100));
>         BufWr.ar(in, a, Phasor.ar(0, BufRateScale.kr(a) * rate, 0, BufFrames.kr(a)));
>     0.0 //quiet
> }.play;
> )
>
> But would it be possible to write just one cycle of the envelope into the buffer?
>
> Thank you!
> Max


  #|
     fredrikolofsson.com     musicalfieldsforever.com
  |#


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/