strudel icon indicating copy to clipboard operation
strudel copied to clipboard

Flesh out midi()

Open yaxu opened this issue 3 years ago • 10 comments

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:

  • [x] ccn / ccv
  • [ ] nrpnn / nrpv
  • [ ] midinote why not use note?
  • [x] n why not use note?
  • [x] midichan
  • [x] clock out https://github.com/tidalcycles/strudel/pull/710 todo: doc
  • [x] midicmd todo: doc
  • [ ] clock in https://github.com/tidalcycles/strudel/issues/844
  • [ ] https://github.com/tidalcycles/strudel/issues/1175

yaxu avatar Aug 16 '22 19:08 yaxu

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

felixroos avatar Aug 16 '22 19:08 felixroos

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!

yaxu avatar Aug 16 '22 19:08 yaxu

started implementing this in https://github.com/tidalcycles/strudel/compare/objectify-midi there is this list of controls: https://webmidijs.org/api/classes/OutputChannel#sendControlChange

felixroos avatar Aug 16 '22 21:08 felixroos

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?

clickglue avatar Sep 12 '22 06:09 clickglue

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

felixroos avatar Sep 12 '22 06:09 felixroos

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)

yaxu avatar Sep 12 '22 07:09 yaxu

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

felixroos avatar Sep 14 '23 17:09 felixroos

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 https://github.com/tidalcycles/strudel/pull/710

felixroos avatar Sep 27 '23 20:09 felixroos

Thanks! Thats great!

Van: "Felix Roos" @.> Aan: "tidalcycles/strudel" @.> Cc: "clickglue" @.>, "Comment" @.> Verzonden: Woensdag 27 september 2023 22:55:41 Onderwerp: Re: [tidalcycles/strudel] Flesh out midi() (Issue #192)

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 [ https://github.com/tidalcycles/strudel/pull/710 | #710 ]

— Reply to this email directly, [ https://github.com/tidalcycles/strudel/issues/192#issuecomment-1738065543 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AELXOAKV5UTFSNR72A33J7DX4SHE3ANCNFSM56W7NHAQ | unsubscribe ] . You are receiving this because you commented. Message ID: @.***>

clickglue avatar Sep 27 '23 21:09 clickglue

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).

totalgee avatar Dec 12 '23 08:12 totalgee