Capturing audio through applet using Java Sound

hi fellows i need ur help.
I am working on a voice project to Capture & Play the sound using java sound API instead of JMF. I can capture , play and transmit the sound through application. It works pretty fine but when i convert it to the applet, it is not working.
I got the full system permissions and also signed the applet for Internet Explorer. Also i packed the
javax.sound.midi.*
javax.sound.sampled.*
classes in the signed cab.
After doing all this i am getting the AudioFormat not supported exception. I changed the format and used all the combinations but still getting this error
No line matching interface TargetDataLine supporting format PCM_SIGNED, 16000.0 Hz, 16 bit, mono, big-endian, audio data is supported.
java.lang.IllegalArgumentException: No line matching interface TargetDataLine supporting format PCM_SIGNED, 16000.0 Hz, 16 bit, mono, big-endian, audio data is supported.
     at javax/sound/sampled/AudioSystem.getLine (AudioSystem.java:312)
     at com/vsoft/voice/VoiceRecord.run (VoiceApplet.java:93)
     at java/lang/Thread.run (Thread.java)plz help me to sort out this problem.

plz have a look over this problem

Similar Messages

  • Emulating sox trim using java sound APIs

    Hi,
    I would like to know if there is a way to split large wave files into smaller ones (approx 5 min clips, similar to "sox trim") using java sound APIs? I tried the following, but it doesn't seem to work for me
    1. Open a wave file using AudioSystem.getAudioInputStream();
    2. Read 300 * sample_rate * bytes_per_sample bytes into a buffer.
    3. Read the written bytes back using AudioSystem.getAudioInputStream().
    4. Write the stream using AudioSystem.write();
    I can't get step 3 to work, possibly because headers are not written into the buffer and AudioSystem complains about unknown audio format. How do I get this working?
    TIA.

    Okay, I figured a way to do this without using the sound APIs. Now, I am reading the header and data separately, splitting the data and copying the header on each segment. Sorry to have bothered everyone.

  • Using Java Sound in Eclipse.

    Can anyone tell me where to put the java soundbanks that i downloaded in order to use Java sound in Eclipse?

    I'm not familiar with this particular issue, but I believe jsresources.org has lots of information on installing soundbanks.

  • Cannot recognise any sound devices in Linux using Java sound!

    Hi there - I'm new to Java sound, and can't even get my foot in the door on my Linux system. Even thought my speakers and microphone are fully functional on my system (I can record, playback, etc. using other programs) I cannot get Java to find the microphone, speaker, anything. I've tried calling "AudioSystem.isLineSupported(Port.Info.MICROPHONE)", which returns false, as with all the other Port.Info.... objects.
    I'm sure there are no programs using my audio devices (used lsof | grep snd and lsof | grep dsp, then killed the only program that had anything open) and I've tried running my Java program as the super-user too, but to no avail.
    One thing I CAN do is get sound from /dev/dsp - I can put this into a byte array and play it back later, but I don't know how to find out what sort of codec it uses, how to merge it with Java sound, or anything like that.
    Any help would be much appreciated!
    If it makes any difference, I'm using Xubuntu 8.10, and I normally don't use a microphone or flashy surround-sound speakers, so I've not touched the sound system since I installed Linux.

    Ports are tricky...and by tricky, I don't mean complicated so much as a pain.
    Try using Line.Info objects instead of Port.Info objects and see if you can get any lines.

  • Front and Rear Audio Through only one Socket - Sound Blaster Live! 24

    <p class="MsoNormal">PLEASE HELP ?
    <p class="MsoNormal">I'm getting Front and Rear Audio through the front speakers (Front Socket), and nothing out of the back.
    All cables are set up correctly; I have reinstalled drivers, updated drivers etc. and the software.
    What?s going on ? :S

    I'll answer you here, as I believe it may be helpful to other users as well... You will need to download the latest drivers for Li've! 24-bit under Vista, which are available [url="http://us.creative.com/support/downloads/download.asp?MainCategory=&nRegionFK=&nCountryFK=& nLanguageFK=&sOSName=Windows+Vista+32-bit&region=&Product_Name=Li've%2+24-bit&Product_ID=035&modelnumber=&driverlang=033&OS= 26&drivertype=0&x=29&y=0">here[/url]. These add AudioConsole, which allows you to select CMSS options for your soundcard.
    amm44 wrote:
    On Windows XP this was never the case, for surround sound I would leave it in Dolby mode.
    This is indeed strange... In ProLogic mode, as I already said, it'sproduces?surround sound from the 2 front channels but this is not the same as discrete sound, which is eventually 6-channel analog or Dolby Digital. It really all depends on the content you are playing. Also note, that a lot of the Dolby movies available on the web, may use AC-3 format, but may still be stereo only. On this content ProLogig will produce nice surround sound. (Media Player Classic states clearly how many channels are actually available)?If you however playback a true 6-channel AC-3 movie and you have ProLogic enabled, you will most probably not hear any dialogue, or just its echoe... (Assuming that you leave the AC-3 decoding to happen on the soundcard, which will then send the signal through the 6 analog channels)?How is your soundcard connected to the receiver? SPDIF/Optical or only analog??

  • Capturing audio on iPAQ with java

    Hello,
    Does anybody know a method of capturing audio data from the built in microphone on the iPAQ using java?

    Hello,
    Does anybody know a method of capturing audio data from the built in microphone on the iPAQ using java?

  • How to link two user interfaces together through networking using java??

    Im doing an java assignmet...the entry system...
    I have to create two interfaces ..
    one is a interface which is a keypad and let user key in their password
    for accessing...
    another interface is receive the password and determine whether it is valid or not...
    Two interfaces is on different computer.....
    I have to link these interfaces together using java....
    PLS HELP!!!!!!

    It sounds like you should probabally use RMI.That is, remote method invocation...these guys are doing a more complicated version of what you want to do:
    http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20680356.html#8935218
    Be sure to check out Sun's RMI tutorial:
    http://java.sun.com/docs/books/tutorial/rmi/
    Happy coding! Sounds like a fun little project...I want to do some RMI sometime when I get a chance...

  • How can I load an applet using Java Plug-in?

    I have written an applet and have tested with appletviewer, but I can't load it from a browser. Ghlin told me that I need to use Java Plug-in to load it. Please tell me how.

    Click on the Products and API link at the top left of this page. Download the Java Plugin. Be sure to get the developers version. Inside that developer's version there is a tool called HTMLConverter. Run HTMLConverter on your HTML and it will modify the applet tag in such a way that if the user already has the Java Plugin then it will use it. IF not, then the user will be asked if he wants to download it.

  • Error while downloading through ftp using Java

    I have attempted to download a file using ftp through java this is my code
    import sun.net.www.protocol.ftp.FtpURLConnection;
    import sun.net.ftp.FtpClient;
    import sun.net.TelnetInputStream;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    public class PasswordedPageViewer {
    public static void main (String[] args) {
    try {
    //Open the URLConnection for reading
    FtpClient cli = new FtpClient();
    cli.openServer("mycgiserver.com", 21);
    cli.login("//Username//", "//password//");
    TelnetInputStream ins = cli.get("mail.jsp");
    BufferedReader d = new BufferedReader(new InputStreamReader(ins));
    while(d.readLine().length()>0){
    System.out.println(d.readLine());
    catch (MalformedURLException e) {
    System.err.println(args[0] + " is not a parseable URL");
    catch (IOException e) {
    e.printStackTrace();
    System.err.println(e);
    } // end main
    } // end SourceViewer2
    But this keeps failing and returning the following error message
    sun.net.TelnetProtocolException: misplaced CR in input
         at sun.net.TelnetInputStream.read(TelnetInputStream.java:96)
         at sun.net.TelnetInputStream.read(TelnetInputStream.java:130)
         at sun.net.TelnetInputStream.read(TelnetInputStream.java:115)
         at java.io.InputStreamReader.fill(InputStreamReader.java:173)
         at java.io.InputStreamReader.read(InputStreamReader.java:249)
         at java.io.BufferedReader.fill(BufferedReader.java:139)
         at java.io.BufferedReader.readLine(BufferedReader.java:299)
         at java.io.BufferedReader.readLine(BufferedReader.java:362)
         at PasswordedPageViewer.main(PasswordedPageViewer.java:30)
    sun.net.TelnetProtocolException: misplaced CR in input
    Can anyone help

    Even so. Try simplifying. You only need one sun.* class:
    import java.io.*;
    import sun.net.ftp.FtpClient;
    public class FtpGet {
    public static void main( String[] argv ) throws Exception {
    FtpClient c = new FtpClient();
    c.openServer( "ftp.yourplace.com" );
    c.login( "user", "password );
    InputStream in = c.get( "yourFile.txt" );
    BufferedReader r = new BufferedReader(new InputStreamReader(in));
    String line = r.readLine();
    while ( null != line ) {
    System.out.println( line );
    line = r.readLine();
    }

  • Taking screenshot with java applet using java robot class not working

    Hi Everyone,
    I am using the java applet to take screenshot of the web browser using the java's robot class.
    Robot objRobot = new Robot ();
    BufferedImage objBufferedImage = objRobot.createScreenCapture(objRectArea);
    The thing work good in windows system taking screenshot but in case of mac osx i get the blank image.When i check the event viewer in mac osx i get the following error.
    invalid context
    invalid pixel format
    CoreAnimation: rendering error 506
    The problem is coming for all the browser safari,firefox and chrome.My applet is signed applet.
    What might be the reason.An early reply is very valuable.
    My machine configuration is as follows.
    OS : MAC OSX
    Version : 10.6.4
    Is that a system level issue , java plugin issue?I'am confused with this error.
    Thanks sagar.

    870613 wrote:
    invalid context
    invalid pixel formatHm, seems like the Mac implementation of the Robot class is doing some bad initializations there. I can't be a 100% sure of course, but this smells like a bug to me. Are you sure you have the latest version of Java installed?

  • Applet using java.util.Properties.setPropterty()

    Hi,
    I'm trying to use the java.util.Properties class in an Applet. More specifically the setProperty(String, String) method. My applet compiles fine but it crashes when I run it with IE (ver. 6). It shows an "NoSuchMethodError: method setProperty(Ljava.lang.String,Ljava.lang.String)". When I compile with javac, it doesn't complain but I guess the IE VM doesn't see that method. But Properties is part of java.util.*, so shouldn't IE have access to that class?
    Any help is much appreciated?
    Thanks
    Heather

    The API for that method includes this:
    Since:
    1.2
    That means it's a Java 2 method. The JVM in Internet Explorer doesn't support Java 2 methods (unless you load a plugin that does).

  • Capture Audio through USB interface - How to adjust input level?

    My USB turntable offers Line In and USB in order to connect it to my iMac. I would prefer USB but there is no way to adjust the input level. This only seems to be possible with Line In. Is this correct or is there anything I should know?

    The only way to change levels with an A/D audio interface is BEFORE the analog/digital conversion.
    If your turntable outputs USB (a digital connection), then the A/D stage is within the turntable, and any level adjustment will have taken place within there (I'm betting there's a level adjustment trimpot somewhere inside if you can't see any knobs from the outside).
    This shouldn't be a problem, though, because the maximum levels a vinyl LP can produce are limited by groove spacing and the sheer amount of vibration the needle can take before jumping out of the groove. The turntable will have been adjusted for this at the factory (I'd assume), so you can safely use the USB out - the turntable's A/D stage is bound to sound better than the $1.50 A/D-D/A chip built into the computer.

  • Java Applets and Java Sound

    I have an applet that displays buttons on panel and after doing all this it has to play a sound file. I have made sure that only after the methods that display the buttons (like creating panel, adding buttons to that panel etc.) i am calling the method that plays the sound file. But what happens is that immediately it starts playing the sound file and after playing the sound file it displays the buttons etc. on the applet. Can you please help me with this problem??

    as has already been said you should:
    1) load the clips you want to play in the init() method (ie audioClip = Applet.newAudioClip(URL) )
    2) play them in the applet start() method
    3) stop the clip in the applet stop() method
    You shouldn't play the clip in the init() method because it's the method called by the applet to initialize itself.
    ie to paint itself...

  • Capture Audio which can be heard from speakers..

    Hi..
    I am currently facing a problem in capturing audio which can be heard from the speakers.. i.e. i want to capture audio generated by other applications. Till now I have been successful in capturing audio from microphone using JMF and Java Sound too.. But I fail to understand what capture device should I use to capture internal sound i.e. sound generated by other applications.. pls. help me out regarding this.. Can DirectSoundCapture (capture device) be used to capture such sounds or can it just capture sounds from microphone..? Pls. help me soon.. Thanks in advance :)

    hardware issue read more here
    https://discussions.apple.com/thread/1343532?start=315&tstart=0
    more hits
    https://www.google.dk/search?client=opera&q=iphone+stuck+in+headphone+mode&sourc eid=opera&ie=utf-8&oe=utf-8&channel=suggest

  • An I18N bug from java sound should be fixed.

    When you try to list some audio related names (such as mix name, port name, control name) by using java sound api, and if the names are writtened by non-ascii character such as Chinese, you will get the strange characters, that means java sound api does not support internationalization character. Here is the sample:
    *     SystemMixerFrame.java
    * Copyright (c) 2001 - 2002 by Matthias Pfisterer
    * All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * - Redistributions of source code must retain the above copyright notice,
    * this list of conditions and the following disclaimer.
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
    * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    * OF THE POSSIBILITY OF SUCH DAMAGE.
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.BooleanControl;
    import javax.sound.sampled.CompoundControl;
    import javax.sound.sampled.Control;
    import javax.sound.sampled.EnumControl;
    import javax.sound.sampled.FloatControl;
    import javax.sound.sampled.Line;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.Mixer;
    import javax.sound.sampled.Port;
    IDEAS:
    - user setting tab style vs. show complete windows for multiple mixers (horicontal/vertical)
    - user setting unix style (L/R volume) vs. windows style (volume/balance)
    /**     TODO:
    public class TestSystemMixer {
         /**     TODO:
         private static final Port.Info[]     EMPTY_PORT_INFO_ARRAY = new Port.Info[0];
         public static void main(String[] args) {
              new TestSystemMixer();
              System.exit(0);
         /**     TODO:
         public TestSystemMixer()
              List portMixers = getPortMixers();
              if (portMixers.size() == 0) {
                   out("There are no mixers that support Port lines.SystemMixer: Error");
                   System.exit(1);
              Iterator iterator = portMixers.iterator();
              while (iterator.hasNext())
                   Mixer     mixer = (Mixer) iterator.next();
                   String     strMixerName = mixer.getMixerInfo().getName();
                   out("mixername:" + strMixerName);
                   createMixerPanel(mixer);
         /**     Returns the Mixers that support Port lines.
         private List getPortMixers()
              List supportingMixers = new ArrayList();
              Mixer.Info[]     aMixerInfos = AudioSystem.getMixerInfo();
              for (int i = 0; i < aMixerInfos.length; i++)
                   Mixer     mixer = AudioSystem.getMixer(aMixerInfos);
                   boolean     bSupportsPorts = arePortsSupported(mixer);
                   if (bSupportsPorts)
                        supportingMixers.add(mixer);
              return supportingMixers;
         /**     TODO:
         // should be implemented by:
         // Mixer.isLineSupported(new Line.Info(Port.class))
         private boolean arePortsSupported(Mixer mixer)
              Line.Info[]     infos;
              infos = mixer.getSourceLineInfo();
              for (int i = 0; i < infos.length; i++)
                   if (infos[i] instanceof Port.Info)
                        return true;
              infos = mixer.getTargetLineInfo();
              for (int i = 0; i < infos.length; i++)
                   if (infos[i] instanceof Port.Info)
                        return true;
              return false;
         /**     TODO:
         private void createMixerPanel(Mixer mixer)
              Port.Info[]     infosToCheck = getPortInfo(mixer);
              for (int i = 0; i < infosToCheck.length; i++)
                   Port     port = null;
                   try
                        port = (Port) mixer.getLine(infosToCheck[i]);
                        port.open();
                   catch (LineUnavailableException e)
                        e.printStackTrace();
                   if (port != null)
                        createPortPanel(port);
         /**     TODO:
         private Port.Info[] getPortInfo(Mixer mixer)
              Line.Info[]     infos;
              List portInfoList = new ArrayList();
              infos = mixer.getSourceLineInfo();
              for (int i = 0; i < infos.length; i++)
                   if (infos[i] instanceof Port.Info)
                        portInfoList.add((Port.Info) infos[i]);
              infos = mixer.getTargetLineInfo();
              for (int i = 0; i < infos.length; i++)
                   if (infos[i] instanceof Port.Info)
                        portInfoList.add((Port.Info) infos[i]);
              Port.Info[]     portInfos = (Port.Info[]) portInfoList.toArray(EMPTY_PORT_INFO_ARRAY);
              return portInfos;
         /**     TODO:
         private void createPortPanel(Port port)
              String     strPortName = ((Port.Info) port.getLineInfo()).getName();
              out("Portname:" + strPortName);
              Control[]     aControls = port.getControls();
    //          for (int i = 0; i < aControls.length; i++)
              if (aControls.length > 1) {
                   // In fact in the windows system, it named SPEAKER port, and it contains play controls.
                   out("ignore the port " + strPortName + " that contains more than one control.");
              } else {
                   // this is record control.
                   out("control:" + aControls[0].toString());
                   createControlComponent(aControls[0]);
                   if (aControls[0] instanceof FloatControl)
                   else
         /**     TODO:
         private void createControlComponent(Control control)
              if (control instanceof BooleanControl)
              String          strControlName = control.getType().toString();
              out("sub control type BooleanControl:" + strControlName);
              else if (control instanceof EnumControl)
              String     strControlName = control.getType().toString();
              out("sub control type EnumControl:" + strControlName);
              System.out.println("WARNING: EnumControl is not yet supported");
              else if (control instanceof FloatControl)
              String     strControlName = control.getType().toString();
              out("sub control type FloatControl:" + strControlName);
              else if (control instanceof CompoundControl)
              String     strControlName = control.getType().toString();
              out("sub control type CompoundControl:" + strControlName);
              Control[]     aControls = ((CompoundControl)control).getMemberControls();
              for (int i = 0; i < aControls.length; i++)
                   Control con = aControls[i];
                   if (con instanceof BooleanControl) {
                        out("sub sub control type BooleanControl:" + con.getType().toString());
                        if (strControlName.equalsIgnoreCase("Stereo Mix")) {
                             ((BooleanControl) con).setValue(true);
                   else if (con instanceof EnumControl) {
                        out("sub sub control type EnumControl:" + con.getType().toString());
                   else if (con instanceof FloatControl)
                        if (isBalanceOrPan((FloatControl) con))
                        out("sub sub control type FloatControl balance:" + con.getType().toString());
                        else
                        out("sub sub control type FloatControl pan:" + con.getType().toString());
                   else
         /** Returns whether the type of a FloatControl is BALANCE or PAN.
         private static boolean isBalanceOrPan(FloatControl control)
              Control.Type type = control.getType();
              return type.equals(FloatControl.Type.PAN) || type.equals(FloatControl.Type.BALANCE);
         private static void out(String message)
              System.out.println(message);
    /*** SystemMixerFrame.java ***/
    Compile and run the code below on non-ascii Windows OS, you will catch the problem.
    The solution I provide:
    Download the jdk 1.4.2 source, search the files named PortMixer.c && PortMixerProvider.c and replace the method "NewStringUTF" with the method below:
    jstring WindowsTojstring2( JNIEnv* env, char* str )
    jstring rtn = 0;
    int slen = strlen(str);
    unsigned short* buffer = 0;
    if( slen == 0 )
    rtn = (*env)->NewStringUTF(env,str );
    else
    int length = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, NULL, 0 );
    buffer = malloc( length*2 + 1 );
    if( MultiByteToWideChar( CP_ACP, 0, (LPCSTR)str, slen, (LPWSTR)buffer, length ) >0 )
    rtn = (*env)->NewString( env, (jchar*)buffer, length );
    if( buffer )
    free( buffer );
    return rtn;
    Rebuild jdk source code as per sun build document. Got the result files and pick up jsound.dll, replace the original jsound.dll in your JRE with the fixed file.
    Then the problem solved. I also hope sun will fix the problem in the future version of JDK.
    Or any one can help me to submit this article to the sun JDK team.
    Jiawei Zhang
    From Chinese, The city of Shanghai.
    MSN: [email protected]

    If you only wanted to get a beep you could have used Toolkit.beep
    Very simple and fast.
    Rommie.

Maybe you are looking for