everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
* Using 16-bit Signed Integer PCM
@ 2019-11-24 13:01 Rene Maurer
  2019-11-24 23:04 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Rene Maurer @ 2019-11-24 13:01 UTC (permalink / raw)
  To: dtas-all

Even if I choose type=s16 the resulting output is s32.

wav file as follows:

soxi src.wav

Input File     : 'src.wav'
Channels       : 2
Sample Rate    : 44100
Precision      : 16-bit
Duration       : 00:00:53.43 = 2356478 samples = 4007.62 CDDA sectors
File Size      : 9.43M
Bit Rate       : 1.41M
Sample Encoding: 16-bit Signed Integer PCM

Used "sox src.wav src.raw" to convert the file to src.raw:

ls -l src.raw 
-rw-r--r-- 1 r r 9425912 Nov 24 12:16 src.raw

Used "dtas-ctl format type=s16" to change the format to 16bit signed.
Used "dtas-ctl sink ed dumper command='sox $SOXFMT - /tmp/dump.sox' to
create a dumper sink.
Used "dtas-ctl sink ed dumper active=true" to activate the sink.
Play the file with "dtas-enq src.wav"

Output of ps -x:
10030 ?        SL     0:00 play -q -ts16 -c2 -r44100 -
10031 ?        S      0:00 sox -ts16 -c2 -r44100 - /tmp/dump.sox
10032 ?        S      0:00 sox /home/r/Desktop/SOX/src.wav -ts16 -c2 -r44100 -

I have assumed that /tmp/dump.sox will be identical with src.raw. But it
isn't:

ls -l /tmp/dump.sox 
-rw-r--r-- 1 r r 18851872 Nov 24 13:24 /tmp/dump.sox

dump.sox is in s32 format and not as assumed in s16 format.

Is there an explanation?

Best René


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

* Re: Using 16-bit Signed Integer PCM
  2019-11-24 13:01 Using 16-bit Signed Integer PCM Rene Maurer
@ 2019-11-24 23:04 ` Eric Wong
  2019-11-26 12:58   ` Rene Maurer
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2019-11-24 23:04 UTC (permalink / raw)
  To: Rene Maurer; +Cc: dtas-all

Rene Maurer <rmnet@mailc.net> wrote:
> dump.sox is in s32 format and not as assumed in s16 format.

> Is there an explanation?

.sox is always 32-bit integer, see soxformat(7) manpage.

And having hacked on sox internals in C, I can confirm.  It's a
bit unfortunate, since nowadays most audio plugins and libraries
are 32-bit float and FPUs are common, so the conversions cost
some performance.


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

* Re: Using 16-bit Signed Integer PCM
  2019-11-24 23:04 ` Eric Wong
@ 2019-11-26 12:58   ` Rene Maurer
  2019-11-26 19:16     ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Rene Maurer @ 2019-11-26 12:58 UTC (permalink / raw)
  To: Eric Wong; +Cc: dtas-all


Eric Wong <e@80x24.org> wrote:
> .sox is always 32-bit integer, see soxformat(7) manpage.

Ok. I have overseen that SoX's native PCM format is also used for
*piping*. Does this mean, that also 32 bit are sent towards the sound
card?


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

* Re: Using 16-bit Signed Integer PCM
  2019-11-26 12:58   ` Rene Maurer
@ 2019-11-26 19:16     ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-11-26 19:16 UTC (permalink / raw)
  To: Rene Maurer; +Cc: dtas-all

Rene Maurer <rmnet@mailc.net> wrote:
> 
> Eric Wong <e@80x24.org> wrote:
> > .sox is always 32-bit integer, see soxformat(7) manpage.
> 
> Ok. I have overseen that SoX's native PCM format is also used for
> *piping*. Does this mean, that also 32 bit are sent towards the sound
> card?

Nope.  sox will either convert to whatever the layer accepts
(as done for ALSA) or hand off to a sound server (e.g. pulseaudio)
and the soundserver will do the conversion.


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

end of thread, other threads:[~2019-11-26 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-24 13:01 Using 16-bit Signed Integer PCM Rene Maurer
2019-11-24 23:04 ` Eric Wong
2019-11-26 12:58   ` Rene Maurer
2019-11-26 19:16     ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/dtas.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).