Getting the amplitude of a sound Clip

Hi, I'm having problems with the javax.sound.sampled package, specifically, the Clip interface.
I want to get the current amplitude of a Clip object. I set up the Clip and then call getLevel () on it, but it returns -1 (i.e., it doesn't know how loud it is)
The Clip is set up fine, and it plays OK, I just need the volume level of it. (By the way, the Clip is created from a .wav file).
This is what I do at the moment:
try {
   // clipURL is the URL of the .wav file
   AudioInputStream inputStream = AudioSystem.getAudioInputStream (clipURL);
   DataLine.Info info = new DataLine.Info (Clip.class, inputStream.getFormat ());
   if (!AudioSystem.isLineSupported (info)) {
      System.out.println ("There are no installed mixers that support this file type. System exiting");
      System.exit (-1);
   try {
      clip = (Clip) AudioSystem.getLine (info);
      clip.open (inputStream);
   } catch (LineUnavailableException lue) {
      // Handle exception
} catch (UnsupportedAudioFileException usafe) {
   // Handle exception
} catch (IOException ioe) {
   // Handle exception
} catch (Exception e) {
   // Handle exception
}Once I get this far, I play the Clip and try to get the current amplitude:
clip.start ();
float clipLevel = clip.getLevel ();
clip.stop ();
clip.close ()All of the above works, except for the fact that clipLevel is always -1, when it should be between 0.0 and 1.0.
Any help would be much appreciated. Cheers.

This is a known bug, see:
http://developer.java.sun.com/developer/bugParade/bugs/4297101.html
If this issue is important to you, please add your vote. It was originally reported in 1999 and has not been resolved as of 1.4.

Similar Messages

  • How to get the amplitude of a sound as a float number in Java

    Hi, I would like to create a program which plays an audio file(it may be a midi, probably) and it returns
    the amplitude of the sound in terms of float number.
    I mean, is it possible to obtain this number, since every sound file is actually a sequence of float number like
    110.010110101 etc.
    Can you help me with suggestions and details about the way to take.
    Regards
    Frank

    For sampled sound, the answer might be seen in [ this thread|http://forums.sun.com/thread.jspa?messageID=10636576#10636576]. For MIDI it is different in that you will only be able to get it as sampled sound once it has been synthesized, and as I recently found out, to get the audio coming through the regular sound lines will take nothing less than a physcical or software 'audio loopback' being installed, on most PCs.
    Of course, if it is MIDI, you might just cheat by calculating a 'volume' from the note velocities in the MIDI score.

  • What app can I get to to turn a sound clip of my grand-nephew into a ringtone?

    What app can I get to to turn a sound clip of my grand-nephew into a ringtone?

    QuickTime, GarageBand, iTunes, Audacity, and VLC can all do this. Actually, iMovie and FinalCut can too...
    Open your audio clip in the desired program and trim id down to the segment you want to use as a ringtone (iTunes can do the conversion, but it can't modify/trim the audio).
    Once you have the piece of the audio you want to use, save the audio file as MPEG4 audio (AAC) and use the file suffix ".m4r" instead of ".m4a" or ".mov".
    Drag the m4r file onto the iTunes icon in the dock or Applications folder and it will be added to iTunes as a ringtone (which you can add to your phone).
    If you use iTunes to convert the audio to AAC format, drag the sound out of iTunes and replace the file name suffix (.m4a) with ".m4r" and drag it back in.
    That's it.

  • Help!! working on a movie on Imovie. I had to delete a music file from a clip section and now there are some clips that have no audio!!! don't know how to get the audio back to my clips!!!! Help!!!

    Help!! working on a movie on Imovie. I had to delete a music file from a clip section and now there are some clips that have no audio!!! don't know how to get the audio back to my clips!!!! Help!!!

    You can use some third party software to copy the music from your old iPod back to computer first, and then import the music into iTunes and re-sync them to yournew iPod. Here is a guide about how to transfer iPod music to computer. Hope it helps. Feel free to email me if you need further help.

  • I am having a difficult time getting the duration of multiple selected clips. The duration display only will display the time for one clip.  Yes, I know I can add them up myself, but why?  :-)

    I am having a difficult time getting the duration of multiple selected clips. The duration display will only display the time for one clip not multiple clips.  Yes, I know I can add them up myself, but why?  :-)
    I am using imovie 10.0.6

    For reasons that you would have to ask Apple for they decided not to allow the precise position of the playhead to be shown in iMovie 10 (unlike in FCP 10.1.x).
    Geoff

  • Where can I get the codec to import iMovie clips into Premiere CS6?

    I am running a PC with Win7 & PPro CS6
    I have a bunch of clips that were copied over from iMovie imports (no original files exist anymore)
    They are all a special form of .mov
    I can play them in VLC Media Player (but not Quicktime, or WMP) so I know that a pc can handle them...
    When I import into CS6 I get an errorsaying Codec missing or unavailable...
    Whered can I get the proper Codec?
    Thanks all!
    Aza

    Considering the last post was made in March last year, I've attached the feature request I made today, just so you know you're not alone on this issue, for anyone with the same problem.
    MAC to PC Support:
    There needs to be a comprehensive and readily supplied library of codecs to provide simple transitions between MAC and PC.
    I'm currently working on my first feature film. I raised a little bit of money through Kickstarter, enough to buy a decent HD camera and a microphone. Basically, I'm not a professional and I'm learning as I go. The camera I bought is a Canon XHA1- it records to mini-DV. I do not have the money to buy an HDV tape deck, leaving me with the only other option of using the firewire port to capture footage off of the camera itself. I had a firewire-to-USB cable, which I used to capture footage to my PC, but after getting a new computer with Windows 8, the camera is now out of date and the OS has no drivers for it. I then decided to capture my footage on an old i-Mac my friend gave me, through i-Movie. After moving the files to my PC, I found that Premiere Pro CC was unable to import them.
    Needless to say, the song and dance I have to go through every time I try to capture footage is frustrating, and considering the mission of Adobe Creative Cloud, to provide affordable opportunities and resources to independent artists, not to mention the fact that Adobe is for both Mac and PC (and especially not mentioning the fact that it is a service I am paying for monthly,) I feel like these kinds of problems shouldn't exist.
    Of course saying "I pay for this, this problem shouldn't exist" is the rallying cry for every idiot who expects the impossible. But capturing on i-Movie... and importing to Premiere Pro? Really? Why is this an issue? Maybe i-Movie is out of date... but I'm not going to waste another weekend capturing; it probably still won't work.
    I'm not asking for file conversion software. That's what I'm going to have to do on my own, for GBs upon GBs of footage just so I can get to the editing table. The problem is that I have to convert it in the first place. If there is any progress on this issue, please let me know.

  • Getting the sitar (and other) sounds

    I know this is probably rudimentary, but I'm having a heck of a time changing the software instrument sounds on GB 09. I want to use the sitar and I see the sitar in the instrument gallery but getting the sound to work is another story.
    GB help has proven fruitless. And I've gone on other help sites that say that Audio Unit that is included with GB called the DLS Music Device will give me options. But when I open the Track info window for a software instrument and scroll down the list of generators and click the DLS Music Device, nothing happens. No options become available to me.
    What do I need to do exactly? As in step by step? And am I missing something in my audio library?
    Thanks,

    I'm hung up on the fact that there's an icon that I can see that shows a sitar.
    the icons have no relation to what is included in GB. note there is also a bagpipes icon, and there are no bagpipes included in GB.
    I tried earlier to download a Soundfont on a different site but it came up a dud with the file opening in ancient code.
    more information on SF2s:
    http://www.bulletsandbones.com/GB/GBFAQ.html#installsf2s
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    http://www.bulletsandbones.com/GB/GBFAQ.html#usesf2s
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    and a slightly out of date, but more hand holding tutorial that will give you lots of background:
    http://www.bulletsandbones.com/GB/Tutorials.html#allaboutsoundfonts

  • When I run the Free exec Download, I get the Windows XP "thud" sound and message "File is corrupt." I downloaded again and got same error.

    I am running Windows XP Servicepack 3. I clicked the Free Download, saved it using IE8, and then tried to run it. A couple of seconds after I pressed ENTER on the filename, I got that infamous Windows XP "thud" sound along with the message that the file is corrupt.

    Hi knobman- I'm not sure why the file would be corrupt. I would recommend downloading from the official Mozilla site only. You can click this link to get the latest and best version [just select 'Windows' and it should go]:
    http://www.mozilla.org/en-US/firefox/new/
    Hope that helps!

  • I get the picture BUT NO SOUND - HELP!!!

    Hello all,
    I need help just bought apple tv and connected to my flatscreen samsung 1080p to the tv hdmi4 and i get picture but NO SOUND!! Am I missing a cable?? Do I need something else?? What do i do ???

    I'm not familiar with your Denon specifically, but my Onkyo A/V amp has a settings menu for each input. Check the settings for the HDMI input you have the ATV connected to and make sure they are correct for your TV.
    Also, as I mentioned previously, you could connect your ATV back to your TV directly with the HDMI cable, then connect the optical audio output on the ATV to an optical audio input on your Denon, then make sure it is selected when you watch the ATV to get digital sound.

  • In Imovie I get the message that my source clip is missing so I can't work/view the project

    What do I do if I get a source clip is missing message in Imovie?

    Well you need to reimport the original of missing clip into iMovie.
    Geoff.

  • I've made a film, and I'm at the point where I export it to post it, and I get the error message that "2 clips are missing"?

    So my film is all done, very excited to share it. It's a short thing at about 4:20 minutes long with music with video from several different cameras, 2 types of gopros, and my buddy's nikon DSLR. It plays back fine in final cut but gives me the error message when i try to export.
    How do i 'find the clips that are missing' or figure which ones are the ones that are 'missing' ? And the how do i 'find' them ?

    Do you see any of your clips in the Browser have have been replace by a red icon? Those are the missing clips.
    You can also go to File -> Relink Files. It'll bring up a window showing the missing files when the "Missing" radio button is selected. There's a button to help you locate the files. Once you have located the missing files, click the "Relink Files" at the bottom of the window.
    I had to do this for 339 missing files...it's a long story...last weekend. It worked perfectly.

  • HT201335 how do you get video to come from amazon prime, I can get the sound but no video

    I have an ipad2 and am a amazon prime member, when trying to watch the movies on my TV I can get the audio but not sound, message on the screen tells me to disable the mirroring capability on my ipad2 which I cannot do because the feature to disable doesn't show anywhere.   Is there a solution?

    This is why I have a Roku 2 ( the 3 has problems).  I stream netflix and Amazon to any TV.

  • Satellite 1100-Z14: I get the only picture but no sound when playing DVD's

    I know mine is a fairly old notebook,but despite updating with latest firmware, I have an intermittent problem when playing DVD's (Reg 2) in that I get the picture but no sound, particularly with some older DVD's.
    CD's are ok.
    Toshiba repair agent says it is a software problem and they only deal with hardware problems.
    Can anyone tell me how I can deal with this problem please ? ( apart from getting a later model ! )

    I think I may have stumbled on the problem, I use IntervideoDVD7 and under audio effects there is an option
    'Sydney Theatre' etc, I changed it to 'off' and the sound cames back. maybe I should study their manual a bit more !

  • Multiple Sound Clips

    Simple problem, and I hope there's a simple fix . . . I have
    a sound clip running at the start of a Flash presentation. At some
    point, I need the first one to stop so I can start the second one.
    I know there's a difference between "stream" and "event" and all,
    but I'm having no success getting the first one to stop so it
    doesn't play over the second one.
    Suggestions?

    MBKrebs,
    > They were audio assets dragged to the timeline.
    In that case, think of it like this: Stream sounds are
    locked in-step
    with the timeline they're in. Let's say you drag an asset
    from the Library,
    put it in a frame, and configure it as Stream. Let's say the
    audio clip is
    30 seconds long. Your movie is set for 12fps, so 30 seconds
    would require
    360 frames to fully play the audio. If your span of frames is
    shorter than
    that, the audio will stop early. If the playhead stops before
    the full span
    of frames, the audio will stop earlier (and reconvene when
    the playhead
    starts again).
    If that same audio's entry keyframe is configured as Event,
    the sound
    only needs a single frame to play. Big difference!
    Stream sounds are often used for lip synching, as as for
    cartoons.
    There's no way to guarantee such tight synching with Event
    sounds. The
    timeline will play as fast as it can on a given user's
    machine, and might
    fall out of step with the audio.
    > For some reason, I can't seem to get a handle on using
    > sound clips ? I think I know what I'm doing, but then
    > it doesn't seem to work like it's supposed to.
    The ActionScript route isn't especially hard, but it differs
    based on
    what version of ActionScript you're using. If you're
    interested in that,
    let me know.
    Totally aside, your name reminds me of someone I knew, years
    ago, in
    Manitoba (MB), whose last name was Krebs.
    David Stiller
    Co-author, Foundation Flash CS3 for Designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • Getting the entire file path using "Browse button"

    Hi All,
    I searched the forum for the solution, but did not find it there.
    I am using JFileChooser to browse and select a file.
    then i have to pass this file as and argument to another java program where it reads the file and sends it to the server.
    Now what i actually want is, when the file is selected i want to get the file nam along with the path i.e. C:/temp/temp.doc
    instead i am getting only temp.doc.
    I tried setting the JFileChooser mode as DIRECTORIES_ONLY. But that gives me only C:/temp and not the file name.
    If i set it as FILES_AND_DIRECTORIES it again gives me only the file name and not the path.
    pls. help me. its urgent.
    thanks

    What is wrong with JFileChooser.getSelectedFile()? From the returned File object you can get the canonical name which sounds to be what you want.

Maybe you are looking for

  • Open Channel in Campaign execution

    dear experts, i want to used the open channel in campagin execution for sending message to the other system. basicly it will generate the xml file in the server. in order to do that, i made a badi implementation of CRM_MKT_EXP_CAMP_DAT and made some

  • A/R and A/P

    Hi freinds I want certain clarification on A/R and A/P. I persume A/R is generally related to sales and A/P accounts payable is related to Purchase . I want a clarification and confirmation. Regards Eldee

  • Open Purchase Requisition & open Planned Order

    Hi, How to know if a Purchase Requisition or a Planned Order is open? Regards, Anupam

  • Posting Document Not Created in Quality Server

    Dear All,                     My HR-FI Posting document is not created in quality server. Whem am running the PC_M99_CIPE  transaction and  run simulation run after that it giving me the message no document is created . And also am not able to see th

  • Employee master table

    I want know to know the employee master table object type...can anyone help me to sort out this issue