On Thu, Feb 25, 2010 at 10:37:36AM -0800, James Paige wrote: > On Thu, Feb 25, 2010 at 10:31:12AM -0800, B W wrote: > > I have two songs. One has a bitrate of 48000, the other 44100. If I allow > > Pygame (SDL mixer) to use the default frequency, the playback speed of the > > songs is distorted. If I explicitly set the mixer frequency to match a > > song so it sounds good, the other sounds distorted. > > > > Reinitializing the mixer is not a good option. There are other sounds that > > need to play, and would be interrupted by a reinit. Resampling the songs > > is not ideal, either, as Vorbis is a lossy format and sound quality is > > obviously lost in re-sampling. Is that a theoretical observation, or can you actually hear the difference? > > Does anyone have a recommendation? Are all sounds in an implementation > > expected to have the same bitrate? > > Even if SDL_mixer was capable of handling this situation, it would still > have to handle it by resampling. Unless I am greatly mistaken, there is > no way to avoid resambling in this situation, so it will be better to > resample in advance, rather than to expect the library to do it at > runtime. If SDL resampled the sound on load, you'd end up with: decode vorbis -> resample (mostly lossless) -> play. If you resample it in advance, you end up with decode vorbis -> resample (mostly lossless) -> reencode vorbis (lossy!) => decode vorbis -> play It's not the resampling that B W is trying to avoid, it's the lossy reencoding. Marius Gedminas -- (mental note: stop installing red hat. everytime i do so, it takes ages to fix my system again.) -- from the sig of Martin Hön
Attachment:
signature.asc
Description: Digital signature