faust icon indicating copy to clipboard operation
faust copied to clipboard

Host Tempo into generated Plugins

Open AlexMitchellMus opened this issue 5 years ago • 13 comments

Having read the Faust documentation, it is unclear what is the best way to get host tempo (BPM, speed etc) into a plugin DSP.

I am referring to DSP code that is compiled with the faust2/plugin/ scripts.

Can this be made clearer in the documentation?

AlexMitchellMus avatar Nov 05 '19 12:11 AlexMitchellMus

This example code shows how Faust audio DSP can indeed be synchronized using MIDI clock based synchro (so start/stop/sync MIDI messages). To correctly work, it supposes that the MIDI receiving wrapping code handles MIDI events timestamps. This is not the case in all faust2xx scripts.

sletz avatar Nov 05 '19 14:11 sletz

So right now MIDI clock based synchro (with start/stop/clock messages) is handled in some of the faust2xx scripts. What kind of other synchro system would be usefull ?

sletz avatar Nov 06 '19 08:11 sletz

Ableton Link support would be very useful.

JeremyKeenan avatar Feb 02 '20 19:02 JeremyKeenan

What kind of use-case do you have in mind?

sletz avatar Feb 02 '20 19:02 sletz

Using Link synchronisation in Faust generated plugins within SuperCollider for example, which will have Link support in the next release.

JeremyKeenan avatar Feb 02 '20 20:02 JeremyKeenan

Well I actually started to implement something in 2019. The idea was to define some new meta-data to be added in controllers (like sliders, nentry..) and to be linked to Ableton Link start/stop/tempo parameters. This is coded in an AbletonLinkUI class that is not part of GitHub yet, and has never been finished and tested. @JeremyKeenan are you willing to help in some C++ programming ?

sletz avatar Feb 03 '20 09:02 sletz

Good to know a start has been made. Unfortunately my C++ dev skills are not up to par, I'm more on the openFrameworks tinkering level. I would be glad to help with testing.

I guess the specific use case I'd imagined was syncing triggers and LFOs to tempo, for example in SuperCollider externals.

JeremyKeenan avatar Feb 03 '20 11:02 JeremyKeenan

Du you mean SuperCollider externals written in Faust ?

sletz avatar Feb 03 '20 12:02 sletz

Yes, exactly that.

On Mon, Feb 3, 2020 at 12:23 PM Stéphane Letz [email protected] wrote:

Du you mean SuperCollider externals written in Faust ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/357?email_source=notifications&email_token=ABGYLF5DIJCQU7BJDUI3FH3RBAEDLA5CNFSM4JJCBAS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKTU2VY#issuecomment-581389655, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYLF2XUY6DKWYBUJNOIFLRBAEDLANCNFSM4JJCBASQ .

-- www.jeremykeenan.info www.callandresponse.org.uk

JeremyKeenan avatar Feb 03 '20 12:02 JeremyKeenan

Which means probably being able to "connect" to the SuperCollider global Ableton Link context ? Or imagine each Faust UGEn has its own Ableton Link context ? (which is probably easier to set up, but would mean several Faust UGEn would open several Ableton Link context..) Is this a problem ?

sletz avatar Feb 03 '20 12:02 sletz

I think the idea would be to connect to the SuperCollider Link context. I don't think it would be a problem though to have individual contexts, as I understand the idea of link is to Sync multiple applications and contexts to a single source.

On Mon, Feb 3, 2020 at 12:44 PM Stéphane Letz [email protected] wrote:

Which means probably being able to "connect" to the SuperCollider global Ableton Link context ? Or imagine each Faust UGEn has its own Ableton Link context ? (which is probably easier to set up, but would mean several Faust UGEn would open several Ableton Link context..) Is this a problem ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/grame-cncm/faust/issues/357?email_source=notifications&email_token=ABGYLFZXIRRXFFXS6UAN7ZTRBAGUDA5CNFSM4JJCBAS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKTWTOI#issuecomment-581396921, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGYLF72OIRLTXYNKQI35GDRBAGUDANCNFSM4JJCBASQ .

-- www.jeremykeenan.info www.callandresponse.org.uk

JeremyKeenan avatar Feb 03 '20 13:02 JeremyKeenan

@sletz

This is not the case in all faust2xx scripts.

Which ones do have host tempo abilities?

magnetophon avatar Jun 07 '20 00:06 magnetophon

We could take some inspiration from how VSTs get the playhead context from the DAW including the tempo, time signature, etc.

https://github.com/juce-framework/JUCE/blob/2f980209cc4091a4490bb1bafc5d530f16834e58/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp#L250

Maybe we could have a new faust libraries named pl (playhead). Then we could write pl.bpm. BPM would not become an hslider or anything UI related. It would be up to the DAW to tell Faust the playhead context for each block.

m_dsp = m_factory->createDSPInstance();
m_dsp->setPlayhead(somethingFromDAW);

// then later in process loop:

// compute would be modified to get the playhead and make private calls to update private variables:
// pl.bpm, pl.timeSigNumerator etc.
// Then compute would proceed as usual.
m_dsp->compute(128, inPtrs, outPtrs);

DBraun avatar May 18 '22 17:05 DBraun