0

I wrote a program to start and stop a wav file in Java which will run on pi 3/b. The program works well in windows pc but it doesn't works good in pi (Raspbian Installed). It stops the audio clip after a second or two.

String filename = "cpu2x-jtfe7.wav";
clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(new File(filename)));
start.addActionListener(new ActionListener() {
            @Override

            public void actionPerformed(ActionEvent e) {                
                try {               
                        clip.start();
                } catch (Exception exc) {
                    exc.printStackTrace(System.out);
                }           
            }

        });
stop.addActionListener(new ActionListener() {

            @Override

            public void actionPerformed(ActionEvent e) {                

                clip.stop();                

            }

        });
  • 1
    i think that you are missing some info .... how do you start and stop the clip? – jsotola Jun 10 '18 at 23:27
  • @jsotola I have paste the code here.. You can take a look – Shafiqur Rahman Jun 11 '18 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.