You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Seeking forward in MIDI files doesn't resend PROGRAM CHANGE events #704
Media3 pre-release (alpha, beta or RC not in this list)
More version details
release-1.2.0-alpha01
Devices that reproduce the issue
Not device specific, so emulator, Pixel etc...
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Using demo app with MidiExtract and MidiRenderer
Open a MIDI file
Seek forward in the file, and all channels are reset to default program (usually Piano)
Seek backward in the file, and all channels are properly configured back.
I've put some logs, and it seems indeed, that when seeking forward, MidiDecoder reset the Synthesizer but never sends the PROGRAM CHANGES events, but does so when seeking backward.
Expected result
MIDI channels are properly configured back after seeking forward
Actual result
MIDI channels are reset to default program (Piano) after seeking forward
Media
Not applicable, any MIDI file should expose the issue
Can you please share a specific MIDI file that we can reproduce the issue? I've tried several MIDI files but can't repro. I hear all the instruments regardless of seeking forwards or backwards.
Here it is,
For Doom midi, there is a overrdrive guitar that plays the "melody", which clearly switch to Piano when seeking
For scabbmap, the melody is a flute like instrument
I made some more tests, and sometimes it works when seeking forward, and sometimes seeking backward also revert to piano.
Activity
christosts commentedon Nov 10, 2023
Can you please share a specific MIDI file that we can reproduce the issue? I've tried several MIDI files but can't repro. I hear all the instruments regardless of seeking forwards or backwards.
Thanks
loki666 commentedon Nov 14, 2023
midi_tests.zip
Here it is,
For Doom midi, there is a overrdrive guitar that plays the "melody", which clearly switch to Piano when seeking
For scabbmap, the melody is a flute like instrument
I made some more tests, and sometimes it works when seeking forward, and sometimes seeking backward also revert to piano.
loki666 commentedon Nov 15, 2023
to check the behavior,
add a logging function in MidiDecoder
and call it before (or after)
media/libraries/decoder_midi/src/main/java/androidx/media3/decoder/midi/MidiDecoder.java
Line 163 in 35219ee
add a log in resetSynthesizers()
you clearly see that PGM CHG events are not sent when seeking forward
christosts commentedon Nov 17, 2023
thank you, I can reproduce this, we'll work on a fix
MidiExtractor: mark only the first sample as key-frame
MidiExtractor: mark only the first sample as key-frame
christosts commentedon Nov 22, 2023
the linked commit should fix this. Would you be able to checkout the main branch and give it a try too?
loki666 commentedon Nov 22, 2023
seems to do the trick !
thanks
MidiExtractor: mark only the first sample as key-frame