When you need the theory behind a technology in order to put things together, all the videos in the world on how to use MIDI with your DAW won't help. This video series is solid gold and is filling in missing pieces by the minute. Thanks for your time and dedication.
Been enjoying your videos on MIDI. Nice to get educated on the subject by another EE Musician. I like the thorough explanation and look forward to the rest of the series. 🎹
Patrick, yes I did get a lot from these first couple of videos on midi. I watched some other videos prior to seeing yours and they seemed very confusing. You played it out in a clear concise manner. Thank you so much for
Wow, Part 1 and to 2 were already common knowledge to me. But from this point I picked up some new information. Thanks a lot for this deep dive and sharing high quality information.
This is the sort of stuff that youtube should be proud off. Hidden gems of piece of knowledge. Thank you very much. We need to encourage this rather than catchy looking thumbnail youtubers.
I'm enjoying the lessons in Midi. Thank You!! I was considering getting the MIO connectivity to hook up things. I don't have a lot of hardware. Maybe for now stick with old school.
Andrew, you are a great instructor. I find the information very helpful. I am also an engineer/musician and it's interesting to see how MIDI parallels the other serial protocols used in other industries (CAN, Modbus). Thanks for the series.
Thank you for sharing your knowledge with us! Do you think that would be possible to send mono audio through pin 1 and 3? If so why its not implemented?
After so many manuals and tutorials I've been through, your lessons here have made things much more clear for my purposes. Question- Most of the components in my home studio have USB MIDI with the exception of drum pads, as you mentioned. Should I make the DIN connections using my MOTU MIDI Express along with the USB MIDI for all the components? Basically, should I make both DIN and USB connections where I have the option? Thanks.
Each device needs only one connection. If it supports USB MIDI it will be easier to find and use within your software so I’d choose that. For older devices a good MIDI interface like your MOTU is fine.
Thanks for the info. I am preparing to open up my Casio lk 280 lightning keyboard that has usb midi, and to put rgb strips into it, so it will have all the colors instead of only red, and to control it from a raspberry pi console with touchscreen so I can extend the standard lesson functionality and to do basically anything I would want to do with it. Now, the raspberry pi must over usb midi feed the synthesizer data to play and at the same time monitor the keystrokes that have been hit, and to control the light strip over its own dedicated connection. And so I was kind of wondering whether midi and now usb midi is full duplex and can handle this. I guess, when the raspberry pi has no other usb tasks to perform it will be allright, I think.
A very useful comparison between DIN and MIDI. Why wasn't it possible to increase the baud rate of the RS-232 to increase the overall bandwith of DIN MIDI? It doesn't sound like the USB polling mechanism guarantees timely message passing on a heavily loaded system (as we often see with processes in operating systems).
Since hardware synthesizers supporting MIDI have been available since the early 80s, it's not really possible to adjust the baudrate. Some devices (Elektron) support higher multiples of 31.25kbps between compatible devices so it is done but wouldn't work with most devices. As for USB, it really depends on what other USB devices are on the same host controller. When developing USB MIDI device drivers I noticed that despite a 1ms polling interval, most hosts would request IN transfers (from the device to the PC) many more times per 1ms frame. With each transfer being 64 bytes (3 out of each 4 bytes is actual MIDI data) it can go quite fast. But being a BULK type endpoint, there is no bandwidth or latency guarantee... instead the reliable delivery of the data is what you get. In most cases USB MIDI works "fine" but I would prefer not having to deal with it. :)
I think that shows that if there is a cable between the jack and the opto it should be shielded. But you definitely don't want to connect any part of the input cable to your circuit... it will cause ground loops and likely cause the data signal to leak into the audio.
Well idle in MIDI means no current, because the + and - outputs are both at the same potential. When the - line goes low, current flows through the LED in the receiver optocoupler. This is why there is no change when you plug or unplug a cable... most of the time no current flows.
I am building an MIDI (USB) to CV Module with an MCU. I have experienced that when you have an high BPM, many Notes and especially many fast changing CC Messages DIN MIDI will start to lag a lot. Also because of the serial communication the MCU have to read at that low 31250 Baud Rate the MCU itslef will also have a bad time. Using MIDI over USB on the other hand just works like a charme with no timing issues at all. For comparison with the above described scenario I couldn't get DIN MIDI lagless over 170-200 BPM. On USB MIDI I was able to go high to 400-500 BPM without any noticable lags. Also a good Idea is to split the module up into two so for the first module use an USB MIDI input and split the Note, CC and System (especially Clock) related messages to 3 seperate DIN MIDI Outputs. Then the second module takes a DIN MIDI in and do the MIDI to CV conversation. That will not lag that much because you filtered/splitted out the unessesary messages with the first Module. But of course it depends on the usage and what you want to do. Also this only makes sense when using an DAW as the Master and going with high BPM and a lot of CC and Note Messages. Maybe this comment helps somebody having the same issue as me. Took me a week to test and figure out all this stuff :)
While it is true that USB MIDI has higher throughput than DIN MIDI, the link speed is not the only factor that affects things like "lag", which I think you mean having events appear to be processed too late. It's also worth evaluating the speed of your real-time timer to make sure you can handle all incoming MIDI bytes and process them in a timely manner. Even at 500BPM (unusual) MIDI clock only takes 200 bytes per second, or every 5ms. That's less than 10% of available MIDI bandwidth even on a DIN connection. I've found that the real cause of lag is often how the data is processed once it is received. Normally I would try to process all incoming data every 1ms or so. A good trick is to put a GPIO pin on your oscilloscope and turn it on during the processing part of your timer code. By watching the length of the pulses you can get a sense of how long everything is taking. On a modern microcontroller it should be easy to get all the work done fast enough that lag is hardly ever a problem.
@@shiftedphase I am using a 120MHz MCU (Teensy 3.2 Overlocked) and when I have a test sequence playing with 200 BPM a couple of notes and then start moving an CC Knob the mess is starting, when I use Serial data reading thru the MIDI DIN. When I have the exact same scenario over USB MIDI there are no problems at all. On about 130 BPM with just a simple note sequence and not moving the CC Knob everything is okay. So there has to be a bottleneck. So either the Hardware UART Part of the MCU is just garbage at that speed or the DIN MIDI is overflowing. When I use an bought MIDI Interface Cable I get the same problems by the way. Like said with MIDI USB there are no problems at all. But like I said when you are just playing some notes per hand and have some 130BPM Clock signal you will never experience any lags. I am just curious that noone else seem to be annoyed of this lags at higher BPM + decent amount of Notes + constant CC changes. I would love to see how MIDI to CV or MIDI to Clock Modules from the market perform on my scenario. But like I said even my MIDI Interface can't handle the sequencer scenario. UART is just slow it seems. The interface gets the data from USB relatively fast and then has to produce serial data at a 31250 Baud Rate and that is the bottleneck because when I use only USB everything is fast enough :) It could also be that my DAW (Fl studio) is just garbage at sending MIDI. I know it's not using Running Status and maybe it's just sending too much CC and/or Clock signals. I am just annoyed that nobody else has tested how much a MIDI DIN connection can handle before it noticably lags :D Am I the only one who cares? xD But yeah I already heard that MIDI 2.0 will use a higher baud rate ^^
@@dr_j0nes There are a lot of places for problems to occur that's for sure. But if there's anything I've learned in >20 years doing embedded projects... it's almost always the software to blame. :)
@@shiftedphase yeah you are totally right. But even when my programm is as simple as it could be (I also tried code from open source projects): main () { while (serial.available > 0) { if (serial.read() == 248) clockSetLastTime = millis(); } if (millis() - clockSetLastTime < 10) digitalWrite(clockPin, HIGH); else digitalWrite(clockPin, LOW); } The problem still occurs on DIN MIDI. And like I said even modern Audiointerfaces seem to have the same problem. The other part of the software could be FL Studio tho ^^ Maybe I should do some testing with another software.
@@dr_j0nes Yup, it sounds like you're not really in control of the serial driver so the timing could be not enough for you. Maybe the serial UART is not being actually read behind the scenes very often. The good thing is that it that if you're comfortable with this type of coding, you can easily learn how to bypass all the wrapper code that these boards give you and work on the bare metal. That will give you much better control of timing in your app.
Hey there! Really enjoy the videos. I am curious that how could I connect a din midi cabel to my stm32 nucleo board. I would be really happy to have some info about that :)
I just want to send to nucleo F411RE. Actually in the long term I want to use a board (I just orderd a F407VG discovery board) for an oscillator and ENV generator for AMP and VCF.
@@zsoltnagy2403 Okay so making a digital synth. Check the MIDI spec for ideas on the input circuit with an optocoupler. I use the 6N138. The output from the opto can go directly into the STM32. Make sure to run it on 3.3V instead of 5V which you might see in some old documents.
Hi Andrew, your USB MIDI vs. DIN MIDI discussion is quite interessting. I have to ask: How to get MIDI into the PC without USB? I am a prog/rock/metal drummer and now quite deep into edrums and VST drumming (Superior Drummer 3) and every software drummer is fighting agains every single millisecond of latency. Of course every VST musician. I am asking because I have 3 drum modules connected via USB MIDI thru an USB hub with another sample pad, a Novation Lauch Pad mini and a Korg nanoKontrol2. The Lauch Pad and nanoKontrol2 don't have a DIN output, maybe because they are mainly designed to controll scences and the DAW and not for playing music. But what do you think about the drum modules and sample pads? Until now I was quite happy with this setup but you destroyed my perfect world. :-) Just yesterday I had a discussion on latency with MIDI DIN against MIDI USB. Please, maybe you could comment on what would be your "lowest latency" edrum to VST connection... Thanks a lot! I just got here because your channel popped up while I was searching something about attenuating/damping piezos. I got an e-snare with a piezo that is quite hot ... and I mostly got 127 as velocity. The peak is almost at 65 volts. It's plugged into a Audiofront eDrumIn4 Trigger2MIDI interface (www.audiofront.net).
I've used MIDI since the 1980s and to an advanced level, and in my experience these next two devices to deal with computer based MIDI were the absolute best. An Edirol UM-880 USB interface and up to four can be daisy chained to achieve a mind boggling 32in / 32out. It's the best because it has MIDI performance so tight with low latency, which rivals the other device from years previous, an Atari ST which has legendary timing. But most of the better Roland (Edirol was one of their brand names) interfaces have their timing technology builtin. The Edirol has shot up in price on Ebay, due to word getting around about how good it is. So 10 to 15 years ago you could get them for around £100 but these days they are £300+. There is a smaller desktop version UM-550 which is cheaper though.
My VPC1 keyboard is connected to my computer via USB. My system says the speed of this USB connection is 12 Mbps. I have an external usb sound card that has a 5 din midi input and operates at a usb speed of 480 Mbps. The keyboard also has a 5 din midi output. If I connect the keyboard to the sound card via a 5-pin cable, does it make sense? Will this reduce signal jitter? Curious..
Good question. I have only implemented USB MIDI as full speed (12Mbps) and done audio at both full speed and high speed..... my next project is a high speed audio driver + MIDI so I'll let you know how fast the MIDI is actually going. :)
There is a start bit, 8 data bits, and a stop bit. When we count bits we number them 0-7... the start and stop bits never appear in the data stream that we process in code because the serial hardware takes them out.
@@shiftedphase at timestamp ~15:20 you said "the eighth bit is the stop bit" - did you mean to say "the signal/pulse AFTER the eight bit (bit #7) is the stop signal". I think there can be confusion about bit vs pulse, in that the binary word is eight bits that correspond to the inner 8 pulses of a 10-pulse data stream.
With the correct type of interfaces.The most common way is USB device (from a PC) to/from DIN MIDI ports. A less common (but also possible) way is to convert a USB device like a keyboard controller into DIN MIDI. Devices exist for doing this also.
If you mean why current flows when sending 0 and not 1, that's because the idle state of this type of serial line is always 1. 1s and 0s are really just different information states and are called "MARK" and "BREAK" in traditional terminology. I checked Wikipedia and it looks like these names date back to the 1800s. In most serial data links like RS-232, MIDI, DMX, etc., the 1 is the "MARK" or idle state when nothing is happening. The reason the current is off in MIDI during the idle state makes sense because if you don't plug in a cable, or aren't sending data (most of the time) then nothing happens. Only in the case of wanting to send 0s do you need current flowing. This takes less power and also means that unplugging a cable has the same effect as stopping the flow of messages. Hope this makes sense!
thought well electrical diagrams better skip that part but even that was interesting - and now i get why trrs can be in between two din extensions: only 3 pins used !
I’m sure that influenced a lot of people. I never had one, but for me the fact that PC sound cards had MIDI on the 15 pin joystick port meant that a cheap cable was all that was needed to plug my synth into the computer.
@@shiftedphase I guess there are many option hidden around. Great stuff btw!!! Knowing about the opto isolator pretty much explains the advantages of using MIDI cables.
@@parallel1studio843 Yes I so wish that USB had been better thought out in that regard. Ethernet is by design electrically isolated also so it’s a wonder why we aren’t using it more for music and sound.
@@shiftedphase I used an Atari STE for over ten years and the MIDI on that is legendary with a well deserved reputation. When I moved to PC the performance was not as good, although the situation has improved in more recent years.
@@shiftedphase Compared with the MIDI DIN plugs and sockets, the Ethernet RJ45 style are very flimsy and easily broken and therefore not up to life in the pro studio or out on the road at live concerts and gigs. USB is arguably even worse. Shame that manufacturers are abandoning DIN in favour of USB.
anybody out there got any videos that arent quite so computer programming based on MIDI? This is not what I was hoping for from these videos. I just wanted to know how to program synths with MIDI program changes etc. Plz help!
Sorry you didn't find what you were looking for. I am trying to present a glimpse into what goes on under the hood to help folks either designing their own projects, or who want to really understand what happens when you press a key or turn a knob.
Was dealing with a performer a philipino duo that acts smart instead was stupid.His setup consist of daw band in the box sound from GM daw pack and sound from a external sound device library and. Analog piano yamaha C1 and of course 2 inside piano mic from input using only one mixer and soundcard as it is
Finally we change to brand new digital mixer and first week that one using his same setup ,broken the new mixer after that i ve resign because poor management!
After a while the analog mixer get tirred like after few month using this rong setup and gets wierd sound like digital sounds! Event on other performers!
Ok sow the guy extracted the audio mic piano and converted into midi then extract and trigger the midi using a internal segventer with in the daw acomodate with bgt and bgv and real duo mic
Because you are smart i let you figure way but definitely i want to mark the corect way was to use instead a second tiny mixer or external sound card atach his own sistem and using our moxer just for audio !?! Thats way audio cips are not meant yo use as ADDA convertors or MIDI cips.I told him thats just a MIDI card and not a sound card and we get a semless discussion after that i ve never spoken to him and went out there on resign! Please explain people the correct way of hooking a live setup like this!😅
When you need the theory behind a technology in order to put things together, all the videos in the world on how to use MIDI with your DAW won't help. This video series is solid gold and is filling in missing pieces by the minute. Thanks for your time and dedication.
Glad it helped you!
Been enjoying your videos on MIDI. Nice to get educated on the subject by another EE Musician. I like the thorough explanation and look forward to the rest of the series. 🎹
Ok, seriously thanks for starting to go through in detail all of this stuff that has left me scratching my head on many an occasion. Hype.
Thanks I'm glad you find them useful!
Patrick, yes I did get a lot from these first couple of videos on midi. I watched some other videos prior to seeing yours and they seemed very confusing. You played it out in a clear concise manner. Thank you so much for
A summary with true educational value that is you createt here. Big Ups!
Wow, Part 1 and to 2 were already common knowledge to me. But from this point I picked up some new information. Thanks a lot for this deep dive and sharing high quality information.
I love you for this series man, I'm binge watching the whole thing, you rule!
Diego A. Morera Yay I’m glad it helps you!
You did it great. Easy to understand!!! I've search the NET for info about MIDI but no one explains like you do. Thumbs UP.
Thanks! I'm glad it helped you!
This is the sort of stuff that youtube should be proud off. Hidden gems of piece of knowledge. Thank you very much. We need to encourage this rather than catchy looking thumbnail youtubers.
Thanks! I promise to never yell at you or ask you to buy a VPN service you don’t need. :)
@@shiftedphase You suggesting it now ? How tricky hehehem ;)
@@rafaelmartineztomas4911 Haha! I feel a bit sad whenever a person I enjoy starts promoting that kind of stuff though.
@@shiftedphase As long as that person you enjoy doesn't promote it on a date or sth we should be fine haha
Fascinating, thanks for these videos.
Thank you so much for doing this! 😭🙏🙌♥️
You're welcome!
This is great info!! thanks for posting
excellent material! Thank you!
Excellent video, I had so many doubts about this protocol. Thanks from Chile
I'm enjoying the lessons in Midi. Thank You!! I was considering getting the MIO connectivity to hook up things. I don't have a lot of hardware. Maybe for now stick with old school.
Start with just what you need... I find that my future needs are never quite what I imagined.
Andrew, you are a great instructor. I find the information very helpful. I am also an engineer/musician and it's interesting to see how MIDI parallels the other serial protocols used in other industries (CAN, Modbus). Thanks for the series.
Your videos are amazing, thank you so much!
Awesome, thanks Patrick.
Awesome..... information...this only one place we can get information about midi..thanks
This video is excellent!
Thank you for sharing your knowledge with us! Do you think that would be possible to send mono audio through pin 1 and 3? If so why its not implemented?
After so many manuals and tutorials I've been through, your lessons here have made things much more clear for my purposes. Question- Most of the components in my home studio have USB MIDI with the exception of drum pads, as you mentioned. Should I make the DIN connections using my MOTU MIDI Express along with the USB MIDI for all the components? Basically, should I make both DIN and USB connections where I have the option? Thanks.
Each device needs only one connection. If it supports USB MIDI it will be easier to find and use within your software so I’d choose that. For older devices a good MIDI interface like your MOTU is fine.
@@shiftedphase I like a straight answer. Thanks, dude.
Good info. Thanks
Thank you for this!
My pleasure!
Excellent video. Would love to see a full video on USB MIDI!!
I plan to do one when I have time.
Thanks! So are the bits in each byte sent LSB first?
Thanks for the info. I am preparing to open up my Casio lk 280 lightning keyboard that has usb midi, and to put rgb strips into it, so it will have all the colors instead of only red, and to control it from a raspberry pi console with touchscreen so I can extend the standard lesson functionality and to do basically anything I would want to do with it. Now, the raspberry pi must over usb midi feed the synthesizer data to play and at the same time monitor the keystrokes that have been hit, and to control the light strip over its own dedicated connection. And so I was kind of wondering whether midi and now usb midi is full duplex and can handle this. I guess, when the raspberry pi has no other usb tasks to perform it will be allright, I think.
That's awesome so far the message protocol looks a lot like can bus except for the speed
Thank you Nature for making other audio nerds like me
“I’m not going to need this info but I’ll watch anyway”
10min in and I now know how to fix a noise issue I have.
A very useful comparison between DIN and MIDI. Why wasn't it possible to increase the baud rate of the RS-232 to increase the overall bandwith of DIN MIDI? It doesn't sound like the USB polling mechanism guarantees timely message passing on a heavily loaded system (as we often see with processes in operating systems).
Since hardware synthesizers supporting MIDI have been available since the early 80s, it's not really possible to adjust the baudrate. Some devices (Elektron) support higher multiples of 31.25kbps between compatible devices so it is done but wouldn't work with most devices.
As for USB, it really depends on what other USB devices are on the same host controller. When developing USB MIDI device drivers I noticed that despite a 1ms polling interval, most hosts would request IN transfers (from the device to the PC) many more times per 1ms frame. With each transfer being 64 bytes (3 out of each 4 bytes is actual MIDI data) it can go quite fast. But being a BULK type endpoint, there is no bandwidth or latency guarantee... instead the reliable delivery of the data is what you get. In most cases USB MIDI works "fine" but I would prefer not having to deal with it. :)
It looks to me like there's a ground on the in circuit - just before the opto-isolator. It's just that pin 2 doesn't go to ground. Am I wrong?
I think that shows that if there is a cable between the jack and the opto it should be shielded. But you definitely don't want to connect any part of the input cable to your circuit... it will cause ground loops and likely cause the data signal to leak into the audio.
Holy cow. Never knew that the idle signal cable should be on HIGH! :o Always had it LOW by default - did I risk damaging something?
Well idle in MIDI means no current, because the + and - outputs are both at the same potential. When the - line goes low, current flows through the LED in the receiver optocoupler. This is why there is no change when you plug or unplug a cable... most of the time no current flows.
any plan on including another vid on how protocol changes with the addition of MPE?
MIDI 2.0 pretty much improves and replaces MPE so I think I'll wait until I do some 2.0 videos to get into this kind of stuff.
@@shiftedphase super, thanks!!
Thanks 🙏
Cheers !
You are a genius, thats all I can say.😲
I've been mastering my craft for a long time... still lots to learn though. Glad you found it helpful.
I am building an MIDI (USB) to CV Module with an MCU. I have experienced that when you have an high BPM, many Notes and especially many fast changing CC Messages DIN MIDI will start to lag a lot. Also because of the serial communication the MCU have to read at that low 31250 Baud Rate the MCU itslef will also have a bad time. Using MIDI over USB on the other hand just works like a charme with no timing issues at all. For comparison with the above described scenario I couldn't get DIN MIDI lagless over 170-200 BPM. On USB MIDI I was able to go high to 400-500 BPM without any noticable lags.
Also a good Idea is to split the module up into two so for the first module use an USB MIDI input and split the Note, CC and System (especially Clock) related messages to 3 seperate DIN MIDI Outputs. Then the second module takes a DIN MIDI in and do the MIDI to CV conversation. That will not lag that much because you filtered/splitted out the unessesary messages with the first Module.
But of course it depends on the usage and what you want to do. Also this only makes sense when using an DAW as the Master and going with high BPM and a lot of CC and Note Messages.
Maybe this comment helps somebody having the same issue as me. Took me a week to test and figure out all this stuff :)
While it is true that USB MIDI has higher throughput than DIN MIDI, the link speed is not the only factor that affects things like "lag", which I think you mean having events appear to be processed too late. It's also worth evaluating the speed of your real-time timer to make sure you can handle all incoming MIDI bytes and process them in a timely manner. Even at 500BPM (unusual) MIDI clock only takes 200 bytes per second, or every 5ms. That's less than 10% of available MIDI bandwidth even on a DIN connection. I've found that the real cause of lag is often how the data is processed once it is received. Normally I would try to process all incoming data every 1ms or so. A good trick is to put a GPIO pin on your oscilloscope and turn it on during the processing part of your timer code. By watching the length of the pulses you can get a sense of how long everything is taking. On a modern microcontroller it should be easy to get all the work done fast enough that lag is hardly ever a problem.
@@shiftedphase I am using a 120MHz MCU (Teensy 3.2 Overlocked) and when I have a test sequence playing with 200 BPM a couple of notes and then start moving an CC Knob the mess is starting, when I use Serial data reading thru the MIDI DIN. When I have the exact same scenario over USB MIDI there are no problems at all. On about 130 BPM with just a simple note sequence and not moving the CC Knob everything is okay. So there has to be a bottleneck. So either the Hardware UART Part of the MCU is just garbage at that speed or the DIN MIDI is overflowing. When I use an bought MIDI Interface Cable I get the same problems by the way. Like said with MIDI USB there are no problems at all.
But like I said when you are just playing some notes per hand and have some 130BPM Clock signal you will never experience any lags.
I am just curious that noone else seem to be annoyed of this lags at higher BPM + decent amount of Notes + constant CC changes. I would love to see how MIDI to CV or MIDI to Clock Modules from the market perform on my scenario. But like I said even my MIDI Interface can't handle the sequencer scenario. UART is just slow it seems. The interface gets the data from USB relatively fast and then has to produce serial data at a 31250 Baud Rate and that is the bottleneck because when I use only USB everything is fast enough :)
It could also be that my DAW (Fl studio) is just garbage at sending MIDI. I know it's not using Running Status and maybe it's just sending too much CC and/or Clock signals. I am just annoyed that nobody else has tested how much a MIDI DIN connection can handle before it noticably lags :D Am I the only one who cares? xD
But yeah I already heard that MIDI 2.0 will use a higher baud rate ^^
@@dr_j0nes There are a lot of places for problems to occur that's for sure. But if there's anything I've learned in >20 years doing embedded projects... it's almost always the software to blame. :)
@@shiftedphase yeah you are totally right. But even when my programm is as simple as it could be (I also tried code from open source projects):
main ()
{
while (serial.available > 0)
{
if (serial.read() == 248)
clockSetLastTime = millis();
}
if (millis() - clockSetLastTime < 10)
digitalWrite(clockPin, HIGH);
else
digitalWrite(clockPin, LOW);
}
The problem still occurs on DIN MIDI. And like I said even modern Audiointerfaces seem to have the same problem. The other part of the software could be FL Studio tho ^^ Maybe I should do some testing with another software.
@@dr_j0nes Yup, it sounds like you're not really in control of the serial driver so the timing could be not enough for you. Maybe the serial UART is not being actually read behind the scenes very often.
The good thing is that it that if you're comfortable with this type of coding, you can easily learn how to bypass all the wrapper code that these boards give you and work on the bare metal. That will give you much better control of timing in your app.
Hey there! Really enjoy the videos. I am curious that how could I connect a din midi cabel to my stm32 nucleo board. I would be really happy to have some info about that :)
Do you want to send or receive MIDI from your nucleo? (or both?) Also which Nucleo are you using?
I just want to send to nucleo F411RE. Actually in the long term I want to use a board (I just orderd a F407VG discovery board) for an oscillator and ENV generator for AMP and VCF.
@@zsoltnagy2403 Okay so making a digital synth. Check the MIDI spec for ideas on the input circuit with an optocoupler. I use the 6N138. The output from the opto can go directly into the STM32. Make sure to run it on 3.3V instead of 5V which you might see in some old documents.
@@shiftedphase Thanks, I have done that.. now I just need to get started in coding :)
How would one take a midi-out, break it into individual notes then convert those into individual control voltages?
There are some midi to cv Converter out there
Hi Andrew, your USB MIDI vs. DIN MIDI discussion is quite interessting. I have to ask: How to get MIDI into the PC without USB?
I am a prog/rock/metal drummer and now quite deep into edrums and VST drumming (Superior Drummer 3) and every software drummer is fighting agains every single millisecond of latency.
Of course every VST musician. I am asking because I have 3 drum modules connected via USB MIDI thru an USB hub with another sample pad, a Novation Lauch Pad mini and a Korg nanoKontrol2.
The Lauch Pad and nanoKontrol2 don't have a DIN output, maybe because they are mainly designed to controll scences and the DAW and not for playing music.
But what do you think about the drum modules and sample pads? Until now I was quite happy with this setup but you destroyed my perfect world. :-)
Just yesterday I had a discussion on latency with MIDI DIN against MIDI USB.
Please, maybe you could comment on what would be your "lowest latency" edrum to VST connection...
Thanks a lot!
I just got here because your channel popped up while I was searching something about attenuating/damping piezos.
I got an e-snare with a piezo that is quite hot ... and I mostly got 127 as velocity. The peak is almost at 65 volts.
It's plugged into a Audiofront eDrumIn4 Trigger2MIDI interface (www.audiofront.net).
I started writing a long answer to you, but I think it would be easier to explain with a video. Standby...
@@shiftedphase Thank you, man! That's awsome!
@@eDrumsInANutshell Check out the video called MIDI and Audio Latency on my channel. I hope it helps you!
I've used MIDI since the 1980s and to an advanced level, and in my experience these next two devices to deal with computer based MIDI were the absolute best. An Edirol UM-880 USB interface and up to four can be daisy chained to achieve a mind boggling 32in / 32out. It's the best because it has MIDI performance so tight with low latency, which rivals the other device from years previous, an Atari ST which has legendary timing. But most of the better Roland (Edirol was one of their brand names) interfaces have their timing technology builtin. The Edirol has shot up in price on Ebay, due to word getting around about how good it is. So 10 to 15 years ago you could get them for around £100 but these days they are £300+. There is a smaller desktop version UM-550 which is cheaper though.
My VPC1 keyboard is connected to my computer via USB. My system says the speed of this USB connection is 12 Mbps. I have an external usb sound card that has a 5 din midi input and operates at a usb speed of 480 Mbps. The keyboard also has a 5 din midi output. If I connect the keyboard to the sound card via a 5-pin cable, does it make sense? Will this reduce signal jitter? Curious..
Good question. I have only implemented USB MIDI as full speed (12Mbps) and done audio at both full speed and high speed..... my next project is a high speed audio driver + MIDI so I'll let you know how fast the MIDI is actually going. :)
@@shiftedphase Thanks! I will be waiting for new information!
Why is the 8th bit the stop bit? Wouldn't it be the 10th bit? 8bits wrapped in a start and stop bit. BTW, thanks for this incredible series.
There is a start bit, 8 data bits, and a stop bit. When we count bits we number them 0-7... the start and stop bits never appear in the data stream that we process in code because the serial hardware takes them out.
@@shiftedphase Ahh ok thanks
@@shiftedphase at timestamp ~15:20 you said "the eighth bit is the stop bit" - did you mean to say "the signal/pulse AFTER the eight bit (bit #7) is the stop signal". I think there can be confusion about bit vs pulse, in that the binary word is eight bits that correspond to the inner 8 pulses of a 10-pulse data stream.
Can USB and DIN be interchanged?
Very clear presentation.
With the correct type of interfaces.The most common way is USB device (from a PC) to/from DIN MIDI ports. A less common (but also possible) way is to convert a USB device like a keyboard controller into DIN MIDI. Devices exist for doing this also.
@@shiftedphase Thank you,sir.
in the 1st diagram, why is 1 representing OFF rather than ON? I always thought it was the other way around... 0 = OFF 1 = ON
If you mean why current flows when sending 0 and not 1, that's because the idle state of this type of serial line is always 1. 1s and 0s are really just different information states and are called "MARK" and "BREAK" in traditional terminology. I checked Wikipedia and it looks like these names date back to the 1800s. In most serial data links like RS-232, MIDI, DMX, etc., the 1 is the "MARK" or idle state when nothing is happening. The reason the current is off in MIDI during the idle state makes sense because if you don't plug in a cable, or aren't sending data (most of the time) then nothing happens. Only in the case of wanting to send 0s do you need current flowing. This takes less power and also means that unplugging a cable has the same effect as stopping the flow of messages. Hope this makes sense!
THANKS!
Thank you so much!
Thanks
thought well electrical diagrams better skip that part but even that was interesting - and now i get why trrs can be in between two din extensions: only 3 pins used !
Killin it
I guess those Atari computers having a MIDI socket made a huge difference
I’m sure that influenced a lot of people. I never had one, but for me the fact that PC sound cards had MIDI on the 15 pin joystick port meant that a cheap cable was all that was needed to plug my synth into the computer.
@@shiftedphase I guess there are many option hidden around. Great stuff btw!!! Knowing about the opto isolator pretty much explains the advantages of using MIDI cables.
@@parallel1studio843 Yes I so wish that USB had been better thought out in that regard. Ethernet is by design electrically isolated also so it’s a wonder why we aren’t using it more for music and sound.
@@shiftedphase I used an Atari STE for over ten years and the MIDI on that is legendary with a well deserved reputation. When I moved to PC the performance was not as good, although the situation has improved in more recent years.
@@shiftedphase Compared with the MIDI DIN plugs and sockets, the Ethernet RJ45 style are very flimsy and easily broken and therefore not up to life in the pro studio or out on the road at live concerts and gigs. USB is arguably even worse. Shame that manufacturers are abandoning DIN in favour of USB.
thank you
Andrew you rong on a particular thing! Im sound engineer and of course electronist and programmer on audio and light .
anybody out there got any videos that arent quite so computer programming based on MIDI?
This is not what I was hoping for from these videos. I just wanted to know how to program synths with MIDI program changes etc.
Plz help!
Sorry you didn't find what you were looking for. I am trying to present a glimpse into what goes on under the hood to help folks either designing their own projects, or who want to really understand what happens when you press a key or turn a knob.
Was dealing with a performer a philipino duo that acts smart instead was stupid.His setup consist of daw band in the box sound from GM daw pack and sound from a external sound device library and. Analog piano yamaha C1 and of course 2 inside piano mic from input using only one mixer and soundcard as it is
DIN (Deutsche Industrie Norm) again!
Finally we change to brand new digital mixer and first week that one using his same setup ,broken the new mixer after that i ve resign because poor management!
But i trust your knowledge
Thats way i want to share all onthers including you how you can broken a analog mixer with exactly your MIDI card
After a while the analog mixer get tirred like after few month using this rong setup and gets wierd sound like digital sounds! Event on other performers!
Ok sow the guy extracted the audio mic piano and converted into midi then extract and trigger the midi using a internal segventer with in the daw acomodate with bgt and bgv and real duo mic
I'm afraid this was way over my head. I don't understand electronics etc whatsoever 😞
I have other videos about more fundamental electronics topics if it interests you.
@@shiftedphase Cheers.
@@shiftedphase Where are your less complex tutorials on this subject matter, please? Thanks.
@@monsterjazzlicks No idea... let me know what you need help with.
Because you are smart i let you figure way but definitely i want to mark the corect way was to use instead a second tiny mixer or external sound card atach his own sistem and using our moxer just for audio !?! Thats way audio cips are not meant yo use as ADDA convertors or MIDI cips.I told him thats just a MIDI card and not a sound card and we get a semless discussion after that i ve never spoken to him and went out there on resign! Please explain people the correct way of hooking a live setup like this!😅
Ok, so got a touch of brain glaze now. But I’ll stick with it. Pretty sure something is going in 🧐
Don't expect to master it in a day. But I hope you find it helpful!