How can determine the duration of an audio file

Hi,
i'm making speech recognition project using java. i can capture sound by michrophone and playback it. the type of the sound is .wav.
my question is how to determine the recording duration (for example: determine the duration for 0.25 second) because i must recorded syllable,the assumtion is needed less than 0.5 second to say a word. and then.. can this wav file be changed into... binary or integer ?
thanks for your help

FYI I'm newbie in Java,
Yes, I want to limit the audio file lengths to a certain value. What should I do?
I have read wav file using an AudioInputStream, for audio format I'm using sampleRate = 8000.0F and sampleSizeInBits = 8. My friend said if I used 8 bit for sampleSizeInBit (resolution in amplitude) the binary file should be -128 till 127 in range according to the bit. I try this code and the result is binary file which is zero, positive, and negative.
the code
try{
audioInputStream.read(audioBytes);
for (int i=0; i<audioBytes.length;i++){
System.out.println(audioBytes);
catch(IOException ioe){
System.out.println("Error"+ioe);
I'm not sure that the code is right, but it works. Should I change the audioBytes into integer before? I try this code but it doesn't work.
int a = new int[audioBytes.length];
for (int i=0;i<audioBytes.length;i++){
a[i] = new Byte(audioBytes[i]).intValue();
this binary file has been printed in console (I’m using texpad). So, how I can write that to file.txt? I'm using FileoutputStream but it doesn't work correctly. Here is the code
FileOutputStream fos = new FileOutputStream(strFilePath);
{audioInputStream.read(audioBytes);
fos.write(audioBytes);
catch (IOException ioe){
System.out.println("Error"+ioe);
When I open file .txt is read as character like this üüüüüüüüüüüüûüüüûüûûû ||||||| ||||||| ||||||||||||||||||||||||||||| &#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746; (like using alt plus number)
Edited by: anasfr on Mar 19, 2009 9:02 AM

Similar Messages

  • The duration of an audio file

    I need to determine the length of my audio file. Right now I am using .caf files, but I can see how I might this to work with mp3s also.
    Anyhow, I see this tidbit from the Apple Core Audio Spec:
    mSampleRate
    The number of sample frames per second of the data. You can combine this value with the frames per packet to determine the amount of time represented by a packet. This value must be nonzero.
    That's looking good, except this will only tell me the duration of the packet. I can't find out how many packets my total audio file has. (And yes, this is a file, not a stream.)
    What am I missing? Any help is appreciated.
    Thank you.

    Unless I am mis-interpreting the question this should work:
    +(NSTimeInterval)getDurationForAudioFile:(NSString*)path
    OSStatus status = 0;
    AudioFileID audioFile;
    NSTimeInterval seconds;
    UInt32 propertySize;
    propertySize = sizeof(seconds);
    status = AudioFileOpenURL((CFURLRef)[NSURL fileURLWithPath:path],
    fsRdPerm, AUDIOFILETYPE, &audioFile);
    status = AudioFileGetProperty (
    audioFile,
    kAudioFilePropertyEstimatedDuration,
    &propertySize,
    &seconds);
    return seconds;
    Message was edited by: Amber Star

  • HT201066 How can I split a long recording audio file into multiple audio files?

    Hi,
    How can I split a long recording audio file into multiple audio files?
    With Windows I was using Nero software, which is not available for Mac. Is there any similar app for free for Mac?
    Thanks!

    Hello ingiorgio
    You can import the track into GarageBand and then split the tracks there. Once that it is done you can highlight the ruler section and then share the song to iTunes to get them separated out. 
    GarageBand - Split regions in the Tracks area
    http://help.apple.com/garageband/mac/10.0/#gbnd76fcce04
    GarageBand - Share songs to iTunes
    http://help.apple.com/garageband/mac/10.0/#gbndfb96a96f
    Regards,
    -Norm G.

  • How to determine the mimetype of an uploaded file (GUI_UPLOAD)?

    Hi everybody.
    I use method cl_gui_frontend_services=>gui_upload to upload files and save the binary data in the database. to preview the filetype (pdf, doc, jpg, ...) later i also need to store the mimetype.
    but how can I determine the mimetype of an uploaded file if several file extensions/formats are possible?
    thanks in advance for your help,
    Stefan

    call the function SKWF_MIMETYPE_OF_FILE_GET
    for this pass the filename , you will get the mime type.
    FILENAME                        C:\TEST.PDF  "pass this
    MIMETYPE                        application/pdf "you will get this
    FILENAME                        C:\TEST.JPG
    MIMETYPE                        image/jpeg
    FILENAME                        C:\TEST.DOC
    MIMETYPE                        application/msword

  • How to get the length of a audio file without play it ?

    Now I know a method to get the length of a audio file by play it:
    1 Create a Player, and add a ControllerListener
    2.Start the Player
    3.In the ControllerListener's controllerUpdate method, use getMediaTime() by receiving a EndOfMediaEvent
    However I think this method is not convenience, if I don't want to play it how I can get the length of the audio file?
    Is anyone can help me?Really thanks a lot !

    I got the answer here:
    http://forum.java.sun.com/thread.jspa?threadID=5149132&tstart=15
    I tried getDuration() before, but it always return a same time, I think maybe I didn't realize the player.

  • How to determine the size of a flat file attachment in a mail sender cc?

    Hi
    I use PI 7.11
    I have a scenario where a flat file attachment is being picked up by a MailSender adapter and if the size of the attached flat file is larger that 500 bytes the receiver is A and if the attachment is less that 500 bytes the receiver is B.
    I have checked the Context Object list in the Conditions section of Receiver Determination, and it seems, that only the file adapter allows for validation on the file size.
    I contemplated an extended receiver determination but the attachment is a flat file which just needs to be passed thru without being converted to an XML document, so my source document is not of XML format.
    An other but not very nice way would be to use an intermediate folder to drop the attachment in and from there use a file sender adapter and thus get access to the filesize attribute in my receiver determination, but I would like to avoid this.
    Any suggestions?
    BR MIkael

    Hi
    I have decided to make a module, where I plan to place the size of the attachment in the Dynamic Configuration variable "ProcessStep", but to my surprise, it seems that all the context objects in the receiver determination condition section are of type String and hence it is not possible to make a condition where I test for whether the value is smaller than say 500!? Only equal, NOT equal and LIKE are available (EX seems to be disabled as this probably only works in an xpath.
    Would one way be to use the xpath expression like this ns1:Main\ProcessStep < 500 where ns1: http://sap.com/xi/XI/System?
    MIkael

  • How can I get a low resolution audio file?

    Hello to all. I have recently upgraded my iTunes to 11.0.03. I remember being able to create a new audio file of specifications offered by the menu in iTunes. My present requirement is to make a low quality MP3 file of an existing higher quality file and find that I am unable to do it with this new version of iTunes which only creates a new version of like quality and does not offer me options of selecting the quality of the file I need to make. Any help in this matter will be deeply appreciated.

    Thanks Jim for the leads. I did go into preferences>import settings and set it to the lowest offered quality. When I then selected the file and clicked, I have not been given the option of converting the file but only create:
    When I had earlier clicked this option, it only resulted in a same sized file being replicated.
    Anyway, I proceeded and clicked create MP3 version and, 'lo and behold' it created one according to the import settings that had been made!
    Thanks Jim, you have solved my problem.

  • How can reduce the size of my pdf file?

    Hi There,
    I need to reduced a scanned pdf document which is 23MB in to a smaller size so it's acceptable for email.

    Acrobat can reduce PDF file sizes.  However, by how much depends largely on its content.
    On the other hand, sending e-documents as email attachments is never a good idea - they can get damaged, misdirected, lost, and there is always the file size limit.
    Much better is to use a file sharing service (Acrobat.com, Dropbox, Google Drive, Microsoft OneDrive, ...) - upload and share the document, then send the download link by email.

  • How can stop the bdump and udump trace files from accumulating?

    The files are growing so until it is filling up the user's c: drive. It's hundreds of files over 20 megs.

    Angela,
    The management of those files is a reposnsibilty of the DBA. ie The files dumped there are from background processes, session traces and your alert log.
    The alert log in bdump should be checked daily and errors investigated. Some errors will result in trace files being dumped. The alert log will always grow during normal operation and you can simply delete it or better yet zip it up and store it somewhere for a period of time.
    You can clean up the udump user traces files by simply deleting them periodically. For other traces you should have a look to see what they are for. Any ORA 600 traces should be investigated.
    If you are not a DBA and this seems to much trouble then you can just delete the files to reclaim the space.

  • I have an ipod I want to sell, but I don't know how to determine the specs, which one it is, how much memory, etc. Where can I find this information?

    I have an ipod I want to sell, but I don't know how to determine the specs, which one it is, how much memory, etc. Where can I find this information?

    See this Apple support document.
    http://support.apple.com/kb/ht1353
    B-rock

  • Upgraded to 10.3.1.55, now can't set iT as default player,"An error occurred when updating the default player for audio files types.  You do not have enough access privileges for this operation." How to fix?

    After I upgraded iTunes, iTunes doesn't recognize CD in the drive, apparently isn't the default player.  It won't let me set iTunes as the default player, I get the error message "An error occurred when updating the default player for audio files types."  I tried Whitesides' remedy (changing Read Only status in folder in Windows) but it didn't solve the problem.  Any suggestions?  Thanks.
    J

    Oddly enough. I think I just solved it. It looks like, for some reason, my computer has about 8 different "iTunes music" folders, and I've been saving my music to the wrong one. Neat. Music now imports and plays as it should. Copying things over is going to be so fun tonight!

  • How can I export a video with audio from premiere cs 5.5 to a DVD

    how can I export a video with audio from premiere cs 5.5 to a DVD

    You don't... at least not directly... you export MPEG2-DVD and then use the TWO files (audio and video) in Encore
    CS5-thru-CC PPro/Encore tutorial list http://forums.adobe.com/thread/1448923 may help

  • Integration MIRO error, how to determine the VST related accounts.

    integration Miro error.
    Hi gurus,
    please resolve the problem urgent.
    while doing MIRO Iam getting the following error.
    after given PO number in MIRO I getting the following error. please how to resolve the problem.
    where i can determin the accounts, which accounts will be effect.
    Error in account determination: table T030K key ASHA VST V0
    Message no. FF709
    Diagnosis
    In the chart of accounts to be posted to, no accounts are defined for the tax code you used.
    Procedure
    Contact your system administrator.
    Define the accounts to which a tax posting is to be made with the tax code entered in Customizing for taxes on sales/purchases.
    To do this, choose Maintain entries (F5).
    How to determine VST

    I have already replied to the same question in one of ur earlier posts.
    If you want to knowthe GL accounts which are used presently for the transaction VST, you can go to table T030K give the field name KTOSL value as VST and execute. YOu will get the list of all GL accounts which use the transaction VST for all possible tax codes and Chart of Accounts.

  • How to determine the ROWNUM in a Master Detail Form

    Hello,
    I am working in a Master Detail Form with Orders and Order Items Information; and I created a process that allows the users to select a Product ID on a tabular form, and the next column is populated automatically with the Product Description.
    To achieve that, I followed some instructions by Denes Kubicek (http://apex.oracle.com/pls/otn/f?p=31517:241), but my case is slightly different:
    <ul>I am using a wizard-created tabular form, instead of a manual tabular form; and </ul>
    <ul>Instead of using another page as a Popup to pass the parameter of the ROWNUM, I am using a plug-in called “Tabular Form Super LOV” which is a modified version of the SkillBuilders’ Super LOV that works on Tabular Forms. </ul>
    The Product ID is returned in the correct row by the plug-in; but in the case of the Product Description, it is always returned into the first row; and my problem is that I don't know how to determine the row where the user clicked to call the plug-in.
    I set up an example in apex.oracle.com in case someone would like to look at it:
    Workspace: ediazjorge
    Username: test
    Password: test
    App Name: Sample App
    App Number: 1550
    BTW, I am using Apex 4.1.1.00.23 and Oracle DB 10.3.2.
    Thanks in advance,
    Erick

    Hello VC,
    Thank you for your time and help.
    Unfortunately, it is still not working properly:
    1. When the Popup LOV opens, the first row of the tabular form is 0, the second row is 1, and so on. How can I assign the values starting with 1 and in the format *0001* ? (I am still a novice on Apex and new to JavaScript :-), sorry about that).
    --2. Also, when I close the Popup LOV, the value of P1_ROWNUM is ‘undefined’ again so I'm not sure if the Product Name column will be populated.--
    3. And finally, you are using the jQuery Selector uPopupLOVIcon, which is an attribute of the Cloudy Theme. In my real application (Apex 4.1.1.00.26), my element looks like: *<img src="/i/lov_16x16.gif" width="16" height="16" alt="Popup Lov" alt="List" style="vertical-align:middle;" align="middle" />*. What do you recommend me to use as a jQuery Selector?
    Again, I really appreciate your help and time. I think you solved the most difficult part.
    Thank you so much,
    Erick
    Update: I just found out that the problem with my comment 2 is because I didn’t delete the previous dynamic action that set the value to P1_ROWNUM.
    Edited by: ediazjorge on Sep 18, 2012 11:20 AM

  • How to determine the structure of parameter method in WebServiceDataControl

    Hi all ,
    I have a web Service Data Control ,this data control has web service method that take a parameter of type (java.lang.Object)
    how can I determine the structure of this object to send it to the web service method
    (how can create the object that satisfy the object parameter of web service data control)

    I can see the constructor of data control which contain (name,age)
    but I don't know how can I send these two parameter in one object that satisfy the type of object in the web service method
    "parameterObject" : contain (name and age) values . (I don't know the type of "parameterObject" in web service)
    Map params = operationBinding.getParamsMap();
    params.put("arg0", parameterObject);

Maybe you are looking for