npisanti / ofxPDSP

openFrameworks addon for audio synthesis and generative music
Other
304 stars 37 forks source link

Can I sync the sequencer via MIDI clock and/or ableton link ? #62

Open macramole opened 4 years ago

macramole commented 4 years ago

If not, can you give me some insight on how this could be implemented ?

thanks

npisanti commented 4 years ago

hello! those feature are not yet available.

midi clock could be implemented but it won't be easy, probably the best option would be to make a class that process pdsp::midi::Input in a similar manner to the keyboard or pads class but it calculates the right playhead value for the audio buffer to process

ableton link should be implemented into a separate addon as the ableton link license (GPL) is incompatible with the ofxPDSP MIT license

macramole commented 4 years ago

For the MIDI Clock, what if I make public and call SequencerProcessor::setPlayHead() for each MIDI Clock message ? Will it work ? Is it totally wrong ? Will something be out of sync ?

npisanti commented 4 years ago

i looked at the code again and probably it won't work that way, as it doesn't have memory of the old playhead, so skipping to a point could left you with unplayed events.

Adding midi clock input should need a rewrite of a good amount of ScoreProcessor

macramole commented 4 years ago

hey man, thanks for the reply. I hope you and your loved ones are hanging in there fine with the pandemic and all.

you mean SequencerProcessor right ?

I'm trying to understand the problem.

What you are thinking is: if I change the playhead using setPlayHead() it won't be "instantaneous" since the process method runs in the audio thread so it will actually change only next time the engine call process. In this scenario we may have events occurring that shouldn't occur. Is this right ?

npisanti commented 4 years ago

luckily everyone is fine, i'm the south now and here the pandemic has been weaker.

What i mean it's this: when you set the playhead it simply changes the starting point for the next iteration for the audio thread. Then in the audio thread the next point of playhead it's calcolated and only the events between the actual playhead point and the next are triggered. So it could happen that by making the playhead jump with midi you accidentally move it in a way that some events are not triggered (midi clock is also a bit jittery)

macramole commented 4 years ago

Ok, thanks for the explanation.

Since I'm not using all the great features the sequencer provides I'll just use an alternative clock. Implementing MIDI clock here seems out of my possibilities and a worthless effort since the alternative is working good enough.

I've reached a point where I'm finally enjoying ofxPDSP's features including sound effects !, I'll ask some questions in other thread.

You said "you are in the south" I guess south of Italy ? I'm from Argentina, very long lockdown here.

cheers.

-- leandrogarber.info

El mar., 30 jun. 2020 a las 16:34, Nicola Pisanti (notifications@github.com) escribió:

luckily everyone is fine, i'm the south now and here the pandemic has been weaker.

What i mean it's this: when you set the playhead it simply changes the starting point for the next iteration for the audio thread. Then in the audio thread the next point of playhead it's calcolated and only the events between the actual playhead point and the next are triggered. So it could happen that by making the playhead jump with midi you accidentally move it in a way that some events are not triggered (midi clock is also a bit jittery)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/npisanti/ofxPDSP/issues/62#issuecomment-651999751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWH6OL6ZEQITCMRMTSXWHDRZI44TANCNFSM4LRNNIXQ .

npisanti commented 4 years ago

ah yes, i was meaning south italy, here the lockdown is a bit loose and there are few cases, obviously we still have to wear masks in many places.

let me know if you need something =)