GithubHelp home page GithubHelp logo

Comments (7)

jgefele avatar jgefele commented on June 29, 2024 6

Hi,

I had similar issues and found a solution for my case.
I'm not sure if it applies to those cases above, but maybe it helps.

My setup is very simple: a single potentiometer sending ControlChange when I rotate it.

I got lots of "Unexpected data byte" unless I did @slyt's trick.

Solution: Use

struct HairlessMidiSettings : public midi::DefaultSettings
{
   static const bool UseRunningStatus = false;
   static const long BaudRate = 115200;
};
MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, HairlessMidiSettings);

instead of

MIDI_CREATE_DEFAULT_INSTANCE();

Reason: a ControlChange message consists of 3 bytes: 1 "status" byte indicating the type of message and the channel and 2 "data" bytes for controller number and value.

Now there's a MIDI-feature called "running status" to save some bytes. If the status byte doesn't change (because we send lots of ControlChanges on the same channel), instead of sending

S D1 D1   S D2 D2   S D3 D3   S D4 D4   S D5 D5 ...

a midi device can just omit the repetitions of status byte S and just send

S D1 D1   D2 D2   D3 D3   D4 D4   D5 D5 ...

Now guess what happens if your MIDI controller (like mine) ONLY sends ControlChange messages... it will only send one single status byte followed by an endless stream of data bytes. And if Hairless MIDI connects to your Arduino only after it already runs for a while it will never see the status byte, leading to "unexpected data bytes".

The code above disables the "running status" feature in the MIDI library.

from hairless-midiserial.

ibanman555 avatar ibanman555 commented on June 29, 2024

I was also getting the same error for a while, although my set up is quite different than yours. Try changing the baud rate again in Preferences, personally I started from the top down until I was able to receive appropriate MIDI messages from my COM Port. The 'unexpected data byte" error disappeared and my controller was stable, but only stable after changing 'flow control' to XON/XOFF. Experiment around a bit and you may find the sweet spot.

from hairless-midiserial.

korakios avatar korakios commented on June 29, 2024

Hi,
I have the same issue with ControlChange messages. I did a small test and found:
CC works only if I also send NoteOn and NoteOff message
NoteOn messages are not recognised ,until I also send NoteOff message.
UPDATE:
Seems it works but I have to set a message(CC,NoteOn/OFF) going out twice.
Is it a bug?
EDIT: Sorry for the multiple edits but I isolated some issues:
If I send a single CC it's not recognised.But if I send 2 CC but on different channels then both are recognised.

from hairless-midiserial.

projectgus avatar projectgus commented on June 29, 2024

@korakios are you also receiving these messages on Windows?

from hairless-midiserial.

korakios avatar korakios commented on June 29, 2024

I am on Windows 64bit. Tested on win7_64 and win8.1_64.
Also if I send a single NoteOn it's not recognised ,but if I send a NoteOn and then NoteOff message it's ok. Tell me If you need any more info.Thank you.

from hairless-midiserial.

slyt avatar slyt commented on June 29, 2024

I'm on Windows 7 64-bit. I also had the same problem when using the arduino midi library with hairless.

Sending the control change on two channels (thanks @korakios) seemed to help remedy the problem (although not an ideal fix).

MIDI.sendControlChange(16, val, 1); //send to midi control change
MIDI.sendControlChange(16, val, 2); //send to midi control change

from hairless-midiserial.

LuisChris avatar LuisChris commented on June 29, 2024

Incredible that you figured it out what's going on. I tried a lot of programs and no one worked well for me that custom trick is awesome. Thanks for sharing it. Saved me a lot of time for my homework.

from hairless-midiserial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.