[Xiph-Advocacy] example of lossless fade out
Tor-Einar Jarnbjo
tor-einar at jarnbjo.name
Tue Jul 7 14:18:57 PDT 2009
Jose Ramirez schrieb:
> The big question is, it possible to edit fade ins and outs in vorbis and
> theora without re-encoding. If for some technical reason it's not, then
> the fade feature should be added to the HTML 5 spec.
I'm not sure about Theora, but (someone correct me if I'm wrong) for
Vorbis, a lossless "perfect" fade is not possible. I suppose however,
that it might be possible to implement a sort of lossless "imperfect"
fade with non-audible artifacts.
A lossless "perfect" fade-out is probably possible with MP3, since it
works with a fixed frame length. I'm not very familiar with the MP3
internals, but I suppose it is possible to attenuate each frame with a
fixed amount and since the frames are faded into eachother with complete
overlaps (the second half of the first frame is blended into the first
half of the second frame a.s.o.), the result is as if you applied a
fading filter with a smooth amplitude decay envelope.
In case of Vorbis, it should be just as easy to attenuate a single frame
by scaling the floor. The residues can be left as they are, since they
are eventually multiplied with the base floor, so that an attenuation of
the floor itself should cause a correct attenuation even after applying
the residues. The problem is though, that Vorbis is not using a fixed
frame length, but alternates between two different lengths (short and
long frames) within the same file. In the transition between two short
or two long frames, the overlap is complete, but in the transition
between a short and a long frame, a part of the long frame is copied 1:1
into the output, causing the fade to be interrupted by a constant
amplitude for a very brief period. For normal encoding parameters, we
are just talking about a few ms here, so I _assume_ at least that this
"fade artifact" is not audible, but I am really not sure.
Tor
More information about the Advocacy
mailing list