How to play sound in servlet program

How to play sound when a page is gernerated? Thank you for any suggestion.

Why would you want to do that? Remember that the servlet runs on the web server, which is probably in a room full of computers. Nobody will be there to hear it, and if somebody does hear it they will just think it is a problem.
Perhaps you wanted to play a sound when the page is loaded in the browser? That's an HTML/Javascript/browser question that might get an answer in a forum about those topics.

Similar Messages

  • How do we run a servlet program in eclipse

    how do we run a servlet program in eclipse.

    Not at all, because servlets require a servlet container. Some Eclipse plugins (Lomboz etc.) do provide integration with those.

  • 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

  • How to play sound after clicking on an object?

    Can anyone explain me how to play a sound in java when I click on a particular object? I have read lots of threads but couldn't find anything. All I want is a short sound(3,4 seconds) to be played each time I click on an object. I know I need to use Sound API but I cannot find anything helpful
    Thanks in advance

    flounder wrote:
    ProGenius wrote:
    I have read lots of threads but couldn't find anything.
    [I found lots of info|http://lmgtfy.com/?q=java+audioclip]
    that is knowing you can use audioclip. Even searching for "java sound tutorial" gives many good resources, including the sun trail:
    http://java.sun.com/docs/books/tutorial/sound/index.html

  • How to play sound in midlet midp1.0

    how to play a sound (wav format) in midp1.0?
    help needed regarding nokia api.

    well i think ur specified location might be wrong.
    also check out some other ways:
    i hope this might help u.
    1.
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import javax.microedition.media.control.*;
    import java.io.*;
    import java.util.*;
    public class mainsound {
    public Player player;
    public mainsound(String s){
    try{
    InputStream is = getClass().getResourceAsStream(s);
    player = Manager.createPlayer(is,"audio/AMR");
    player.addPlayerListener(new Listener());
    player.prefetch();
    catch(Exception e){System.out.println("Media Error" + e);}
    class Listener implements PlayerListener {
         public void playerUpdate(Player p, String event, Object eventData) {
              if (event == END_OF_MEDIA) {
              try {
              p.start();
              } catch (MediaException me) { }
    2.
    public void soundview()
    byte abyte0[]=a("024A3A45D0040029286185985504D04D06186987107107106185985504D0450710690610610000");
    Sound sound = new Sound(abyte0, 1);
    sound.init(abyte0, 1);
    sound.play(1);
    public static byte[] a(String s1)
    s1.toUpperCase();
    byte abyte0[] = new byte[s1.length() / 2];
    int i1 = 0;
    int j1 = 0;
    for(int l1 = s1.length() / 2; l1 > 0; l1--)
    int k1;
    if(s1.charAt(j1) >= '0' && s1.charAt(j1) <= '9')
    k1 = s1.charAt(j1) - 48;
    else
    k1 = (s1.charAt(j1) - 65) + 10;
    k1 *= 16;
    if(s1.charAt(j1 + 1) >= '0' && s1.charAt(j1 + 1) <= '9')
    k1 += s1.charAt(j1 + 1) - 48;
    else
    k1 += (s1.charAt(j1 + 1) - 65) + 10;
    abyte0[i1] = (byte)k1;
    j1 += 2;
    i1++;
    return abyte0;

  • How to compile and Run servlet Program

    Hi,
    pls help me the following doubt
    i am using Tomacat 4.1 server.
    1. Where is save Servlet program?
    2. How to set classpath?
    3. how compile and run?
    bye
    Mathi

    1. Where is save Servlet program?
    2. How to set classpath?
    3. how compile and run?
    http://www.coreservlets.com

  • How to play sound when a form is opened

    Hi ,
    I do have a problem in playing sound, by getting values from a properties file.
    The property file has values
    tone1PitchkHz=1.2
    tone1DurationSec=0.1
    tone1SeparationSec=0.1
    tone1VolumePct=80Using these values I want to play a sound when I open a form.I tried few methods but not successful. Can anyone help

    Google is your friend.
    [http://www.cs.princeton.edu/introcs/15inout/StdAudio.java.html]
    [http://www.cs.princeton.edu/introcs/21function/Tone.java.html]
    db
    edit And what does this have to do with Swing anyway?
    Edited by: Darryl.Burke

  • Can't play sound from multiple programs

    So I have this new shiny box running Arch64 with a ASRock N68-S motherboard. I installed alsa and I am able to play music just fine using amarok or mpd. However, when I try playing two sounds at once, there is a short pause and the first program becomes silent, and then the second kicks in.
    According to the wiki, dmix should work automatically with this version of alsa. I tried seting up dmix "the old way" using /etc/asound.conf (hey, you never know) but no luck either.
    Lspci lists my card as
    00:05.0 Audio device: nVidia Corporation MCP61 High Definition Audio (rev a2)
    I figured this was a bit vague and went to the manufacturer's site and found out the actual name is
    5.1 CH Windows® Vista™ Premium Level HD Audio (Realtek ALC662 / VIA® VT1708S / VT1705 Audio Codec)
    The Alsa wiki suggests to test dmix using these instructions but this simple test fails miserably, alsaplayer windows show up and complain "no stream found". So it seems and one of the unlucky few for which dmix doesn't just work.
    However, OSS4 works with hardly no setup. But I just don't want to use it since most applications aren't OSS-aware, there is no KDE integration and so on.
    What sould I do? I'd happy to report a bug upstream if necessary but I realised audio in Linux is way more complicated than previously thought and I'd rather make sure I haven't over looked something. I'm so confused I can't tell what my actual soundcard vendor is: nVidia, Realtek or Via?
    edit: oh and of course, nothing of interest in /var/log/everything.log
    Thanks!
    Last edited by eldalion (2010-02-21 17:28:53)

    eldalion wrote:I tried seting up dmix "the old way" using /etc/asound.conf (hey, you never know) but no luck either.
    Not necessary. ALSA supports dmix by default. Don't edit that file.
    Let me explain what's happening. mpd has a stupid default config, of using OSS rather than ALSA. And OSS screws up dmix.
    For example, my ~/.mpdconf is:
    music_directory "~/gnutella/downloads/Cool"
    playlist_directory "~/.mpd/playlists"
    db_file "~/.mpd/mpd.db"
    log_file "~/.mpd/mpd.log"
    error_file "~/.mpd/mpd.error"
    audio_output {
    type "alsa"
    name "Sound Card"
    options "dev=dmixer"
    device "plug:dmix"
    Try that, to prove to yourself that I'm right   Also use this good debugging command, from the same ALSA wiki entry (because I put it there):
    fuser -v /dev/snd/* /dev/dsp*
    eldalion wrote:What should I do?
    Step 1: File a bug with your distro, for the app (mpd) to default to ALSA instead of OSS. Defaulting to OSS these days is ridiculous - ALSA is the standard sound system in Linux, and that's not gonna change.
    Please do this. I'm not doing this, because I don't use Arch or mpd any more.
    Step 2: File a bug upstream, to default to ALSA instead of OSS.
    Edit: I notice that Ubuntu has the right idea:
    * Update mpd.conf from upstream
        - Configure an ALSA output by default
    Last edited by brebs (2010-02-23 07:56:16)

  • How to play sound input thru speakers

    Is there any way to play the audio stream coming in on the Line In port to the computer's speakers? It seems intuitively obvious that it should be possible and easy, but I can't find anything which enables it. I have the output volume at a reasonable level, and the "mute" controls in the Sounds control panel are not set. Still nothing!
    Thanks.

    I agree that it should be simple, but it is not. In Mac OS X, there is no setting to play-through the audio input to the audio output. You have to run some program, such as an audio recording application, and set that program to play-through the sound.
    Fortunately, if all you want is to play-through the sound, there is a simple little program that does just that one function. It's called LineIn.
    http://www.versiontracker.com/dyn/moreinfo/macosx/18987

  • How to play sound from a proprietary format

    I would like to convert a small java applet to flex as3
    The current applet connects  to a remote server to receive audio in a proprietry compressed and encrypted format using a tcp connection (the data is encoded as text)
    It then decrypts, decompresses the audio and uses java sound to play it.
    Looking at the as3 classes all I could find is a sound object that seems to only play mp3 audio and a urlrequest object that is used to download (what about streaming) mp3 audio from a server.
    I am looking for a simple sample that will incorporate retreving data from a server (perhaps using the http service) into e.g. a byte array, and playing pcm audio from a byte array.
    Ideally it would be a small set of files (1?) that I can compile using mxmlc; I am not good with IDEs, linux command line is my thing
    Thanks

    Maciek, many thanks!
    Here's sample code showing how to stream audio in arbitrary format and play it
    // File: Player.as
    // When running from local storage (during developement)
    // compile mxmlc -use-network=false Player.as
    // otherwise loading the local raw audio file fails with error 2148
    // The input audio format is 16 bit little endian 44.1Khz mono.
    package
        import flash.display.Sprite;
        import flash.text.TextField;
        import flash.media.Sound;
        import flash.media.SoundChannel;
        import flash.events.Event;
        import flash.events.SampleDataEvent;
        import flash.net.URLRequest;
        import flash.net.URLStream;
        public class Player extends Sprite
            private var sourceUri:String = "audio.44.raw";
            private var sound:Sound = new Sound();
            private var soundChannel:SoundChannel = new SoundChannel();
            private var playing:Boolean;
            private var stream:URLStream;
            private var request:URLRequest;
            private var statusLine:TextField = new TextField();
            public function Player()
                statusLine.width = 400;
                statusLine.text = "Starting...";
                addChild(statusLine);
                getAudio();
                start();
            public function getAudio():void
                stream = new URLStream();
                request = new URLRequest(sourceUri);
                try {
                    stream.load(request);
                } catch (error:Error) {
                    statusLine.text = "Failed to load " + request.url + " : " + err!
            private function playCallback(event:SampleDataEvent):void
                var value:Number;
                var i:int, cnt:int;
                // Input is 16bit PCM, each sample occupies 2 bytes
                cnt = stream.bytesAvailable / 2;
                if (cnt >= 8192 || playing) {
                    playing = true;
                    statusLine.text = request.url + " : playing...";
                    if (cnt > 8192)
                        cnt = 8192;
                    for (i = 0; i < cnt; i++) {
                        // Convert 16bit little edndian pcm samples to numbers
                        value = stream.readUnsignedByte() + 256 * stream.readUnsign!
                        if (value > 32767)
                            value -= 65536;
                        value /= 10000; //Adjust the volume
                        // Input is mono, write to both channels
                        event.data.writeFloat(value);
                        event.data.writeFloat(value);
                    if (cnt < 2048)
                        statusLine.text = request.url + " : done...";              !
                else {
                    // Wait until enough data is bufferred
                    statusLine.text = request.url + " : buffering...";
                    for (i = 0; i < 8192; i++) {
                        event.data.writeFloat(0);
                        event.data.writeFloat(0);
            private function start():void
                soundChannel.stop();
                sound.removeEventListener(SampleDataEvent.SAMPLE_DATA,playCallback);
                playing = false;
                sound.addEventListener(SampleDataEvent.SAMPLE_DATA,playCallback);
                soundChannel = sound.play();

  • How to play sound file on HTML

    I have successfully able to record voice and save it into the database and replay it. Also able to store an external wave file and replay it using forms.
    I need to play the same soundfile from database on HTML using PL/SQL.
    Would appreciate if someone can support my problem. I need to know the package to read and play the database column storing sound.
    Thanks and Regards,
    Vipul

    Hi Vipul,
    Great to know that you could record a sound file and save it in Oracle and play it through Forms. We are having a similar requirment. Could you please list down the steps of exactly how did you achieve this ?
    It would be of great help to us if you can clear us the same. Thanks in Advance.
    Thanks,
    Karthik.

  • Final Cut/quicktime dont play sound while other programs do

    My video camera records MPGs onto its hard drive. I put these MPGs on a Mac and the videos are fine, but there is no sound when i play the videos in quicktime or final cut pro.
    If i play the MPGs in VLC, both the video and sound work on the Mac. When i play the MPGs on a PC, the sound/video work in every program.
    I had this problem once before, and someone nearby (i was in a computer lab) fixed the problem for me by clicking or unclicking some option.
    Please help - I want to edit the footage, but its hard without sound- thanks!

    the audio and video are "muxed" in these MPG's, Final Cut Pro does not work natively with this format.
    you need to "demux" the files and/or preferably, transcode to a more edit compliant codec.
    try the free MPEG Streamclip application which can do any of this for you

  • How to Play Sound on the Hour - not Voice

    I miss the ability I had in Classic to play a sound on the hour and half hour. In OSX, it seems that only having a voice announce the time is an option - unless I'm missing something.
    Does anyone know of a workaround? I hate the voice thing and would rather listen to a pleasant sound.
    Thanks in advance for any help offered.

    Install the recently released OS X version of Sounds4Fun (www.macupdate.com or www.versiontracker.com.) Once the premier OS 9 utility for assigning sounds to system actions including assigning sounds to the time (1/4, 1/2, 3/4, top.)
    Also can assign sounds to dozens of other actions.
    Why reward points?(Quoted from Discussions Terms of Use.)
    The reward system helps to increase community participation. When a community member gives you (or another member) a reward for providing helpful advice or a solution to their question, your accumulated points will increase your status level within the community.
    Members may reward you with 5 points if they deem that your reply is helpful and 10 points if you post a solution to their issue. Likewise, when you mark a reply as Helpful or Solved in your own created topic, you will be awarding the respondent with the same point values.

  • How to play sound in Palm?

    Hello, everyone. I'm a beginner of Palm Application by using J2ME.
    I cant play a sound or a simple tone (Java Sound) in a Palm Emulator...
    Does my emulator not up-to-date? Or do I need to do something before importing that *.prc file?
    Is there any good website I can get more info that?
    Pls.

    Palm does not do its own VM and Sun has not released a Palm VM in a long time.
    http://www.palmos.com/dev/tech/java/
    http://java.sun.com/products/midp4palm/
    In other words, you will probably have a buy a commercial VM that supports this.
    Note: Kada Systems was just aquired by Esmertec AG. Both of these vendors had emphasized remote access (typically for business), as opposed to multimedia.

  • How to play sound file in Forms 9i  using  PJC.

    Hi ,
    I want to play a sound file in Forms 9i over the web using "Pluggable Java Component". Any pointers / help in this regard will be highly appreciated.
    Thanks in Advance,
    Vinod.

    Vinod,
    just do a search on the Internet for a Java Bean and add this to Forms. However, if you don't necessarily require the sound to be played from within Forms, you could use web.show_document() to call it in a URL displayed in a hidden frame on the Forms HTML page. This way it would be the browser playing the sound (assuming a proper Plugin)
    web.show_document('http://server:port/myDir/mysound.wav','myHidden_frame')
    Frank

Maybe you are looking for

  • Some photos don't appear in the blog's main page

    All the entries in my blog include a photo and almost always a small version of the picture appears in the blog's main page. Sometimes the small picture does not appear, although it shows up in the individual entry containing the photo. You can see w

  • HT204053 Can multiple people use the same Apple ID for their own devices?

    Can multiple people use the same Apple ID for their own devices? I just set up my IPhone 4S (first time user) using the same Apple ID as my daughters and now we receive each others texts, do I need to set up my own Apple ID account?

  • Problem in J1IIN - CIN

    Dear All, While Saving Out Going Excise Invoice system gave me the error GL account has not been assigned for RG23CAT1 in customization Although, in DLFC i alreday maintained G/L in RG23C AT1 ..... Regards, Pardeep Malik

  • XPLITE ON ASUS EEE WONT INSTALL N81 DRIVERS

    I have been trying to set up my wifes n81 to act a modem for her asus eee. The asus eee is running on xplite(condensed windows xp.)When the phone is connected to the asus by usb cable it recognises it and seems to be trying to download drivers but ev

  • I CAN NOT open Iphoto with the new Mavericks????

    I can not open Iphoto with the new Mavericks, I changed Dutch for English but stil nothing ....