Results 1 to 3 of 3
  1. #1
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

    Default Get Sound Output

    Hey everyone, I was thinking about writing a program that changed the hue of something depending on the sound output of the speakers. I want to capture the sound the same way itunes has those little bars go up and down, or how in windows media player, how on visualizer, the picture changes depending on the music. I was looking into sound in java (which I'm new to), and I made a program that looked for all the lines on each mixer. However, even though I'm playing music, i get 0 lines for all mixers. Does this have something to do with permission? Or am I going at this from the wrong direction entirely... Any help would be greatly appreciated.

    By the way, here is the code i used to see what mixers/lines I had.
    Java Code:
       import javax.sound.sampled.*;
    
       
        public class SoundTest
          {
          
           public static void main(String args[])
             {
             Mixer mix;
             Mixer.Info[] mixers = AudioSystem.getMixerInfo();
             for(int i = 0; i< mixers.length; i++)
                {
                System.out.println(mixers[i].toString());
                
                mix = AudioSystem.getMixer(mixers[i]);
                Line[] lines = mix.getSourceLines();
                System.out.println(lines.length);
                for(int j=0; j<lines.length; j++)
                   {
                   System.out.println(lines[j].getLineInfo().toString());
                   System.out.println(((DataLine)lines[j]).getFormat().toString());
                   }
                }
                
             
             }
       
          }
    I also tried getting targetl lines too. it was still all 0's
    Last edited by collin389; 05-17-2010 at 05:08 AM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you debug the code? I mean check values in each step execution. If you are working on an IDE, then put few breakpoints and debug, or else if you are working on command prompt use few print statements.

  3. #3
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    5

    Default

    they are in there... It's pretty simple. I just get the mixers (about 7) and for each one i get the lines, and see how many there are, there are 0 for each, even though i'm playing music, why?

Similar Threads

  1. sound converter WAV to AU
    By Unome in forum Java Applets
    Replies: 5
    Last Post: 03-14-2009, 10:25 AM
  2. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 11:44 PM
  3. add sound to my applet
    By anotsu in forum Java Applets
    Replies: 4
    Last Post: 03-24-2008, 11:26 PM
  4. applet sound
    By marco in forum Java Applets
    Replies: 1
    Last Post: 09-28-2007, 10:31 PM
  5. Applets having sound
    By peiceonly in forum Java Applets
    Replies: 2
    Last Post: 03-31-2007, 09:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •