Sound application

Hello.
I sometimes get lost in the sound applications (games), with it all at once, and all the other sounds on the spot. How can I fix it?

Ive solved my problem, but I have another question.
Does anyone know how I could put in volume control?
Ive searched the forums, but I still cant figure it
out.The SourceDataLine has a control called "Master Gain" that can be used to control volume. Note that it is not linear, it's calibrated in decibles. So an adjustment of -10 will cut the volume in half. It also has range limits that may vary with your system and will trhow exceptions if they are exceeded. Here's the code you need to set it.
    public void setGain(float gain) {
        FloatControl g = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
        g.setValue(gain);
    }You'll find some documentation here.

Similar Messages

  • Sound application help

    here is another example of a sound application that does not work. can any one help me fix it??
    import java.awt.*;
    import java.applet.*;
    import java.net.URL;
    public class AnotherAudioAttempt{
      public static void AlertSound(){
        try{
          java.io.File file = new java.io.File("file:///home/nova812/myJava/audio/siren.au");
          AudioClip welldoneclip = Applet.newAudioClip(file.toURL());
          welldoneclip.play();
        catch (Exception e){}
      public static void main(String[] argz){
        AlertSound();
    }//end classRon_W

    I did try System.in.read() but it didn't work either. However, going the the archives here I found a version of the following code. finally some code that works. I modified it so that it would play a sound when the app starts. Althoug the code works, pushing the play sound button to fast will cause the app to not play a sound for a long time. some tweeking is needed.
    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    import java.net.*;
    import java.io.*;
    public class PlaySound {
      public static void main(String args[]) {
      new PlaySoundFrame();
    class PlaySoundFrame extends Frame implements ActionListener {
      Button playSound = new Button("Play Sound");
      PlaySoundFrame() {
        super();
        /* Add the window listener */
        addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
          dispose(); System.exit(0);}});
        playSound.addActionListener(this);
        add(BorderLayout.NORTH,playSound);
        /* Size the frame */
        setSize(200,200);
        /* Center the frame */
        Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize
        Rectangle frameDim = getBounds();
        setLocation((screenDim.width - frameDim.width) / 2,
        (screenDim.height - frameDim.height) / 2);
        /* Show the frame */
        setVisible(true);
        playSnd();
    public void playSnd(){
       AudioClip ac = null;
          try{
            ac = Applet.newAudioClip(new URL("file:///home/nova812/myJava/audio/siren.au"));
          catch(MalformedURLException mfe){
          System.out.println("BadURL!");
          if(ac != null)
            ac.play();
          else
            System.out.println("no sound!!");
      public void actionPerformed(ActionEvent evt){
        if (evt.getSource() == playSound){
          playSnd();
    }Ron_W

  • Sound Application Problems

    Hello,
    Ive been working on a small sound application that just plays music when is starts up. Ive got this:
    import java.applet.AudioClip;
    import java.applet.Applet;
    import javax.swing.*;
    import java.net.URL;
    class Soundf extends JFrame {
         public Soundf() {
              super("Sound");
              AudioClip p = null;
              try {
                   p = Applet.newAudioClip(new URL(new URL("file:z3-light_world1.mid"), "z3-light_world1.mid"));
              catch(Exception e){
                   System.out.println("error");}
              p.play();
              setVisible(true);
    class Sound {
         public static void main(String args[]) {
              JFrame f = new Soundf();
    }I dont get any errors, but it just doesnt play the mid file. Please help.

    p = Applet.newAudioClip(new URL(new
    URL("file:z3-light_world1.mid"),
    "z3-light_world1.mid"));The contructor URL( URL, String) (eg URL( new URL( "http://www.example.com" ), "index.html" )creates a URL of http://www.example.com/index.html.

  • System 10.5.8 Sound application missing

    Friends were having major problems with Mac OS 10.5.8. I tried to install 10.6 but the installation stalled several times. Through it all, I got OS 10.5.8 running for them again but the sound application is now missing, so I can't get the iMac to play sounds effects nor will it show the Harmann Kardon sound sticks as a sound output. They can't find their original install discs and I do not have that version. Will the sound application for system 10.6 work if I drag that file into their 10.5.8 system?  Any ideas would be appreciated!  Thanks.

    Nairy Fuff.
    Are you booting from the DVD, or installing from the desktop? (both are possible).
    As you appear to have a failed install, check the root level of the Finder (i.e Macintosh HD) to see if a folder has appeared called something Like 'Mac OS Install Data'.
    That would contain all the System files that should have been moved into place during the restart.
    You could try removing that. It may need a sudo commad in Terminal; not my territory, but ask again if it won't delete normally.
    I'm assuming up to now that you did a verify/repair disc on mac HD before starting?

  • Please i need help with sound application! please?

    hey there people heres the deal I need to complete this before 5 today but im completely stumped...we have to make a sound file player with a swing interface I have it playing(kind of!) but where now...I would be forever in your debt as my masters degree hangs in the balance! de de duhhhh! cheers
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.event.*;
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.*;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Clip;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineEvent;
    import javax.sound.sampled.LineListener;
    import javax.sound.sampled.LineUnavailableException;
    public class AudioPlayer extends JFrame implements ActionListener, ChangeListener{
    boolean playing;
    boolean looping;
    String filename = File.separator+"tmp";
    File selFile;
    Clip clip;
    JFileChooser fc = new JFileChooser();
    JButton btnOpen = new JButton("Open");
    JButton btnPlay = new JButton("Play");
    JButton btnStop = new JButton("Stop");
    JButton btnPause = new JButton("Pause");
    JButton btnLoop = new JButton("Loop");
    JSlider volume = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
    JSlider panning = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
    public AudioPlayer(){
    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());
    contentPane.add(btnOpen);btnPlay.addActionListener(this);
    contentPane.add(btnPlay);btnPlay.addActionListener(this);
    contentPane.add(btnStop);btnStop.addActionListener(this);
    contentPane.add(btnPause);btnPause.addActionListener(this);
    contentPane.add(btnLoop);btnLoop.addActionListener(this);
    // Show open dialog; this method does not return until the dialog is closed
    fc.showOpenDialog(this);
    selFile = fc.getSelectedFile();
    volume.addChangeListener(this);
    panning.addChangeListener(this);
    volume.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    volume.setPaintTicks(true);volume.setPaintLabels(true);
    volume.setMajorTickSpacing(20);volume.setMinorTickSpacing(10);
    contentPane.add(volume);
    panning.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    panning.setPaintTicks(true);panning.setPaintLabels(true);
    panning.setMajorTickSpacing(20);panning.setMinorTickSpacing(10);
    contentPane.add(panning);
    addWindowListener(
    new WindowAdapter () {
    public void windowClosing(WindowEvent e){
    setVisible(false);
    public void actionPerformed(ActionEvent e){
    int returnVal = JFileChooser.APPROVE_OPTION;
    //Handle open file action.
    if (e.getSource() == btnOpen)
    System.out.println("FA1");
    returnVal = fc.showOpenDialog(AudioPlayer.this);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    { selFile = fc.getSelectedFile();
    //This is where a real application would open the file.
    else
    if(e.getSource() == btnPlay)
    playAudio();
    public void stateChanged(ChangeEvent e)
    public static void main(String[] args)
    AudioPlayer audioPlayer = new AudioPlayer();
    audioPlayer.setSize(400,400);
    audioPlayer.show();
    public void playAudio ()
    playing = true;
    AudioInputStream audiosource = null;
    try
    audiosource = AudioSystem.getAudioInputStream(selFile);
    System.out.println("here");
    //System.out.println(audiosource.getFormat());
    DataLine.Info dataLineInfo = new DataLine.Info(Clip.class,audiosource.getFormat());
    clip = (Clip)AudioSystem.getLine(dataLineInfo);
    clip.open(audiosource);
    catch (UnsupportedAudioFileException e)
    catch (LineUnavailableException e)
    catch (IOException e)
    //catch (Exception e) {}
    if (looping)
    clip.loop(clip.LOOP_CONTINUOUSLY);
    else
    clip.loop(0);
    playing = false;
    }

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.event.*;
    import javax.sound.sampled.*;
    * Description of the Class
    *@author rsmazara
    *@created 28 February 2003
    public class AudioPlayer extends JFrame implements ActionListener, ChangeListener {
    File selFile;
    JFileChooser fc = new JFileChooser();
    JButton btnOpen = new JButton( "Open" );
    JButton btnPlay = new JButton( "Play >" );
    JButton btnStop = new JButton( "Stop" );
    JButton btnPause = new JButton( "Pause ||" );
    JCheckBox btnLoop = new JCheckBox( "Loop" );
    JSlider volume = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
    JSlider panning = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
    JLabel label = new JLabel( " " );
    public AudioPlayer() {
    Container contentPane = getContentPane();
    contentPane.setLayout( new FlowLayout() );
    btnOpen.addActionListener( this );
    contentPane.add( btnOpen );
    btnPlay.addActionListener( this );
    contentPane.add( btnPlay );
    btnPlay.addActionListener( this );
    contentPane.add( btnStop );
    btnStop.addActionListener( this );
    contentPane.add( btnPause );
    btnPause.addActionListener( this );
    contentPane.add( btnLoop );
    btnLoop.addActionListener( this );
    btnPlay.setEnabled( false );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    // Show open dialog; this method does not return until the dialog is closed
    // fc.showOpenDialog( this );
    // selFile = fc.getSelectedFile();
    volume.addChangeListener( this );
    panning.addChangeListener( this );
    volume.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
    volume.setPaintTicks( true );
    volume.setPaintLabels( true );
    volume.setMajorTickSpacing( 20 );
    volume.setMinorTickSpacing( 10 );
    contentPane.add( volume );
    panning.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
    panning.setPaintTicks( true );
    panning.setPaintLabels( true );
    panning.setMajorTickSpacing( 20 );
    panning.setMinorTickSpacing( 10 );
    contentPane.add( panning );
    contentPane.add( label );
    addWindowListener(
    new WindowAdapter() {
    public void windowClosing( WindowEvent e ) {
    setVisible( false );
    System.exit( -100 );
    public void actionPerformed( ActionEvent e ) {
    int returnVal = JFileChooser.APPROVE_OPTION;
    //Handle open file action.
    System.out.println( e.getActionCommand() );
    ///open
    if ( e.getSource() == btnOpen ) {
    System.out.println( "FA1" );
    returnVal = fc.showOpenDialog( AudioPlayer.this );
    if ( returnVal == JFileChooser.APPROVE_OPTION ) {
    selFile = fc.getSelectedFile();
    player = new Player( selFile );
    label.setText( "File loaded : " + selFile.getAbsolutePath() );
    btnPlay.setEnabled( true );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    //This is where a real application would open the file.
    } else {
    //play
    if ( e.getSource() == btnPlay ) {
    player.go( btnLoop.isSelected() );
    btnPlay.setEnabled( false );
    btnStop.setEnabled( true );
    btnPause.setEnabled( true );
    // playAudio();
    // pause
    if ( e.getSource() == btnPause ) {
    player.pause();
    btnPlay.setEnabled( true );
    btnStop.setEnabled( true );
    btnPause.setEnabled( false );
    if ( e.getSource() == btnStop ) {
    player.finish();
    btnPlay.setEnabled( true );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    public void stateChanged( ChangeEvent e ) {
    private Player player = null;
    public static void main( String[] args ) {
    AudioPlayer audioPlayer = new AudioPlayer();
    audioPlayer.setSize( 400, 400 );
    audioPlayer.show();
    * Description of the Class
    *@author rsmazara
    *@created 28 February 2003
    class Player {
    Clip clip;
    private java.io.File selectedFile = null;
    private boolean looping = false;
    public Player( File file ) {
    selectedFile = file;
    AudioInputStream audiosource = null;
    try {
    audiosource = AudioSystem.getAudioInputStream( selectedFile );
    System.out.println( "here" );
    //System.out.println(audiosource.getFormat());
    DataLine.Info dataLineInfo = new DataLine.Info( Clip.class, audiosource.getFormat() );
    clip = ( Clip ) AudioSystem.getLine( dataLineInfo );
    clip.open( audiosource );
    } catch ( UnsupportedAudioFileException e1 ) {
    e1.printStackTrace();
    } catch ( LineUnavailableException e2 ) {
    e2.printStackTrace();
    } catch ( IOException e3 ) {
    e3.printStackTrace();
    private boolean work = false;
    public void go( boolean loop ) {
    looping = loop;
    playAudio();
    public void finish() {
    clip.stop();
    public boolean isWorking() {
    return clip.isRunning();
    long pausePosition = ( long ) 0;
    public void pause() {
    pausePosition = clip.getMicrosecondPosition();
    clip.stop();
    public void restart() {
    clip.setMicrosecondPosition( pausePosition );
    playAudio();
    public void loop( boolean loop ) {
    looping = loop;
    private void playAudio() {
    if ( looping ) {
    clip.loop( clip.LOOP_CONTINUOUSLY );
    } else {
    clip.loop( 0 );

  • Fadeout iTunes when another sound application takes over

    I like to leave my itunes playing music in the backround while i browse the internet (facebook, youtube, ect...) is there a way to make itunes automatically fadeout music when another application uses sound (like playing a video on youtube).

    First off, I meant to title this "When switching spaces application window is not showing."
    Just in case anyone else runs into this problem or any other weirdness with switching between spaces, the answer seems to be trashing the com.apple.dock.plist file and then restarting the dock. The preferences file can evidentially get corrupted and create some problems. Spaces does not have it's own plist file but stores it's data in the dock's plist file. Be warned that this will reset all of your dock preferences including which apps you have on the dock.
    Mark

  • Vibration & sound applications features in iOS 4.3.3

    Hi all, I have iOS 4.3.3 in my iphone and in some apps (for example whatsapp) I can't put vibration without sound when the phone is with sound. I have turned vibration options in phone and applications.
    Further, when I changed different options of applications notifications, the phone has not returned to vibrate or sound with new notifications
    Thanks for your help
    Regards

    It reads very clearly 'THE MULTITASLKING USER INTERFACE'... When Steve Jobs presented it, the slideshow read very clearly MULTITASKING.
    Not being clever. Just calling it what it is - as Apple do - repeatedly. Something you should try doing, instead of confusing people calling it something it isn't.
    Multitasking is the FEATURE of the phone.
    The *Recently Used Apps* list is the USER INTERFACE element that has some control over the multitasking feature.
    It's not called a multitasking tray because not every App in there is multitasking, or even running. Calling it a "multitasking" whatever is what gives many people the impression that everything there is multitasking.
    Why do you think Apple themselves call it the Recently Used Apps list in their documentation?

  • JAVA SOUND APPLICATION not applet.....help needed.....cheers

    hey there people heres the deal I need to complete this before 5 today but im completely stumped...we have to make a sound file player with a swing interface I have it playing(kind of!) but where now...I would be forever in your debt as my masters degree hangs in the balance! de de duhhhh! cheers
    iT WORKS ALRIGHT JUST NEED STOP PAUSE BUTTON FUNCTION..........
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.event.*;
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.*;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Clip;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineEvent;
    import javax.sound.sampled.LineListener;
    import javax.sound.sampled.LineUnavailableException;
    public class AudioPlayer extends JFrame implements ActionListener, ChangeListener{
    boolean playing;
    boolean looping;
    String filename = File.separator+"tmp";
    File selFile;
    Clip clip;
    JFileChooser fc = new JFileChooser();
    JButton btnOpen = new JButton("Open");
    JButton btnPlay = new JButton("Play");
    JButton btnStop = new JButton("Stop");
    JButton btnPause = new JButton("Pause");
    JButton btnLoop = new JButton("Loop");
    JSlider volume = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
    JSlider panning = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
    public AudioPlayer(){
    Container contentPane = getContentPane();
    contentPane.setLayout(new FlowLayout());
    contentPane.add(btnOpen);btnPlay.addActionListener(this);
    contentPane.add(btnPlay);btnPlay.addActionListener(this);
    contentPane.add(btnStop);btnStop.addActionListener(this);
    contentPane.add(btnPause);btnPause.addActionListener(this);
    contentPane.add(btnLoop);btnLoop.addActionListener(this);
    // Show open dialog; this method does not return until the dialog is closed
    fc.showOpenDialog(this);
    selFile = fc.getSelectedFile();
    volume.addChangeListener(this);
    panning.addChangeListener(this);
    volume.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    volume.setPaintTicks(true);volume.setPaintLabels(true);
    volume.setMajorTickSpacing(20);volume.setMinorTickSpacing(10);
    contentPane.add(volume);
    panning.putClientProperty("JSlider.isFilled", Boolean.TRUE);
    panning.setPaintTicks(true);panning.setPaintLabels(true);
    panning.setMajorTickSpacing(20);panning.setMinorTickSpacing(10);
    contentPane.add(panning);
    addWindowListener(
    new WindowAdapter () {
    public void windowClosing(WindowEvent e){
    setVisible(false);
    public void actionPerformed(ActionEvent e){
    int returnVal = JFileChooser.APPROVE_OPTION;
    //Handle open file action.
    if (e.getSource() == btnOpen)
    System.out.println("FA1");
    returnVal = fc.showOpenDialog(AudioPlayer.this);
    if (returnVal == JFileChooser.APPROVE_OPTION)
    { selFile = fc.getSelectedFile();
    //This is where a real application would open the file.
    else
    if(e.getSource() == btnPlay)
    playAudio();
    public void stateChanged(ChangeEvent e)
    public static void main(String[] args)
    AudioPlayer audioPlayer = new AudioPlayer();
    audioPlayer.setSize(400,400);
    audioPlayer.show();
    public void playAudio ()
    playing = true;
    AudioInputStream audiosource = null;
    try
    audiosource = AudioSystem.getAudioInputStream(selFile);
    System.out.println("here");
    //System.out.println(audiosource.getFormat());
    DataLine.Info dataLineInfo = new DataLine.Info(Clip.class,audiosource.getFormat());
    clip = (Clip)AudioSystem.getLine(dataLineInfo);
    clip.open(audiosource);
    catch (UnsupportedAudioFileException e)
    catch (LineUnavailableException e)
    catch (IOException e)
    //catch (Exception e) {}
    if (looping)
    clip.loop(clip.LOOP_CONTINUOUSLY);
    else
    clip.loop(0);
    playing = false;
    }

    You have not added the actionListener to all the button D'oh
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.event.*;
    import javax.sound.sampled.*;
    * Description of the Class
    *@author rsmazara
    *@created 28 February 2003
    public class AudioPlayer extends JFrame implements ActionListener, ChangeListener {
    File selFile;
    JFileChooser fc = new JFileChooser();
    JButton btnOpen = new JButton( "Open" );
    JButton btnPlay = new JButton( "Play >" );
    JButton btnStop = new JButton( "Stop" );
    JButton btnPause = new JButton( "Pause ||" );
    JCheckBox btnLoop = new JCheckBox( "Loop" );
    JSlider volume = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
    JSlider panning = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
    JLabel label = new JLabel( " " );
    public AudioPlayer() {
    Container contentPane = getContentPane();
    contentPane.setLayout( new FlowLayout() );
    btnOpen.addActionListener( this );
    contentPane.add( btnOpen );
    btnPlay.addActionListener( this );
    contentPane.add( btnPlay );
    btnPlay.addActionListener( this );
    contentPane.add( btnStop );
    btnStop.addActionListener( this );
    contentPane.add( btnPause );
    btnPause.addActionListener( this );
    contentPane.add( btnLoop );
    btnLoop.addActionListener( this );
    btnPlay.setEnabled( false );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    // Show open dialog; this method does not return until the dialog is closed
    // fc.showOpenDialog( this );
    // selFile = fc.getSelectedFile();
    volume.addChangeListener( this );
    panning.addChangeListener( this );
    volume.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
    volume.setPaintTicks( true );
    volume.setPaintLabels( true );
    volume.setMajorTickSpacing( 20 );
    volume.setMinorTickSpacing( 10 );
    contentPane.add( volume );
    panning.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
    panning.setPaintTicks( true );
    panning.setPaintLabels( true );
    panning.setMajorTickSpacing( 20 );
    panning.setMinorTickSpacing( 10 );
    contentPane.add( panning );
    contentPane.add( label );
    addWindowListener(
    new WindowAdapter() {
    public void windowClosing( WindowEvent e ) {
    setVisible( false );
    System.exit( -100 );
    public void actionPerformed( ActionEvent e ) {
    int returnVal = JFileChooser.APPROVE_OPTION;
    //Handle open file action.
    System.out.println( e.getActionCommand() );
    ///open
    if ( e.getSource() == btnOpen ) {
    System.out.println( "FA1" );
    returnVal = fc.showOpenDialog( AudioPlayer.this );
    if ( returnVal == JFileChooser.APPROVE_OPTION ) {
    selFile = fc.getSelectedFile();
    player = new Player( selFile );
    label.setText( "File loaded : " + selFile.getAbsolutePath() );
    btnPlay.setEnabled( true );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    //This is where a real application would open the file.
    } else {
    //play
    if ( e.getSource() == btnPlay ) {
    player.go( btnLoop.isSelected() );
    btnPlay.setEnabled( false );
    btnStop.setEnabled( true );
    btnPause.setEnabled( true );
    // playAudio();
    // pause
    if ( e.getSource() == btnPause ) {
    player.pause();
    btnPlay.setEnabled( true );
    btnStop.setEnabled( true );
    btnPause.setEnabled( false );
    if ( e.getSource() == btnStop ) {
    player.finish();
    btnPlay.setEnabled( true );
    btnStop.setEnabled( false );
    btnPause.setEnabled( false );
    public void stateChanged( ChangeEvent e ) {
    private Player player = null;
    public static void main( String[] args ) {
    AudioPlayer audioPlayer = new AudioPlayer();
    audioPlayer.setSize( 400, 400 );
    audioPlayer.show();
    * Description of the Class
    *@author rsmazara
    *@created 28 February 2003
    class Player {
    Clip clip;
    private java.io.File selectedFile = null;
    private boolean looping = false;
    public Player( File file ) {
    selectedFile = file;
    AudioInputStream audiosource = null;
    try {
    audiosource = AudioSystem.getAudioInputStream( selectedFile );
    System.out.println( "here" );
    //System.out.println(audiosource.getFormat());
    DataLine.Info dataLineInfo = new DataLine.Info( Clip.class, audiosource.getFormat() );
    clip = ( Clip ) AudioSystem.getLine( dataLineInfo );
    clip.open( audiosource );
    } catch ( UnsupportedAudioFileException e1 ) {
    e1.printStackTrace();
    } catch ( LineUnavailableException e2 ) {
    e2.printStackTrace();
    } catch ( IOException e3 ) {
    e3.printStackTrace();
    private boolean work = false;
    public void go( boolean loop ) {
    looping = loop;
    playAudio();
    public void finish() {
    clip.stop();
    public boolean isWorking() {
    return clip.isRunning();
    long pausePosition = ( long ) 0;
    public void pause() {
    pausePosition = clip.getMicrosecondPosition();
    clip.stop();
    public void restart() {
    clip.setMicrosecondPosition( pausePosition );
    playAudio();
    public void loop( boolean loop ) {
    looping = loop;
    private void playAudio() {
    if ( looping ) {
    clip.loop( clip.LOOP_CONTINUOUSLY );
    } else {
    clip.loop( 0 );

  • (Solved) one sound application at a time

    hello,archers! I moved from gnome to Kde(at last) and faced the issue. E.G if amarok plays musik there's no system notifications and smplayer plays no sound t.i only one programm can use alsa at a time. I have latest kde, alsa and gstreamer and xine backends for phonon. alsamixer shows everything's ok. What should  I do? thnx.
    Last edited by off220 (2011-01-15 10:30:01)

    Ok. I've been able to solve the problem by creating /home/user/.asoundrc file with this content
    pcm.softvolPhonon {           
        type softvol             
        slave.pcm "default:CARD=0"
        control {                 
            name "Phonon"         
            card 0               
        min_dB -51.0             
        max_dB 0.0               
        resolution 100           
        hint {                   
            show on               
            description "My Soundcard with extra Volume Control"
    Then I just choose Phonon as the mail output in sound preferences. Solved.

  • Why won't my .wav files show up in a 3rd party sound application after being exported as an omf file

    Hi all, I've searched everywhere and can't find an answer, so hopefully someone out there will have mercy and help me!
    I have Canon 7D footage (h.264 codec) and H4N Zoom audio (24bit 48khz .wav files) loaded into Premiere Pro CS 5. Editing on a Macbook Pro OS 10.6.8.  I haven't added timecode. 
    My workflow, which I've done successfully several times in the past, is to sync the footage by creating individual sequences for each take (usually interview takes) and then bring in the audio and video and manually line/sync them up.  I then link the two clips. 
    I then create a new sequence for my edit and then cut parts of the previously synced clips and then paste them into the sequence and edit away.  After locking I export an omf (48khz, 24 bit, files as separate audio, aiff files, with 24frame handles).  Then I import the OMF into Soundtrack Pro.
    However this time, the majority of the sound clips do not show up in Soundtrack Pro timeline even though they are present in the omf folder as Aiff files.  Normally you would think this was an issue with Soundtrack Pro, however one audio file did show up in Soundtrack Pro, but it was a sound file I had not linked to a video clip.  Upon further investigation I found that that the audio clip that was not synced retained it's STE-014.wav name in the Premiere timeline.  All the other audio I had synced to video had somehow taken on the video clip's MVI 0075 name.
    I checked my old projects (the ones that I successfully exported to OMF) and even when I synced the audio and video, the audio retained it's STE.wav name. I don't know why the names changed; I did a test in my current project by cutting and pasting a synced clip at the end of the edit timeline and the audio retained it's  STE.wav name.  See pic.
    After further tests, if the audio retains it's STE name it shows up in Soundtrack Pro (and Soundbooth as well), if it takes on the video MVI name it doesn't.  I've tried exporting as an AAF and a Final Cut Pro XML file and it still doesn't work.  I've tried unlinking and relinking the clips as well as making the audio offline and then relinking but still nada.  I also cleaned the media cache to no avail.
    If I render and replace the audio in the edit timeline, the name doesn't change, but the audio file does show up in Soundtrack Pro and Soundbooth, but unfortunately I need handles to edit the sound so this doesn't help me much. 
    Any ideas?  and thanks!

    Yes, it has always worked in the past.  The past projects audio clips do not change names.  I obviously did something different in this current project, but unfortunately I have no idea what.

  • Logic/live sound application?

    Hello again. OK..I have this idea of using my pre-recorded Logic projects to enhance the sound of my live ensemble. (just some added percussion. Maybe some keyboard parts) I'm thinking I'll need a headphone mix for the drummer with click info. Then, be able to monitor out tracks to external sound system for mixing with the live musicians.  I would like to be able to do all this with my MacBook Pro for portability reasons.
    Where do I begin? Is this idea even doable?  Thanks....

    Hi
    Depending on your needs, this should be relatively simple to set up:
    Logic project with separate audio click outputs via a multi-output andio interface, possibly using separate additional feeds to Front of House main PA, and/or your own monitoring system. Each project could be as simple as audio file bounces of each tunes' parts/stems.
    You may also want to check out Mainstage, which may be perfect for this sort of scenario:
    http://www.apple.com/logicpro/mainstage/
    CCT

  • Need help on Java in sound application

    A good day to everyone here,
    I need help on using Java.My project is mainly manipulating WAV sound files with Java. There is some problem.I hope you all can help me. I couldn't find much info about Java in sound manipulating,sample coding or something like that. I need to find the command to
    1) Find each sampling point value in a sound file.
    2) Find the number of sampling point and the average value of the all the sampling point.
    3) Record the sound file in a different bit rate format.
    I dont know how to go about it.I really hope you all can help me, or direct me to any resources that may help me. Your help is very much appreciated.
    Thank you very much....

    i found this coding in a website n i not very sure that i understand it.
    can anyone tell me if i can find the sample point value of a sound file with this coding (byte[] source is byte array of the sound file).
    thanks...for all the help
    public byte[] executeAmplitudeTransformationInternal(byte[]
    source)
    int[] sampleArray = getSampleArray(source);
    int[] newSampleArray = executeTransformation(sampleArray);
    //convert 16 bit samples back to 8 bit byte[]
    return getByteArray(newSampleArray);
    public int[] getSampleArray(byte[] eightBitByteArray) {
    //create an array 1/2 the size (since every 2
    //8bit samples makes 1 16bit sample)
    int[] toReturn = new int[eightBitByteArray.length];
    int index = 0;
    for (int t = 0; t < eightBitByteArray.length; t += 2) {
    //read the high bit
    int low = (int) eightBitByteArray[t];
    //read the low bit
    int high = (int) eightBitByteArray[t + 1];
    //bit shift the high bit 8 bits to the left and
    // "And" the low bit against 255 to drop any
    //sign extended data in the top 8 bits.
    //refer to the tutorial for more clarification
    toReturn[index] = (high << 8) (low & 0x00ff);
    index++;
    return toReturn;
    public byte[] getByteArray(int[] sampleArray) {
    //create a new byte[] twice as big as the sample array
    //because it takes two 8-bit bytes to represent one
    //16-bit sample
    byte[] toReturn = new byte[sampleArray.length * 2];
    int index = 0;
    for (int t = 0; t < sampleArray.length; t++) {
    int sample = sampleArray[t];
    //this places the low byte in the array.
    //the downcasting automatically lops off the high byte
    toReturn[index] = (byte) sample;
    index++;
    //this byte shifts the sample 8 bits to the right
    //this puts the old high byte in the position of the low byte.
    //this way the high byte remains after the downcasating from
    //an int to a byte
    toReturn[index] = (byte) (sample >> 8);
    index++;
    return toReturn;
    public int[] executeTransformation(int[] sampleArray) {
    //create a clone sample array
    int[] newSampleArray = new int[sampleArray.length];
    //apply algo to each sample
    for (int t = 0; t < sampleArray.length; t++) {
    int result = (int) (sampleArray[t] );
    //add the sample
    newSampleArray[t] = result;
    return newSampleArray;

  • Re: MMAPI sound application

    First, you must check that your phone supports this API. If it does, then you can write your app and you won't have to include anything in your JAR.
    Just compile and link against the mmapi api libs and you'll be set. Install the app on your device and you will be ready to go.

    my mail app freezes everytime I open it...
    Verify/repair your disk first (not just permissions), as described here:
    The Repair functions of Disk Utility: what's it all about?
    Now, try launching Mail under the following conditions:
    1. While holding the Shift key down until the main window appears.
    2. With no Internet connection.
    Does any of the above make a difference?

  • Assigning an application to different sound outputs

    Question: Is there a way to assign an application to use a sound output options in the mixer or another Win7 application?
    I have installed Win7 RC 32bit.  I have headphones and speaker outputs on my system.  Both are detected and both can be assigned to a working default sound choice.  I am unable to assign an applications sound output to a certain outputs or change them.
    The only way I can make a sound application work through the speakers if the headset is assigned the default role is to go into sound management, then assign the speakers to default and then restart my application.
    Desired: I would like an application profile to default to the assigned role from the mixer.  The settings could be permanent or temporary.  If the 1st choice is not available, use the alternate working or (default).  The sound should dynamically change or at the very least keep that profile with that application until changed.
    In the mixer, I should be able to rt click on the application in the mixer and manually assign it to a sound device.  This option should be assigned to a default target to play ONLY if the desired is not available.  Possible options can be, just one time, or have this device handle sound if available.
    Hardware:  Asus Rampage 2: Gene motherboard, 6GB Ram, GTX 275 graphics, Seagate 1.5TB.  Drivers auto discovered on install and appear to be functional.

    Hi TKCDAC,
    As you may noticed, great improvements have been made in Windows 7. Applications can realize Stream Routing via the new Core Audio APIs. Windows 7 has the ability to distinguish between communication devices and all other audio devices. It is now possible to have both a Default Communications Device that is separate from the Default Audio Device. The Default Communication Devices will be used for PC based communication like web chat or VOIP, and the Default Audio Device will be used for everything else. Stream switching enabled dynamic stream switching based on the default device. If the default audio device is disabled or unplugged, Windows automatically tries to determine the next default audio device and will dynamically redirect the audio to that new device.
    For instance, if you would like to play the audio via headphone when using communication applications such as Windows Live Messenger, we can simply right click the volume icon in the system tray, click Playback Devices, right click the headphone listed and then choose Set as default Communications Device.
    For more information, please refer to the following articles:
    http://msdn.microsoft.com/en-us/library/dd756612(VS.85).aspx
    http://louisgale.blogspot.com/2009/08/live-messenger-and-default.html
    Also, based on my test, certain application such as Windows Media Player has a sound output option. To change the settings, please open Windows Media Player, click Tools, Options, click Devices tab, double click Speakers in the Devices list, pull down the Select the audio device and then choose the device you would like to play the music from Windows Media Player, click OK. We may play another song in the play list to take effect.
    In the meantime, I will forward your suggestions to our Product Group. Please be assured that any improvements in the product are based on users' requirements.
    Thanks,
    Linda

  • Recording sound between applications.

    On my old G4 Mac running Tiger I used a free programme called Soundflower to record audio from any program into a recording app like Audacity or Garageband. Now I am using OS X Yosemite and Soundflower is not compatible. Is there a viable alternative? I looked on the App store and on-line, where there are alternatives, but after downloading them as trials they don't really work.
    Soundflower was perfect as a conduit to let me record sounds coming from the computer and I miss not having that ability for the work that I need to do.
    Many thanks.

    Your subject mentions switching between sound playback applications, but the details in your message only mention a problem occurring when you open/close the laptop screen. Tell us more about the sound application switching you mentioned.
    Did you perform a recovery because of this symptom, or did the symptom appear after you performed the recovery?  And are the videos that you're watching on DVD media or are you streaming them in a web browser.
    Jim

Maybe you are looking for

  • Tecra S10-176 - Can I install Windows 7 64bit?

    Hi to everyone, I am new to this forum. I have just bought a Tecra S10-176 with Vista Business 32 bit and I could upgrade to Windows 7 Professional 32 bit paying 29 euros. However, I am tempted to buy an OM licence for Windows 7 Professional at 64 bi

  • HT4623 hi,

    I am having a problem with my iphone 4s connecting to wifi networks and if it does, it keeps dropping network and can remain unconnected for hours.

  • Delivery document is not updated " update was terminated"

    Hi all, I have a problem with creating delivery order using vl01n. When i'm creating delivery it is successfully saved and system giving delivery number also but problem is when i'm opend my delivery using vlo2 sytem not displaying my delivery. And o

  • Can't see any thumbnails in iPhoto

    The only thumbnails I can see are those of phtotos I have just uploaded. However when I try to rebuild thumbnails even the ones I could see disappear. I have tried both thumbnail rebuild options, I have moved the slider. The photos are there but with

  • Os x lion facebook doesnt load right

    I just upgraded to OSX Lion and certain websites don't load correctly in FF 5.0.1. Facebook is one specific one, and it makes me sad because I have to use Safari to look at it..... Deadspin.com does not load correctly either, but only sometimes.. Ano