Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Feb 2007
    Location
    Missouri
    Posts
    178

    Incorrect Audio Lengths! Help!

    For some reason my for some of my songs, it says that they are longer then they actually are. For instance, I have a 3:42 song, however my label says its 7:14. Thats more then 4 minutes longer. This incorrect file length makes my progress object for my songs not function properly. It only does it for SOME songs not ALL.

    Any ideas?

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    that is strange, iv never had that (yet, lol)

    how are you getting the length Audio.GetLength?

    all i can suggest is upload one of the suspect tracks and i'll try it in some of my ams audio players (hence, iv made a few, lol)

    it might have something to do with the file attributes wich would be unrelated to your code so changing it is useless if it only happens with some of your tracks

    EDIT: Are you sure there is nothing in your code that could add to the track time.......just a tought
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    May 2005
    Posts
    1,115
    Have you used CoolEdit/Audition and saved the file as a VBR?
    Never know what life is gonna throw at you.
    (Based on a true story.)

  4. #4
    Join Date
    Mar 2005
    Posts
    130
    yes vbr files return incorrect length.
    only solution media player pluigin :(

  5. #5
    Join Date
    Sep 2005
    Location
    Arizona
    Posts
    77
    I am consistently seeing longer audio lengths (between 10 - 20 secs) using Audio.GetLength on 3:00 - 4:00 stereo 44 Khz .WAV files... Anyone else seeing this?

  6. #6
    Join Date
    Jan 2007
    Location
    Resita ( Romania )
    Posts
    118
    Seems that the lenght witch is given by the function ( 7:14 ) is double to ( 3:42 ) . Use this :

    Code:
    CurrLength = Augio.GetLength () ;
    RealLength = CurrLength / 2 ;
    That's all , I hope this is usefull !

    Anyone need a script to convert lenth in seconds , to the format : mm:ss ?

  7. #7
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Hey CrazyFrog, I'd like to see that script (mm:ss) if you dont mind.

  8. #8
    Join Date
    Jan 2007
    Location
    Resita ( Romania )
    Posts
    118
    Put This Code in " On Audio " Event
    the script is :
    Code:
    lengthsec = Audio.GetLength(5);
    lengthminex = lengthsec/60;
    slengthminex = lengthminex..""
    min = Math.Floor(lengthminex);
    smin = min.."";
    target_index = String.Find(slengthminex.."", ".", 1, false);
    safterdot = String.Mid(slengthminex.."", target_index, -1);
    safterdotf = String.Concat("0",safterdot.."");
    nafterdot = String.ToNumber(safterdotf.."");
    nafterdotf = nafterdot*60;
    ssec = Math.Floor(nafterdotf);
    minsec = String.Concat(min..":",ssec.."");
    Label.SetText("totmin", minsec.."");
    Sorry for those nasty variables names
    I had worked for this code over an hour
    It has one Bug that when it should be 4:07 , the code returns 4:7
    Last edited by CrazyFrog; 04-20-2007 at 02:29 AM.

  9. #9
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Thanks CrazyFrog, works perfect.

  10. #10
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Here is a function that uses string.format to add in the zeroes as necessary. This formats the string from milliseconds.

    Code:
    function MilliSecondsToClock(sMilliSeconds)
    	local nMilliSeconds = String.ToNumber(sMilliSeconds)
    	if nMilliSeconds == 0 then
    		--return nil;
    		return "00:00:00";
    	else
    		nHours = string.format("%02.f", Math.Floor(nMilliSeconds/3600000));
    		nMins = string.format("%02.f", Math.Floor(nMilliSeconds/60000 - (nHours*60000)));
    		nSecs = string.format("%02.f", Math.Floor(nMilliSeconds/1000 - nHours*3600000 - nMins *60000));
    		nMilliSecs = Math.Round(nMilliseconds - (nHours*3600000) - (nMins *60000) - (nSecs *1000))
    		return nHours..":"..nMins..":"..nSecs.."."..nMilliSecs
    	end
    end
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  11. #11
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Hey TJ_Tigger, I'm having a brain fart, how would I use this with the code above?

  12. #12
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Place the above function into your global functions so it gets defined when the project starts. Then when you want to use it get the current position of the song, which if I recall correctly returns milliseconds and place that value into the function and it will return a formatted string.

    Code:
    nMilliSeconds = Audio.GetCurrentPosition() -- or whatever the appropriate command is 
    sFormattedTime = MilliSecondsToClock(nMilliSeconds)
    Label.SetText("Label1", sFormattedTime);
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  13. #13
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Code:
    function MilliSecondsToClock(sMilliSeconds)
    	local nMilliSeconds = String.ToNumber(sMilliSeconds)
    	if nMilliSeconds == 0 then
    		--return nil;
    		return "00:00:00";
    	else
    		nHours = string.format("%02.f", Math.Floor(nMilliSeconds/3600000));
    		nMins = string.format("%02.f", Math.Floor(nMilliSeconds/60000 - (nHours*60000)));
    		nSecs = string.format("%02.f", Math.Floor(nMilliSeconds/1000 - nHours*3600000 - nMins *60000));
    		nMilliSecs = Math.Round(nMilliSeconds - (nHours*3600000) - (nMins *60000) - (nSecs *1000))
    		return nHours..":"..nMins..":"..nSecs.."."..nMilliSecs
    	end
    end
    Just to let you know there is a Cap problem in red. Thanks for the help TJ_Tigger

  14. #14
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Ok I'm having another problem that I didn't see when I tested this. The time is coming back as 00:00:00:110. Of course that is an example, but the second,minutes,and hours are not changing only the milliseconds. Am I missing something here?

    on my mediaplayer OnPlay action:
    Code:
    Page.StartTimer(1000);
    On page OnTimer Action
    Code:
    nMilliSeconds = MediaPlayer.GetLength("Video1");
    length = MilliSecondsToClock(nMilliSeconds)
    WinButton.SetText("time", length);
    Global Function
    Code:
    function MilliSecondsToClock(sMilliSeconds)
    	local nMilliSeconds = String.ToNumber(sMilliSeconds)
    	if nMilliSeconds == 0 then
    		--return nil;
    		return "00:00:00";
    	else
    		nHours = string.format("%02.f", Math.Floor(nMilliSeconds/3600000));
    		nMins = string.format("%02.f", Math.Floor(nMilliSeconds/60000 - (nHours*60000)));
    		nSecs = string.format("%02.f", Math.Floor(nMilliSeconds/1000 - nHours*3600000 - nMins *60000));
    		nMilliSecs = Math.Round(nMilliSeconds - (nHours*3600000) - (nMins *60000) - (nSecs *1000))
    		return nHours..":"..nMins..":"..nSecs.."."..nMilliSecs
    	end
    end

  15. #15
    Join Date
    Dec 2004
    Location
    Texas
    Posts
    239
    Any help guys?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Build failure because of errors
    By Ed Stanley in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 02-07-2006, 03:51 PM
  2. HELP: Trying to create a bookmark for audio
    By Ren in forum AutoPlay Media Studio 5.0
    Replies: 3
    Last Post: 09-12-2005, 05:20 AM
  3. Help: Trying to create a bookmark for audio
    By Ren in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 09-09-2005, 01:43 PM
  4. Playing Multiple Audio Files in Sequence
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 6
    Last Post: 08-15-2005, 03:38 PM
  5. audio question
    By mike41 in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 09-03-2004, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts