Exported WAV, Ogg, FLAC, and MP3 files too long by about 2 beats

• Jan 29, 2015 - 15:52
Type
Functional
Severity
S4 - Minor
Status
by design
Project

if my score has a 4/4 beat, but the last measure is effectiv only a 2/4, the exported wav, ogg, flac or mp3 has a brake of 2 quarter length at the end. The resulting audio file is too long.
This does not happen in midi export.

I have no experience in c++ and musescore development , but my first thought is a maybe wrong calculated endpoint in exportaudio.cpp (line 85 to 88).


Comments

This, as per discussion on IRC, is on MuseScore 1.3 as well as on the latest nightly builds.
And for mp3 it would be a different file, exportmp3.cpp, but basically the same code as in exportaudio.cpp when it comes to calculating the length.

Title Export to wav, ogg, flac, mp3 Export to wav, ogg, flac, mp3 loo long by about 2 beats

Actually it is unrelated to having an irregular measure, even with a regular 4/4 measure there is some extra silence at the end of mp3 and wav but not for MIDI, approximately worth 2 beats.

Sample files attached, odd for irregular measure at start and end, even for regular measures. Same instrument, same notes, same number of beats.

Attachment Size
ODD.ZIP 1.13 MB
EVEN.ZIP 1.13 MB

No idea if this is the case, but I wonder if this might not be deliberate, to accomodate sounds that don't die right away when the note stops. For instance, consider a a piece that ends with a gong or crash cymbal on the last beat. I don't think MuseScore can simply cut off sound on the final tick, but I'm also not sure there is an easy way to get enough information from the synthesizer to know just how long that last note actually sounds

Title Export to wav, ogg, flac, mp3 too long by about 2 beats Exported WAV, Ogg, FLAC, and MP3 files too long by about 2 beats

Regarding Marc's comments, see this .

MIDI wouldn't have to "know" the true length of the last note, though. It works for MuseScore to stop sending commands right on the final barline; it would play back just fine. What doesn't work is for MuseScore to cut off *audio* on the final bar.

Status (old) active by design

As explained by Marc, MIDI doesn't know about the sustain of the last notes of the score. It just send the last event and it's done. Audio export needs to let the sound decay. So this one is by design and after the fix of #48246: End of exported audio heard at start, audio files will be even a bit longer to make sure that the sound decays.

Also it is considered good sound engineering practice to have silent roll-in and roll-out sections of about 2 seconds at the beginning and end of an audio file.

This enables audio players firstly to sort out any initialisation they may have to do prior to playback and secondly allows for reverb tails, fadeouts etc to finish completely before the track finishes.

In the old days of magnetic tape roll-in and roll-out sections were actually far longer common practice being to wait 10 seconds before playing after the engineer had made the "rolling" call, and similarly to stay silent for 10 seconds at the end of the take after which the engineer would stop the tape.