Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 200051 - stabilize media-sound/sox-14.0.1
Summary: stabilize media-sound/sox-14.0.1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: MIPS Porters
URL:
Whiteboard:
Keywords: STABLEREQ
Depends on:
Blocks: 146062
  Show dependency tree
 
Reported: 2007-11-23 06:48 UTC by Akkara
Modified: 2008-02-13 00:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Akkara 2007-11-23 06:48:15 UTC
The currently stable media-sound/sox-12.17.9 loses the last sample when processing 2-channel 16-bit pcm .wav soundfiles with a odd number of samples

Problem seems to be fixed in unstable media-sound/sox-14.0.0 as well as the previous unstable, media-sound/sox-13.0.0


Reproducible: Always

Steps to Reproduce:
>>> echo "UklGRjAAAABXQVZFZm10IBAAAAABAAIARKwAABCxAgAEABAAZGF0YQwAAAABEA/wAiAO4AMwDdA=" | base64 -d >test.wav

>>> md5sum test.wav
bc073b230966e3e3c05a085d2e5ebf00  test.wav

>>> hexdump -C test.wav
00000000  52 49 46 46 30 00 00 00  57 41 56 45 66 6d 74 20  |RIFF0...WAVEfmt |
00000010  10 00 00 00 01 00 02 00  44 ac 00 00 10 b1 02 00  |........D.......|
00000020  04 00 10 00 64 61 74 61  0c 00 00 00 01 10 0f f0  |....data........|
00000030  02 20 0e e0 03 30 0d d0                           |. ...0..|
00000038

# Commentary: The data is at the end, 3 sample-frames times 2 channels
# is 6 16-bit samples, in little-endian format:
# 1001, F00F, 2002, E00E, 3003, D00D

>>> equery list sox
[ Searching for package 'sox' in all categories among: ]
 * installed packages
[I--] [  ] media-sound/sox-12.17.9 (0)


# Commentary: use sox to convert the file to raw 16-bit form

>>> sox  -t .wav test.wav  -t .raw -c 2 -s -w test.raw
>>> hexdump -C test.raw
00000000  01 10 0f f0 02 20 0e e0                           |..... ..|
00000008

# Commentary: Notice the last sample of each channel has been dropped

Actual Results:  
00000000  01 10 0f f0 02 20 0e e0                           |..... ..|

The last sample of each channel has been lost

Expected Results:  
00000000  01 10 0f f0 02 20 0e e0  03 30 0d d0              |..... ...0..|

Converted all the samples.


Try the same steps with unstable sox to show it works:


>>> equery list sox
[ Searching for package 'sox' in all categories among: ]
 * installed packages
[I--] [ ~] media-sound/sox-14.0.0 (0)


>>> sox  -t .wav test.wav  -t .raw -c 2 -s -w test.raw
>>> hexdump -C test.raw
00000000  01 10 0f f0 02 20 0e e0  03 30 0d d0              |..... ...0..|
0000000c


If for some reason it is decided not to stabilize the 14.* or 13.* versions, the following patch to wav.c also works:

sox-12.17.9 >>> diff -c src/wav-orig.c src/wav.c
*** src/wav-orig.c	2007-11-22 22:34:29.206250390 -0800
--- src/wav.c	2007-11-22 22:35:49.148905833 -0800
***************
*** 1150,1156 ****
          /* Only return buffers that contain a totally playable
           * amount of audio.
           */
!         done -= (done % (ft->info.channels * ft->info.size));
          if (done/ft->info.channels > wav->numSamples)
              wav->numSamples = 0;
          else
--- 1150,1156 ----
          /* Only return buffers that contain a totally playable
           * amount of audio.
           */
!         done -= (done % ft->info.channels);
          if (done/ft->info.channels > wav->numSamples)
              wav->numSamples = 0;
          else

=====
This change is supported by looking at the corresponding lines of the 14.0.0, where it appears the same thing was done.
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2007-11-23 10:53:09 UTC
Moving on, marking 14.0.0 stable.



amd64 stable
Comment 2 Markus Meier gentoo-dev 2007-11-23 16:06:03 UTC
x86 stable
Comment 3 Markus Rothe (RETIRED) gentoo-dev 2007-11-23 21:30:54 UTC
ppc64 stable
Comment 4 nixnut (RETIRED) gentoo-dev 2007-11-24 18:03:47 UTC
ppc stable
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2007-11-26 01:01:56 UTC
Stable for HPPA.
Comment 6 Raúl Porcel (RETIRED) gentoo-dev 2007-11-28 17:34:29 UTC
alpha/sparc stable
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2008-02-13 00:06:39 UTC
Closing, Bug 192235 for mips re-keywording.