On Tue, Feb 09, 2016 at 10:24:47AM +0000, Comète wrote: > Hi, > > i'm using openbsd 5.8 amd64 stable. I'm trying to record audio > with 24-bits precision with sox and it seems to be impossible: > > rec -t flac -c 2 -r 48000 -b 24 test.flac > > Input File : 'default' (sndio) > Channels : 2 > Sample Rate : 48000 > Precision : 32-bit > Sample Encoding: 32-bit Signed Integer PCM > > In:0.00% 00:00:16.90 [00:00:00.00] Out:807k [ | ] Clip:0 > > It is always encoded with 32-bits precision, but if i try > specifying 16 instead of 24, it is well encoded in 16 bits. >
This should fix the problem. If bits_per_sample is set, then use it to configure sndiod; otherwise, pick a value close to precision or the default sox precision. OK? Index: Makefile =================================================================== RCS file: /cvs/ports/audio/sox/Makefile,v retrieving revision 1.63 diff -u -p -u -p -r1.63 Makefile --- Makefile 12 Dec 2015 08:17:34 -0000 1.63 +++ Makefile 9 Feb 2016 22:24:19 -0000 @@ -5,6 +5,7 @@ BROKEN-hppa = bend.c:155:12: internal co COMMENT= Sound eXchange, the Swiss Army knife of audio manipulation DISTNAME= sox-14.4.2 +REVISION= 0 SHARED_LIBS += sox 4.0 # 3.0 CATEGORIES= audio Index: patches/patch-src_sndio_c =================================================================== RCS file: patches/patch-src_sndio_c diff -N patches/patch-src_sndio_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_sndio_c 9 Feb 2016 22:24:19 -0000 @@ -0,0 +1,25 @@ +$OpenBSD$ +--- src/sndio.c.orig Mon Jan 30 04:01:44 2012 ++++ src/sndio.c Tue Feb 9 23:23:00 2016 +@@ -113,8 +113,6 @@ static int startany(sox_format_t *ft, unsigned mode) + else + reqpar.rchan = ft->signal.channels; + } +- if (ft->signal.precision > 0) +- reqpar.bits = ft->signal.precision; + switch (ft->encoding.encoding) { + case SOX_ENCODING_SIGN2: + reqpar.sig = 1; +@@ -127,6 +125,12 @@ static int startany(sox_format_t *ft, unsigned mode) + } + if (ft->encoding.bits_per_sample > 0) + reqpar.bits = ft->encoding.bits_per_sample; ++ else if (ft->signal.precision > 0) ++ reqpar.bits = ft->signal.precision; ++ else ++ reqpar.bits = SOX_DEFAULT_PRECISION; ++ reqpar.bps = (reqpar.bits + 7) / 8; ++ reqpar.msb = 1; + if (ft->encoding.reverse_bytes != sox_option_default) { + reqpar.le = SIO_LE_NATIVE; + if (ft->encoding.reverse_bytes)