1) Is there any way of altering a streams pitch through fmod??
2) Ive read the documentation on spectrum analysis and have put a very simple function into my code to test that im getting the array of 512 floats.
Firstly i asked for the sizeof the array returned by fmod but it always returned “4”. I then tried adding all the 512 values together but it always returns the value 9.6689594… – surely the value should change every time its called due to the change in sound??
float* array = (FSOUND_DSP_GetSpectrum());
//int size = sizeof(array);
for (i=0; i < 200; i++)
total = (total + array[i]);
- joniboy123 asked 16 years ago
1) Are you searching for FSOUND_SetFrequency?
2) I don’t know C, but it seems to me, that you try to get the size of the pointer (= 4).
The result of GetSpectum() is not an array, but a pointer on it.
In PB I just peek the memory from the point given by the GetSpectum-pointer 512 times for a 4-Byte-FLOAT.
thanks for the tips on the pointer, ive seen the error of my ways!
but as for the pitch/frequency – im writing an mp3 mixer program so i wanna be able to change the pitch of the stream at the users request.
whereas fmod seems to only allow change of frequency when the streams set-up and init, not while its playing.
is this kind of speed change possible during playback??
- joniboy123 answered 16 years ago
[quote:1ct98ysy]is this kind of speed change possible during playback?? [/quote:1ct98ysy]
mini-example in PB:
[code:1ct98ysy]screenY = GetSystemMetrics_(#SM_CYSCREEN)
hStream = FSOUND_Stream_OpenFile(OpenFileRequester("Load a Soundfile","C:\","All files (.)|.",0,0),$2,0)
MessageRequester("!","Move the mouse up/down to toggle speed."+Chr(13)+Chr(10)+"Move to upperleft to end.",0)
fq = Int(88100 * (position\y / screenY) + 100)
Until position\y = 0 And position\x = 0
MessageRequester("!","Cannot load the specified file.",0)
I think, it’s self-explaining. Just move the mouse up and down and pitch the sound.
You can download the exe here. The ZIP is called ‘realtimepitcher.zip’:
Please login first to submit.