Note that there are some explanatory texts on larger screens.

plurals
  1. POJavasound not playing .m4a files through JAAD (an SPI)
    primarykey
    data
    text
    <p>I'm trying to play some .m4a files, and I understand that <a href="http://jaadec.sourceforge.net/index.php" rel="nofollow">JAAD</a> only supports decoding AAC, but there are songs that I am able to get the sourceDataLine from, and then when I go to try to play them, I get behavior like this:</p> <p>We read: 1024 bytes.</p> <p>We read: 512 bytes.</p> <p>We read: -1 bytes.</p> <p>When running this:</p> <pre><code>// read from the input bytesRead = audioInputStream.read(tempBuffer, 0, tempBuffer.length); System.out.println("We read: " + bytesRead + " bytes."); </code></pre> <p>until bytesRead == -1</p> <p>For this particular file, I'm getting the AudioFormat baseformat to be this: MPEG1L1 48000.0 Hz, unknown bits per sample, mono, unknown frame size, 125.0 frames/second.</p> <p>Then the AudioFormat decodedFormat to be this: PCM_SIGNED 48000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian</p> <p>I use these line of code to make the conversion:</p> <pre><code>AudioFormat baseFormat = audioInputStream.getFormat(); AudioFormat decodedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, baseFormat.getSampleRate(), 16, baseFormat.getChannels(), baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false); </code></pre> <p>Am I doing something wrong here? I don't fully understand that that second line really does, but it's been working just fine for decoding MP3 files using the <a href="http://www.javazoom.net/mp3spi/about.html" rel="nofollow">MP3SPI</a>.</p> <p>I'd really appreciate any guidance here.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload