Go Down

Topic: Arduino midi musical instrument has volume problem in midi editing software. (Read 1 time) previous topic - next topic


I have made a midi Hurdy Gurdy
My musical instrument uses an Arduino uno midi sketch for the control of The "Robertsonics/SparkFun WAV Trigger". The WAV Trigger supports the MIDI protocol on its serial control port, enabling low-latency, 14-stereo voice poly-phony for creating a basic musical instrument sampler.
I am mapping the volume of the instrument to the speed of handle turn, measured by the pulse width from a 600 pulse per turn optical rotary encoder. The instrument works well with the volume varying according to the mapped midi volume command, and in the IDE monitor I can see that the volume ranges from 1 to about 126   as it should do.
I have replaced the original firmware on the Arduino Uno`s Mega8u2/16U2 with dualMocoLUFA firmware, Arduino Uno it acts as USB-MIDI device (Standard Midi Class), which is suitable to build music instruments and devices.
If I connect the mid out to the computer and use the gurdy as a midi instrument for use with midi editing software (such as MIDI-OX) there is a problem.
The problem is that MIDI-OX monitor shows the volume reaching 126 as it should but the midi notes and sound disappears at about 121.
If I then I map the volume in my sketch from 1 to 120, the instrument no longer cuts out, (but of cause has a lower volume range ).
Does any one have a idea as to what might be happening?


HI.  As it is the ATMega8u2 which manages the MIDI, you must remind that the flow is :

MIDI APPS send midi     => USB  => ATMega8u2 TX  => ARDUINO RX  => MIDI OUT
MIDI APPS receive midi <=  USB <=  ATMega8u2 RX <=  ARDUINO TX <=  MIDI IN

So theorically, your MIDI sketch can listen ATMega8u2 TX before sending to MIDI OUT,
but can't send via TX. You must use another UART port or a software serial.

So what is your current config ?


Hi TheKitGen
The arduino uno has a midi hardware serial out on the TX pin, connected to thefirst wav Trigger board
I have also programmed the Arduino uno to have a midi software serial out on pin D2 for the second wav Trigger board, this pin is also connected to the RX pin, and this enables me to monitor both the hardware and software serial in the IDE monitor.
I am using a midi usb cable for the computer midi editor, this plugs into a midi din socket connected to the TX pin on the uno.


I am not sure if you are having this problem or not but I ran into problem with lost UART data.

It is possible to send too fast to a hardware UART resulting in lost data. This happens a lot when doing USB to UART since USB is so much faster than the UART. Using the availbleForWrite() function helps avoid this.

Code: [Select]
old: mSerial.write(byte1);

new: while (mSerial.availableForWrite() <= 0) continue;
new: mSerial.write(byte1);

Go Up