midimsg object can't store data bytes when the data byte value is > 127

I'm very green to programming with mat lab (just a week) but I'm very excited about all the potiential things I can do with it.
I feel I'm pretty cometent when it comes to MIDI programming and so far for with what I'm trying to do, I think there might be Bug/Limitation with the
current way the midimsg object is designed.
So far I can not create messages with data bytes using the Data or the SystemExclusive tags.
The issue lies with the limitalion that the array values for the Data Bytes have to be in the range 0 to 127.
An actual data byte, which is really an unsigned 8 bit value, will contain a value in the range of 0 to 255.
Because of the range limitation, I can't store actual data with these tags.
Is there a way to work around this problem?
Thanks.

1 Comment

In Addition to this would it be possible to create a 'Tempo' tag.
This meta event has a significant impact on the playback of a Midi file.
Many files will have tempo changes which change the way the Ticks per Quater Note
value will be used.
Thanks.

Sign in to comment.

Answers (2)

https://users.cs.cf.ac.uk/Dave.Marshall/Multimedia/node158.html
The most significant bit of data bytes are set to 0. This is part of the midi message definition.
Did you find a solution to this? The interesting thing is that it works fine with Octave's midimsg. But then I just tried it on Matlab (2024a) and ran into the same issue as you did.

1 Comment

Okay I think I figured it out. I noticed that only Bytes that are larger than 127, in my case, was F0 at the beginning (SysEx) and F7 (End of SysEx , EOX). So then I followed the matlab example to replace those two bytes with Matlab's example (https://www.mathworks.com/help/audio/ref/midimsg.html#d126e110584)
msg = [midimsg('SystemExclusive',timestamp), ...
midimsg('Data',bytes,timestamp), ...
midimsg('EOX',timestamp)]

Sign in to comment.

Categories

Find more on Musical Instrument Digital Interface (MIDI) in Help Center and File Exchange

Products

Release

R2019a

Asked:

on 13 Aug 2019

Commented:

on 27 Aug 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!