How playing the sound from sound card backward?

hello
I write the following program for playing backward the sounds from the sound card:
package sound;
import java.io.ByteArrayOutputStream;
import javax.sound.sampled.*;
public class SoundLimiter {
      //final AudioFormat format = new AudioFormat(44100, 8, 1, true, false);
     final AudioFormat format = AudioSystem.getClip().getFormat();
     final DataLine.Info info = new DataLine.Info(SourceDataLine.class, format, 1);
     final SourceDataLine soundLine = (SourceDataLine) AudioSystem.getLine(info);
      boolean stopped = false;
      int total;
     public SoundLimiter() throws LineUnavailableException {
          TargetDataLine line;
          if (!AudioSystem.isLineSupported(info)) {
              // Handle the error ...
          // Obtain and open the line.
          try {
              line = (TargetDataLine) AudioSystem.getLine(info);
              line.open(format);
              // playing back audio
              line.start();
           // Assume that the TargetDataLine, line, has already
           // been obtained and opened.
           ByteArrayOutputStream out  = new ByteArrayOutputStream();
           int numBytesRead;
           byte[] data = new byte[line.getBufferSize() / 5];
           // Begin audio capture.
           line.start();
           soundLine.open(format);
           int totalToRead = data.length;
              while (total < totalToRead && !stopped){
                  //numBytesRead = stream.read(data, 0, numBytesRead);
                   numBytesRead =  line.read(data, 0, data.length);
                  if (numBytesRead == -1) break;
                  total += numBytesRead;
                  soundLine.write(data, 0,numBytesRead);
                  //(data, 0, numBytesRead)
          } catch (LineUnavailableException ex) {
              // Handle the error ...
               ex.getStackTrace();               
     public static void main(String[] args) {
          try {
               new SoundLimiter();
          } catch (LineUnavailableException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
}Using the above code i received the following error:
Exception in thread "main" java.lang.IllegalArgumentException: No line matching interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian, and buffers of 1 to 1 bytes is supported.
     at javax.sound.sampled.AudioSystem.getLine(Unknown Source)
     at sound.SoundLimiter.<init>(SoundLimiter.java:12)
     at sound.SoundLimiter.main(SoundLimiter.java:59)
Edited by: 982163 on Jan 16, 2013 1:46 AM
Edited by: 982163 on Jan 16, 2013 2:32 AM

Well, first of all, use the tags to format your code.
Second of all, your code looks pretty horrible (fair enough, you posted in New to Java).
Lastly, the error message seems to be quite clear, you're trying to open a SourceDataLine with an unsupported format.
Where did you get this code?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • My iPad will not play sounds on certain applications. ie: if I click on a video from FB sound will not play. If I go to YouTube and play the same video sound will play. Also certain games will no longer play sounds. They always played sounds but now won't

    My iPad will not play sounds on certain applications. ie: if I click on a video from FB sound will not play. If I go to YouTube and play the same video sound will play. Also certain games will no longer play sounds. They always played sounds but now won't now. I just went to my churches web site to watch live service and again no sound. I grabbed my dads iPad and the sound works fine.

    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • Some music files do not show up in google play music app library.  I did clear cache/data and restarted phone.  The music is stored on the SD card.  Most of the music in the library is in the same folder on the sd card.  I can play the song from file mana

    some music files do not show up in google play music app library.  I did clear cache/data and restarted phone.  The music is stored on the SD card.  Most of the music in the library is in the same folder on the sd card.  I can play the song from file manager, but it still is not in the music library in play music.

    Cyndi6858, help is here! We'd be happy to help figure this out. Just to be sure though, the Droid Maxx should not have an SD card. Is this the Droid Razr Maxx? How did you add the music to the device? Are you able to see the files and folders located on the SD card or device when plugged in?
    Thanks,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

  • I have reorganised my music in the itunes folder in windows explorer.  Now I can't sync all my music to a new iPad, or play the music from itunes (as it is looking in the old location).  How do I repoint itunes to all my music?

    I have reorganised my music in the itunes folder in windows explorer.  Now I can't sync all my music to a new iPad, or play the music from itunes (as it is looking in the old location).  How do I repoint itunes to all my music?

    Have you read for possible solutions over in the "More Like This" thread over here?----------------------->
    Check out the following KB Articles:  http://support.apple.com/kb/HT1329 How to use your iPod to move your music to a new computer
    http://support.apple.com/kb/HT4527 iTunes: How to move your music to a new computer

  • I want to create a "Play All" chapter marker that will play the video from start to finish in addition to the standard chapters I have-I guess I can auto start the DVD but would prefer a button-how and where would I put this "play all" marker??

    I want to create a "Play All" chapter marker that will play the video from start to finish in addition to the standard chapters I have…I guess I can auto start the DVD but would prefer a button…how and where would I put this "play all" marker?? Thanks..

    The start chapter button is a play the whole movie button regardless of how many other markers you have.
    Once a DVD starts playing it continues to the end.
    Chapters marker simply gives the viewer a place to start playback whether it be the start, middle or near the end.
    Al

  • HT1379 Summary: how to transfer files from SD card when the system (Mac OS X v 10.7.5) will NOT recognize SD cards.

    How to transfer files from SD card when the system (Mac OS X v 10.7.5) will NOT recognize SD cards?
    Insert the SD card.
    System opens iPhoto with SD contents.
    Want to transfer files from SD card to system drive.  iPhoto closes
    SD card directory removed from the Finder window and is not available again. 
    I don't want to have to reboot the system every time I want to perform this option.
    What's wrong here. 
    The support columns show this isn't an isolated incident with all sorts of solutions possible.
    This is a simple task - there should be a simple method for the system to recognize SD cards.
    What's the answer?
    I've reviewed a recommendation to reset the SMC.
    https://discussions.apple.com/message/18500187#18500187
    and
    http://support.apple.com/kb/HT3964
    and another thread that says, basically, you must buy extra hardware to perform this simple task,
    https://discussions.apple.com/message/16911326#16911326
    another one that has the same problem with OS Mountian Lion,
    https://discussions.apple.com/message/21919740#21919740
    another one with the problem that says SD cards can't be read by Apple unless the card is formatted specifically for Apple, ie. that Apple is not compatible with other cards, but the problem maybe something else that requires Apple service - (bad SD card reader?).
    https://discussions.apple.com/message/18711818#18711818
    there are probably more discussions, but I dont' want to spend my entire sunny in Seattle day working this.
    thanks for the help!

    Bucky Fullmeister wrote:
    When I plug in an SD card, the finder window shows it under the DEVICES section.  At this point, I can drag the contents to the hard drive.  However, when I screw up and click the character on the right side of the name - it apparently closes the SD card and I can't find any command to reload or re-recognize the card.  I have to remove and reinsert the card and then sometimes it recognizes the card.  Other times I reboot and it will recognize it.
    What does that character on the right side of the SD card name do?  Is it an eject function - with no way to subsequently reread the drive?
    It ejects or unmounts the card. When the SD card mounts click on it once to highlight it and then drag the files shown within it to the new folder.
    Pete

  • I am using imovie 09 and when I try to play the scenes from my hd camcorder video freezes then voice freezes and bar keeps running to the end.  Does anyone know how to fix this? PLEASE!

    I am using imovie 09 and when I try to play the scenes from my hd camcorder the video freezes then audio freezes and the play bar keeps going with no video or audio.  How Can I fix this???  PLEASE HELP!

    Up front I would say the short answer is "no"... but the long answer is "sort of".
    Replicators are part of the Fractal "arsenal" and Motion definitely has those, but I think you would be very hard pressed to come anywhere near the type of fractal imaging as in the Electric Sheep example.
    I was able to squeeze the following out of Motion (the base element is a simple square), but by the time it got this far, Motion wouldn't play faster than about 1 frame every 5 or so seconds. At a certain point, you end up having to render movie files in order to see it in action (and that took Motion about 8 minutes for a 12 second project [09 iMac i7].) [If you're interested, I posted a short video of these here: http://www.youtube.com/watch?v=l6Fe_ydfAss. The segments are longer than 12 seconds each because these are designed to loop @12 seconds and each one was looped more than once.]
    [You asked the question on the 4th - I "finished" this on the 7th... (I admit to several "false starts")]
    If you have a faster mac than mine, you might be able to do more than this... and you really don't have access to the Maths that fractal apps have, so depending on your creativity for devising the "root" motif element you may (or may not) be disappointed in what Motion has to offer (it *will* try your patience!) If you would like to experiment anyway, I will explain some of the techniques I used for the above (which are, at best, rudimentary!) Once you get the basics down, you should be able to take off in your own directions.
    HTH

  • How 2 move the message from memory card 2 phone me...

    did anyone know in nokia N73 how 2
    move the message from memory card move
    to phone memory???? did anyone know
    how 2 move it??? teach me plz.....

    Here is an easy way to move your messages from Phone Memory to Memory Card or from Memory Card to Phone memory In Nokia models.
    1- Install latest version of Nokia PC Suite and connect your set.
    2- Open Nokia Communication Centre. (Select Phone Memory or Memory Card from which you want to move messages to other memory)
    3- Select all messages in a single folder (Inbox/Sent Items or from My Folders) and click on file> export. This will create *.csv file.
    4- Download NBU Explorer 1.8 from http://www.soft82.com/download/windows/nokia-nbuex​plorer/  (You must have installed Windows Installer 3.1 and Microsoft .Net Framework 3.5 to run NBU Explorer. You can easily download these from Microsoft Site,)
    5- Open *.csv file in NBU Explorer and click File > Export All. (Your all messages will be exported as *.vmg files.)
    6- Disconnect and connect your phone again in Nokia PC Suite.
    7- Now set your target memory in your phone for messages.
    8- Open Communication Centre and Select your desired folder then click on file > Import messages by selecting multiple messages *.vmg files. (You don’t have to import messages one by one but you can import all messages in a single folder at once)
    9- And you have done it.
    10- You can import *.csv list in Nokia PC Suite rather *.vmg files, but in this case, all the spaces (blank spaces) in your messages will be lost. All the text of your messages will be merged to a single line. So exporting via NBU Explorer is recommended.  
    11- Any query?  Contact me at ********@yahoo.com.
    MODERATOR'S NOTE:
    E-mail address has been removed from this post as it is unwise to post such personal information in a public web forum. This is for your personal safety and privacy.
    Edited by: Aikin19

  • How do I switch from credit card to no card

    How do I switch from credit card to no card

    Did you follow these instructions as written? The email address has to be one not used with Apple before like in trying to set up an account previously.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card

  • I would like to play music from my iPhone 5 on the speakers attached to my computer at work. I don't have the authority to download itunes onto the computer. Can I play the music from the phone without having itunes on the computer?

    I would like to play music from my iPhone 5 on the speakers attached to my computer at work. I don't have the authority to download itunes onto the computer. Can I play the music from the phone without having itunes on the computer?

    KiltedTim wrote:
    The cable would be much cheaper than the Scotch!
    But much less fun or satisfying.
    Signed,
    An IT guy 

  • I downloaded a movie from iTunes.  I wanted to burn a DVD so I dragged the movie onto a blank DVD and it appeared to burn it correctly.  When I try to play the movie from this DVD  I get an error message referencing "you can't open the application mediaio

    I downloaded a movie from iTunes.  I wanted to burn a DVD of the movie which I could play on my home entertainment system.  After I had burned the DVD I tried to play the movie from it on the computer and got the message " You can't open the application mediaioserver because it may be damaged or incomplete".  What is this all about?  Are there settings I need to change?  PS: I tried to play the DVD on my home DVD player and it also doesn't work.  Help!

    Klaus:  Does this mean that I can only watch this movie on my computer and ipad not on my home big screen system?

  • After recharging shuffle(second gen 2 gb) it played the song from the start

    after recharging shuffle(second gen 2 gb) it played the song from the start instead or continuing from the last song played. I put 500 song on the shuffle, then I listen to 200 roughly on and off for 3 days (1 hour here, 1 hour there etc.).But now I have to recharge it then when I turn it on, it start at number 1 song and not 201. Even though with 500 song itunes says play time roughtly 1.4 day, so roughly 30 hours, and the charge last roughly 12 hour (give or take a few, depending on volume, skip etc...) maybe I would have been better with a 1 gb. so i don't have to skip to the last song I played before I recharge it.
    Beside that, so far I love my shuffle, I have been going thru different mp3 players, this one is great except for that little problem.
    any idea or suggestion would be appreciate to help maximize my ipod experience
    Thank you

    Hi Jello2208,
    unfortunately it's normal behaviour for the iPod shuffle to reset the playback position to the first song whenever it is synced.
    A safe way to avoid this is using the USB power adapter for charging instead of connecting the iPod to your computer.
    If you don't have a power adapter, try this: In the iPod settings in iTunes, deselect the option to open iTunes automatically when the iPod is connected. Now whenever you connect your iPod to your computer just to charge it, make sure that iTunes isn't running, and don't start it while the iPod is connected. This way no sync will happen and hopefully the playback position will survive.

  • I get audio but no video unless I play the file from UTube

    I get audio but no video unless I play the file from UTube

    Use a different browser?
    Firefox (from Mozilla)
    Opera (from Opera)
    Safari (from Apple)
    Chrome (from Google)
    ANY of those will work where IE11 won't, with the Flash Player Plug-in (For all other browsers), and Chrome doesn't even need that because it has its own Flash Player plugin built in.
    Even if it's just to redownload the driver. I recommend another browser.

  • HP Mini 110-1160SA problem recording sound from sound card

    I am trying to record sound from the sound card itself rather than an external or internal microphone, using a free software called Sonarca Sound Recorder. For example, I play radio from the internet using the BBC Iplayer. I have Windows 7 Starter. When I use the Windows Control Panel > Hardware and Sound > Manage Audio Devices, I get a window called Sound. I press the Recording tab, and get a choice of Internal Microphone, External Microphone, and Stereo Mix. According to my sound recorder software's documentation, I need to select that Stereo Mix, because it means "record whatever the sound card is playing". However, the Stereo Mix recording device, despite having a red tick mark next to it is "Currently Unavailable". How do I make it available?

    to be honest, i am not sure about your problems, normally, you need to set stereo mix as default device, then using recording devices to record sound on windows 7. Since you cannot make it, why not insall a virtual sound device, it works like a real one, install this streaming music recorder on your system, start recording. Just test it out by yourself.

  • Somehow i/o playing the songs from my library in scrambled fashion...it keeps playing the SAME song...I can't find how to scramble the playing.

    When I listen to ITunes now...the playlist isn't scrambled anymore....it plays the SAME song over and over. I can't find how to change it.

    Are you also restoring from your backup? That sounds like what is happening or someone else has your Apple ID.
    A backup to iCloud would have no way to add UK holidays to your calendar. Open Calendar, tap on Calendars at the bottom middle of the page and untick the ones you don't want.

Maybe you are looking for

  • Why does my App Store say all my apps are up to date when they're really not?

    I'm in the process of updating my iPod touch 5G to iOS7, and before I do so, I would like to update all my apps to their current versions. However, no updates are showing in the App Store; it says they are all up-to-date when they really aren't. I ha

  • Scan app does not find 4625 sacnner / printer in windows 8.1

    I posted a while ago that I could not install the printer / scanner software on my laptop runningWindows 7.1  because it would not recognise my printer, although 1. I provided the correct IP address when asked by the installer 2. The installer worked

  • Time machine restore crashed system preferences

    Hi, just hoping someone can help with the following as my MacBook is not a happy bunny. I recently reformatted my hdd and restored my system using Time machine. This was to allow me to create a new partition so I could run bootcamp. All was fine for

  • My iPod Touch in need to enter DFU mode

    My iPod Touch got stuck on the apple logo, and there is no way to get out of that instead of entering DFU mode and restoring my iPod Touch, but my iPod Touch 4th Generation (sleep/wake/power) button is broken and can't enter DFU mode without press th

  • OT: FTP on IIS6

    Yes, it is linked to DW - I can't upload any files from DW (or any other FTP program). Background: Server 2003 Standard, running IIS 6.0. I've set up a website, and copied a few test files to it over the LAN; everything works fine, and if I access th