apply for .pcm file as sox
Asked Answered
S

2

2

I want to exchange 16kHz pcm --> 48kHz wav using sox. however, pcm file isn't applied in sox.

so, I just changed pcm to raw, and then sox -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav

Can I apply for pcm file not convert raw?

Sign answered 8/4, 2014 at 10:35 Comment(0)
H
3

For the PCM file, since PCM's are headerless, you need to add '-t raw' as the first argument.

sox -t raw -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav

Try that out.

Also try the different Endian settings; -L; -B; -x though only use one at a time, and only if not using one doesn't work.

Hemeralopia answered 5/10, 2017 at 7:2 Comment(0)
H
1

There is no need to convert the input file into raw. Sox can handle pcm files.

sox input.pcm -r 48000 output.wav

The input file can either be a .pcm or .wav.

Since .wav files have a header containing audio metadata (such as sample rate, bit precision, file length, etc), you don't have to pass any information about the input file. Hence, non need to use:

-r 16000 -e signed -b 16 -c 1

Converting pcm to raw you have just stripped down the file header.

Houseyhousey answered 15/5, 2014 at 10:41 Comment(2)
no, it does not work for 'pcm' , I am getting us error "$ sox file_32.pcm -r 48000 output.wav C:\Program Files (x86)\sox-14-4-2\sox.exe FAIL formats: no handler for file extension `pcm'"Boodle
@MMH, it does work for pcm, only if you don't name the input file with .pcm extension, use .raw.Konstantine

© 2022 - 2024 — McMap. All rights reserved.