I am currently trying to complete a project for school that involves reading an audio 'wav' file, using a golomb encoder to encode the samples, writing the result to a binary file, reading that binary file on another script and decoding it using the golomb decoder. The assignment guide suggests I develop a BitStream class that can read and write a single bit and read and write n bits. I have done the golomb encoder and decoder and it seems to be working well. However, I am having trouble with the BitStream part. I have tried searching for existing classes online but as I am fairly new to programming, they all seem super complicated to work with. My golomb coder returns a string of 1's and 0's and the decoder works with a similar string as input. Another questions I have are: When I am done writing the binary files, how do I know where each sample code starts and ends? How do I pass the sampling frequency to the decoder? How do I know where the left and right channels of the audio sample begin and end? How do I encode the M parameter of the golomb encoder of each separate sample? I am supposed to do this in Python by the way.
Thanks in advance!