Announcement

Collapse
No announcement yet.

Using Arduino for MIDI...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Arduino for MIDI...

    I'm curious if anyone else has used Arduino processors for creating MIDI. I'm adding MIDI to the upper manual of my Hammond X77, and using an Arduino Mega to process the note on/note off data. It works and all 61 notes play but I've noticed some latency and polyphony issues. I'd like to hear from anyone else who has used these processors.
    Thanks,
    Bruce
    Over the years: Hammond M3, BC, M102, B3, four X77s and three PR-40s, a Thomas Electra and a Celebrity, three Fender Rhodes, Roland HS-10, HP-2000, HP-600, RD-600, JV-880, a thing made by Korg (?), two Leslie 910s, 122, 257, 258, 247, two 142s, and three custom-built Leslies. Wow, way too much money spent!

    #2
    I've used Arduino board components for MIDI chores, but not keyboard encoding. I've also used the ATMega328p processor, used in the Uno and other Arduinos, in some of my own designs. The Allen MOS2 keyboard encoder that I designed, uses a PIC processor, similar in capabilities to an ATMega328p; however, it's coded in assembly language. It encodes 3 keyboards and the pedal board and implements a transposer. I would think that with a properly written program an Arduino Mega should be up to the task of functioning as keyboard encoder, especially so for a single keyboard.

    If optimizing software is not your thing, use a faster processor. I'd take a look at the Teensy 3.x series.
    -Admin

    Allen 965
    Zuma Group Midi Keyboard Encoder
    Zuma Group DM Midi Stop Controller
    Hauptwerk 4.2

    Comment


      #3
      I just finished adding a capture system to a small Moller pipe organ using the Teensy 3.6. It's so easy to use and really fast so it would be a great choice to add midi for an entire console. There's no substitute for real time hardware and software experience, but at 180Mhz the main issue with the Teensy 3.6 may be slowing it down. The Teensy libraries I've used, SPI and EEPROM mainly, have been fast and reliable.
      http://www.kinkennon.com

      Comment


        #4
        I designed a 61 note keying system, which supplies note on/note off data to the Arduino, and uses 4066 bilateral switch ICs. The chips are pulled down to ground through a 1500 ohm resistor and LED. I've yet to do a run that these chips couldn't handle (maybe Joey D could, I suppose). But the Mega seems to lag at times, which has me wondering. I'll keep playing with sketch and lightening the code.
        Over the years: Hammond M3, BC, M102, B3, four X77s and three PR-40s, a Thomas Electra and a Celebrity, three Fender Rhodes, Roland HS-10, HP-2000, HP-600, RD-600, JV-880, a thing made by Korg (?), two Leslie 910s, 122, 257, 258, 247, two 142s, and three custom-built Leslies. Wow, way too much money spent!

        Comment


          #5
          The Arduino debounce examples I've seen use simple inline delays for debouncing switch contacts. That is a huge potential slowdown as well as any use of conventional 5-pin MIDI. Try Teensyduino on a Teensy 3.6, use the Teensyduino timing functions such as elapsedMillis() which doesn't pause the entire program, or better yet poll the inputs continuously and debounce based on perhaps three or four closed or open readings in sequence. Also, the Teensy allows a simple changeover to USB-MIDI with its 200x or more speed increase so MIDI traffic never creates a delay.
          http://www.kinkennon.com

          Comment


            #6
            I have very little experience personally with the Arduino ecosystem, but I have implemented a fully polyphonic synth a fully polyphonic synth using a Raspberry Pi. My first reaction upon seeing this thread is that even an Arduino would be more than fast enough to work as a keyboard encoder without introducing any noticeable latency.

            As John states above, debouncing correctly is the key (pun sort of intended) to not introducing latency. Naive debouncing algorithms wait until the key has been down for some period of time before acting on the key press. Likewise for the key release.

            One correct way to debounce is to act on the key press immediately, and then ignore any additional key presses that appear to happen during the debounce interval. The trick it to realize that for a bouncing key to register again, a key release first has to register. By ignoring any releases during the debounce interval, you ignore any bounces during that interval. This way, the note sounds as soon as you hit the key, but any bounces will not cause additional notes to sound. The only latency that ever shows up with this scheme is on the key release, but even that can be very short (around 1ms).
            Stefan Vorkoetter: http://www.stefanv.com

            1962 Hammond M-111 with Improved Vibrato, Internal Rotary Speaker, Drum Machine,
            Window Seat Tone Cabinets, Completely Rebuilt Amplifier, and Recapped Tone Generator.
            1978 PAiA 1550 Stringz'n'Thingz with many enhancements.
            2017 Raspberry Pi organ-top synthesizer.

            Comment


              #7
              Thanks for a!l the great feedback.
              Over the years: Hammond M3, BC, M102, B3, four X77s and three PR-40s, a Thomas Electra and a Celebrity, three Fender Rhodes, Roland HS-10, HP-2000, HP-600, RD-600, JV-880, a thing made by Korg (?), two Leslie 910s, 122, 257, 258, 247, two 142s, and three custom-built Leslies. Wow, way too much money spent!

              Comment


                #8
                I'm wrapping up an Allen organ (300 B) two-manual project using an Arduino Mega and Teensy 4, if you still need any help. I'm seeing ~1 microsecond latency on the hardware side.

                Comment


                  #9
                  The best two Arduino controllers for use with MIDI are probably the Due and the Teensy. This is because both of them include native MIDI over USB capability. I have been using both of these on projects for Hauptwerk.

                  Kenneth Spencer
                  Kenneth Spencer
                  Book - All about Hauptwerk: Get it here
                  Book - All about your Computer: Get it here
                  Site - Organ Project: See it here
                  You never know, my books about Hauptwerk & Computers might tell you something you never knew!

                  Comment


                    #10
                    I've used the Teensy 3.6 for a number of projects. Just today I got a MIDI encoder working for an 88-key Technics keyboard in a non-functioning digital piano. This was my first successful encoder with velocity and the first results were quite good. I will probably install a Raspberry Pi in the piano that I've had running with a small DAQ hat. There's a matching amplifier for the Pi that I may order which would give me a fully self contained instrument. The Raspberry Pi is running Raspbian Linux with the Pianoteq program from Modartt. Since this is an organ forum I'll mention that I hope to do the same on an organ console soon, adding a third manual with velocity to one of the many two manual organs in the garage and on my trailer.

                    For an Allen 300-B with two11x6 matrix manuals plus pedals I've designed a small motherboard for a Teensy 3.6. A second Teensy 3.6 will take care of the stop tabs (SAMs) and pistons. This board will optionally handle four 8x8 matrix manuals, thus the 22 column by 16 row design. The right hand connectors are for four expression pedal inputs. Second board shown is for the stops using a couple of SPI I/O boards.

                    Click image for larger version  Name:	Matrix Layout.png Views:	0 Size:	29.9 KB ID:	714911 Click image for larger version

Name:	Teensy Encoder PCB.png
Views:	53
Size:	12.2 KB
ID:	714913
                    http://www.kinkennon.com

                    Comment


                      #11
                      Originally posted by John Kinkennon View Post
                      I've used the Teensy 3.6 for a number of projects. Just today I got a MIDI encoder working for an 88-key Technics keyboard in a non-functioning digital piano. This was my first successful encoder with velocity and the first results were quite good. I will probably install a Raspberry Pi in the piano that I've had running with a small DAQ hat. There's a matching amplifier for the Pi that I may order which would give me a fully self contained instrument. The Raspberry Pi is running Raspbian Linux with the Pianoteq program from Modartt. Since this is an organ forum I'll mention that I hope to do the same on an organ console soon, adding a third manual with velocity to one of the many two manual organs in the garage and on my trailer.

                      For an Allen 300-B with two11x6 matrix manuals plus pedals I've designed a small motherboard for a Teensy 3.6. A second Teensy 3.6 will take care of the stop tabs (SAMs) and pistons. This board will optionally handle four 8x8 matrix manuals, thus the 22 column by 16 row design. The right hand connectors are for four expression pedal inputs. Second board shown is for the stops using a couple of SPI I/O boards.

                      Click image for larger version Name:	Matrix Layout.png Views:	0 Size:	29.9 KB ID:	714911 Click image for larger version

Name:	Teensy Encoder PCB.png
Views:	53
Size:	12.2 KB
ID:	714913
                      The designs are beautiful. Good work!
                      Over the years: Hammond M3, BC, M102, B3, four X77s and three PR-40s, a Thomas Electra and a Celebrity, three Fender Rhodes, Roland HS-10, HP-2000, HP-600, RD-600, JV-880, a thing made by Korg (?), two Leslie 910s, 122, 257, 258, 247, two 142s, and three custom-built Leslies. Wow, way too much money spent!

                      Comment


                        #12
                        Hi Bruce
                        If you visit my website you can see how I've used Arduinos for MIDI encoding, MIDI merging, pipe organ control, VPOs and more.

                        https://sites.google.com/site/casavantopus400/

                        If you keep your code stupidly simple, the Arduino is plenty fast and not once have I had problems with latency or speed.
                        By stupidly simple, I mean don't use MIDI or any other libraries. These routines carry a lot of unnecessary overhead as a friend of mine discovered.

                        Over the last year I've shared all this on this forum.
                        Good luck
                        John

                        Comment


                          #13
                          Thanks for the comment, bnelson218. I did my 88-key velocity decoder just wiring directly to virtually every pin on a Teensy 3.6. For more complicated connections I've found that I can whip out a prototype board in about half a day and get it back from Hong Kong in about half a week if it's a case where I do my own assembly. For the Matrix Encoder I have existing consoles out and about that already use 20 pin ribbon connectors so it made sense to follow the same wiring pattern.

                          I agree with John (Coenraads) that it doesn't take so much power. I started out in the MidiBox world with 8 and 16-bit PIC chips that ran (I think) at 40Mhz or less and performed quite well.
                          http://www.kinkennon.com

                          Comment

                          Working...
                          X