Java Tutorials: Episode 21 - Java Sound API - Clips

baralaborn · 65K views · 2014 · 14:36

Open on YouTube

Software practice, open source & careersC, C++, Rust, Go & systems languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they followed when asking why Java Sound code fails to get a Clip, list mixers, or play audio.

Recommended by 0 people across 0 different months, 2014 to 2019.

What it is

Episode 21 of a Java tutorial series by baralaborn, introducing the Java Sound API and its Clip class. The 14-minute screencast walks through listing mixers, getting a Clip line, and ends with the program playing a short tune.

What people said

Cites Stefan Rafa · 2014-12 · Stack Overflow · on “play sound on button click”

I have a big problem over here i tried a million ways of doing this but nothing helps, here are the links i tried to make this... [this video] How can I play sound in Java? [LINK] [LINK] [LINK] there are just some links that are still opened in the browser but never mind.. i'm making this in NetBeans and i really cannot figure out how should i do this please help me. Here is the class i want to make this and also the button.. if you can make it for me i will be very happy public class Machines extends javax.swing.JFrame { public Machines() { initComponents(); } private void spinBtnActionPerformed(java.awt.event.ActionEvent evt) { } also the music file is spinsound.wav and i have placed in the dir

Cites cd3 · 2015-05 · Stack Overflow · on “Javasound Mixer Not showing any output devices”

When I run this code, I get an output of 4 objects, all of which are input. All I want to get is my computer's (Macbook late 2014 w/ OSX 10.9.5) default output. public static void aPlayer(){ Mixer.Info[] mixInfos = AudioSystem.getMixerInfo(); for (Mixer.Info info : mixInfos){ System.out.println("Name: " + info.getName() + ", Description: " + info.getDescription()); } } this code returns: Name: Java Sound Audio Engine, Description: Software mixer and synthesizer Name: Built-in Microph, Description: No details available Name: Soundflower (2ch), Description: No details available Name: Soundflower (16ch), Description: No details available this code, identical to the beginning of this tutorial [V

Cites itzjackyscode · 2019-04 · Stack Overflow · on “Why does attempting to get a Clip throw exception?”

I have been following this tutorial for Java 1.7 [this video] and I am sure I have the code right. However, Java throws an IllegalArgumentException at runtime. I've tried to catch it in an existing catch block, using Java's slightly-newer multi-catch. However, it simply throws exceptions. Here is the beginning of my code. Mixer.Info[] mixInfos = AudioSystem.getMixerInfo(); /* for (Mixer.Info info : mixInfos) { System.out.println(info.getName() + " - " + info.getDescription()); } */ mixer = AudioSystem.getMixer(mixInfos[0]); DataLine.Info dataInfo = new DataLine.Info(Clip.class, null); try { clip = (Clip) mixer.getLine(dataInfo); } I expect that the code will continue running and play the Clip but