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

Flesh out midi() #192

Open
5 of 9 tasks
yaxu opened this issue Aug 16, 2022 · 10 comments
Open
5 of 9 tasks

Flesh out midi() #192

yaxu opened this issue Aug 16, 2022 · 10 comments
Labels
enhancement improves an existing feature

Comments

@yaxu
Copy link
Member

yaxu commented Aug 16, 2022

Relates to #60

Wish list:

ccn(a).ccv(b).midi() // Sends cc a with value b
nrpnn(a).nrpv(b).midi() // Sends nrprn a with value b
midinote("40 20").midi() // sends midi notes
n(a).midi() // send midi note a.add(60) 
n(5).ccn(20).ccv(40).midi() // send a note and a cc in one pattern

The above send to first midi channel, send to both second and sixth like:

midinote("40 20").channel("[1,5]").midi()

Also midinote, polytouch, midibend, etc..

edit:

@felixroos
Copy link
Collaborator

nice wish list! would also love to find a way to support mpe for microtonal stuff

@yaxu
Copy link
Member Author

yaxu commented Aug 16, 2022

I think these mostly would work already via superdirt e.g. ccn(30).ccv(70).superdirt()

Tidal also has grouped parameters for cc and nrpn so this is possible cc("30:70"), it'd be nice to support that here too!

felixroos added a commit that referenced this issue Aug 16, 2022
@felixroos
Copy link
Collaborator

felixroos commented Aug 16, 2022

@clickglue
Copy link

Hi, thank you so much for all the work you put in Strudel, I really love playing it with digitakt/tone! Is there already a way to sync the midi clock?

@felixroos
Copy link
Collaborator

felixroos commented Sep 12, 2022

Strudel currently does not support clock syncing, but I think the library it uses supports clocks: https://webmidijs.org/api/classes/Input#event:clock / https://webmidijs.org/api/classes/Output#sendClock
I think using strudel as the clock source would be simpler to implement, because the scheduler would not need syncing

@yaxu
Copy link
Member Author

yaxu commented Sep 12, 2022

Yes it would be a matter of calling .sendClock 48 times per cycle (assuming one 'note' per cycle), and .sendClockonce every 4 cycles or so. In tidal this looks like midicmd "[midiClock*48, start/4]" # s "midi". It could be nice to abstract this a bit to make it friendlier but it's quite nice to be able to tweak the numbers directly.

Here's superdirt's logic for turning messages into midi:
https://github.com/musikinformatik/SuperDirt/blob/develop/classes/DirtEventTypes.sc#L40

There's some nuances e.g. if a control change arrives in the same message as a note you want to send the control change first. (This can delay notes a bit though.. midi gets fiddly)

@felixroos felixroos added the enhancement improves an existing feature label Sep 13, 2022
@felixroos
Copy link
Collaborator

idea: use registerSound for midi output, which allows doing things like note("c a f e").s("midi") (like tidal)

@felixroos
Copy link
Collaborator

Hi, thank you so much for all the work you put in Strudel, I really love playing it with digitakt/tone! Is there already a way to sync the midi clock?

clock is now implemented in #710

@clickglue
Copy link

clickglue commented Sep 27, 2023 via email

@totalgee
Copy link

It would be great if a midiprogram() (or midiprog or whatever you want to call it) function could be added, to send MIDI program change messages. I'm using a Dirtywave M8 tracker with Strudel (USB MIDI), and there it is possible to switch instruments (i.e. program) even with each note, for a given channel. For example, instrument/program 1 might be bass drum, 2 might be snare, and I might want to use both of those on a single MIDI channel, switching back and forth.

Also, if there is a note and program change message at the same time, the program change should be sent first, so the correct instrument is selected before playing the note. This works fine for me in SuperCollider, so I know it can work.

Regardless of my M8 needs, it would be useful to be able to switch presets on any external synth (even if on many of them there is a slight delay before the new sound can be used -- you might send the program change at the start of a cycle or new section of the piece).

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

No branches or pull requests

4 participants