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

Add support for i2c2midi to firmware #490

Open
eethann opened this issue Oct 21, 2023 · 7 comments
Open

Add support for i2c2midi to firmware #490

eethann opened this issue Oct 21, 2023 · 7 comments

Comments

@eethann
Copy link

eethann commented Oct 21, 2023

It would be so fabulous to be able to use i2c2midi + crow in standalone mode as a generative CV/i2c to MIDI bridge, especially integrating midi controllers into scripts. Is there room to incorporate the initial work done on this by @mreid (https://github.com/mreid/crow-i2c2midi/blob/main/i2c2midi.lua).

I'd love to help jam on this though it might take a long time for me to get the compile environment set up at the moment.

@mreid
Copy link

mreid commented Oct 21, 2023

I’d love to see this too. I have a more memory efficient and fully featured version of that script you linked to on my machine. I’m traveling at the moment but will push an update once I’m home next week.

@eethann
Copy link
Author

eethann commented Nov 2, 2023

I've started merging the i2c2midi code into the firmware here, currently compiles but untested: https://github.com/eethann/crow/tree/i2c2midi_support

@eethann
Copy link
Author

eethann commented Nov 6, 2023

I just uploaded a compile of the first rough implementation and it seems to be working. Yay. I'll work on smoothing it out a bit and maybe getting more coverage of the i2c2midi commands.

@mreid
Copy link

mreid commented Nov 6, 2023

Nice work! I've just pushed the version I mentioned above to my repo: https://github.com/mreid/crow-i2c2midi/blob/main/i2c2midi-compact.lua

From memory, it gets rid of the range checking of the original to save memory and adds some extra commands. It also has a simple example usage at the top.

@eethann
Copy link
Author

eethann commented Nov 6, 2023

Awesome. I just tried with the added CC out ops and they work. So fun!

I also tried adding a MIDI IN CC getter, but it's not working immediately. I'll push and provide more info.

@eethann
Copy link
Author

eethann commented Nov 7, 2023

I figured out the CC getter (have to pass both channel and control number as args) and got the midi getters basically working. I've published a release so others can try it out here: https://github.com/eethann/crow/releases/tag/4.1.0-i2c2midi-rc1

I haven't gotten to any documentation yet. There's one problem that might require a change to some deeper code in the crow firmware: the second arg is used to pass the control number to query, but the event callback function is only passed the first argument. This makes it impossible to handle a specific controller number in the callback. The solutions I can see are either

  1. Generate separate getters for every CC controller number, so you only pass the channel (seems less than ideal, but would follow the fader implementation)
  2. Update the callback handler to pass an args table or an arg2 property back to the controller so we can check the specific controller that is being reported on (I think this would be preferable if not prohibitive)

Interested in any thoughts or recommendations about those two.

@trentgill
Copy link
Collaborator

hey folks! apologies for the long delay here - i didn't realize this was sitting here waiting!

i took a quick look at the linked forks & the core ii descriptors look good. if i understand correctly, the big block of commented out code is the example of how to incorporate it into a crow script. i assume the runtime-memory usage comes from generating function stubs for every command.

could someone link me to (or explain):
a) example of a crow setter & getter using this
b) the transmitted bytes that match to the above

my hope is we can find a way to use the "pickle"/"unpickle" C-extensions of the ii description file, to avoid needing to create stub-functions for every command.

if that fails, we could look into a metatable solution so all the commands can share the same function. i'd prefer to avoid this and keep everything within the automated ii code generation land!

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