cannam@86: cannam@86: cannam@86:
cannam@86:Vorbisfile documentation |
cannam@86: vorbisfile version 1.3.2 - 20101101 |
cannam@86:
Crosslapping blends two samples together using a window function, cannam@86: such that any sudden discontinuities between the samples that may cannam@86: cause clicks or thumps are eliminated or blended away. The technique cannam@86: is nearly identical to how Vorbis internally splices together frames cannam@86: of audio data during normal decode. API functions are provided to crosslap transitions between seperate cannam@86: streams, or to crosslap when seeking within cannam@86: a single stream. cannam@86: cannam@86:
Vorbis is a lossy compression format such that any compressed cannam@86: signal is at best a close approximation of the original. The cannam@86: approximation may be very good (ie, indistingushable to the human cannam@86: ear), but it is an approximation nonetheless. Even if a sample or set cannam@86: of samples is contructed carefully such that transitions from one to cannam@86: another match perfectly in the original, the compression process cannam@86: introduces minute amplitude and phase errors. It's an unavoidable cannam@86: result of such high compression rates. cannam@86: cannam@86:
If an application transitions instantly from one sample to another, cannam@86: any tiny discrepancy introduced in the lossy compression process cannam@86: becomes audible as a stairstep discontinuity. Even if the discrepancy cannam@86: in a normal lapped frame is only .1dB (usually far below the cannam@86: threshhold of perception), that's a sudden cliff of 380 steps in a 16 cannam@86: bit sample (when there's a boundary with no lapping). cannam@86: cannam@86:
It is. Vorbis introduces no extra samples at the beginning or end cannam@86: of a stream, nor does it remove any samples. Gapless encoding cannam@86: eliminates 99% of the click, pop or outright blown speaker that would cannam@86: occur if boundaries had gaps or made no effort to align cannam@86: transitions. However, gapless encoding is not enough to entirely cannam@86: eliminate stairstep discontinuities all the time for exactly the cannam@86: reasons described above. cannam@86: cannam@86:
Frame lapping, like Vorbis performs internally during continuous cannam@86: playback, is necessary to eliminate that last epsilon of trouble. cannam@86: cannam@86:
Ideally, vorbisfile internally reads an extra frame of audio from cannam@86: the old stream/position to perform lapping into the new cannam@86: stream/position. However, automagic crosslapping works properly even cannam@86: if the old stream/position is at EOF. In this case, the synthetic cannam@86: post-extrapolation generated by the encoder to pad out the last block cannam@86: with appropriate data (and avoid encoding a stairstep, which is cannam@86: inefficient) is used for crosslapping purposes. Although this is cannam@86: synthetic data, the result is still usually completely unnoticable cannam@86: even in careful listening (and always preferable to a click or pop). cannam@86: cannam@86:
Vorbisfile will lap between streams of differing numbers of cannam@86: channels. Any extra channels from the old stream are ignored; playback cannam@86: of these channels simply ends. Extra channels in the new stream are cannam@86: lapped from silence. Vorbisfile will also lap between streams links cannam@86: of differing sample rates. In this case, the sample rates are ignored cannam@86: (no implicit resampling is done to match playback). It is up to the cannam@86: application developer to decide if this behavior makes any sense in a cannam@86: given context; in practical use, these default behaviors perform cannam@86: sensibly. cannam@86: cannam@86:
To acheive the best possible crosslapping results, avoid the case cannam@86: where synthetic extrapolation data is used for crosslapping. That is, cannam@86: design loops and samples such that a little bit of data is left over cannam@86: in sample A when seeking to sample B. Normally, the end of sample A cannam@86: and the beginning of B would overlap exactly; this allows cannam@86: crosslapping to perform exactly as it would within vorbis when cannam@86: stitching audio frames together into continuous decoded audio. cannam@86: cannam@86:
The optimal amount of overlap is half a short-block, and this
cannam@86: varies by compression mode. Each encoder will vary in exact block
cannam@86: size selection; for vorbis 1.0, for -q0 through -q10 and 44kHz or
cannam@86: greater, a half-short block is 64 samples.
cannam@86:
cannam@86:
cannam@86:
copyright © 2000-2010 Xiph.Org |
cannam@86: cannam@86: |
Vorbisfile documentation |
cannam@86: vorbisfile version 1.3.2 - 20101101 |
cannam@86: