Re: convert raw file to wav file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-12-29 09:09, markus.blaschke--- via Sox-users wrote:

an I know from the Internet page of the Bat cording systeme that the

RAW files have no header

samplerate 500 kHz
little endien format
PCM 16-bits

other WAV files from an other Bat-cording system have

Channels       : 1
Sample Rate    : 312500
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

so i tried a batchfile to convert

@echo
cd C:\temp\sox-14-4-2
for %%i in (C:\temp\*.raw); do (sox.exe -r 500k -b 16 -L -c 1 %%i
-r 312500 -b 16 -L -c 1 .\converted\%%i.wav)
pause

but i get this back:

sox.exe FAIL formats: bad input format for file
`C:\temp\20230523-N091_B0220-000014.raw': sampling rate was not
specified

I thought the "-r 500k" is the information for the sampling rate.


I thought so too...


I've not used FOR in batch files, but it looks wrong to me.  For sox
to find the input file it needs the first "%%i" to be the whole path
and file name of each of the input files.

But if that is so, surely the "%%i" in your ".\converted\%%i.wav" is
also a whole path?  That can't be right.  Surely there you only want
a file's basic name, which looks to me as if it should be "%%~ni" -
according to what "help for" tells me.


If you replace your FOR with

for %%i in (C:\temp\*.raw); do (echo sox.exe -r 500k -b 16 -L -c 1 %%i
 -r 312500 -b 16 -L -c 1 .\converted\%%i.wav)

- note the "echo" - you should see what the issued commands look
like.



If I were you I'd not use FOR until you can make a single command
for a single file work properly.



If the problem isn't with FOR, another possibility is that you need
to tell sox how the input file is encoded.  That's the

  -e ENCODING, --encoding ENCODING

parameter.


Also, (I don't know), perhaps trying  -V3  (to get verbose output)
might give a clue.

--
Jeremy Nicoll - my opinions are my own


_______________________________________________
Sox-users mailing list
Sox-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sox-users



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux