Sound programming and how to invert a sound wave?

I'm trying to invert a sound wave (180 degree phase shift), but I'm not quite sure how I would do it. Can any sound programmers point me in the right direction? By the way, I use Java.

+4
source share
1 answer

Inverting a sound wave should usually be simple if you have access to the byte array that makes up the sound. You just need to accept the negative value of each value in the stream.

Audio streams come in many variations, so it's impossible to be specific. However, if it was a 16-bit PCM stream that was filled with 2-byte values, you should iterate over the data for every two bytes in the stream: drop it to short, accept a negative result and put it back into the byte stream.

+4
source

Source: https://habr.com/ru/post/1342516/


All Articles