0
0

Hi i’m new to fmod…
basically i was trying to develop a java application where i press the keys, and while the key is down, it plays a sin wave with a specific frequence that corresponds to a piano key.

Problem is.. i dont know how to configure the sample rate on the oscilator, to create the sin wave.

And.. do i have the guarantee that that oscilator creates a sin wave for example with 500hz and to be played with a FS ( sample rate) of 22050 hz ?

I was programming an oscilator function that returns the coeficients for a FIR and IIR filter and made a filter myself, that i’ve used in previous projects..in c++
Though i dont know how to play a sin wave while a key is down and stop playing after i release the key, , hence i tried FMOD

I got the keyListener doing its job well, and a thread to process keyevents from the awt thread.

Now i just dont know how to play the sin wave of, lets say 500hz, using a sample rate of 22050 or even 44100, while a keyboard key is down.

And… does the dsp play the sin wave sample by sample or the oscilator calculates a period of the sin wave and keeps repeating it.. ?

Thanks for ur help.. the javadoc aint much detailed on this..so i took a look at the c++ headers on the source code, the commentarys in there are very clear and helpful, still i did not find how to set the sample rate frequence.

PS . i use the jouvieje java library (of fmodEx)

  • You must to post comments
0
0

you should try Channel::setFrequency

  • You must to post comments
0
0

ah i see.. sample rate is related to the channel and not to the DSP.
So is it possible to play on different channels using the same dsp?

Also.. do u have any tip on how to play / stop a sin wave when key is down / released ?

is there a way to configure that or do i have to create a list or hashmap < KeyInfo, Channel> and then manually stop the channel?

KeyInfo is a structure i made with information on a pressed key.

thanks for the help 😉

  • You must to post comments
0
0

use createDSPByType and choose oscillator dsp type, then just call System::playDSP and Channel::stop.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.