sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
From: Danijel DOMAZET <p-danijel.domazet@devialet.com>
To: "Måns Rullgård" <mans@mansr.com>
Cc: sox-users@lists.sourceforge.net
Subject: Re: Prevent SoX from doing the clipping?
Date: Fri, 5 Jun 2020 10:39:19 +0200
Message-ID: <CAB+hYN0KD6LNS5ykf2U2nhABSkFSW=eGg3N=ZyZ2b1=_u6CCAA@mail.gmail.com> (raw)
In-Reply-To: <yw1ximg5ykv5.fsf@mansr.com>


[-- Attachment #1.1: Type: text/plain, Size: 1491 bytes --]

Nice workaround idea, works! Thank you Mans.

p.s. Have no idea where the "confidential" thing came from, sorry.


On Fri, Jun 5, 2020 at 10:31 AM Måns Rullgård <mans@mansr.com> wrote:

> Danijel DOMAZET <p-danijel.domazet@devialet.com> writes:
>
> > Hi list,
> >
> > I have a heavily "overflowed" WAV file (samples written in float 32-bit
> > format): instead of [-1.0,+1.0], the samples range goes as far as
> > [-5.0,+5.0].
> >
> > Using SoX to get raw PCM audio samples from WAV file:
> >
> > `sox --bits 32 --channels 1 --encoding floating-point --rate 48000
> > input.wav output.raw`
> >
> > I get warnings:
> >
> >     sox WARN sox: `input.wav' input clipped 1163400 samples
> >     sox WARN sox: `output.raw' output clipped 605664 samples; decrease
> > volume?
> >
> > When I look into the output, I see the samples were clipped, and the
> range
> > is [-1.0,+1.0] now. However, that is not what I want.
> >
> > I would like to have exactly the same output as input, just in different
> > format (RAW instead of WAV). Is there a way to prevent SoX from doing the
> > clipping?
>
> No, that isn't possible.  Sorry.
>
> In your specific case, however, a workaround is possible.  If you
> override input sample encoding as 32-bit signed integer instead of
> float, the values will be copied untouched.  Since the output is
> headerless, it doesn't matter what sox thinks the samples are.
>
> --
> Måns Rullgård
>

-- 
- Confidential -

[-- Attachment #1.2: Type: text/html, Size: 2329 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

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

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05  6:54 Danijel DOMAZET
2020-06-05  8:05 ` Peter P.
2020-06-05  8:31 ` Måns Rullgård
2020-06-05  8:39   ` Danijel DOMAZET [this message]
2020-06-06 18:02 ` Jan Stary
2020-06-06 18:03 ` Jan Stary

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-users

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAB+hYN0KD6LNS5ykf2U2nhABSkFSW=eGg3N=ZyZ2b1=_u6CCAA@mail.gmail.com' \
    --to=sox-users@lists.sourceforge.net \
    --cc=mans@mansr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

sox-users@lists.sourceforge.net unofficial mirror

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

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.io/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.git