.WAV file played too fast by SDL_mixer

Hello out there,
I am using SDL_mixer 1.2 on Windows from Tcl via (what we call) an extension: a
thin wrapper which converts Tcl commands into the appropriate C calls and
converts their results into something usable by Tcl.
The central function I am using is Mix_SetPosition to put one WAV file on the
right channel and another WAV file on the left (and of course play those 2
channels).
Everything is working - it only plays too fast (approx. 20%). If I use a stock
Windows player (e.g. Media Player) the tempo is correct - so I tend to think
that the WAV file is in itself correct.

Did anyone encounter similar problems? Any idea where I should start looking for
details?
Any ideas or hints will be greatly appreciated.
Best regards
Helmut Giese

SDL’s rate-conversion capabilities are limited. Take a look at the sample
rate of the file and the sample rate you’re playing audio at. I bet it’s not
a whole multiple of the file rate.On December 5, 2005 03:55 pm, Helmut Giese wrote:

Everything is working - it only plays too fast (approx. 20%). If I use a
stock Windows player (e.g. Media Player) the tempo is correct - so I tend
to think that the WAV file is in itself correct.

Tyler Montbriand <tsm accesscomm.ca> writes:

Everything is working - it only plays too fast (approx. 20%). If I use a
stock Windows player (e.g. Media Player) the tempo is correct - so I tend
to think that the WAV file is in itself correct.
SDL’s rate-conversion capabilities are limited. Take a look at the sample
rate of the file and the sample rate you’re playing audio at. I bet it’s not
a whole multiple of the file rate.
Hello Tyler,
thanks, this sounds like a plausible explanation. Just one more question: How do
I “look” at the sample rate of the file? I suppose I could find out the sample
rate of the audio player by looking at the audio properties somehow / somewhere?
(You will by these questions guess - correctly - that I do not really know what
I am doing :slight_smile: ).
Best regards
Helmut Giese> On December 5, 2005 03:55 pm, Helmut Giese wrote:

If you have Sound Recorder, or get a trial version of
http://www.goldwave.com/, you can open the WAV file in those to better view
their characteristics.On December 6, 2005 05:43 am, Helmut Giese wrote:

Tyler Montbriand <tsm accesscomm.ca> writes:

SDL’s rate-conversion capabilities are limited. Take a look at the
sample rate of the file and the sample rate you’re playing audio at. I
bet it’s not a whole multiple of the file rate.

Hello Tyler,
thanks, this sounds like a plausible explanation. Just one more question:
How do I “look” at the sample rate of the file? I suppose I could find out
the sample rate of the audio player by looking at the audio properties
somehow / somewhere? (You will by these questions guess - correctly - that
I do not really know what I am doing :slight_smile: ).
Best regards
Helmut Giese

How do
I “look” at the sample rate of the file? I suppose I could find out the sample
rate of the audio player by looking at the audio properties somehow / somewhere?

  • Tom

Tyler Montbriand <tsm accesscomm.ca> writes:

Tyler Montbriand <tsm accesscomm.ca> writes:

SDL’s rate-conversion capabilities are limited. Take a look at the
sample rate of the file and the sample rate you’re playing audio at. I
bet it’s not a whole multiple of the file rate.

Hello Tyler,
thanks, this sounds like a plausible explanation. Just one more question:
How do I “look” at the sample rate of the file? I suppose I could find out
the sample rate of the audio player by looking at the audio properties
somehow / somewhere? (You will by these questions guess - correctly - that
I do not really know what I am doing :slight_smile: ).
Best regards
Helmut Giese
If you have Sound Recorder, or get a trial version of
http://www.goldwave.com/, you can open the WAV file in those to better view
their characteristics.
Hi Tyler,
your assumption was spot on. I found out that it had a sample rate of 32000 Hz
and this apparently messed SDL_mixer up.
This .wav file was produced off of a mide file via Timidity. Knowing about this
problem now I looked closer at Timidity’s options, and lo and behold it is
possible to set the sampling frequency. So I converted my midi files again with
a sample rate of 22050 / 41000 (I am still experimenting a bit) and now the
sound is like it should be.
Again many thanks and best regards
Helmut Giese> On December 6, 2005 05:43 am, Helmut Giese wrote:

http://audacity.sourceforge.net/

Hi Tom,
it turned out that right-clicking on the file and selecting properties Windows
told me that this file had a sample rate of 32000.
But thanks for the link - I have heard (good things) about Audacity before.
Best regards
Helmut Giese