Hi ! I'am discovering the SoundBuffer while currently working on a pretty basic project :
I load a "A4.wav" containing the A4 key sound (La, 440hz) in a SoundBuffer called
LaI then load a second Soundbuffer called
Do with the sample, count, and rate of
La, but I divide the rate by 1.68176432 to have give it the C sound (Do, 261.6hz)
I then play the
Do sound and it plays the note well but the duration of the sound is longer than the
La sound.
I think thats because by dividing the rate, fewer bytes are being played each second which lowers the frequence of the sound and increase its duration.
440 (A4 -
La) / 1.68176432 = 261.6 (C -
Do)
So I tried dividing the count value of the Do sound by 1.68176432 too, and it actually worked since the SoundBuffer.duration is now equals to the
La's SoundBuffer.duration. But the Sound doesnt play anymore and I dont really understand why...
I then tried to play around with the samples of the
Do's buffer too maybe shorten its length accordingly to the new found count value. but I couldnt really understand how to really do that
So I'd like to know if someone had any idea why the Sound doesnt play anymore, thanks in advance