JDK-4895934 : AudioInputStream.getFrameLength returns wrong value for 12-bit AIFF file
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-07-24
  • Updated: 2003-08-19
  • Resolved: 2003-08-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description

Name: rmT116609			Date: 07/24/2003


FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

FULL OPERATING SYSTEM VERSION :Microsoft Windows XP [Version 5.1.2600]


A DESCRIPTION OF THE PROBLEM :
The method getFrameLength of class
javax.sound.sampled.AudioInputStream returns twice the
number that it should for a stream created from an AIFF
file containing 12-bit samples.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the program below.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.io.File;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;

/**
 * Demonstrates a bug in <code>AudioInputStream.getFrameLength</code>,
 * which returns twice what it should for a stream created from a 12-bit
 * AIFF file. The file sampleSize12.aif is a single-channel AIFF file
 * containing 100 samples, with values 0 through 99. It is available at
 * http://www.birds.cornell.edu/brp/HaroldMills/JavaSoundBug1.html.
 */
public class SampleSizeBug {

    public static void main(String[] inArgs) throws Exception {

        File file = new File("sampleSize12.aiff");
        AudioInputStream stream = AudioSystem.getAudioInputStream(file);
        System.out.println("number of sample frames " + stream.getFrameLength
());

    }

}

---------- END SOURCE ----------
(Incident Review ID: 173352) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b16
14-06-2004

EVALUATION ###@###.### 2003-08-07 Needs to verify that the AIFF file is actually correct. Does the AIFF file specify if the 12-bit samples are packed, or if one sample requires 16 bits? ###@###.### 2003-08-13 Checking the file with AudioFileInfo from the Java Sound Resources (http://www.jsresources.org/) and the latest develpment version of tiger shows an AudioFormat of 12 bits per sample, mono, 1 byte per frame. So the calculation of the frame size seems to be still wrong.
11-06-2004

PUBLIC COMMENTS AudioInputStream.getFrameLength returns wrong value for 12-bit AIFF file
10-06-2004