[Bug]: VST3 note-expression text (lyrics) never reaches a JUCE plug-in; MidiBuffer truncates text meta events — patches attached
Detailed steps on how to reproduce the bug
Hello JUCE team,
Two related problems, with patches, a unit test and an end-to-end verification in a public repository:
https://github.com/chiqurjin/juce-vst3-lyrics (three git apply-able patches against 8.0.15; they also apply to develop at e5c43f07).
1. MidiBuffer cuts every text meta event to 8 bytes. MidiBufferHelpers::findActualEventLength reads the variable-length size of an 0xFF message at data + 1, which is the meta type byte; MidiMessage::getMetaEventLength() reads it at data + 2. So a lyric (type 5) keeps 5 + 2 + 1 = 8 bytes:
juce::MidiBuffer buffer;
buffer.addEvent (juce::MidiMessage::textMetaEvent (5, "una corda"), 0); // 12 bytes
for (const auto m : buffer)
DBG (m.numBytes << " " << m.getMessage().getTextFromTextMetaEvent()); // 8 "una c"… (expected 12 "una corda")Patch 0001 reads the length where MidiMessage does, keeps a bare 0xFF at one byte, and adds a case to MidiBufferTest.
2. The VST3 wrapper discards Event::kNoteExpressionTextEvent. The VST3 specification defines NoteExpressionTextEvent (kTextTypeID, kPhonemeTypeID) as the way a host sends lyrics and phonemes to an instrument, and has since VST 3.5. MidiEventList::toMidiMessage in juce_VST3Common.h returns nothing for it, so a JUCE instrument cannot receive text a host sends per the specification, and has no way to opt in. We think this should be treated as a conformance bug rather than a feature request: the wrapper is all a JUCE plug-in has for its VST3 behaviour, and the event has an obvious representation JUCE already owns — a lyric meta event, which is what the same words are in a MIDI file. Patch 0002 converts the event to MidiMessage::textMetaEvent (5, …) (type 1 for a phoneme) at its sampleOffset and changes nothing else. It needs 0001.
Patch 0003 (optional) is the host side: a lyric/text meta event in a MidiBuffer handed to a hosted VST3 goes out as kNoteExpressionTextEvent. With it we verified the whole path with JUCE's own VST3PluginFormat: our instrument, built as a VST3 and hosted in a test process, received "una corda" intact through the real plug-in boundary and acted on it.
We build instruments on JUCE and a host of our own that sends lyrics per the specification; today they reach a JUCE plug-in only with a patched JUCE. We would rather not carry that. Everything needed is in the repository; we will sign the CLA and open a PR against develop if you prefer to receive it that way.
Thank you, Chiqurjin
What is the expected behaviour?
We would be grateful if you would adopt this: the patches as they are, or, if you prefer to implement it differently, the idea itself — that note-expression text reaches a plug-in as a lyric meta event.
Operating systems
Windows
What versions of the operating systems?
11
Architectures
x86_64
Stacktrace
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
The bug is present on the develop branch
Code of Conduct
- I agree to follow the Code of Conduct
Source: juce-framework/JUCE