Note that there are some explanatory texts on larger screens.

plurals
  1. POJava - Error when trying to use mp3plugin for playing an mp3 file
    primarykey
    data
    text
    <p>I am writing a music visualiser and am trying to play mp3 files in java using an mp3plugin (<a href="http://pscode.org/lib/mp3plugin.jar" rel="nofollow noreferrer">http://pscode.org/lib/mp3plugin.jar</a>). However I've come across an error, probably due to my lack of experience using this plugin and coding music in general. </p> <p>I have tested this code with a wide range of mp3 files, all with the same problem, I believe I can rule out with some confidence that the mp3 files are at fault.</p> <p>My code below:</p> <pre><code>AudioInputStream audioIn; try { JS_MP3FileReader m = new JS_MP3FileReader(); audioIn = m.getAudioInputStream(new File(ex.trackname)); //audioIn = AudioSystem.getAudioInputStream(new File(ex.trackname)); // Get a sound clip resource. Clip clip = AudioSystem.getClip(); // Open audio clip and load samples from the audio input stream. clip.open(audioIn); clip.start(); } catch (Exception e) { e.printStackTrace(); } </code></pre> <p>The error I get:</p> <pre><code>javax.sound.sampled.LineUnavailableException: line with format MPEG1L3 48000.0 Hz, unknown bits per sample, stereo, unknown frame size, unknown frame rate, not supported. at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(Unknown Source) at com.sun.media.sound.DirectAudioDevice$DirectClip.implOpen(Unknown Source) at com.sun.media.sound.AbstractDataLine.open(Unknown Source) at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source) at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source) at Logic.Run$1.run(Run.java:101) at java.lang.Thread.run(Unknown Source) </code></pre> <p>(note the class instance I wrote that runs this code is called Run)</p> <p>My project structure below, including the plugin file:</p> <p><img src="https://i.stack.imgur.com/ZsYB2.png" alt="Project Structure"></p>
    singulars
    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