DBraun / TD-Faust

FAUST (Functional Audio Stream) for TouchDesigner
Other
61 stars 2 forks source link

Setup UI misses effects on polyphonic instruments #9

Closed DBraun closed 2 years ago

DBraun commented 2 years ago

Example dsp:

declare options "[nvoices:6]";
//declare nvoices "6";

import("stdfaust.lib");
// polyphonic control parameters:
freq = hslider("freq", 440., 0., 18000., 0.);
gain = hslider("gain", 0., 0., 1., 0.);
gate = button("gate");
// other controls:
cutoff0 = hslider("Cutoff 0", 40., 30., 20000., .0) : si.smoo;
cutoff1 = hslider("Cutoff 1", 15000., 30., 20000., .0) : si.smoo;
cutoff2 = hslider("Cutoff High", 15000., 30., 20000., .0) : si.smoo;

env1 = gate : en.adsr(0.001, 0.2, 0., .1);
cutoff = cutoff0, cutoff1 : it.interpolate_linear(env1);
myOsc = os.sawtooth(freq) * env1 * gain;
filter = fi.lowpass(2, cutoff);

process = myOsc : filter <: _, _;
effect = sp.stereoize(fi.highpass(2, cutoff2));

In this example, the "Setup UI" button in TouchDesinger will create a UI that doesn't have "Cutoff High" because it's on the effect. If we transition from relying on XML to relying on JSON we should be able to more easily build a UI with all the necessary components. In the short term, you can usually just put the effect code in a separate Faust Audio CHOP.

theDsp->buildUserInterface(&m_jsonui);  // assume JSONUI m_jsonui; is in header
std::cerr << m_jsonui.JSON(false) << std::endl;  // need to give this back to TouchDesigner via Python
DBraun commented 2 years ago

This will be fixed in the JSON branch!