tiburzi / cync

a drum machine about non-quantized grooves
33 stars 4 forks source link

Live Midi #12

Open jeremydeanw opened 4 years ago

jeremydeanw commented 4 years ago

Would love a live midi out function, so I could hook up a hardware drum machine to Cync.
If any of the authors find time to implement this, I'd be eternally grateful.

OmarShehata commented 4 years ago

@jeremydeanw I don't have a MIDI out device to test with, but I together a quick test. Can you try opening this link with your drum machine connected?

https://f3pq6.csb.app/

It should play some notes. If that works it should be pretty easy to hook up to Cync's notes.

jeremydeanw commented 4 years ago

Hi! I just plugged in my USB midi cable, the light is working, so the signals are being sent. But I'm not receiving it on the drum machine side. This is probably because the midi notes aren't quite lined up in the correct keys.....is there a way of adding the ability to change midi note keys? I'm not actually sure where mine are for this particular drum machine, but I've run into this problem before....just a sec

jeremydeanw commented 4 years ago

I am getting a constant light flash on the USB cable, even without putting any drums into cync, so I'm not sure?

OmarShehata commented 4 years ago

Yeah there should be a way to choose the channel, I'm using code from this article: https://medium.com/@kulak/web-midi-api-sending-notes-from-javascript-to-your-synth-1dfee9c57645.

You can open the code here: https://codesandbox.io/s/f3pq6?file=/code/main.js. It's on line 150 in code/main.js. Looks like the channel is set as part of the MIDI message (see the "Structure of a MIDI Message" in that article).

jeremydeanw commented 4 years ago

If there were a way to choose a midi key for each drum(color) you put into cync, that would be the most ideal workflow, So just 6 MIDI keys, one for each note....that would help others who want live midi with their drum machines too, since every drum machine would have different options, and would help for multiple instances of using the same drum(note) in a row

jeremydeanw commented 3 years ago

Hey so your original https://f3pq6.csb.app/ actually does work for me, it must have been that all the drivers were not up to date on my end.

jeremydeanw commented 3 years ago

I received some help on reddit: https://www.reddit.com/r/learnjavascript/comments/k1679n/need_help_with_implementing_webmidi_in_javascript/

https://codesandbox.io/s/nifty-shamir-9p2gv

It works! (though it is currently triggering very specific notes) Line 1618 changes this :)

OmarShehata commented 3 years ago

Thanks for confirming @jeremydeanw . I just got a version of Cync with the correct live MIDI output here with help from @cupp0 :

https://cync-live-midi.glitch.me/

It uses the same mapping in the app, so the downloaded MIDI file should match what is played live by the app. I don't have a MIDI output device but I was able to test it with:

It's really cool seeing a web app control a (virtual) piece of hardware!

cync_midi

@jeremydeanw did you ever share what you were working on here? Is this part of a performance piece you're doing or just for fun? Either way if it's working on a physical drum machine it'd be really cool to see a video of that!

OmarShehata commented 3 years ago

I'm re-opening this issue if anyone is interested in finishing this work to make it part of the app (but it'll also be up to @tiburzi whether/how to integrate this from a design perspective). The only remaining work I think is:

I wrote up more technical details here along with the source code: https://glitch.com/edit/#!/cync-live-midi?path=README.md%3A23%3A107

jeremydeanw commented 3 years ago

Awesome! Works for me! The only thing I personally would need is a way to choose which notes are triggered for my particular drum machine, as the notes fall on different banks. I had changed line 1618 from https://codesandbox.io/s/nifty-shamir-9p2gv to certain midi notes. It might help for people to be able to choose, my drum machine is old...I think the notes responded are different on every drum machine. Velocity would be awesome too.

One thing that would be extra cool, though probably hard to implement is a way of loading in a midi file. For instance: https://www.reddit.com/r/WeAreTheMusicMakers/comments/3anwu8/the_drum_percussion_midi_archive_800k/
If you could open a rhythm and then break it apart, add to it....etc.
:)

OmarShehata commented 3 years ago

Thanks for the feedback Jeremy. I think importing a MIDI file might not be that hard (we'd have to figure out what to do if a file has more notes than the app has samples). That could be a lot of fun to explore.

jeremydeanw commented 1 year ago

Hi @OmarShehata + @tiburzi I was thinking about cync + your midi version of cync again today, I was wondering as a feature request if it might be possible to implement different tempos per ring within cync? Kindof like: https://danbennettdev.github.io/projects/neurythmic.html where each ring is independently doing its own thing. Cheers

jeremydeanw commented 1 year ago

Oh and sorry I totally didn't see your comment from way back "Either way if it's working on a physical drum machine it'd be really cool to see a video of that!" It was just for fun. I could try and hook it up again, and make a video to send to you :) I think the issue I was having with https://cync-live-midi.glitch.me/ if I remember right, was choosing the midi notes as they fell on different banks on the machine, so I had to reroute the midi notes or something. So that was something else I'd find super useful as a feature, being able to choose what midi notes are triggered.

OmarShehata commented 1 year ago

I was wondering as a feature request if it might be possible to implement different tempos per ring within cync?

This sounds interesting! I'm the one non-music expert in this project so you may need to break this down a bit for me: in Cync the size of each ring is it's tempo, right? (if I understand "tempo" right, it's just the speed at which the notes are triggered?) is what you're suggesting then to be able to change the speed of each ring separately from its size?

So that was something else I'd find super useful as a feature, being able to choose what midi notes are triggered.

That sounds useful! This is the function that currently controls its mapping:

https://github.com/tiburzi/cync/blob/7fa9cb84efb80974c8a831f9bacdff10e87f7660/code/main.js#L1592-L1610

jeremydeanw commented 1 year ago

Yes exactly, being able to change the speed of each ring separately from it's size, as a freeform type of rhythm. Having a tempo slider for each created ring would be the most ideal workflow for me at least. Also having tempos alot faster than the max that is allowed currently, because even at the fastest tempo in the smallest ring, it's not that fast....im thinking like "glitchy" fast, real fast, up to 300bpm for maximum craziness.

Are 35, 36, 40....the midi note numbers? Yeah somehow being able to choose your midi note number for each colored dot would be great!