Trying a sound recording applet

Hi all.. I am developing an applet that records sound and stores it in a WAV file... The applet is signed and loads in the browser well but it does not give the output, i.e. the WAV file in the specified directory.
Can you please have a look at my code and tell me where Im going wrong?
     public void init()
          b1=new Button("Record");
          add(b1);
          b1.addActionListener(this);
          b2=new Button("Stop");
          add(b2);
          b2.addActionListener(this);
     public void run()
     public void start()
          try
          audioFile = new File(filename);
          audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,44100.0F, 16, 2, 4, 44100.0F, false);
          info = new DataLine.Info(TargetDataLine.class, audioFormat);
          targetType = AudioFileFormat.Type.WAVE;
               targetDataLine = (TargetDataLine)AudioSystem.getLine(info);
               targetDataLine.open(audioFormat);
          catch (LineUnavailableException e)
               msg="Exception occured"+e;
          repaint();
     public void actionPerformed(ActionEvent ae)
          String cmd=ae.getActionCommand();
          if(cmd.equals("Record"))
               try{
               virtual_line           = targetDataLine;
               virtual_audioInputStream= new AudioInputStream(virtual_line);
               virtual_targetType     = targetType;
               System.in.read();
               virtual_outputFile     = audioFile;
               virtual_line.start();
               AudioSystem.write(virtual_audioInputStream,virtual_targetType,virtual_outputFile);
               }catch(Exception e)
                    msg="Exception here"+e;
               msg="Recording..";
          if(cmd.equals("Stop"))
               virtual_line.stop();
               virtual_line.close();
               msg="Stopped";
          repaint();
     public void paint(Graphics g)
          g.drawString(msg,8,80);
}

how can i will play a .wav file in applet

Similar Messages

  • HT1414 When I record videos, there's no sound recorded. But I tried recording a voice memo, there is a voice/sound recorded. Mobile technicians said I need to restore the phone to factory settings. HELP :) thanks!

    When I record videos, there's no sound recorded. But I tried recording a voice memo, there is a voice/sound recorded. Mobile technicians said I need to restore the phone to factory settings. HELP thanks!

    When I record videos, there's no sound recorded. But I tried recording a voice memo, there is a voice/sound recorded. Mobile technicians said I need to restore the phone to factory settings. HELP thanks!

  • Sound recorder playback volume low ?

    I have a dv6000 notebook , for the first time ever I tried recording sound using windows movie maker  to add ''narration'' but the playback volume is very low .
    I tried the windows '' sound recorder '' and got the same result .
    I've been through all the standard adjustments and settings and have gone into  ' control panel ' and adjusted 'levels' and everything else with no success .
    When I record a video using the sound on my camera the volume is fine - it's just the mic sound that is low whether I use an external mic or the built in ones .  

    I have the same issue and I see no responses to your inquiry..  This Windows help menu leaves much to be desired.  Im sure I will one day figure out how to work this version that I had no clue I was buying bc it should come with a warning label..  its completely different and agonizing  and great help menu lovely.. Im sorry to be so negative  wish I could help.. Ill sit here all night till I figure it out and then post an option on how to adjust the recording volume.. Unreal..  

  • Sound Recorder Mac

    Where and how do you install Sound Recorder Mac on an Intel Mac running O.S. 10.5.8.
    I've downloaded it and it only shows part of the screen ie: record and save and they don't work. Or maybe there's a better, simpler application for recording old LPS. It has to be real simple because I'm 81 years old and not an expert either. Simple Sound on my old I-Mac
    was great. Thanks, lockeson

    Have you tried contacting the vendor for help?

  • Sound recording with duration

    hi all ,
        i have some trouble about sound recording function.
    i want to have 30S duration of sound input recording and also , if the user click the finish button
    the recording will be stopped even it is still have time for recording.
    i have tried to use loop with timer to take the data for 1 second period .but it will show the error
    is there any other method to perform this function ?
    Thank you

    i have tried to use loop with timer to take the data for 1 second period .but it will show the error
    is there any other method to perform this function ?
    You are on the correct track here using a while loop and reading data in say 1 seconds interval. But try to skip the timer. Let the sound card do the timing details for you. Also use a larger buffer size for the sound card. You set the buffer size by the "number of samples/ch" control in the Sound Input Configure VI. Set this value to be at least 2 to 5 times larger than the "number of samples/ch" value used in the Sound Input Read VI. My guess is that you have a sound card buffer overflow problem.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • How to add sound recorder in web pages?

    Hello everyone, can anyone help me on how to embed a sound recorder in my web page? I'm using Netbeans 6.5.1, Java Persistence technology, and Woodstock Components for the Web Application. I would like to add a recorder which can save audio files in MySQL, retrieve it and listen to it afterwards.
    I have no idea on how to or where to start, any help would be appreciated. Thanks.

    [http://www.jsresources.org/examples/]
    There are examples there for doing everything you're wanting to do.
    As for the JRE, no. That's a question for the generic applet forum, I've never once written an applet.
    But, start by writing an application that does what you want, and then convert that to be an applet. That's always the best approach... and you should also check to make sure there's not a set of media components for recording that's designed for use in applets (I know there are special applet media players, I'm just not sure about recorders...again, that's an applet forum question).
    Read the examples, consult the applet forum...if you end up with any specific JavaSound questions, I'll be more than happy to answer those. I just flat-out don't know much (anything) about applets.

  • Need Help with Sound Recording

    Hi,
    I'm a Comp. Sys. Eng. student in my final year and I've been trying to record sound with java for a couple of months now and its driving me stupid. I've looked around on just about every java source site I could find and have found many similar examples of sound recording, none seem to work on my machine. The problem is that I keep on getting either IOExceptions, or empty .wav files (as in the code below). The code included below is a shortened and modified version of some code I got from jsresources.org, the full link is http://www.jsresources.org/examples/AudioCommon.java.html.
    I have not had any experience with multimedia in java before.
    Can somebody please tell me what is wrong with this code? or is my java environment to blame?
    Am I declaring my AudioFormat correctly?
    Am I controlling my AudioInputStream correctly?
    I'm using JDK1.4 in eclipse. Any help would be greatly appreciated.
    * AudioCommon.java
    * This file is part of jsresources.org
    * Copyright (c) 1999 - 2001 by Matthias Pfisterer
    * All rights reserved.
    import java.io.File;
    import java.io.IOException;
    import javax.sound.sampled.AudioFileFormat;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.Line;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.Mixer;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.TargetDataLine;
    public class AudioCommon
         private static boolean          DEBUG = true;
         public static void main(String Args[]){
              AudioFormat audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
    44100.0F, 16, 2, 4, 44100.0F, false);
              TargetDataLine dataLine = getTargetDataLine("AK5370 ",
                        audioFormat,
                        5);
              File     outputFile = new File("C:\\testRecorder.wav");
              try{
                   outputFile.createNewFile();
              } catch(IOException ioe){
                   System.err.println("Couldn't create a new file: " + ioe);
              AudioFileFormat.Type     targetType = AudioFileFormat.Type.WAVE;
              SimpleAudioRecorder     recorder = new SimpleAudioRecorder(
                        dataLine,
                        targetType,
                        outputFile);
              out("Press ENTER to start the recording.");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              recorder.start();
              out("Recording...");
              long millis = System.currentTimeMillis();
              while(System.currentTimeMillis() < millis + 5000);
              recorder.stopRecording();
              out("Recording stopped.");
              if(outputFile.exists()){
                   System.out.println("File Exists.");
              } else {
                   System.err.println("File does not Exist.");
              System.exit(0);
         public static TargetDataLine getTargetDataLine(String strMixerName,
                                       AudioFormat audioFormat,
                                       int nBufferSize)
                   Asking for a line is a rather tricky thing.
                   We have to construct an Info object that specifies
                   the desired properties for the line.
                   First, we have to say which kind of line we want. The
                   possibilities are: SourceDataLine (for playback), Clip
                   (for repeated playback)     and TargetDataLine (for
                   recording).
                   Here, we want to do normal capture, so we ask for
                   a TargetDataLine.
                   Then, we have to pass an AudioFormat object, so that
                   the Line knows which format the data passed to it
                   will have.
                   Furthermore, we can give Java Sound a hint about how
                   big the internal buffer for the line should be. This
                   isn't used here, signaling that we
                   don't care about the exact size. Java Sound will use
                   some default value for the buffer size.
              TargetDataLine     targetDataLine = null;
              DataLine.Info     info = new DataLine.Info(TargetDataLine.class,
                                       audioFormat, nBufferSize);
              try
                   if (strMixerName != null)
                        Mixer.Info     mixerInfo = getMixerInfo(strMixerName);
                        if (mixerInfo == null)
                             out("AudioCommon.getTargetDataLine(): mixer not found: " + strMixerName);
                             return null;
                        Mixer     mixer = AudioSystem.getMixer(mixerInfo);
                        targetDataLine = (TargetDataLine) mixer.getLine(info);
                   else
                        if (DEBUG) { out("AudioCommon.getTargetDataLine(): using default mixer"); }
                        targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                   *     The line is there, but it is not yet ready to
                   *     receive audio data. We have to open the line.
                   if (DEBUG) { out("AudioCommon.getTargetDataLine(): opening line..."); }
                   targetDataLine.open(audioFormat, nBufferSize);
                   if (DEBUG) { out("AudioCommon.getTargetDataLine(): opened line"); }
              catch (LineUnavailableException e)
                   if (DEBUG) { e.printStackTrace(); }
              catch (Exception e)
                   if (DEBUG) { e.printStackTrace(); }
                   if (DEBUG) { out("AudioCommon.getTargetDataLine(): returning line: " + targetDataLine); }
              return targetDataLine;
    EOF<<<<<<<<<<<<<<<<import java.io.File;
    import javax.sound.sampled.*;
    class SimpleAudioRecorder extends Thread{
         private TargetDataLine          m_line;
         private AudioFileFormat.Type     m_targetType;
         private AudioInputStream     m_audioInputStream;
         private File               m_outputFile;
         public SimpleAudioRecorder(TargetDataLine line,
              AudioFileFormat.Type targetType,
              File file)
         m_line = line;
         m_audioInputStream = new AudioInputStream(line);
         m_targetType = targetType;
         m_outputFile = file;
         public void stopRecording(){
              m_line.stop();
              m_line.flush();
              m_line.close();
    EOF<<<<<<<<<<<<<<<<

    your asking the quest in the jmf forum and using some old type of handling the media
    sun has given you very good frame work which reduce lot of coding and makes the life easy
    then why are you going to old way.
    first go and read jmf tutorial and implement your self dont go to get the code which some other people have written. do your self . you have energy to do. why are depending on others
    read well tutorial and design. you will win i am sure
    jmf makes life easy

  • My BB 8320 Camera and Sound recorder non functional

    For the past year the camera and sound recorder are non functional. I have tried the following.
    1.Removing the battery and SIM and rebooting.
    2. Sync the BB using my Laptop Desktop Manager to sync.
    3. Downloaded latest o/s available.
    Nothing works. Can anyone help me? 
    Thanks

    Hello arindamd and welcome to the BlackBerry Support Community Forums.
    Sorry to hear you're having an issue with the sound on your device.
    To rule out a software issue, backup your data (see KB12487 How to back up the data on a BlackBerry smartphone) then follow the steps in KB11320 How to perform a clean reload of the BlackBerry Device Software for Windows or KB19915 Perform a clean reload of BlackBerry smartphone application software using BlackBerry Desktop Software on a Mac computer).
    Before any software is restored test the sound recorder.
    If no sound is recorded then it's likely the issue may be a hardware one in which case you will need to contact your point of sale for hardware repair options.
    Hope this helps.
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • I cannot remove the free sound recorder toolbar from firefox.

    I was not smart and downloaded the free sound recorder from cnet. Now I cannot remove it. I have tried using the add/remove hardware method 3 times. I also installed malwarebytes to try and see if it caught anything and it did. I then removed the three things it found and several restarts later I am still having no luck. I am using microsoft xp and firefox 5.0. Thanks

    If you select Add-ons from the Tool menu, do you see this "WiseConvert" thing as a plugin or extension? If so, you can just disable it from there...
    Clinton

  • Invoke windows sound recorder in host machine by flex application

    Hi
    I have a flex application which provides option to invoke
    windows sound recorder in client machine. User provides path of
    windows sound recorder exe file and using 'navigateToURL('path of
    recorder given by user)' method i plan to invoke the recorder in
    client machine.
    While executing this code in flex builder it runs properly
    and invokes recorder. Then i deployed the flex application in a
    server and requested using internet explorer. But this time it does
    not invoke recorder. The error messge it displayed is gi ven below
    SecurityError: Error #2148: SWF file
    http://localhost:8080/flex/bin/DEVM.swf
    cannot access local resource C:\WINNT\system32\sndrec32.exe. Only
    local-with-filesystem and trusted local SWF files may access local
    resources.
    at global/flash.net::navigateToURL()
    I think it is a security issue of sand boxes. Anyway i tried
    to make the directory where exe file is kept (ie. system32) as a
    trusted location using 'Global security settings panel'. But that
    also did not solve the problem. I think only swf files, not any
    other files, in the trusted local directories can be accessed by
    the remote flex application. Is it right ???
    Anyway i dont wish to keep any swf file under
    'local-with-filesystem' sandbox in client machine.
    Can anybody please help me to resolve this issue please ....
    -rakesh

    Hi,
    The problem is I am not able to connect to database (11i/R12) from host machine. I am successfully able to run the application from host machine after putting entry in "hosts" file.What is the error?
    To connect to database I have installed Oracle 9i client on host machine and put the entry in TNSNAMES.ORA generated by 11i/R12, but even doing so I am not able to connect to database.Are you able to tnsping the entry? If not, what is the error?
    Please make sure you also follow the steps in (Note 291897.1 - 11.5.10 New Features : Managed SQL*Net Access from Hosts).
    Is there any way I can connect to database (Installed on VMWARE) from HOST Machine.Post the error you get when you connect to the database remotely as well as the output of tnsping command.
    Regards,
    Hussein

  • Why is there no sound recording when I capture Video in iMovie?

    Sometimes there is sound recording, sometimes there isn't. And I can no longer find the "choose microphone" field that lets me change from the internal mic to an external Yeti.  What's going on??
    There are no waveforms in the audio field under the video.  I've checked all the mute buttons and the connector cables. I've tried both the Yeti and the internal mic.  I'm wondering if something in my iMovie got changed when the last update came in. Also, I've been Skyping lately.  Did that affect anything?   Help!! 

    Contact iTunes store support
    This article clearly states you don't need a credit card
    http://docs.info.apple.com/article.html?artnum=301958
    +7. In the resulting screen, create your new iTunes Store account. You will have the option to enter credit card information; if you do not wish to do so, click the None button on the Payment screen.+
    If the "None" isn't there, it's a problem on their end!

  • Sound recording problem

    my audio recording isn't working very well. for example, when i record a video of me talking, it seems as if im whispering. it seems like something is blocking the sound recorder. anyone having this problem?

    - Make sure the mic hole is clear and unobstructed. It is the little hole on the back by the camera lens
    - Open the Voice Memos app and see if you see movement on the VU meter needle with changes in noise level trying to be recorded.
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                             
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          

  • Creative sound recorder is

    Hi I have creative soundblaster li've [C000].
    Along with soundblaster is the creative sound recorder.
    this application used to work quite well.
    Untill a few months back.
    I had to run a full system restore on my computer which uses the windows XP platform (service pack 2).
    After the restore I can no longer run the creative sound recorder (or audio headquarters or any of the other soundblaster applications other than the card itself which is the only thing still working. I can play sounds and record with other recorders such as windows recorder.)
    When I click creative sound recorder, windows tells me the creative sound recorder has encountered a problem and needs to shut down..
    I have tried running the diagnostics which does not seam to have any mention of what to do for troubleshooting the creative sound recorder..
    I tried un-installing the application and re-installing it but that does not resolve the problem.
    Can someone please help me with the issue..
    Thanks in advance to any who has some suggestions.

    After much frustration and searching I believe I have come upon at least one simple solution to the Creative Recorder "files corrupt or missing" problem, at least in my particular case. My problem started when I installed a Logitech USB webcamera to use for instant messaging. Apparently the Logitech camera microphone somehow uses audio facilities in the computer and in doing so interferes with the Creative Recorder. Apparently I can use one or the other but not both at the same time. Here was my fix, essentially disabling the interfering device in the "Hardware Profile". You can reverse the situation when you want to use the other device.
    In Windows 98SE
    . Right click on My Computer on the desktop
    2. Choose "Properties"
    3. Choose "Device Manager" tab
    4. Scroll down and click on the "+" sign box to expand "Sound, video, and game controllers."
    5. I chose the Logitech device and disabled it by:
    6. Click on "Properties" button
    7. Check "Disable in this hardware profile"
    8. Uncheck "Exists in all hardware profiles."
    9. Click "OK"

  • Bad sound recording‏ ‏quality..!!

    Hi, mine is asha 303
    iam asking if there is any way to make sound recording be good with my mobile, i think it just support (.amr) and i tried to change it but that only one, the sound recording is poor sound quality in (sound recording) but its good in (videos recording) idn know why althought its the same mic‏ ‏used..!!
    So is there any solution for this, or thats is known problem in my asha phone??

    Moron wrote:
    Does Nokia stopped producing all new asha series phones and (S40), and all new phones will be symbians or others??
    New roadmap to transition to Microsoft Mobile indicates that Nokia Asha and X series will be left out in favour of Windows Phone platform. Nokia has abandoned in manufacturing Symbian phones in mid-2013 with the Nokia 808 being the last one to be shipped out.
    What is different between (S60) and symbian???
    The S60 or series 60 is a platform on Symbian OS.

  • Sound recording using an external mic?

    What's the best way to do sound recording using an external mic?
    I have found the fostex stereo mic and the iRig. Is there any others out there?

    Hello Robert,
    I came up with the same problem last week and the Genius Desk and support have no answer. Furthermore, Plantronics is saying it's an Apple problem. The only clue Apple provides is to try the device on a non-Intel Mac to isolate it further. Have you tried this? I'm attempting to get to work using SKYPE but I don't know anyone with an older Mac.
    Carl

Maybe you are looking for

  • Error when using BAPI

    Please find herewith my below code. This program i have created for transferring goods with mvt type '657' to '555' using BAPI 'BAPI_GOODSMVT_CREATE' for TCODE MB1A. *& Report  Z_BAPI_FOR_MB1A REPORT  Z_BAPI_FOR_MB1A. Tables : mkpf, mseg, WB2_V_MKPF_

  • How i can solve 6753 airport error

    how i can solve 6753 airport error?

  • If i edit a photo in iPhoto on an ipad will iPhoto on my macbook pro have the edited version as well

    If i edit a photo on iphoto on my ipad and then conect it to my laptop will it save the changes i made the photos on the ipad or will it revert them to the original version which is the verion they are on the macbook pro?

  • Profile selection?

    While troubleshooting preference sync issues (which have been resolved), I noticed something.  I have two profiles, but the one with my name is not the one that Premiere has saved my custom workspace and keyboard selections in.  My custom settings ha

  • CHN COMBOBOX CHANNELS ASSIGNMENT

    How do I use the channels selected in the combobox or chncombobox inside the TDR report. How do I assign the channels selected in the combobox or chncombobox to a new variable name. Difference between combobox and chncombobox. Regards, X. Ignatius So