#185 incorrect negative samples when uprezzing wav files

closed-invalid
nobody
None
5
2011-10-09
2011-09-28
Todd West
No

Repro command line is

sox-14-3-2>sox.exe whiteNoise.44100.16.sox.wav -b 24 -e signed whiteNoise.44100.24.sox.wav

source file is attached.

Comparison of whiteNoise.44100.16.sox.wav to whiteNoise.44100.24.sox.wav on a sample by sample basis shows the values of positive samples in the 24 bit output file are, as expected, 256 times larger than than the same samples in the 16 bit source file. Negative samples in source file are emitted as 256 * (ushort)sample and therefore end up being large and incorrect positive numbers instead of properly scaled negative numbers. It wouldn't surprise me if this turns out to be a one line fix of an incorrect cast.

sox.exe: SoX v14.3.2
time: Feb 27 2011 16:03:50
gcc: 4.5.0 20100414 (Fedora MinGW 4.5.0-1.fc14)
arch: 1248 48 44 L OMP
sox.exe INFO formats: detected file format type `wav'
sox.exe DBUG wav: WAV Chunk fmt
sox.exe DBUG wav: WAV Chunk data
sox.exe DBUG wav: Reading Wave file: Microsoft PCM format, 2 channels, 44100 sam
p/sec
sox.exe DBUG wav: 176400 byte/sec, 4 block align, 16 bits/samp, 176400 d
ata bytes
sox.exe DBUG wav: 44100 Samps/chans

Input File : 'whiteNoise.44100.16.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:01.00 = 44100 samples = 75 CDDA sectors
File Size : 176k
Bit Rate : 1.41M
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no

sox.exe INFO sox: Overwriting `..\CrossTimeDsp\Tests\bin\Debug\whiteNoise.44100.
24.sox.wav'
sox.exe DBUG wav: Writing Wave file: Microsoft PCM format, 2 channels, 44100 sam
p/sec
sox.exe DBUG wav: 264600 byte/sec, 6 block align, 24 bits/samp

Output File : 'whiteNoise.44100.24.sox.wav'
Channels : 2
Sample Rate : 44100
Precision : 16-bit
Duration : 00:00:01.00 = 44100 samples = 75 CDDA sectors
Sample Encoding: 24-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'

sox.exe INFO sox: effects chain: input 44100Hz 2 channels 16 bits (multi)
sox.exe INFO sox: effects chain: output 44100Hz 2 channels 16 bits (multi)
sox.exe DBUG wav: Finished writing Wave file, 264600 data bytes 44100 samples

Discussion

  • Todd West

    Todd West - 2011-09-28

    1 second 16 bit wav of white noise with samples as expected

     
  • Todd West

    Todd West - 2011-09-28
    • status: open --> open-invalid
     
  • Todd West

    Todd West - 2011-09-28

    On closer inspection, this is a bug in the wav file parser I was using---it wasn't sign extending negative 24 bit integers when converting them to 32 bit---and not a SoX issue.

     
  • Ulrich Klauer

    Ulrich Klauer - 2011-10-09
    • status: open-invalid --> closed-invalid
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks