Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » voice_set_frequency doesn't work

This thread is locked; no one can reply to it. rss feed Print
voice_set_frequency doesn't work
Frank Drebin
Member #2,987
December 2002
avatar

this is how i play my sounds

void play_sound(SAMPLE* smpl, int vol, int prior)
{
   int voice=allocate_voice(smpl);
   if (voice>-1)
   {
      voice_set_volume(voice,vol);
      voice_set_priority(voice,prior);
      //voice_set_frequency(voice,1000);
      voice_start(voice);
      release_voice(voice);
   }
}

everything worked fine until i used voice_set_frequency here to slow down the sample.
it tried a value of 500 first when the sample sounded just like noise.
when i use 1000 here it doesn't sound any better...

Kitty Cat
Member #2,815
October 2002
avatar

TFM said:

Sets the pitch of the voice, in Hz.

500 and 1000 are way too low to make any meaningful noise. 8000 is the lowest I've seen things go, and even that's pretty bad.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Frank Drebin
Member #2,987
December 2002
avatar

manual says

Quote:

1000 represents the frequency that the sample was recorded at, 2000 is twice this, etc.

Kitty Cat
Member #2,815
October 2002
avatar

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Frank Drebin
Member #2,987
December 2002
avatar

ok so what's the according value for voice_set_frequency ?

James Stanley
Member #7,275
May 2006
avatar

I suspect it's the frequency of play. i.e. a byte (or whatever) is sent to the speaker every x Hz

Frank Drebin
Member #2,987
December 2002
avatar

i will answer myself: smpl->freq ;)

Go to: