New to sound

I'm new to sound. I saw this program on the internet, but i'm not sure how to use it exactly. It says it needs a parameter (the name of the audio file) can anyone show me how to connect it to the main program?
public class SimpleAudioPlayer
     private static final int     EXTERNAL_BUFFER_SIZE = 128000;
     public static void main(String[] args)
          if (args.length != 1)
               printUsageAndExit();
          String     strFilename = args[0];
          File     soundFile = new File(strFilename);
          AudioInputStream     audioInputStream = null;
          try
               audioInputStream = AudioSystem.getAudioInputStream(soundFile);
          catch (Exception e)
               e.printStackTrace();
               System.exit(1);
          AudioFormat     audioFormat = audioInputStream.getFormat();
          SourceDataLine     line = null;
          DataLine.Info     info = new DataLine.Info(SourceDataLine.class,
                                                             audioFormat);
          try
               line = (SourceDataLine) AudioSystem.getLine(info);
               line.open(audioFormat);
          catch (LineUnavailableException e)
               e.printStackTrace();
               System.exit(1);
          catch (Exception e)
               e.printStackTrace();
               System.exit(1);
          line.start();
          int     nBytesRead = 0;
          byte[]     abData = new byte[EXTERNAL_BUFFER_SIZE];
          while (nBytesRead != -1)
               try
                    nBytesRead = audioInputStream.read(abData, 0, abData.length);
               catch (IOException e)
                    e.printStackTrace();
               if (nBytesRead >= 0)
                    int     nBytesWritten = line.write(abData, 0, nBytesRead);
          line.drain();
          line.close();
          System.exit(0);
     private static void printUsageAndExit()
          out("SimpleAudioPlayer: usage:");
          out("\tjava SimpleAudioPlayer <soundfile>");
          System.exit(1);
     private static void out(String strMessage)
          System.out.println(strMessage);
}

I'm not really sure what you mean by connecting it to the main program. That's a nearly complete program in itself. It's only missing two lines from the top:
import javax.sound.sampled.*;
import java.io.*;
Once you've added those (and compiled) it should run just fine from the command line: type "java SimpleAudioPlayer yoursoundfile.wav".

Similar Messages

  • My new iPad sound is not working after updating to ios 6.1

    My new iPad sound not working after updating to ios 6.1. Headphones are working fine. I tried all the troubleshoot. can anyone know the answer, plz share with me

    Hi,
    I have exactly the same issue as everyone above. I only get sound through the slider on the ringtone in settings and through my headphones. I do not get any sound anywhere else at all.
    I Have tried:
    - Updating to iOS 6.1.3
    -re starting the device
    -checking that the device is not muted. My slider switch is set to mute rather than lock and is unmuted.
    -going into general settings and reset all settings
    -the device reset several times (waiting until I saw the all important apple logo)
    -removing the last few apps I installed.
    Nothing at all has worked, please help!
    New iPadiPad

  • New Mail Sound...  Wont let me change to sound I want.

    I downloaded a .wav file and want to change my new mail sound to that .wav sound. I can add it but when I get new mail it doesn't play it. Anybody know what the deal is?

    i have the same issue as well except i have another email but it won't let me send to the email. ( the link isn't there) i tried this on my phone and now on the computer. what is going on?

  • When sync ipod error message "new wave sound not copied, because not found

    I just upgraded to 7.0 and after I download music to my library I get a message stating the following "new wave sound" was not copied to the ipod because it could not be found. I looked on apple support for this plug but no luck. Please help.

    Hello LeaMinovitch,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iTunes Store: Authorize or deauthorize your Mac or PC
    http://support.apple.com/kb/ht1420
    To authorize a computer, follow these steps:
    Open iTunes.
    Choose Store > Authorize This Computer from the menu bar.
    You may need to show the menu bar to see this option in Windows. In earlier versions of iTunes, you can access this option from the Advanced menu.
    Enter your Apple ID and click Authorize.
    If your Apple ID uses an expired MobileMe account, you can still authorize your computer.
    In some cases, iTunes may ask you to authorize the computer again. iTunes should use the same authorization as before if the computer is in your list of authorized computers.
    Learn what to do if iTunes repeatedly asks you to authorize when you try to play your content.
    Best of luck,
    Mario

  • What do I do to resolve an ongoing problem with the MAIL "new messages sound".?  If I reboot the iMAC and keep the mail app open after a number of messages come in the NEW MESSAGE Sound quits. I have to reboot the machine to get it back.

    New Messages sound quits after several messages have arrived. I've tried several passes at resolving but nothing I have done seems to work. Sometimes I have to reboot the imac several times to get the New Messages Sounds back. Everything else works. The only thing I haven't done is reinstall the OS and that seems foolhardy.

    Hi Memalyn
    Essentially, the bare issue is that you have a 500GB hard drive with only 10GB free. That is not sufficient to run the system properly. The two options you have are to move/remove files to another location, or to install a larger hard drive (eg 2TB). Drive space has nothing to do with SMC firmware, and usually large media files are to blame.
    My first recommendation is this: download and run the free OmniDiskSweeper. This will identify the exact size of all your folders - you can drill down into the subfolders and figure out where your largest culprits are. For example, you might find that your Pictures folder contains both an iPhoto Library and copies that you've brought in from a camera but are outside the iPhoto Library structure. Or perhaps you have a lot of purchased video content in iTunes.
    If you find files that you KNOW you do not need, you can delete them. Don't delete them just because you have a backup, since if the backup fails, you will lose all your copies.
    Don't worry about "cleaners" for now - they don't save much space and can actually cause problems. Deal with the large file situation first and see how you get on.
    Let us know what you find out, and if you manage to get your space back.
    Matt

  • Changing New Mail Sound

    I have an iPhone 4 (AT&T) running iOS 6.0.1. My "New Mail" sound persists in being Tri-tone, despile all my efforts to silence it or change it to another sound.
    I have tried to reset it using Settings>Sounds as well as Settings>Notifications>Mail without success. I have restarted many times, and done a complete reset/restore once, all without success. The settings appear to be correct, but the loud Tri-tone sound still persists.
    Any suggestions?

    I have done a complete backup and restore (twice), as well as a "Reset all Settings".   Neither solved the problem.  I have not yet done a "Restore as new iPhone" because of all the effort that would entail, and because I have become doubtful that any of these things will help.
    I may just have to live with the problem.  I was hoping that I had just overlooked a simple setting somewhere.
    Thanks for your help!

  • Mail 4.1,not playing "new message" sound, and some sent mail not in outBox

    For some reason, no "new message" sound is being played (has been like this for a few weeks), and some (~1/10) sent mail does not show up in the sent box (been like this for a long time).
    And yes, preferences are set to "play new messages sound"
    Any ideas?

    I would guess that's an IMAP account, go into mail preferences and select advanced tab for that account and uncheck use IDLE command and the new mail sound should work.
    Not sure about the sent mail problem.

  • Is it possible to disable New Message sound for SPAM messages?

    I inherited a role email account which receives an incredible amount of spam. Mail's SPAM filters do a good job or routing these messages to the SPAM box and keeping them out of my inbox, but I still receive a "New Message" sound notification every time a new SPAM message arrives. Is it possible to disable the "New Message" sound alert for SPAM messages while still receiving the alert for new messages that arrive in my inbox?
    Thanks,
    jason

    Try this:
    Go into Preferences -> General and uncheck the box that says "Play sounds for other mail actions".
    I'm not sure if it will work since that's really still "new" mail, but it might be worth trying.

  • Ghost Email, new mail sound and no mail, quite often

    I have a two part question: I get the new mail sound with the activity next to a mail box but quite often no mail. Sometimes I'll check online to see mail which I haven't gotten on my computer. I play with the Junk Mail settings, which I do not use. I have several RULES which I will turn off just for a test. None of this seems to matter
    MacBook Pro 2.4 GHz/2 GB SDRAM/   Mac OS X (10.4.9)   .Mac & POP

    I would like to add many times my .mac mail box will show a number but when clicked on the number would go "poof". It seems my computer is showing the number of emails recieved on the server but not forwarding them, until I go to the web site. I do Rebuild the mailbox and usually I'll get one or two I looked at

  • New mail sound suddenly stopped working

    I assigned a 'new mail sound' (wav file) and for no apparent reason suddenly stopped working. Anyone else experienced this ?

    This sometimes happens to me too, as well as my alerts with iChat. I have to restart the computer and that fixes it for me. Hope that is the case with you as well.
    Christine

  • Random "New Mail" Sounds

    Can anyone help me with this, or has anyone experienced this...
    For the last couple of days my iPhone vibrates and makes the "new mail" sound. I look at my mail, text messaging, calendar and no new messages. I have checked my preferences and I don't see where this could be coming from. It really sounds like I have a new mail message, but there isn't any. They only thing I can think of is the sound comes because the phone has just finished and letting me know it has checked the mail. Possible?
    At first it was rather intriguing, but now it is getting annoying.
    Thanks.

    hittlets,
    Do you have a POP mail account set up on the iPhone? If so, do you have that mail account open on a computer or another device?
    The symptoms you are describing sound like it may be caused by POP lock. That occurs when you have more than one device (computer, phone, etc.) accessing the email server at a time. POP protocol is designed to only allow one device to access the server at a time. So you may be receiving the new mail dings when the iPhone checks the email server and sees new messages, but you are not seeing them in your inbox and getting the "load 25 more messages" option because another email client is accessing the server, preventing the iPhone from actually retrieving the new mail. Shutting off the other programs or devices that are accessing that email account should allow new mail to be downloaded by the iPhone correctly and you should see those new mail dings start responding to new messages the iPhone downloads.
    Hope this helps,
    Jennifer B.

  • How do I change the "new messages" sound? (Thunderbird 31.3.0 on MacBookPro running OSX 10.9.5)

    I followed the instructions at
    https://support.mozilla.org/en-US/kb/how-customize-new-mail-sound
    to change the "new messages" sound. It does play when I click on "Play" in the Preferences pane.
    However, when new mail comes in, it plays the default sound. So why is it ignoring the Preference?

    I was wrong. It's playing both the default sound AND the sound I selected. How do I get the default sound to stop?

  • Headphones play new mail sound upon plugging in

    Whenever I plug in or unplug my headphones, my computer plays the new mail sound repeatedly, presumably for each email I have recieved since last plugging/unplugging them. It also plays the sent mail sound if I happened to send any emails in that time period. This only started happening after installing Lion, and searching I have done has yielded no results. Anyone else have this issue and know how to fix it?

    I solved it at least for my situation.
    When you plug in usb audio such as a monitor with speakers, or other speakers go to the sound settigns in system prefernces and select sound effects and then select internal speakers. The problem seems related to the sound effects going through external audio or USB audio.
    Make sure internal or headphones is selected instead of usb while the usb audio device is plugged in. Unplug the device and then plug it back in verifying that the setting stays changed to internal speakers for usb audio devices and it should fix your problems.

  • 3gs - 4.2. update - now new sms sounds found???

    Hello All,
    I just updated my Iphone for new software version. Apple promises 17 new sms-sounds?
    After installation and severeal hard resets/on/off´s - I see only old sms tones?
    What should I do?
    t. m

    What should I do?
    There's nothing for you to do. This is a feature for the iPhone 4 only.

  • New mail sound, but no new mail appearing in inbox or junk

    I've seen this question a few times with anwers, but so far, the answers have not been able to solve my problem.
    Here's what I've done:
    1. unchecked the box to signal when any action in the mailbox takes place.
    2. I moved the messagerules.plist and messagerules.plist.bkup to my desktop and reset the junk filtering, but the new message sound continues to play when no new messages are present.
    I am porting the mail to mac mail from an MSN account, could that have something to do with it?
    I have never set any rules, but only accepted the standard filtering. I have no custom rules.
    Any other ideas?

    Hi tcass. You’re welcome.
    Thanks for the clarifications. Yes, you’re using a plug-in to access this account, and it’s the plug-in that does all the grunt work. Mail is a standard POP & IMAP client that knows nothing about other types of accounts.
    At this point, I’m not positive I’ll be able to figure out what’s going on here, but let’s look at the contents of your Mail folder in case there is something amiss there.
    Report the names of the files and folders present at the first level of the ~/Library/Mail/ folder in the Finder.
    In order to post the exact file names and avoid typing mistakes, proceed as follows. In the Finder, go to ~/Library/Mail/. With that folder open, if you’re looking at it in View > as List mode, first collapse any expanded folders so that the Finder only shows the files and folders at the first level of ~/Library/Mail/. Now, do Edit > Select All (⌘A), then Edit > Copy (⌘C), and paste it in your reply to this post.
    Before actually posting that information, edit it so that the file/folder names do not reveal any details you should keep private, e.g. replace any real username with “username” to hide your real email address. Try to be consistent in how you disguise those details, though, as we may need to refer to them in subsequent posts.
    Report also the names of the files and folders present at the first level of the ~/Library/Mail/HTTPMail-username@mailserver/ (or something like that) account folder.
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder, i.e. ~/Library is the Library folder within the user’s home folder.

  • New messages sound doesn't play in Apple Mail 4.5

    the new messages sound doesn't play in my Apple Mail v.4.5

    Tried Apple Support many times, they just play dumb.. Try this application.  I disabled notification on Mail and let this one does and it actually uses Mail sound files.
    http://www.macupdate.com/app/mac/32744/herald

Maybe you are looking for

  • Objects transported when we transport a Planning level in BW-BPS

    Hi All,    Can anybody tell me what are the objects that will get transported when we transport a Planning Level under a Planning Area in bw-bps. Thanks in Advance Asif

  • Sso configuration in portal to share point portal

    Hi, Can you please provide me the steps to configure sso in portal to share point portal. my requirement is to create an iview that displays the shrepoint portal home page without asking user credentials. pls suggest UPID and logon tkt methods. Thank

  • Mat. No. require in Selection screen of sales order reference

    Hi Team, When we create an order (Credit memo) with reference to billing document, the sytem give the material description in the Selection List. My question is how we set Material No. instead of Description in the selection list. Thanks AT

  • How to delete data from MDS

    Hi All, I have updated the composite for ReqABCS in MDS by running the ANT command. Now there is a ApplicationConnectorServiceLibrary folder created outside AIAComponent as I gave the wrong path in UpdateMetadataDP.xml file. Now I want to delete this

  • Need help on Migration

    i'm going to migrate SQL Server 7 to Oracle 10g. Could you please help me whether any tools are available for migration. whether Oracle SQL Developer 1.2 Migration Workbench tool, would be helpful..? My SQL server is resides in Window 2000 whereas Or