|
Post by reductionist_earth_catalog on Jan 13, 2022 15:49:13 GMT
EDIT: DISCLAIMER: all firmwares described here are experimental, use at your own risk. There is a possibility that your grains module will be bricked when uploading new firmwares (see this AE Modular forum post for a description of the possible problem and solution: forum.aemodular.com/thread/1858/serialport-show-anymore-brick-grains). Hi all, I have a long-term goal of having multiple MIDI-controlled GRAINS be the main signal sources in my rack. My first step is to use the USB connection on GRAINS for sending MIDI to the module. On my computer, I am using ttyMIDI. I tried this out with the MIDI-out firmware on GRAINS, and was able to make that connection successfully, such that sending a MIDI note from my computer resulted in a gate out on GRAINS (I was also able to send CV from GRAINS to my computer as MIDI CC). I noticed that the code for that firmware did not use the MIDI Library. I very slightly edited the built-in MIDI library callbacks example available in the Arduino IDE to similarly send a gate out from GRAINS when it received a MIDI note from my computer over USB. However, I wasn't able to get a gate out from GRAINS. I wasn't sure if there was an implementation detail of GRAINS that prevented such a use of the vanilla MIDI library, or if I was missing something obvious in my code. It also seems possible that I will need to parse the MIDI messages myself without using a library, like in the MIDI Out firmware, but I figured I would start here. Thanks for your help! #include <MIDI.h>
#define DIGITAL_OUT_PIN 8
MIDI_CREATE_DEFAULT_INSTANCE();
void handleNoteOn(byte channel, byte pitch, byte velocity) { // Turn digital out high when the note is received. digitalWrite(DIGITAL_OUT_PIN, HIGH); }
void handleNoteOff(byte channel, byte pitch, byte velocity) { // Turn digital out low when the note is released. digitalWrite(DIGITAL_OUT_PIN, LOW); }
// -----------------------------------------------------------------------------
void setup() { pinMode(DIGITAL_OUT_PIN, OUTPUT); // Connect the handleNoteOn function to the library, // so it is called upon reception of a NoteOn. MIDI.setHandleNoteOn(handleNoteOn);
// Do the same for NoteOffs MIDI.setHandleNoteOff(handleNoteOff);
// Initiate MIDI communications, listen to all channels MIDI.begin(MIDI_CHANNEL_OMNI); }
void loop() { // Call MIDI.read the fastest you can for real-time performance. MIDI.read(); }
|
|
|
Post by robertlanger on Jan 14, 2022 12:56:15 GMT
There should be nothing that blocks the MIDI library; did you tried it without any GRAINS specific code? Because in this case, GRAINS is nothing else than an ordinary Arduino.... The library depends also on the MIDIUSB lib (see github.com/FortySevenEffects/arduino_midi_library#other-transport-mechanisms); did you checked what to do here? Looking forward to see what you come up with; quite interesting topic!
|
|
|
Post by reductionist_earth_catalog on Jan 14, 2022 19:44:34 GMT
Thank you, Robert! I used hairless midi on a different computer, and that worked with my bare-bones sketch, so it seems like it was an issue with my ttymidi setup on my Linux machine.
|
|
|
Post by duddex on Jan 16, 2022 10:42:37 GMT
Your code worked for me after I changed MIDI.begin(MIDI_CHANNEL_OMNI) to ... MIDI.begin(); Serial.begin(115200); ... Maybe take a look at your Serial Port settings. This is a screenshot from my Windows machine: I think if you don't set the Baud rate in setup() the MIDI library will use 31250 bps (the standard MIDI setting). But it seems that it is not possible to set this Baud rate in Hairless Midi <--> Serial Bridge
|
|
|
Post by reductionist_earth_catalog on Jan 17, 2022 16:39:46 GMT
Ah! Good point! I will try setting baud rate in my Arduino code and seeing if there are any command line options in ttymidi--it would totally make sense that my barebones example didn't work if there was a serial communication mismatch there.
My initial target was to adapt some of the pre-existing grains firmwares to take MIDI note input, but then I had to spend a lot of time learning about timer registers to set the sample rate for PWM (I'm still pretty new to low-level audio code). I have a feeling that I'm getting closer. It might have been easier to start with Mozzi, but gosh I just love the sound of some of the grains firmwares.
|
|
|
Post by reductionist_earth_catalog on Jan 18, 2022 2:34:22 GMT
Cool, so I have adapted the tri-shape firmware to take MIDI input via USB. So far it is a pretty bare-bones implementation, but here is a rough jam I just recorded with two such grains:
I'm not sure what the licensing is for the original grains firmwares, but I hope to share what I have so far on github if I can/when I figure all that out. Next I would like to adapt other firmwares in a similar manner, and also implement portamento and pitch bend, with maybe CC control over portamento rate.
|
|
|
Post by duddex on Jan 18, 2022 20:43:52 GMT
The Tri-Shape module is licensed under the terms of the GNU General Public License
|
|
|
Post by reductionist_earth_catalog on Jan 22, 2022 23:20:25 GMT
Hi all, Here is a Github repo where I put my first modified firmware. Hopefully more to come!
|
|
|
Post by reductionist_earth_catalog on Jan 30, 2022 22:09:58 GMT
Hi all, I added a MIDI-controlled version of the SpellOrSpeak firmware (https://github.com/reductionistearthcatalog/AE-GRAINS-MIDI/tree/main/GrainsSpellOrSpeak-midi).
The way it works is that MIDI note-on messages trigger specific individual words from the vocabulary. Note 0-127 on channel 1 triggers words 0-127 of the vocab list, Note 0-127 on channel 2 triggers words 128-255 trigger words 128-255 of the vocab list, etc. A table of associated channel, midi note, and vocab words can be found in word-note-table.txt.
I work with Supercollider, so generating a dictionary of words and associated MIDI events is straightforward, and I can generate a specific sequence of words without much effort. It might be more cumbersome if you do MIDI sequencing in a DAW.
This is experimental, of course--I'm not sure what happens, for instance, if you send note-ons in rapid succession while it is still speaking a word.
|
|
|
Post by maydonpoliris on Jan 31, 2022 21:44:25 GMT
This sounds pretty cool and has a lot of potential. Lyrics on Ae!? Nice one. Wonder if that rapid not on would cause a cool stutter effect. Max headroom style.
|
|
|
Post by reductionist_earth_catalog on Feb 1, 2022 5:27:59 GMT
Thanks! I fixed some errors in the repo. It appears that some words in program memory in the firmware source can't be played, which was throwing off the associations between MIDI channel/MIDI note messages and specific words. I believe I have fixed it now after going through each individual note-on and verifying that the module spoke the proper word.
|
|
|
Post by maydonpoliris on Feb 1, 2022 6:07:56 GMT
cool thanks!
I also didn't realise there was an bigger word library than I thought. Guess I can add words too in the IDE.
When I run verify for the S&S Midi firmware in the IDE I get this error message
MIDI.h: No such file or directory
obviously not my forte, have I missed something in the set up of your firmware.
cheers
|
|
|
Post by reductionist_earth_catalog on Feb 1, 2022 21:22:11 GMT
Ah yes my bad, it relies on the 47 effects MIDI library for arduino (https://github.com/FortySevenEffects/arduino_midi_library), I will change the readme to include that after work. Sorry for the oversight on my part!
|
|
|
Post by maydonpoliris on Feb 2, 2022 1:59:31 GMT
Ah yes my bad, it relies on the 47 effects MIDI library for arduino (https://github.com/FortySevenEffects/arduino_midi_library), I will change the readme to include that after work. Sorry for the oversight on my part! Cool thanks!
|
|
|
Post by reductionist_earth_catalog on Feb 2, 2022 5:07:15 GMT
Yes, the MIDI library can be found here (https://github.com/FortySevenEffects/arduino_midi_library), but it is straightforward to add the library from the Arduino library manager (go to Tools > Manage Libraries... and search for MIDI Library)
|
|
|
Post by maydonpoliris on Feb 2, 2022 10:03:18 GMT
Thanks for the link and instructions, made it easy for me and now the program verified and loaded without issues.
Couldn't get the Grains to make a noise using midi after the load or on man mode. (I can if I reload the orig S&S) I'm only using a norns shield and my parameter set up might not be right for this in allocating proper notes. I can use it to CV the wavetables but might be different and my knowledge of midi is not strong at all so I'd take this with a Grains of salt...
|
|
|
Post by reductionist_earth_catalog on Feb 3, 2022 4:32:01 GMT
I am realizing now how idiosyncratic my setup is. Sorry, it is the first time I have really shared any of my code. Grains won’t be automatically recognized as a USB MIDI device—I think it has to do with the USB chip in the module. The MIDI out firmware GitHub page (https://github.com/aemodular/GRAINS/tree/master/Grains-MIDI-out) recommends using the Hairless MIDI-serial bridge (https://projectgus.github.io/hairless-midiserial/), but I use ttymidi on my raspberry pi (https://github.com/cjbarnes18/ttymidi). Both those programs allow you to send MIDI over serial to grains. I have never used Fates/Norns—my understanding is that it is basically a raspberry pi running supercollider, but with a custom interface. I will have to do some reading to determine if either ttymidi or the midi bridge can be installed on it. I see one is available for sale locally for $500, but I promised myself I wouldn’t spend too much more on synths otherwise I’d pick it up and play around with it in a heartbeat, haha. Will try to do some more reading and get back to you.
|
|
|
Post by maydonpoliris on Feb 3, 2022 10:10:48 GMT
Please don't apologise or stress about it, absolutely no need because I've had a load of fun, you got me playing around and interested with Grains speak and spell, loading up libraries, playing with a bit of code, playing with norns, I also remembered that the circuit mono station has midi out too so I hooked that up with the Ae and had a play (didn't work with the midi version but the CV worked great) and now I've got some sort of patch going to work on so all is great. Keep posting your code and ideas. Would love to be able to code like yourself, I tried to learn and got just far enough for my brain to fry.
|
|
|
Post by pt3r on Feb 3, 2022 13:08:17 GMT
... Would love to be able to code like yourself, I tried to learn and got just far enough for my brain to fry. Perhaps you should try your hand at puredata, it allows you to do really wild things but you have a graphical interface where you connect your building blocks.
|
|
|
Post by maydonpoliris on Feb 3, 2022 20:04:48 GMT
... Would love to be able to code like yourself, I tried to learn and got just far enough for my brain to fry. Perhaps you should try your hand at puredata, it allows you to do really wild things but you have a graphical interface where you connect your building blocks. ah yes I had forgotten about Pure Data, I downloaded the software when someone on the forum, could have been yourself, mentioned it a while ago and then I got side tracked. Now that I've got the itch again I'll give it a crack. I like the idea of having a more graphical interface. cheers. Do you play around with it much?
|
|
|
Post by pt3r on Feb 3, 2022 20:55:34 GMT
I built some performance daw/sampler with which I recorded a lot of my earlier dēofol pieces, the latest puredata records were شاعر مجنون and S.E.T.I. So yes I can vow for its possibilities.
|
|
|
Post by maydonpoliris on Feb 3, 2022 21:06:04 GMT
cooool. listening to شاعر مجنون now, sounds great. Almost bought it too until I realised it wasn't BC Frid yet. Were you using Ae this far back as well or was this purely PData.
|
|
|
Post by pt3r on Feb 3, 2022 21:18:51 GMT
cooool. listening to شاعر مجنون now, sounds great. Almost bought it too until I realised it wasn't BC Frid yet. Were you using Ae this far back as well or was this purely PData. I bought my first AE rack end of december 2020.
|
|
|
Post by maydonpoliris on Feb 3, 2022 21:26:38 GMT
wow, nice work. If I didn't know and had to guess I'd say Ae was in it for sure but this was released before then.
Pretty cool you were able to create a DAW/sampler let alone sound the way it does.
|
|
|
Post by maydonpoliris on Feb 3, 2022 21:42:29 GMT
pt3r ENCOUNTER I is a great track too. really gives the ET feel.
|
|