0
0

hi folks,

i have here another problem…

having a sineDSP started, i can hear it oscillate at 440Hz…

[code:3p71fcep]- (void)playSoundOnChannel:(int)channelID withFrequency:(CGFloat)frequency{

result = FMOD_OK;

NSLog(@"SoundController: now trying to play");

result = system->playDSP(FMOD_CHANNEL_FREE, sineDSP, false, &channels[channelID]);
ERRCHECK(result);

NSLog(@"SoundController: OK");

...[/code:3p71fcep]

but after i change the frequency of the channel, the sound stops while the channel is still playing…

[code:3p71fcep]
...
NSLog(@"SoundController: setting frequency");

result = channels[channelID]->setFrequency(frequency);
ERRCHECK(result);

NSLog(@"SoundController: OK");

}[/code:3p71fcep]

i know the channel is still playing because the output of my main loop:

[code:3p71fcep]- (void)timerUpdate:(NSTimer *)timer{

/*
 Main loop
 */

result = FMOD_OK;
int channelsplaying = 0;

if (system != NULL){

    result = system->getChannelsPlaying(&channelsplaying);
    ERRCHECK(result);

    NSLog(@"SoundController: channelsPlaying = %d", channelsplaying);

    result = system->update();
    ERRCHECK(result);
}

}[/code:3p71fcep]

is actually:

[code:3p71fcep]2009-01-23 12:05:03.479 TouchMe[809:20b] SoundController: channelsPlaying = 1[/code:3p71fcep]

what am i doing wrong?

thx
xonic

  • You must to post comments
0
0

ok, just a few questions,
first, what language are you coding in? It looks like c++, but the function declarations are different.

second, you said you can hear it at 440HZ, did you mean 44khz? it seems 440HZ is extremely low.

if you can hear the sound at first, and then change the frequency during playback and it stops producing sound, what happenes if you set it back to the original frequency? does the sound return?

usually, sounds are created at 44100hz, and comfortable variations may range by only a few 100hz. so, if you adjust the freq from 44100hz to 440hz, you should not be able to hear anything really.

  • You must to post comments
0
0

You may have initialised the system in harware mode… Like the help says, in hardware mode you have less range in variation of the frequency

  • You must to post comments
0
0

[quote="nci":1xii14bw]ok, just a few questions,
first, what language are you coding in? It looks like c++, but the function declarations are different.
[/quote:1xii14bw]
actually it’s Objective-C, i’m developing on an iPhone
[quote="nci":1xii14bw]
second, you said you can hear it at 440HZ, did you mean 44khz? it seems 440HZ is extremely low.[/quote:1xii14bw]
sorry, my bad – i meant 440 khz, standard frequency for oscillators…
[quote="nci":1xii14bw]
if you can hear the sound at first, and then change the frequency during playback and it stops producing sound, what happenes if you set it back to the original frequency? does the sound return?

usually, sounds are created at 44100hz, and comfortable variations may range by only a few 100hz. so, if you adjust the freq from 44100hz to 440hz, you should not be able to hear anything really.[/quote:1xii14bw]
i have found the error. apparently it is only not working to change the channel frequency. if i change the frequency parameter of the dsp unit itself, it works:

[code:1xii14bw]
– (void)changeFrequency:(CGFloat)frequency ofChannel:(int)channelID{

result = FMOD_OK;
if(channels[channelID] == NULL) return;

result = sineDSP[channelID]->setParameter(FMOD_DSP_OSCILLATOR_RATE, frequency);
ERRCHECK(result);

}[/code:1xii14bw]

that solved the problem but i would still like to know why it won’t work to change the channels frequency itself… is it maybe that a channel being a representation of a sound can only alter the frequency of a loaded sample but not dsp sound generated at the moment?

thanks!
best,
xonic

ps: i wrote this a couple of days ago but hit the preview button instead of submit -.-

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.