PLAYING SOUND WITHOUT JApplet

Hi there,
I'm a new member in Java Developer forums, I hope that I'll be an effective member..
for now I need help with java sound , multimedia
I'm developing a program that part of it is to play array of sounds (Not JApplet) I tried to use the function AudioClip(getClass().getResources("soundName.wav"); but it works only with JApplet
I want to play the sound without JApplet
I found that there is a package called javax.swing.sound.*;
but syntax error occured in my program.. that this package does not exist..
Please help me..

I am also having the same problem. I couldn't get sound to work with the applet based one. I have the below code, it compiles and when you run the program it runs the length of the audio file but there is no sound? Is there something missing?
import sun.audio.*;    //import the sun.audio package
import java.io.*;
public class sound{
    public static void main (String args[])
          try
          InputStream in = new FileInputStream("cows2.au");
          AudioStream as = new AudioStream(in);
          AudioPlayer.player.start(as);
          AudioPlayer.player.stop(as);
          catch (Exception e)
               System.out.println("Failed");
} //end classMessage was edited by:
Lisa_g

Similar Messages

  • My iPhone wont play sound without headphones in

    My iPhone wont play any sound without headphones in the volume
    Buttons work but won't change sound my speaker won't play any sound at all

    i had the same problem and used a very small screwdriver, inserted carefully into the heaphone socket, to very gently push the microswitch at the bottom of the socket. i did this a couple of times and suddenly the sound works again.
    i think the button down there can get stuck and cause this problem, or maybe it was just a fluke... try it anyway- it worked for me!

  • My Macbook Pro (13-2010) cannot play sound without a headphone

    Hi all,
    I tried my best to solve this problem but cannot make it. Could anyone shed some light on it?
    My Macbook Pro (13-2010) can play sound well with a headphone, everything is OK. But when I unplug the headphone, it cannot play sound. The keys on the keyboard cannot adjust the sound. A sound adjustment sigh will appear on the screen, with a stop sign at the bottem of the full volumn bar. The volumn bar does not change when I tried to change it by function keys.
    It just happened several days ago and I do not know why.
    Thank you for your help.
    Best,
    Vincent

    hmm... I got it worked by plugging in the headphones and unplugging many times...
    I hope it helps if you have the same problem.

  • How to play sounds on Frames

    I'm been working with sounds on applets and is pretty easy play sounds and build funny stuff.
    But now i need to play sounds on a Frame (Application) and i realize that sounds can be load only on applets(so far thats what i know)
    If anyone knows how play sounds without an applet please let me know this is a huge issue for me.
    thanks in advance.
    Andrey

    See the following thread for a sample program:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=97984

  • No /dev/dsp, some programs failed to play sound

    I'm using chakra-2010.09 and there is no /dev/dsp after a default installation. Programs using phonon as backend (KDE's login music and the default music player, Bangarang) can play sound without problems. But others like vlc, flashplugin and wine cannot. Vlc just report errors about no /dev/dsp. How can this be fixed?
    Then I tried #modprobe snd_pcm_oss snd_mixer_oss snd_seq_oss, the module created /dev/dsp1. then I maked a soft link to /dev/dsp but vlc said "cannot open device /dev/dsp".
    I also tried using osspd and vlc can play sound now, but flashplugin and wine still have problems.
    Here are some of my system information:
    [admin@LenovoPC ~]$ cat /proc/asound/cards
    0 [Generic ]: HDA-Intel - HD-Audio Generic
    HD-Audio Generic at 0x90244000 irq 42
    1 [SB ]: HDA-Intel - HDA ATI SB
    HDA ATI SB at 0x90240000 irq 16
    [admin@LenovoPC ~]$ lsmod | grep snd
    snd_hda_codec_conexant 39073 1
    snd_hda_codec_hdmi 19967 1
    snd_hda_intel 19020 6
    snd_hda_codec 67097 3 snd_hda_codec_conexant,snd_hda_codec_hdmi,snd_hda_intel
    snd_hwdep 4812 1 snd_hda_codec
    snd_pcm 59717 4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
    snd_timer 15279 2 snd_pcm
    snd 43259 17 snd_hda_codec_conexant,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
    soundcore 4993 1 snd
    snd_page_alloc 5805 2 snd_hda_intel,snd_pcm

    RichSelian,
    It is our policy that we only support Arch Linux.  Please take this to http://chakra-project.org/bbs/

  • Lost Mode and Play Sound are "Pending."  However, iCloud indicates that it connected and backed up to iCloud at a date that is 1 week after it went missing.  How is this possible without locking (Lost Mode Pending an internet connection)

    Hi,
    My wife lost her iPhone two weeks ago while on vacation in London (cell service inoperative in foreign country).  Using Find My iPhone app on my device, I activated Lost Mode and Play Sound.  However, both are listed as "Pending," since it those actions require the phone to connect to the internet (wifi only due to no cellular data coverage.).
    We recently returned home and purchased a new iPhone.
    However, when looking to restore the apps/settings from her old phone using a previous iCloud backup, iCloud indicates that the old phone connected to iCloud and backed up the original phone at a date that is 1 week after it went missing.  How is this possible without locking (Lost Mode Pending an internet connection)?
    If the phone was activated and connected to the internet via a wifi signal, shouldn't it immedately lock, show up on the map, Play Sound, and send me an email that the phone has been found?
    I also read somewhere that if running iOS 7, the iCloud website interface enables you to track previous locations, for instance if the phone moves from wifi hotspot to hotspot.  Is that true?  If so, how do I do that?
    Thank you for your time, and have a great day!
    Sincerely,
    - Matt

    just giving this a wee bump as time is of the essence here and i need advice/ answers quick!
    apologies if i've broke any rules!
    alex

  • I was listening to music on my ipod shuffle when it went off.It hasn't turned on since then.When i connect it to the computer,the connection and disconection sounds play continuously without the ipod showing.What could be wrong or how can i get it to work

    I was listening to music on my ipod shuffle when it went off.It hasn't turned on since then.When i connect it to the computer,the connection and disconection sounds play continuously without the ipod showing.What could be wrong or how can i get it to work?

    Hello,
    I am currently an owner of an Ipod Touch 4th generation. I see you are having problems with your Ipod Touch, so I will try to find a solution to your problem.
    Hold down the Sleep/Wake and Home buttons for at least 10sec. or until Apple logo appears (Nothing will be lost, this is just a "Hard Reset")
    Hope that helps!
    If none of the above solutions work, can you please respond back ASAP as I will try to find another solution to your problem (This might even help others with the same problem!)
    Cheers!
    Pizza98704

  • After updating to 12.1.2.27, songs play, but without any sound output to internal iMac speakers

    So i updated to 12.1.2.27 and songs 'play', but without any sound output. Checked my audio settings and had it at Internal speakers. Checked the speakers (they work, at least for YouTube vids), restarted machine, etc and no audio output from iTunes. Any suggestions? Am I missing something?
    Thanks in advance

    Try unchecking Sound Enhancer and Sound Check in your Preferences under Playback
    Sound check may have reduced everything to a low output level inadvertently.

  • Facebook videos play back without sound

    When I click on a video within Facebook, the video plays back without audio.
    I have a 16gb iPad with retina display. 
    This happens on all videos within
    Facebook and continues despite several updates to Facebook.
    I am running iOS 7.0.4
    Help please

    Hello acarrejo,
    It sounds like the Facebook app on your iPad is not playing audio.  I recommend following the steps in the article below for an issue like this (you can skip step 3 since it is not related to this issue):
    iOS: Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/TS1702
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Stream sound without playing it outloud

    Is there a way to stream music through FME without the sound being played through the streaming computer's speakers?  I've got it set up with Window's Stereo Mix, so it does play sound, but in order for the sound to be played through the stream it has to be turned up on the computer I'm streaming from.  Is there a way to get the sound turned off on my computer but still allow it to be heard through the stream?
    If it helps, it's a laptop so I can't just turn the sound off.  A low-tech solution might be to simply put a stereo jack that leads to nothing in the laptop but that seems crude...

    The tick counter has a resolution of 1 ms.  Resolution, accuracy, and the responsiveness of the OS are three different things.  The issue is that OS latency can be 10s of milliseconds or occasionally longer.  If the OS decides to index the hard drive between the time you read the tick count and send the start audio command, your tone could be quite late. Sending the TTL pulse is a third call to the OS.  So you have two latency times for each trial. Unless you have a real-time operating system, this latency issue will introduce randomness into your data.
    Try sending TTL pulses of 50 ms duration every 200 ms, software timed, for a few minutes and look at the variation in the edge timing.  Then try it again with tones thrown into the mix and see if the variation changes. 
    That is where hardware timing and synchronization pays off. 
    Lynn 

  • How do you open/play a .wav file (music file) without play sound file .vi

    I am having big problems to create a music background for my project. I am newbie using labview and maybe my questions is not so dificult to solve (I hope so)
    I was using play sound file vi but the problem is that I dont want the music file start automatically. I wanna control the start time using a button. I tried include a sound output stop but when the app start and I add more wav files in my vi, the sound file start, then stop abruptally because the stop vi and the everything is normal. I would like to eliminate that error.
    Someone have any idea, maybe using open file or another way. 
    Thanks in advance
    I add a screenshot of my vi and also the vi in this post
    Attachments:
    test sound.vi ‏11 KB

    I leave an example that can provide, use it in your program
    Atom
    Certified LabVIEW Associate Developer
    Attachments:
    playsound.zip ‏58 KB

  • My iphone 4s just randomly stopped playing sounds or any audio without the use of headphone

    Phone will just not play sounds not matter what quick fix i try unless i am using siri which seems to work

    Thanks, I tried that. However, this is what I did and what worked!! I saw this technique on a previous message on this site.
    I blew air into the headphone output with a camera cleaning blowy bulb, and put in my headphones, turned them around, and pulled them out  several times.
    My headphone output my have been compromised with dust or dirt !
    Thank you again for your reply.
    PS I called Apple support and the fellow had no idea how to fix this.

  • Help with playing sound in applications

    im new to java and i was practicing playing sound in a swing application but the problem is that when i press the play button no sound is played...here is my code
    import javax.swing.*;
    import java.applet.AudioClip;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.io.File;
    public class JukeBox extends JFrame {
        private JLabel label;
        private JPanel panel, buttonPanel;
        private JComboBox playList;
        private JButton play, stop;
        private URL url1, url2, url3, url4, url5, url6;
        private AudioClip[] musicList;
        private AudioClip current ;
        public JukeBox() {
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setSize(500, 120);
            setLocation(50, 50);
            setTitle("JAVA JukeBox");
            url1 = url2 = url3 = url4 = url5 = url6 = null;
            current = null;
            try {
                url1 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\bottle-open.wav");
                url2 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\BP2.mp3");
                url3 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\fhm.aiff");
                url4 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\jungle.rmf");
                url5 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\spacemusic.au");
                url6 = new URL("file", "localhost", "C:\\Documents and Settings\\KADA\\IdeaProjects\\Sound\\trippygaia.mid");
            } catch (MalformedURLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            musicList = new AudioClip[7];
            musicList[0] = null;
            musicList[1] = JApplet.newAudioClip(url1);
            musicList[2] = JApplet.newAudioClip(url2);
            musicList[3] = JApplet.newAudioClip(url3);
            musicList[4] = JApplet.newAudioClip(url4);
            musicList[5] = JApplet.newAudioClip(url5);
            musicList[6] = JApplet.newAudioClip(url6);
            label = new JLabel("JAVA JukeBox", JLabel.CENTER);
            String[] musicList = {"select a track..."
                    , "bottle open"
                    , "bitch please II"
                    , "flutte, harmonica, mambo"
                    , "jungle"
                    , "spacemusic"
                    , "trippygaia"};
            playList = new JComboBox(musicList);
            playList.addActionListener(new ListListener());
            play = new JButton("Play");
            play.setActionCommand("play");
            play.addActionListener(new ButtonListener());
            stop = new JButton("Stop");
            stop.addActionListener(new ButtonListener());
            buttonPanel = new JPanel();
            buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
            buttonPanel.add(play);
            buttonPanel.add(stop);
            panel = new JPanel();
            panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
            panel.add(label);
            panel.add(Box.createRigidArea(new Dimension(0, 5)));
            panel.add(playList);
            panel.add(Box.createRigidArea(new Dimension(0, 5)));
            panel.add(buttonPanel);
            getContentPane().add(panel);
        private class ButtonListener implements ActionListener {
            public void actionPerformed(ActionEvent e) {
                if(current != null){
                    current.stop();
                if(e.getActionCommand().equalsIgnoreCase("play")){
                    if(current != null){
                        current.play();
        private class ListListener implements ActionListener {
            public void actionPerformed(ActionEvent e) {
                if (current != null) {
                    current.stop();
                current = musicList[playList.getSelectedIndex()];
        public static void main(String[] args) {
            setDefaultLookAndFeelDecorated(true);
            JukeBox jb = new JukeBox();
            jb.setVisible(true);
            jb.setResizable(false);
    }can u please tell me whats wrong with my code coz i cant hear no sound when i press the play button and can u please tell me why i cant simply put the file name in the URL instead of the complete path although the files are in the same directory of the source code and can i play mp3 using this little program ???
    plz help...im a newbie so plz explain as much as u can...

    After
    musicList = new AudioClip[7];
            musicList[0] = null;
            musicList[1] = JApplet.newAudioClip(url1);
            musicList[2] = JApplet.newAudioClip(url2);
            musicList[3] = JApplet.newAudioClip(url3);
            musicList[4] = JApplet.newAudioClip(url4);
            musicList[5] = JApplet.newAudioClip(url5);
            musicList[6] = JApplet.newAudioClip(url6);initialise the variable current with
    current = musicList[1];or similar because the AudioClip current always == null in your code so your listener blocks don`t execute.
    regards

  • After the Ios 6 update, I have lost my Sound for Music, Tweets. i have restored the phone, tried adjusting the settings, and even have Docked and undocked the Iphone 4S, thinking it might be in Dock mode. Headphones work, Dock plays Sounds. Ideas?

    Lost Sound after Ios Upgrade to 6.0.1. All worked before upgrade. Has to be a problem with Software upgrade.
    Tried adjusting Settings. Same Problem
    Tried restoring Phone. Same Problem
    Read some Forums. Tried suggestions such as buying an Song from ITUNES, Docking and undocking Device. Same Problem
    Ideas?
    Sound will be heard  when Docked or through Headphones. Even Volume Bar doesn't appear either when playing music without Headphones or being docked.
    Similar to others, this phone worked 100% prior to the Upgrade to Ios 6.0.1

    Do you have the mute switch engaged? It's the little slider over the volume buttons on the side. If you can see orange, it's engaged. Slide it the other way.

  • My ipod 5 was stolen but I have find my ipod installed on it but my ipod isn't/never was connected to a wifi network when it was stolen so how will my ipod play sound or go on lost mode and if there's no wifi connected to it?

    my ipod 5 was just recently stolen in a waterpark (same with my best friend) and when i went on to find my ipod I pressed play sound and lost mode but it never successfully did all those things because my ipod wasn't or isn't connected to a wifi network as it says in the app. so how will I ever find my ipod if it never is going to connect to a wifi network without the thief accessing my ipod (I have a passcode). and also when I check the app once in a while it says ipod is online but cannot find location, so does that mean the thief is using my ipod or is trying to get in?

    Yo are correct. It has to connect to internet for the FindMyiPhne features to be transmitted to the iPod
    lost/stolen                                     
    No app on the iPod is required.                           
    - If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected, on a computer browser go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up or conbtinue to show off-line.
    - You can also wipe/erase the iPod and have the iPod play a sound via iCloud.
    iCloud: Erase your device
    iCloud: Use Lost Mode
    - If not shown, then you will have to use the old fashioned way, like if you lost a wallet or purse.
    - Change the passwords for all accounts used on the iPod and report to police
    - There is no way to prevent someone from restoring the iPod (it erases it) using it unless you had iOS 7 on the device. With iOS 7, one has to enter the Apple ID and password to restore the device.
    - Apple will do nothing without a court order                                               
    Reporting a lost or stolen Apple product                                              
    - iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number

Maybe you are looking for