Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midi CC / external control of synth parameters #17

Open
thegroove opened this issue Aug 18, 2021 · 1 comment
Open

Midi CC / external control of synth parameters #17

thegroove opened this issue Aug 18, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@thegroove
Copy link

Hi,

Great work on this little plugin, it sounds.. kickass, pardon the pun. I like it so much that I'd like to install it on a standalone plugin host type of machine (self-built x86 box). Upon exploring that idea though, I noticed there's no mention of midi CC or any other form of external control anywhere in the docs or source (that I can find, anyway). Is this indeed missing, and is this something that you plan to implement? Alternatively I may try to implement it myself, I have some c/c++ experience, although I am completely new to Juce and the Juce development process, so I may be biting off more than I can chew in the short term.

@thegroove thegroove added the enhancement New feature or request label Aug 18, 2021
@jatinchowdhury18
Copy link
Contributor

Thanks, glad you're liking the plugin! If you're using a DAW, it's possible to map MIDI controls to individual parameters, but for a standalone thing like you mentioned, we'll need to implement some MIDI CC controls. From my perspective, the process would look something like this:

  • Create a map of MIDI CC controls to plugin parameters.
  • Parse the MidiBuffer input to the plugin to extract the MIDI CC values for those controls.
  • Set the parameters based on the MIDI CC values.

Here's a rough outline of a class that could maybe do this kind of thing (see also JUCE MidiMessage documentation):

class MidiController
{
public:
    MidiController (AudioProcessorValueTreeState& vts)
    {
        map.insert ({ 16, vts.getParameter ("out_level") }); // map output level to MIDI CC 16
        ... // do other parameters
    }

    void processBuffer (MidiBuffer& messages)
    {
        for (const MidiMessageMetadata mm : midi)
        {
            auto message = mm.getMessage();

            for (const auto& [ccID, param] : params)
            {
                if (message.isControllerOfType (ccID)
                {
                    auto paramVal = param->convertFrom0To1 ((float) message.getControllerValue() / 127.0f);
                    param->setValueNotifyingHost (paramVal);
                }
            } 
        }
    }

private:
    std::unordered_map<int, RangedAudioParameter*> params;
};

Anyway, I have no idea if that will work, but might be worth trying.

Do you have references for other plugins that have this sort of thing implemented? I'd be curious to see how they do it, and how it's documented like in the plugin's user manual or something like that.

Thanks,
Jatin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants