Domanda

I have a sound generation program that currently has an enumerated type filled with pitches, starting at A0, a pitch of 27.5 Hz. Every time I loop throw the chromatic scale of all of the included pitches, up to G#5, the sound clicks in between the shifts, no matter what time the pitch lasts for. The code I'm using as a model is https://stackoverflow.com/a/2065693/1777648, and the sound wave byte array is generated in the same way, but I don't know how to fix the clicking. I have a feeling it might be because the end of one pitch wave doesn't connect to the beginning of the next.

È stato utile?

Soluzione

your assumption is correct. if you want no clicks, you have to make sure that the sine wave was generated so that only complete periods are written inside the byte array. otherwise you will cut the wave, which will lead to clicking noises.

for the implementation: you could have a variable "nextPitch", which will become the current pitch as soon as a full period was written.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top