-
Notifications
You must be signed in to change notification settings - Fork 22
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
USB MIDI support for other MIDI Controlers #1
Comments
Great ! I'm so happy someone gets interest in Dekrispator's code ! It would be marvellous if you could improve that minimalistic USB driver for which I spent a lot of time. But understanding USB arcanes was a hard stuff for me as I'm not a pro programmer... |
Hi, guys. Thanks again and respect to you! |
Hi! @MrBlueXav I will try to make the midi flexible, so that we do not have to change the code when we use different synths. I am also taking a look at the audio code. I changed BUFF_LEN_DIV_4 all the way down to 1, and it still plays without glitching (slow usb recognition though, busy CPU). Means that we can achieve a very low latency, more than enough for fast keyboard playing. I have some string physical modeling code, I will add it and we can play some tunes along with the sequencer :) @iRet What a cool synth! That would be really awesome to play on stage! |
Hi, @tomassch Can you please explain what did you do to get "unrecognized device" message in gdb? I'm noob with this stuff. Starting st-util then arm-none-eabi-gdb. Connecting to localhost, and type continue. I'm on a mac, it was really hard to get working environment here. Flashing via st-flash binary file. Project won't compile as is, however another code compiling well even another Xavier's project with Makefile :) Will check further. So, I've tried to connect Novation X-station and send some midi messages according to mapping from Resources folder. Nothing... BTW, Dekrispator sound pretty good! |
Finally played a bit with paths in .mk files to .d and that's it. |
awesome progress! did it work with the novation without changing the interface number in the about the device unrecognized in gdb, I made a break point in the line that yesterday I implemented noteOn noteOff functionality, and put it to test soon gonna commit the code.
|
Oh, got it. I'm using simple text editors, so no built-in debugger for me.
|
gdb runs on the command line, so you can still use your text editor. break foo.c:1234 search for a gdb tutorial, it will give you magic powers in a short time. and about this novation ctrlr, it looks like a lot of interfaces! tomorrow
|
Nice, thanks! |
That's probably few interfaces that's determine this conditions:
Looking for how-to determine which one is right by additional attributes. DAWs did it somehow :) |
DAWs let you choose the interface you want, in the GUI. Since we dont have I was thinking about sweeping all interfaces with a for loop, and sticking of course, on more elaborate keyboards we might be loosing some midi
|
Yep, but anyway it knows what is audio and what is midi. I'm describing |
ableton uses the midi subclass field to tell midi apart from audio. if its we can support this using the buttons another ideia is sweeping all interfaces, and accepting all midi messages
|
Gather midi input messages all sounds good. Behaviour you described in previous message it exactly what I did in my commit. We have a loop and break as soon as found matching device. If found nothing touch blue light and return fail code. In practice when I tweaking parameters I see blue light linking on every event and it really changes synthesis parameters as expected but after few changes about 10 it stops receive anything at all. I'm curious how this code can cause this behaviour. It looks like it called on every message. |
oh, nice! this looks like the behaviour I was getting with an usb<->midi cable. it
|
I think we should move searching code outside of USBH_MIDI_InterfaceInit. Just leave a variable here which was defined after USB init (device was connected). But not sure where to place it for now. Just found interesting place at |
@tomassch you meant you was getting same with an usb<->midi cable when in code was hardcoded interface number? If yes this is weird, it means problem not in search interface code. |
yeah, but I barely tested that interface. did not investigate seriously
|
I've discovered that Mr Thorsten Klose has now a working USB midi host driver : |
How are you guys getting on with the usb midi host driver? I tried the .hex file today and I can't get any response from 4 different midi devices, emu x-49 keyboard, arturia minilab keyboard and 2 arduino controllers, 1 using moco-lufa midi firmware, the other using 'teeonardu', teensy IDE support for arduino leonardo boards. Had you thought about providing serial input as a method to change settings? That would give another incredibly simple way to access them, don't need to change the messages, as midi is serial at 31250 baud. |
@MrBlueXav @tomassch Here's what I've found so far, I used usbpcap and wireshark, usbpcap to capture the usb packets of my keyboard, including unplugging and replugging it in, then moving some encoders. I then opened the .pcap file in wireshark and had a look for the midi messages, this gave me the device and the endpoint, my endpoint was 81 (unless I've made a mistake), I changed the code using tomassch's original 'interfacetoUse' fix and changing the endpoint to 81 and I now have a working deskriptor 👍 I think we need to look at the endpoints too (I know very little about usb) as well as the device that's being used. |
very good to hear that it works in yet another controller. i am all about to make it flexible, auto detecting the controller mrBlueXav suggested using some other people's code to improve the usb
|
I know very little about usb at all, I'm surprised I got it working. When I first installed the original firmware, it didn't work at all, then I tried your code tomassch and that didn't work, I didn't get any blue lights at all but with my changes it saw the device and would work for a very short time (10-20 seconds) and stop working, then the usb host would start to loop resetting the keyboard. My solution was to unplug the stm32F4 from my PC and directly into a usb apple phone charger, so the freezing issue you talk about in previous posts could be power related or it could be related to the usb client port being plugged into a PC? Also, if you guys are using usb hubs at all then that can cause issues, especially if they're cheap ones, cheap usb cables can also cause issues with voltage drop, which causes problems with power and stability. |
apparently my endpoint being 81 is fairly irrelevant, I made a mistake changing the 0x80 mask. It also appears that all midi devices should have an audio interface that shouldn't do anything if it's a simple keyboard/controller. so essentially we should ignore at least the first (0) interface and concentrate on anything after that. After some great advice I used usbView to check the descriptors of my midi devices, they all have an unused audio interface as the first interface, it's part of the spec I've been told. |
@tomassch @MrBlueXav I added channel filtering to my fork, it should make it much easier to keep the existing 7bit controls and any refinements we add seperate, that way it will still work as it was originally intended. |
Hello everybody ! Thank you for "Dekrispatoring" ! |
Well, using Thorsten Klose's MIOS32 driver is too complicated for me I'm afraid... |
We have a working usb host implementation that is very stable, I think we might just need to adapt a little bit of the mios32 code for our own use. btw. @MrBlueXav did you look at this? https://github.com/norbim1/preenFM2/blob/master/src/usb/usbd_midi_core.c It's another stm32f4 synth, it's got usb device support that could be useful. |
It was not that stable for me here at home : my nanoKontrol disconnects episodically ! |
I think the disconnection issue is with the nanokontrol/stm32F4 rather than the software, imho it seems to be a power issue, I have been leaving mine on for days at a time and it's been rock solid. |
Ok ! Thank you for your return. Do you also use nanokontrol v1 ? |
I don't have the nanokontrol but I have 2 different keyboards and other midi controllers that all work fine with dekrispator. they all had issues depending on how the stm32F4 is powered, powered hub had issues, but a usb battery phone charger and an AC usb phone charger ( both 5v with > 500ma output) both worked perfectly, the battery ran for hours and hours before it ran out, and on the AC charger it's been rock solid for days :) |
We should probably in fact power the boards in a different way, not via usb, I'll look into it and see what I can find out. |
Well I think mission is accomplished ! Rewriting the Dekrispator above the new STM32Cube HAL is done. We have a new USB host MIDI driver with send capabilities (not finalized and I can't test it) that should work with any usb midi compliant controller.
I think the new HAL library is better written, easier to understand and use. It should be also easier to port on another STM µc. I'll upload Dekrispator_v2 on github soon. |
https://github.com/MrBlueXav/Dekrispator_v2 |
Merci! |
Thanks a lot for porting the project to cube HAL. I cloned the version 2, changed the paths in the makefile to relative paths, and it was running. Worked with my CME controller first time. If you allow me to push to v2, I can rename my dir to linuxRelease and upload it, so people can build from the command line as well. One more thing: in MIDI_application.h I had to correct the case of a file in an include: #include "usbh_midi.h" -> "usbh_MIDI.h" What is using so much RAM? Synth related code? Happy new year! |
Thank you Tomas ! Happy new year too ! |
Let's go now on Dekrispator_v2 repository please ! |
@tomassch : OK for your LinuxRelease and thank you ! I've added you as a "collaborator". |
Happy New Year to everybody here ! ;-)) |
Have you guys taken a look at the additions I've made to my fork? I haven't cloned version 2 yet, as I would need to pull my code and re-add it.... |
Yes Reggie ! That's a nice work with good doc and many comments in the source files ! I can't test it at the moment however. I don't know much about endless encoders but maybe I could use the ones on my Prophet 08. Keep on the good work on your fork ! Thank you also for talking enthusiastically about Dekrispator on several famous forums !!! My personal project is more of an autonomous machine making strange and sometimes impredictable sounds that you can tweak in real time....or not...., not really a fully controllable versatile synth. |
I've also the "Juronstruktor" which is kind of sample player used to produce sequences of mixed up pieces of (french) dirty words... well that's a stupid thing I know but I love it. Should be on github soon. |
I really like the randomness of dekrispator but I found the randomness to be very extreme, I think I basically put in the ability to tame the randomness if you needed to. I also started to explore the random sequencer, it's just a few functions away from being programmable on the fly. Something else I was really interested in was making the software customisable, like being able to change the order of the effects units in the signal path, perhaps adding a 3rd oscillator/lfo combo, possibly even extra effects that haven't been done yet? |
Better late than never... I've modified the USB host midi driver so it can automatically detect the midi interface in the connected device. I've used your different proposals, thank you guys ! |
Hello, does the Dekrispator now support multiple midi devices? I tried to connect synth controller(Akai LPD8) and keyboard(Keystation mini 32) via USB hub and they both do not turn on. |
Dear fellows,
I wanted to try out Dekrispator on my STM board, controlling it with my CME MIDI Controller.
I couldn't get any response from the controller. With GDB I could see that it would always give me "unrecognized device".
After some investigation, I found out that my controller has two interface descriptors. The first is some audio interface (maybe to send audio back from a hypothetical usb synth?) and the second is the real midi interface.
So I had to make changes in two places:
1)
.../Dekrispator/USB/usbh_conf.h around line 48
define USBH_MAX_NUM_INTERFACES 1
Then obviously it would not decode my second interface. I just changed it to:
define USBH_MAX_NUM_INTERFACES 2
Now I had to tell Dekrispator to get data from that second interface:
.../Dekrispator/USB/MIDIstream_class/usbh_midi_core.c
In function USBH_MIDI_InterfaceInit, whenever there was a Itf_Desc[0][0], I changed to Itf_Desc[interfaceToUse][0]
interfaceToUse is a constant int = 1.
Next step is making this selection automatic (don't want to mess with the support for the Korg Controller).
I am gonna request to pull after I reorganize my code (and maybe make the interface selection automatic).
Very nice project to work with!
PS. Compiling all in Ubuntu 12.10, running make from the Release dir. Debugging with GDB/Emacs.
The text was updated successfully, but these errors were encountered: