|
Post by reductionist_earth_catalog on Sept 24, 2022 23:29:57 GMT
Hi everyone! I think I had talked about this project on the Discord server, but figured I would share it here as well. The impetus behind this is that I love generating and manipulating gates in AE Modular, but I find things like tuning oscillators and dialing in precise pitches on a sequencer to be tricky. (I know that escaping traditional tuning is a plus for others though!) So I do all of the fun, spontaneous clock dividing/logic/burst generation in AE modular, then convert the triggers/gates into midi note-ons, and send those to a pisound over USB, where they clock Supercollider patterns. I then send MIDI over USB from those patterns to MIDI-controlled Grains modules (or any other MIDI device, potentially). Here are pictures of the hardware: IMG_2318.HEIC (1.53 MB) IMG_2319.HEIC (1.74 MB) The hardware side is composed of an Arduino nano which is powered by 5V and ground from the AE Modular power ribbon. Arduino digital pins D2 to D9 are connected to pin header inputs, where gates or triggers from AE Modular can be patched in. Digital pins D2 to D9 are also connected to ground via 100k resistors (as shown in this schematic from the Tuesday Night Machines: github.com/TuesdayNightMachines/AEModular/blob/master/Generative_CV_Sequencer/TTNM_AEModular_GenerativeCVseq_Circuit.jpg). The Arduino also connects via USB to the USB MIDI host NOTE: it is possible that if the USB is connected and the AE Modular system is powered off, the USB host is back-powering the Arduino and, by extension, the AE Modular. I do not know enough about electronics to resolve this, or how big of a safety issue it is. The USB host that the Arduino is connected to needs to run the Hairless MIDI-serial bridge or ttymidi. The baud rate is set to 115200, but this can be changed in the Arduino code. Here is my GitHub repo with the code: github.com/reductionistearthcatalog/AE_gate-to-MIDII might also share some of the SuperCollider code I use with this, but just wanted to share!
|
|
|
Post by maydonpoliris on Sept 25, 2022 2:41:58 GMT
OMG. in the meeting when I mentioned that I was going to revisit the CV to midi diy thread from TNM as I kept getting lost I didn't realise you were pretty much describing the same thing.... I think....
Before I go on, just to let you know the first github link above didn't work for me.
Basically, my ideal setup is to load samples into the Norns Shield (which only has midi) and trigger those samples using Ae Trigger outs/cv so I need something in the middle which sounds pretty much what you are doing here.
after that the next step for me would be to throw a comparator in between the cv and trigger but anyway, I'm getting too far ahead now
I guess the first step is to get an arduino nano as I only have an Uno.
cheers man
|
|
|
Post by reductionist_earth_catalog on Sept 25, 2022 3:27:56 GMT
Ah yes! Even more reason to get ttymidi working on a Norns! Also, I think an arduino uno should work fine—in fact, it might be much easier for prototyping (Unos have pin headers already soldered in, right? So that you don’t have to solder connections between AE pin headers to the arduino pins). so if you can connect ground from AE to ground on the uno, and then usb from the uno to the norns, then things should be fine!
Which Norns script would you be using? I’m curious how it would take midi input—that way we could tailor the arduino code to the Norns script. And I also imagine you could pretty easily use one of the adc inputs on the arduino as a CV input, then send CC signals to the norns to control some sampler parameter.
But yeah, getting ttymidi working on the norns is the number one priority. I’ll try to do more digging around on lines. I seem to recall that there is a web interface to norns where you can access a command line interface. The other unknown for me is how to send or receive midi between norns scripts and ttymidi. I think you might be able to send/receive midi to/from the virtual midi port, and then connect ttymidi to the virtual port? Not sure. Might try to make a post over on lines to see if anyone can help.
|
|
|
Post by reductionist_earth_catalog on Sept 25, 2022 4:11:29 GMT
So here's the lines post where someone talks about using ttymidi on Norns: llllllll.co/t/micro-bit-as-norns-midi-friend/47371They just say "install ttymidi," once maintenance is done on lines I might respond to that post to see if they have any more details on how to do that. Until I can get answers there, here is my best guess for how to install ttymidi on Norns: I found this on the monome website: monome.org/docs/norns/maiden/ (see the "Command Line Interface" section) With either Windows (https://learn.microsoft.com/en-us/windows/terminal/tutorials/ssh) or Mac it should be possible to open the terminal, ssh into Norns, and then enter the commands on this post: forum.aemodular.com/post/17366 Here are the relevant commands: wget https://github.com/cjbarnes18/ttymidi/archive/master.zip unzip master.zip cd ./ttymidi-master make sudo make install cd ..
(I imagine you would not have to do the earlier step of installing libasound, since Norns is audio-oriented hardware). That might at least get ttymidi, then we can work from there.
|
|
|
Post by maydonpoliris on Sept 25, 2022 5:44:55 GMT
thanks very much yes there are pin headers on the uno The Norns script I've been using currently is Timber/player but i'm up for suggestions of course if anyone knows of others. It seems to be the easiest to deal with my limited knowledge. norns.community/authors/markeats/timberI see you've already found maiden but I'll leave this here in case helpful to others. Maiden (using chrome) is the interface that you can interact with the norns over wifi monome.org/docs/norns/maiden/#:~:text=Command%20Line%20Interface%20maiden%20is%20a%20browser-based%20portal,browser%20at%20norns.local%20to%20see%20the%20maiden%20interface. re the midi port to ttymidi you can select different midi devices in the parameters and can select virtual as one of those. also can map this within Timber itself. ok finished installing ttymidi thanks to your quite clear instructions, appreciate the effort there. password into norns while running the code is 'sleep' (it's in the docs too but can be easily missed) I'm trying to find a way to check if i've installed it correctly but this is the end of the terminal results. looks ok creating: ttymidi-master/src/ inflating: ttymidi-master/src/ttymidi.c ~ $ cd ./ttymidi-master ~/ttymidi-master $ make gcc src/ttymidi.c -o ttymidi -lasound -lpthread src/ttymidi.c:484:1: warning: return type defaults to ‘int’ [-Wimplicit-int] main(int argc, char** argv) ^~~~ ~/ttymidi-master $ sudo make install mkdir -p /bin cp ttymidi /bin ~/ttymidi-master $ cd .. ~ $
|
|
|
Post by maydonpoliris on Sept 25, 2022 5:51:58 GMT
also re the arduino uno and Ae connection. if I power both using the same power supply (using a splitter) it should be ok and no need for the seperate ground connection?
|
|
|
Post by reductionist_earth_catalog on Sept 27, 2022 3:03:27 GMT
I think having a common ground is the critical bit--at least, that's what I recall from technobear's earliest AE videos. I think having 5V from the Norns USB should be ok as long as there is a ground connection between the AE and the Uno. I will look into the MIDI implementation of those Norns scripts!
|
|
|
Post by reductionist_earth_catalog on Sept 27, 2022 3:07:13 GMT
Oh yeah, Timber looks really straightforward--I think it should work with my Arduino code basically as-is (since it is just MIDI keypresses triggering samples)!
|
|
|
Post by maydonpoliris on Sept 27, 2022 8:53:50 GMT
thanks very much! this is really cool, I'll download your code, put it into the Uno then start to see how things go. Of course, will let you know how I'm going.
|
|
|
Post by reductionist_earth_catalog on Sept 28, 2022 3:36:37 GMT
Looking at my code again, there are some lines you might change if you are having problems. It might be you have to change line 38 to be some specific channel instead of MIDI_CHANNEL_OMNI, depending on how Timber is set up. Another thing to note is that I set the minimum time between consecutive gates to be 150 milliseconds because I was having some problems with trying to send note-on signals in quick succession--if you want to play around with that, you can change the 150 in line 77. I'll think about it to see if there are any other modifications that would be good to try.
|
|
|
Post by maydonpoliris on Sept 28, 2022 11:08:06 GMT
thankyou, haven't had a chance as yet to play around with it but will do this weekend
|
|
|
Post by maydonpoliris on Oct 1, 2022 5:21:29 GMT
I've compiled and uploaded the AetoGate.ino into the arduino uno Powered the Uno with the same power supply as the Ae Connected the Uno to the norns via a normal usb cable Patched a gate out from the Ae into the Uno digital pin headers 0, 1, 2 etc, (tried the Analog ones too in case)
not getting any readings into the norns When I look at the midi devices settings there is nothing showing up (i've tried using the virtual too) googled around but unable to find any solutions I've tried to change the OMNI to ONE etc but the code doesn't compile (not declared in scope but can't find where OMNI was declared)
This is kind of where my knowledge stops unfortuately.
any thoughts on how to get the norns to read a connection
|
|
|
Post by reductionist_earth_catalog on Oct 2, 2022 15:03:30 GMT
Hmm, OK. When you run ttymidi for instance with the following command:
ttymidi -s /dev/ttyUSB0 -b 115200 & (the 'ttyUSB0' might change depending on what your Arduino's device number is, but if the Arduino is the only USB device plugged into your Norns, I think it should be ttyUSB0), does a number appear on the command line?
After that, you can enter in the command:
aconnect -i to list input devices (the ttyUSB0 midi device should appear here) and
aconnect -o to list output devices (I believe the Norns virtual midi device should show up here). Let me know what the outputs of those commands are.
Also, when changing the Arduino code, MIDI_CHANNEL_OMNI should be replaced with a numeral 1-16, I believe. Might leave MIDI_CHANNEL_OMNI there for the moment in case some of the troubleshooting with ttymidi works.
|
|
|
Post by reductionist_earth_catalog on Oct 2, 2022 21:20:12 GMT
|
|
|
Post by maydonpoliris on Oct 2, 2022 22:35:14 GMT
Thanks, I noticed the pin number 2 on your notes after I posted. I made sure to double check your instructions and that I did test the pins 2-9 only from now. Here are my results of your enquiries after ssh we@norns.local and while the arduino is connected to the norns and a trigger coming from the 2ENV into the pin2 ttymidi -s /dev/ttyUSB0 -b 115200 & [2] 8917 [1] Exit 127 ttymidid -s /dev/ttyusb -b 115200 ~ $ /dev/ttyUSB0: No such file or directory aconnect -i client 0: 'System' [type=kernel] 0 'Timer ' 1 'Announce ' client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'Client-128' [type=user,pid=358] 0 'Virtual RawMIDI ' aconnect -o client 14: 'Midi Through' [type=kernel] 0 'Midi Through Port-0' client 128: 'Client-128' [type=user,pid=358] 0 'Virtual RawMIDI ' regarding the ~ $ /dev/ttyUSB0: No such file or directory result above I checked in Cyberduck software and found ttymidi folders if that helps..
|
|
|
Post by reductionist_earth_catalog on Oct 2, 2022 23:58:03 GMT
Got it, so it sounds like the serial USB device numbering is different on Norns than it is on my Pisound. So first, without the Arduino attached to the Norns, run the following command on Norns:
udevadm monitor Then plug in the Arduino and look for something like /dev/tty... It might be /dev/ttyACM0 or something. Then use that in the ttymidi command instead of /dev/ttyUSB0. Hopefully that will at least get ttymidi working with the Arduino!
(Edit: udevadm monitor might spit a lot of text out after you plug the Arduino in via USB, but the /dev/... should be in there somewhere)
|
|
|
Post by maydonpoliris on Oct 3, 2022 1:47:58 GMT
getting closer I feel and I'm learning things Can't see anything different in the norns at the moment results are:
~ $ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[163541.365306] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2 (usb)
KERNEL[163541.365462] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0 (usb)
KERNEL[163541.365546] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/tty/ttyACM0 (tty)
KERNEL[163541.365641] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.1 (usb)
UDEV [163541.379126] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2 (usb)
UDEV [163541.382502] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0 (usb)
UDEV [163541.384268] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.1 (usb)
UDEV [163541.387241] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/tty/ttyACM0 (tty)
then ran ~$ ttymidi -s /dev/ttyACM0 -b 115200 &
[1] 12161
~$ aconnect -i
client 0: 'System' [type=kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 128: 'Client-128' [type=user,pid=358]
0 'Virtual RawMIDI '
client 129: 'ttymidi' [type=user,pid=12161]
0 'MIDI out '
~ $ aconnect -o
client 14: 'Midi Through' [type=kernel]
0 'Midi Through Port-0'
client 128: 'Client-128' [type=user,pid=358]
0 'Virtual RawMIDI '
client 129: 'ttymidi' [type=user,pid=12161]
1 'MIDI in
|
|
|
Post by reductionist_earth_catalog on Oct 3, 2022 2:05:28 GMT
Awesome! So it has been a while since I did anything with aconnect, but I think the next move is to run this command: aconnect 129:0 128:0
To connect the ttymidi device to the virtual midi port, then I think you should be able to receive midi from the arduino and send it to the norns script!
|
|
|
Post by maydonpoliris on Oct 3, 2022 2:45:15 GMT
typed
~ $ aconnect 129:0 128:0 Connection failed (Invalid argument)
i tried it the other way around for kicks
~ $ aconnect 128:0 129:0
Connection failed (Operation not permitted)
|
|
|
Post by maydonpoliris on Oct 3, 2022 2:51:58 GMT
hold up I ran the previous with the arduino plugged in, ran it again unplugged and
~ $ aconnect 129:0 128:0
~ $
|
|
|
Post by reductionist_earth_catalog on Oct 3, 2022 3:01:02 GMT
Ah wait I think I remember: you might have to pair the 1 after the colon with a 0 after the colon (one of them is an input, one of them is output)
That suggests: aconnect 128:0 129:1
To connect the virtual midi to ttymidi, try that after setting up ttymidi (and running aconnect -i and aconnect -o to make sure the device numbers haven’t changed)
|
|
|
Post by maydonpoliris on Oct 3, 2022 3:27:28 GMT
so I think I've confused myself or done something wrong (i think the spelling is correct on all.
I ran ttymidi again ttymidi -s /dev/ttyACM0 -b 115200 &
[2] 14272
~ $ /dev/ttyACM0: No such file or directory
so I ran the monitor again and the dev changed to ttyACM1
so I ran ttymidi again using ACM1 /dev/ttyACM1: No such file or directory
would I need to disconnect any of the aconnects as I did run aconnect 128:0 129:1 too as I had thought I already did the above tty before the previous test in case
~ $ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[4137.354515] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2 (usb)
KERNEL[4137.354989] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0 (usb)
KERNEL[4137.356048] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/tty/ttyACM1 (tty)
KERNEL[4137.356254] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.1 (usb)
UDEV [4137.371199] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2 (usb)
UDEV [4137.374775] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0 (usb)
UDEV [4137.376168] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.1 (usb)
UDEV [4137.380384] add /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/tty/ttyACM1 (tty)
|
|
|
Post by reductionist_earth_catalog on Oct 3, 2022 3:36:11 GMT
Hmm not sure what happened. maybe try removing arduino usb from norns, restarting norns, and starting again because it looks like ACM1 should have worked. I’ll try reading more on aconnect to see if I can help more there.
|
|
|
Post by maydonpoliris on Oct 3, 2022 3:38:44 GMT
thanks, I think I owe you a coffee/beers after this.....
|
|
|
Post by reductionist_earth_catalog on Oct 3, 2022 3:46:41 GMT
I’m just glad someone else is getting into arduino+AE too! Also hoping to get this all figured out so we can share it over on lines—might be a nice boost for the AE format! So thank you for being the norns guinea pig. I might be hitting the hay soon though, so that’s why if I go quiet for a while.
|
|