Software Convert WAV

I am writing a file compression utility in C ++ that I need support for WMA files for PCM, however I want to save it in PCM encoding and just convert it to a lower sampling rate and change it from stereo to mono if applicable give a lower file size.

I understand the header of the WAV file, however, I have no experience or knowledge of how the actual audio data works. So my question is: would it be relatively easy to programmatically manipulate a sub-piece of data in a WAV file to convert it to a different sampling rate and change the channel number, or would it be much better for me to use the existing library for it? If so, how to do it? Thanks in advance.

+3
source share
3 answers

PCM simply means that the value of the original signal is sampled at equidistant points in time.

For stereo, there are two sequences of these values. To convert them to mono, you simply take the piecewise average of the two sequences.

Re-sampling a signal with a lower sampling rate is a little more complicated - you have to filter out the high frequencies from the signal to prevent the creation of an alias (false low-frequency signal).

+4
source

I agree with avakar and nico, but I would like to add a little more explanation. Decreasing PCM audio sampling rate is not trivial unless two things are true:

, downsample. , , , , - , .

, , , 1/2 . , , , . . , . 7, 3 , , .

. : upsample, , . . , , , .

, , nico . . , .

+2

, ( ). , libsnd

+1

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


All Articles