I have a .wav
file that has 2 types of sounds: Long and short. What I need to do is I need to encode them as bits and write them to a binary file.
I got the code from this SO answer: https://stackoverflow.com/a/53309191/2588339 and using it I get this plot for my input wav file:
As you can see, there are shorter and wider parts in the first plot as for the shorter and longer sounds in my file.
My question is how can I encode each one of the sounds as a bit? Like having each long sound in the file represent a 1
and a short sound represent a 0
.
EDIT: The 2 types of sound differ by how long they play and by frequency also. The longer sound is also lower frequency and the shorter sound is also higher frequency. You can find a sample of the file here: https://vocaroo.com/i/s0A1weOF3I3f