musikinformatik / that

Real time audio analysis library
GNU General Public License v3.0
9 stars 2 forks source link

Introduce bridge to patterns #5

Open capital-G opened 2 years ago

capital-G commented 2 years ago

It would be probably a good Idea to embed the analyzed values in a pattern somehow.

There are some problems though: That can yield events, but a pattern can only generate values upon request. This gets especially tricky as we do not know the duration of a note while its playing so either we have to mock stuff or introduce a delay. Another solution would be to not use this in real time but allow for recording of streams which later can be scheduled/looped?

telephon commented 2 years ago

In a sense, we don't need anything new really?

Pdef(\x, { Pseq(~data ? [Event.silent]) });
That.amp(\x, { SoundIn.ar }, { |event| 
    var envir = Pdef(\x).envir;
    envir[\data] = envir[\data].add(event).keep(-8) // keep the last 8 events 
})

(Pbind() <> Pdef(\x)).play;