Page MenuHomePhabricator

Move MIDI to audio conversion from Score into TimedMediaHandler
Open, LowPublic

Description

We should move the transcoding of Midi to Vorbis from Score to TMH, so that we can use it for uploaded midi files and reuse it from the Score extension.

Event Timeline

I think timidity should be replaced by fluidsynth.

$ fluidsynth /usr/share/sounds/sf2/FluidR3_GM.sf2 -T oga -F my_file.ogg my_file.midi

See also issue T50029.

@Stemby: Welcome to Phabricator and thanks for registering an account. Please note that "I think Blue looks better than Red" comments (especially without any evaluation criteria provided) are off-topic here. This task is about moving TiMidity conversion from the Score extension to the TimedMediaHandler extension. Thanks for keeping this task focused.

OK, sorry to bother you. Read my previous message as «please note that your work risks being lost time, because IMHO timidity should be replaced by fluidsynth». So the right task should be «remove timidity from Score and make MIDI to Vorbis "conversion" in TimedMediaHandler by using fluidsynth».

@Stemby please file separate tasks for separate issues.

Ebe123 renamed this task from Move TiMidity conversion from Score into TimedMediaHandler to Move MIDI to audio conversion from Score into TimedMediaHandler.Nov 19 2018, 2:19 AM

Change 511015 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/TimedMediaHandler@master] Transcode MIDI files to OGG Vorbis and MP3

https://gerrit.wikimedia.org/r/511015

Change 511123 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Remove audio generation functionality

https://gerrit.wikimedia.org/r/511123

Krinkle subscribed.

Provisionally tagging for Tech News per the Gerrit conversation.

@Krinkle @Ebe123 Do you know what a rough timeline for this hitting production might be?

Also, this means MIDI files no longer need the score extension to work, right? So something like the text below?

MIDI files can soon be played without the Score extension. You can then add them with [[File:Filename.midi]]. override_midi and override_audio will no longer work. Instead you need to add the MIDI file below the music score.

@Johan: I wouldn't have much of a timeline for this... I'll try adding tests and making sure mp3 transcoding works well (as it differs from MediaWiki-extensions-Score 's way)

You are correct. However, removing the override_midi and override_audio from MediaWiki-extensions-Score would come later (with https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Score/+/511123), to give some time for deprecation.

@Ebe123 OK! When you're ready, feel free to go to https://phabricator.wikimedia.org/tag/user-notice/ and drag this ticket from "Not ready to announce" to "Announce in next Tech/News" and ping me here, and we'll make sure the communities get to know what's happening. (:

Change 513015 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[mediawiki/vagrant@master] Add MW-Vagrant support for MIDI in TimedMediaHandler

https://gerrit.wikimedia.org/r/513015

Change 514960 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[operations/mediawiki-config@master] Specify the fluidsynth paths for TMH MIDI conversion

https://gerrit.wikimedia.org/r/514960

Change 514962 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[operations/puppet@production] List deps for MIDI to Ogg/MP3 conversion for video scalers

https://gerrit.wikimedia.org/r/514962

@Johan @Ebe123 I've +2'd the latest patchset and added some configuration patchsets for production and MediaWiki-Vagrant. :) This should be ready to roll soon if no problems in testing.

Change 511015 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Transcode MIDI files to OGG Vorbis and MP3

https://gerrit.wikimedia.org/r/511015

Change 514960 merged by jenkins-bot:
[operations/mediawiki-config@master] Specify the fluidsynth paths for TMH MIDI conversion

https://gerrit.wikimedia.org/r/514960

Mentioned in SAL (#wikimedia-operations) [2019-06-06T23:57:26Z] <jforrester@deploy1001> Synchronized wmf-config/CommonSettings.php: Specify the fluidsynth paths for TMH MIDI conversion T135597 (duration: 00m 47s)

Change 515000 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Add tracking categories to pages overriding files

https://gerrit.wikimedia.org/r/515000

Change 513015 merged by jenkins-bot:
[mediawiki/vagrant@master] Add MW-Vagrant support for MIDI in TimedMediaHandler

https://gerrit.wikimedia.org/r/513015

Great stuff @Ebe123 !
I'm going to leave this out of Tech News this week, because there's no deployment train next week, so the new features won't be available until the week of 17 June. That way when it is announced in Tech News, the feature will be only 3 days from release instead of 10 days away. :-)

Hmm, for this to work, someone needs to purge all the mid page uploads, and then initiate the transcode for the newly listed derivatives...

@brion can you assist with running a maintenance script for that ?

cleanupTranscodes.php should be able to do this I believe, I'll test offline later.

s/cleanupTranscodes.php/requeueTranscodes.php/

I have this ready to run on mwmaint1002 but want to wait until the fix for the fatal error in T226748 is deployed so I don't spam the error logs.

Ok Reedy started this a while ago under T226713, so no need to re-run it a second time. It's probably the cause of seeing multiple fatals over on T226748, since all failure cases would come in a relatively short time. :D

So next step here is to figure out how we can make Score use the Transcode pipeline.

Basic idea was to use a separate FileRepo implementation to expose Score entires. Small problem there seems to be that the entire Transcode implementation assumes LocalFile in the implementation. I was supposed to look into this a bit more for @Ebe123 last week, but forgot. Will be good if we can document the design here, because i'm not available enough to keep track of stuff in my mind.

I don't see how separating a new FileRepo implementation could help, as FileRepo is already for interacting with filesystem files with or without database entries.

I was thinking about adding a new field transcode_image_repo to the transcode table with the repo's name which would allow the file to be found using a simple FileRepo in Score. With that, TMH can find and use the transcodes. Thoughts?

Change 524003 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/TimedMediaHandler@master] Add FileRepo to transcode table

https://gerrit.wikimedia.org/r/524003

Change 524004 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Run transcode job when creating MIDI

https://gerrit.wikimedia.org/r/524004

Change 515000 merged by jenkins-bot:
[mediawiki/extensions/Score@master] Add tracking categories to pages overriding files

https://gerrit.wikimedia.org/r/515000

Change 511123 abandoned by Ebe123:
Remove audio generation functionality

Reason:
Superseded by 524004.

https://gerrit.wikimedia.org/r/511123

Change 514962 abandoned by Brion VIBBER:
List deps for MIDI to Ogg/MP3 conversion for video scalers

Reason:
Not sure if still needed. Recreate if needed.

https://gerrit.wikimedia.org/r/514962

FYI I updated the Score attribute documentation on Extension:Score and English Wikipedia Score Help, mentioning the deprecation of override_midi and override_audio. Editors expressed some concern on their talk pages (no good deed goes unpunished 😄).

Hi, it was suggested I bring up my concerns here so I'll do just that. In the context of lilypond scores, I don't think that deprecating the "override_audio" parameter is a particularly helpful change. The main problem I have with it is that it separates the audio from the lilypond syntax and this reduces clarity: keeping the audio within the lilypond tags keeps it clear that it is not just a random audio file but one particularly associated with the lilypond example.

Ebe123 subscribed.