sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
* sox can't encode to 16-bit
@ 2019-01-17 13:41 Toru Yagi
  2019-01-18 12:54 ` Måns Rullgård
  0 siblings, 1 reply; 5+ messages in thread
From: Toru Yagi @ 2019-01-17 13:41 UTC (permalink / raw)
  To: sox-users

Hi all, 

I'm trying to record by sox, splitting the input to multiple files: 

$ sox --version 
sox:      SoX v14.4.1 

$ rec -c 2 -b 16 -r 48000 -p trim 0 20 | 
sox -V3 -c 2 -b 16 -r 48000 -p test.wav trim 0 10 : newfile : restart 

I want to record 16-bit wav files, but the files generated are 32-bit ones. 

$ soxi test*.wav 

Input File     : 'test001.wav' 
Channels       : 2 
Sample Rate    : 48000 
Precision      : 32-bit 
Duration       : 00:00:10.00 = 480000 samples ~ 750 CDDA sectors 
File Size      : 3.84M 
Bit Rate       : 3.07M 
Sample Encoding: 32-bit Signed Integer PCM 


Input File     : 'test002.wav' 
Channels       : 2 
Sample Rate    : 48000 
Precision      : 32-bit 
Duration       : 00:00:10.00 = 480000 samples ~ 750 CDDA sectors 
File Size      : 3.84M 
Bit Rate       : 3.07M 
Sample Encoding: 32-bit Signed Integer PCM 

During recording, I have a message saying: 
"rec WARN formats: sox can't encode to 16-bit" 

When I record without splitting, I can get 16-bit wav files. 

$ rec -c 2 -b 16 -r 48000 test.wav trim 0 20 

$ soxi test.wav 

Input File     : 'test.wav' 
Channels       : 2 
Sample Rate    : 48000 
Precision      : 16-bit 
Duration       : 00:00:20.00 = 960000 samples ~ 1500 CDDA sectors 
File Size      : 3.84M 
Bit Rate       : 1.54M 
Sample Encoding: 16-bit Signed Integer PCM 

Is there any way to record 16-bit wav files, not 32-bit? 

Regards, 

-- 
Toru Yagi 
yagitohru@yahoo.co.jp 



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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sox can't encode to 16-bit
  2019-01-17 13:41 sox can't encode to 16-bit Toru Yagi
@ 2019-01-18 12:54 ` Måns Rullgård
  2019-01-18 14:47   ` Toru Yagi
  0 siblings, 1 reply; 5+ messages in thread
From: Måns Rullgård @ 2019-01-18 12:54 UTC (permalink / raw)
  To: Toru Yagi; +Cc: sox-users

Toru Yagi <yagitohru@yahoo.co.jp> writes:

> Hi all, 
>
> I'm trying to record by sox, splitting the input to multiple files: 
>
> $ sox --version 
> sox:      SoX v14.4.1 
>
> $ rec -c 2 -b 16 -r 48000 -p trim 0 20 | 
> sox -V3 -c 2 -b 16 -r 48000 -p test.wav trim 0 10 : newfile : restart 
>
> I want to record 16-bit wav files, but the files generated are 32-bit ones. 

Put the "-b 16" option immediately before the output file argument.  You
can also drop all the format options preceding the -p since the pipe
format already includes all information.

That said, why don't you do the splitting directly with the rec command?
This should work:

$ rec -c 2 -b 16 -r 48000 test.wav trim 0 10 : newfile : restart

-- 
Måns Rullgård


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sox can't encode to 16-bit
  2019-01-18 12:54 ` Måns Rullgård
@ 2019-01-18 14:47   ` Toru Yagi
  2019-01-18 21:44     ` Måns Rullgård
  0 siblings, 1 reply; 5+ messages in thread
From: Toru Yagi @ 2019-01-18 14:47 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: sox-users

On 1/18/19 9:54 PM, Måns Rullgård wrote:
>> $ rec -c 2 -b 16 -r 48000 -p trim 0 20 |
>> sox -V3 -c 2 -b 16 -r 48000 -p test.wav trim 0 10 : newfile : restart
>>
>> I want to record 16-bit wav files, but the files generated are 32-bit ones.
> 
> Put the "-b 16" option immediately before the output file argument.  You
> can also drop all the format options preceding the -p since the pipe
> format already includes all information.

$ rec -c 2 -r 48000 -b 16 -p trim 0 20 | sox -p test.wav trim 0 10 : newfile : restart
rec WARN formats: sox can't encode to 16-bit

Input File     : 'default' (alsa)
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

In:0.00% 00:00:20.05 [00:00:00.00] Out:960k  [   ===|===   ] Hd:5.0 Clip:0
Done.

$ soxi  test00*.wav

Input File     : 'test001.wav'
Channels       : 2
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:10.00 = 480000 samples ~ 750 CDDA sectors
File Size      : 3.84M
Bit Rate       : 3.07M
Sample Encoding: 32-bit Signed Integer PCM


Input File     : 'test002.wav'
Channels       : 2
Sample Rate    : 48000
Precision      : 32-bit
Duration       : 00:00:10.00 = 480000 samples ~ 750 CDDA sectors
File Size      : 3.84M
Bit Rate       : 3.07M
Sample Encoding: 32-bit Signed Integer PCM

Total Duration of 2 files: 00:00:20.00

Is the position of "-b 16" option okay?

> That said, why don't you do the splitting directly with the rec command?
> This should work:
> 
> $ rec -c 2 -b 16 -r 48000 test.wav trim 0 10 : newfile : restart

I understand it, but I have to save test.wav first.
I just want to split into wav files while I record from the line input.

Regards,
-- 
Toru Yagi
yagitohru@yahoo.co.jp


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sox can't encode to 16-bit
  2019-01-18 14:47   ` Toru Yagi
@ 2019-01-18 21:44     ` Måns Rullgård
  2019-01-19 15:58       ` Toru Yagi
  0 siblings, 1 reply; 5+ messages in thread
From: Måns Rullgård @ 2019-01-18 21:44 UTC (permalink / raw)
  To: Toru Yagi; +Cc: sox-users

Toru Yagi <yagitohru@yahoo.co.jp> writes:

> On 1/18/19 9:54 PM, Måns Rullgård wrote:
>>> $ rec -c 2 -b 16 -r 48000 -p trim 0 20 |
>>> sox -V3 -c 2 -b 16 -r 48000 -p test.wav trim 0 10 : newfile : restart
>>>
>>> I want to record 16-bit wav files, but the files generated are 32-bit ones.
>>
>> Put the "-b 16" option immediately before the output file argument.  You
>> can also drop all the format options preceding the -p since the pipe
>> format already includes all information.
>
> $ rec -c 2 -r 48000 -b 16 -p trim 0 20 | sox -p test.wav trim 0 10 : newfile : restart
> rec WARN formats: sox can't encode to 16-bit
>

[...]

> Is the position of "-b 16" option okay?

No, it needs to go immediately before the "test.wav" argument.

>> That said, why don't you do the splitting directly with the rec command?
>> This should work:
>>
>> $ rec -c 2 -b 16 -r 48000 test.wav trim 0 10 : newfile : restart
>
> I understand it, but I have to save test.wav first.
> I just want to split into wav files while I record from the line input.

The command I suggested does exactly that.

-- 
Måns Rullgård


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: sox can't encode to 16-bit
  2019-01-18 21:44     ` Måns Rullgård
@ 2019-01-19 15:58       ` Toru Yagi
  0 siblings, 0 replies; 5+ messages in thread
From: Toru Yagi @ 2019-01-19 15:58 UTC (permalink / raw)
  To: Måns Rullgård; +Cc: sox-users

On 1/19/19 6:44 AM, Måns Rullgård wrote:
>> Is the position of "-b 16" option okay?
> 
> No, it needs to go immediately before the "test.wav" argument.
> 

$ rec -c 2 -r 48000 -p trim 0 20 | sox -p -b 16 test.wav trim 0 10 : newfile : restart
                                           ^^^^^
This was successful! I could record 16-bit wav files.

>>> $ rec -c 2 -b 16 -r 48000 test.wav trim 0 10 : newfile : restart
> 
> The command I suggested does exactly that.
> 

How can I stop recording? Can I set the recording time in advance?

Regards,
-- 
Toru Yagi
yagitohru@yahoo.co.jp


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 13:41 sox can't encode to 16-bit Toru Yagi
2019-01-18 12:54 ` Måns Rullgård
2019-01-18 14:47   ` Toru Yagi
2019-01-18 21:44     ` Måns Rullgård
2019-01-19 15:58       ` Toru Yagi

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.org/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox