Hi everyone, how are you?
I am trying to do sound manipulation by generating a beep (square wave) simulating a PC speaker with a certain frequency and amplitude.
Initially, I'll make the beep for a Pong game when the ball hits a surface.
I read the library's source code and looked for some YouTube videos to understand the audio concepts involved.
But the most I'm managing to do is generate noise for a short time.
Currently I have a variable where I create the sound dynamically (before playing):
struct sound_t* sound_border;
I initialize the sound system with the code:
setsoundmode(soundmode_8bit_mono_11025);
I create the sound with the code:
int channels = 1;
int samplerate = 11025l;
short samples[] = { 0 };
sound_border = createsound(channels, samplerate, 8, samples); // 8 = framecount
And then when it's necessary to play:
playsound(1, sound_score, 0, 255); // full volume, no loop, channel 1
However, I still don't understand the concept of "framecount" (is it the number of times the samples will be copied into the sound buffer for each channel?).
I don't understand how nois is being played if my sample rate is zero (and the noise changes when I change the framecount).
Any tips would be very helpful.
Thank you everyone.
