Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

update for Qt 5; add MIDI baud rate #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dholth
Copy link

@dholth dholth commented Jan 13, 2016

See also my fork of the serial library.

@projectgus
Copy link
Owner

Thanks for submitting this PR. I'd been meaning to do the Qt 5 update for a while.

What platforms have you tested this on? I've held off on adding 31250bps support before because it's not in POSIX. I think qextserialport will work with this rate on Windows and possibly OS X. It may work on Linux after some additional changes are made.

Even with support, not all UART hardware can synthesise 31250bps (it's not a standard UART baud rate) so there's a chance it won't work for any given interface. Although most modern USB/Serial adapters should handle it OK I think, or at least get a close enough rate that it works in most cases.

I'm curious what hardware you are running with, though. I never really imagined people using "real" hardware MIDI with UART serial like this!

Cheers,

Angus

@dholth
Copy link
Author

dholth commented Jan 13, 2016

I only tested it on OSX with a Yamaha DD-65 drum. I am using an FTDI231X-based (http://www.ftdichip.com/Products/ICs/FT231X.html) USB to serial adapter. The adapter has no problem with that baud rate as verified with a small Python script. I intend to use my homemade adapter with my own hardware but also want to test it on the computer.

There are other bugs with hairless-midiserial however. The drum constantly sends MIDI real-time messages 0xfe and 0xf8 which can be interleaved with the note-on messages and it makes use of running status, where the "note on" byte is omitted when multiple note-on messages follow each other. One or the other of these features confuses hairless-midiserial.

projectgus added a commit that referenced this pull request Jan 1, 2019
Ref #31

Plan to re-add once moved from qextserialport (no longer maintained) to
QSerialPort (part of Qt 5)
@juanmadg
Copy link

juanmadg commented Feb 9, 2019

Nice project. I couldn't find anything even similar except for very old program which won't run on 64-bit platforms. I agree with dholth in that the native MIDI baud rate is totally needed to make this program universal. I'm trying to interface it with a real MIDI keyboard (Yamaha PSS-480) and this will transmit MIDI at the native baudrate of 31250. I'm using a CH340 based serial-to-USB converter on a Windows 10 platform. The CH340 windows driver doesn't show the MIDI baudrate but the CH340 supports it; it's documentation says it can support from 50bps up to 2Mbps and it has an internal 6MHz reference clock, hence = 6000000/31250=192 (exact division) so 0% errors. I've checked it works with a serial monitor from Windows and voila... I can receive the PSS-480 MIDI messages without errors. Using different baud rates (even the closest ones of 33.6 or 38.4Kbps) yields errors. My keyboard (both being Yamaha isn't that strange) also sends the MIDI connection keep alive message (byte 0xFE) continuously. I'm attaching an image of how Hairless MIDISerial behaves (errors) as it doesn't support the right serial baudrate.
I ended up here, precisely looking for its source code with the intent of modifying it and adding the standard MIDI baudrate. The image below is in 'standby'... the keyboard is connected and just sending 0xFE keep alive messages. If the keyboard starts sending actual played MIDI sequences, the number of errors is just awesome.

hms serial errors

@juanmadg
Copy link

Sure... I recompiled with Qt 5.12.1; changed the files as per dholth indications except in 'settingsdialog.cpp' in which the label BAUD31250 in 'box->addItem("31250 (Native MIDI)", BAUD31250);' would imply modifying also the qextserialport.h so I just went through with 'box->addItem("31250 (Native MIDI)", 31250);'

I still had to add a INCLUDEPATH+="[your_local_path_here]\hairless-midiserial-master\libraries" additional argument in the Project Build Settings, select Release Build Configuration (Debug asks for some rules that hasn't been defined) and deselected Enable QML debugging and profiling (it compiles with this last one either way). This goes right through, it builds the application and I could run it.

Now, as you can see (attached image), there are no errors and the application correctly identifies the 'keep alive' 0xFE (0xFx - system message + 0xxE (#14) message).

hms correct baudrate

@randohinn
Copy link

Will this ever be merged in? Finding a possible use for this program, but saddened by the lack of the actual midi baudrate missing

projectgus added a commit that referenced this pull request Apr 22, 2020
Ref #31

Plan to re-add once moved from qextserialport (no longer maintained) to
QSerialPort (part of Qt 5)
@projectgus
Copy link
Owner

Hi @randohinn,

I have @dholth's changes for Qt5 in a branch here with some other fixes and work to build new binaries for all platforms using Travis: https://github.com/projectgus/hairless-midiserial/commits/travis

but... I temporarily reverted the 31250bps change because it's not in the upstream (also unmaintained) qextserialport so would need to change the submodule repo, and dholth's patch in their fork looks like it won't work correctly on Linux (would need to patch src/qextserialport_unix.cpp for this). Hoping to switch to the (maintained, part of Qt) QtSerialPort and re-add support then.

@iMartyn
Copy link

iMartyn commented Mar 20, 2021

I know that it's not a standard but it's really frustrating, I know my CP2102 can do the baud rate, and I'm wanting to talk to (output) mt32pi and (input) miSTer fpga. Both operate at UART levels with midi buad rate, and can optionally convert to midi-dins but that is pointless conversions at both ends!

@Dilnder5JonJon
Copy link

Another person who would love to have 31250. I'm running this on a proprietary kiosk-type machine with Windows Embedded. Only option is to feed into onboard RJ45 serial port. Very odd setup, I know. I've got it working using a software relay, but it would be nice to simplify.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants