The WaveReader is dedicated to reading a WAV file and provides you with samples as you want.
Usage:Open a WAV fileGet the iteratorThe iterator excretes the PCM samples with the format you specified.
The WaveWriter is dedicated to creating a WAV file.
Usage:Choose one of the internal formats by specifying DataFormat and use the WaveWriter to create the WAV file.Use the methods, like write_samples(), write_mono_channel(), write_monos(), write_stereos(), etc, to write your PCM samples to the WaveWriter, it will encode.Call finalize() or just let the WaveWriter get out of the scope.
The SampleType for audio processing.The to_*() methods are for scaling the sample to the another format.The as_*() methods are for casting the sample to the another format.
The fft size can be any number greater than the sample rate of the encoder or the decoder.It is for the resampler. A greater number results in better resample quality, but the process could be slower.In most cases, the audio sampling rate is about 11025 to 48000, so 65536 is the best number for the resampler.
The test() functionarg1: the format, e.g. “pcm”arg2: the input file to parse and decode, tests the decoder for the input file.arg3: the output file to encode, test the encoder.arg4: re-decode arg3 and encode to pcm to test the decoder.