Sign in to follow this  

FMOD problems, sound is distorted

This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to play a wav file with FMOD but it sounds distorted and "echoed". My source:
bool initFMOD()
{
	//make sure FMOD.dll is the same version as the one being used
	if(FSOUND_GetVersion() < FMOD_VERSION)	
		return false;			

	//initialize FMOD
	if(!FSOUND_Init(44100, 32, 0))
		return false;

	return true;
}

void LoadSound(std::string filePath)
{
	//load a wav/mp3 file into memory
	sound1 = FSOUND_Sample_Load(FSOUND_FREE, filePath.c_str(), 0, 0, 0);
}

void PlaySound()
{
	FSOUND_PlaySound(FSOUND_FREE, sound1);
}

InitFMOD() is called first, then LoadSound(), then PlaySound() whenever the 's' key is pressed. I had a similar problem with DirectSound that was caused by incorrect frequency. The only place I can guess is causing the problem is with the FSOUND_Init(), where the mixrate (output rate) is set to 44100. Both the documentation and a tutorial however, said to use 44100. My wav file, "sheep.wav" has the following properties according to Windows if it matters: Bit Rate: 224kbps Audio sample size: 16 bit Channels: 1 (mono) Audio sample rate: 14 kHz Audio format: PCM

Share this post


Link to post
Share on other sites
(bump cleverly disguised as an addition to my original post)

The only other place I can think of that could be causing a problem is with FSOUND_Sample_Load()'s third parameter, unsigned int inputmode. Passing 0 seems to make FMOD use a default value, but I tried passing FSOUND_NORMAL (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO) and then passing FSOUND_16BITS | FSOUND_MONO (I'm not sure what FSOUND_SIGNED means) but the result is still the same distorted messed up sound.

Please help :[

Share this post


Link to post
Share on other sites
I'm not familiar with FMOD...

Your wav seems to have 14kHz sample rate and natively you are setting your hardware to 44.1 kHz.. is FMOD taking care of the sample rate conversion?

FSOUND_SIGNED probably means that the samples are signed short ints. That is, the samples are from -32768 to 32767 or if you use FSOUND_UNSIGNED samples are from 0 to 65535..

Share this post


Link to post
Share on other sites
Considering how simple it is to initialize FMOD and load and play sounds, there has to be a ton of stuff going on internally, but I don't know if automatically taking care of the sample rate conversion is one of them. I'm guessing it does though, since the tutorials + documentations just said to set it to 44100, not "x depending on the frequency of your sound".

Oh well, I decided to go back to DirectSound. If anyone can figure this out I'd still be interested to hear how.

Share this post


Link to post
Share on other sites

This topic is 4728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this