1

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?

user3510476
  • 13
  • 1
  • 5

2 Answers2

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.

edale
  • 31
  • 3
0

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.

lCapp
  • 892
  • 9
  • 18
  • 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'" – MMH Aug 10 '15 at 05:18
  • @MMH, it does work for pcm, only if you don't name the input file with `.pcm` extension, use `.raw`. – neevek May 06 '19 at 03:45