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-CV clock script? #69

Open
256k opened this issue Aug 17, 2020 · 2 comments
Open

MIDI-CV clock script? #69

256k opened this issue Aug 17, 2020 · 2 comments

Comments

@256k
Copy link

256k commented Aug 17, 2020

Hi, I was wondering if there is already a midi-CV script that could put out midi clock to trigger in order to sync my eurorack to a midi device? I'm not very familiar with C coding unfortunately so i dont know where to even begin to learn how to do it.

@stephenhensley
Copy link
Collaborator

This is more relevant in the libdaisy repo, but once MIDI clock has been added to the MIDI parser there, you could very easily send a trigger out based on the MIDI clock.

Here's what a simple clock-to-trigger example might look like once that's been added

// global/static variables in this example
dsy_gpio trigger_output;
uint32_t time_set;
uint32_t dur = 6; // 6ms gates

// Typical Switch case for Message Type.
void HandleMidiMessage(MidiEvent m)
{
    switch(m.type)
    {
        case NoteOn:
        // do something . . .
        break;
        case Clock:
            // Sets Trigger output high, and stores the time in ms that it was set high.
            dsy_gpio_write(&trigger_output, 1);
            time_set = dsy_system_getnow();
            break;
        default: break;
    }
}
// elsewhere (in callback or main)
// This shuts the trigger off after 6ms
if (dsy_system_getnow() - time_set > dur)
    dsy_gpio_write(&trigger_output, 0);

You could probably already do a work around where you do this on reception of a NoteOn message (using the above code, but moving it into the NoteOn section). And then just setting up a MIDI track that sends quarter notes or eighth notes for you to sync to on your eurorack.

@256k
Copy link
Author

256k commented Aug 18, 2020

Thank you, that makes sense the workaround you've mentioned. i could try to do that... would also be useful for transmitting the shuffle/swing of the master sequencer into euro as well coz often clocks don't transmit that shuffle.

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

No branches or pull requests

3 participants