×

Discussion Board

Results 1 to 9 of 9

Thread: Looping sounds

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    15

    Looping sounds

    Hi all,

    I tried playing a sound file (wav or mid) in the looping mode. Found that the sound gets cut with a short pause after each loop before resuming from the start. The repeat mode is being used for things like ambient sound and engine noises where i only have a short sound file which i hope to repeat infinitely but the short pause after each loop is making it impossible to do so.

    Does any1 have any ideas how i could circumvent this problem?? The looping noises are really just repetitive noises and i hope to keep them as short as possible and use the repeat mode to loop the sound for long periods.

    Thanks.

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Location
    Tokyo,Japan
    Posts
    289
    hi
    Are you developing this application in J2ME or symbian OS compatible C++.

    Can you elaborate over the steps you are using in replay , then I may suggest you th solution .

    I have developed application of same type with J2ME and C++ both.

    bye

  3. #3
    Registered User
    Join Date
    Nov 2004
    Posts
    15
    Since this forum is Mobile Java, i'm of course developing on J2ME platforms.

    I'd tried a few ways to tackle this problem, like using multiple Players, multiple threads, etc etc. All works very well on emulators, but on the actual devices, it is another story. Memory fetch time, device switch penalties are very real problems on actual devices and affects performance greatly...

  4. #4
    Regular Contributor
    Join Date
    Oct 2004
    Location
    Tokyo,Japan
    Posts
    289
    Hi
    You may try following scheme

    when your media playing ends you get notification in method

    public void playerUpdate(Player player,String event,Object eventData)
    {

    if (event == PlayerListener.END_OF_MEDIA)
    {
    // start player again
    try
    {
    yourPlayer.start();
    }
    catch(Exception e) { }
    }
    }

    yourPlayer is Player object and a member of your class.

    This is gives very less/negligible delay , instead of using multiple threads and player objects.


    Hope this may help you out.
    Cheers
    Navjot Singh

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    15
    I got the pauses inbetween loops even when i'm just playing the sound in "Looping" mode. Does the notification method carry a lower overhead than simply letting the sound playing in a looping manner??? If u had tested it before, please let me know the results. Thanks.

  6. #6
    Regular Contributor
    Join Date
    Oct 2004
    Location
    Tokyo,Japan
    Posts
    289
    Hi
    With looping what do u mean exactly.
    If you mean to invoke play command on player in a loop ,
    for or while loop , then my friend your are adding a lot of overhead on the mobile ,

    try with the method which i suggest in the above reply coz it takes minimum overhead and introduces least delays in playing a sound file in loops.


    Hope this may hekp you out .

    Cheers
    Navjot Singh

  7. #7
    Registered User
    Join Date
    Nov 2004
    Posts
    15
    Hi, thanks for replying.

    I meant to play the Player objects in looping mode. Shouldn't that incur the least overhead since its directly supported by the J2ME? No no no, nothing to do with while loops at all :-)

  8. #8
    Registered User
    Join Date
    Dec 2004
    Posts
    2
    I have been getting this issue too. When I use the setLoopCount(-1) method, I can't get a smooth loop.
    Has anyone been able to solve this issue?

  9. #9
    Registered User
    Join Date
    Nov 2007
    Posts
    7

    Re: Looping sounds

    Hi,

    I can see the last post was few years ago.
    Has anyone found a solution for this basic problem?
    All we want is to play a wav file in a loop without intervals between each loop. Anybody has an answer?
    I tried the above suggestion but still a big delay is between each loop.
    May be Nokia can answer this?

    Thanks,
    Ishay

Posting Permissions

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