Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Location
    127.0.0.1
    Posts
    348
    Thanks
    26
    Thanked 40 Times in 39 Posts

    Flash and sound: Loading only a part of an mp3. Is this possible?

    Hi all,

    I have an mp3 file of 50 MB size, which has 4 songs combined.

    For example, song1 plays from 00:00:00 (hour:minute:seconds) to 00:05:00 and other songs in the following order.
    00:05:01 - 00:10:00 - Song2
    00:10:01 - 00:14:00 - Song3
    00:14:01 - 00:20:00 - Song4

    What I'm looking for is to load the each songs separately.

    Say, just to load Song 3 from 00:10:01 - 00:14:00, I use the following code.
    Code:
    var test_sound:Sound = new Sound();
    test_sound.loadSound("http://localhost/test/combined-songs.mp3",true);
    test_sound.onLoad = function ():Void{
    		test_sound.start(600);
    };
    The problem is, it loads everything and then plays from the 600th second.


    But if I remove the onLoad event and make it like:
    Code:
    var test_sound:Sound = new Sound();
    test_sound.loadSound("http://localhost/test/combined-songs.mp3",true);
    //test_sound.onLoad = function ():Void{
    test_sound.start(600);
    //};
    it doesn't skip the first part

    Is there a way to load only the required data?

    Thank you.
    Last edited by tagnu; 01-24-2009 at 09:26 AM.
    Blog Charity:Water
    WhatisWrongWith.me/tagnu - Send me anonymous feedback.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Well you have to load the whole mp3 I believe. Perhaps it would be easier to cut out the extra stuff you don't want and order it correctly? This would be the best solution.

    Search for audacity for a great free editor.

    Otherwise, is this all of the code? Something is missing that would help figure this out, but it has something to do with play(600);, which is the marker at which position to start playing the audio. Also your filename says 'combined', so are they all together or are you loading 5 song files?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Location
    127.0.0.1
    Posts
    348
    Thanks
    26
    Thanked 40 Times in 39 Posts
    I have a single file (combined-songs.mp3) which actually has 5 songs combined.

    I'm trying to figure out a way to play each songs without making separate .mp3 files. (using audacity or any other sound editor)

    This is all the code as of now

    The following code is to play the file from 10th minute, which is the second song.
    Code:
    play(600);
    Hope I didn't confuse.
    Blog Charity:Water
    WhatisWrongWith.me/tagnu - Send me anonymous feedback.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Is that all of the code, or are you using buttons to have it play?

    I think you could to use sound cues in order to have the files know when the songs were at a certain point. Otherwise you could have a listener that listens for when the sound is at a certain point and stops it.

    http://www.adobe.com/devnet/actionsc...nts_audio.html
    http://livedocs.adobe.com/flash/9.0/main/00000291.html
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • Users who have thanked gnomeontherun for this post:

    tagnu (01-26-2009)

  • #5
    Regular Coder
    Join Date
    Nov 2007
    Location
    127.0.0.1
    Posts
    348
    Thanks
    26
    Thanked 40 Times in 39 Posts
    Yes, that's all the code I have. No buttons as of now, I'm just testing the possibility.

    Thank you for the links. I'll check them and get back.
    Blog Charity:Water
    WhatisWrongWith.me/tagnu - Send me anonymous feedback.


  •  

    Posting Permissions

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