Play random sound from big list


Last Updated:

  1. pikaachi

    pikaachi New Member This Topic's Starter

    Joined:
    Oct 11, 2010
    Messages:
    1
    Likes Received:
    0
    In my res/raw folder, I have many .wav files. I want my program to choose a random sound clip from my res/raw folder and play it when I click a button.

    I know a way to do it by hard coding the .wav IDs, auto-generated in the R class. But I just have too many .wav files to manually type each ID :(

    I spent hours researching about this but I have no idea. Any help will be appreciated. Thanks!

    EDIT: The .wav files do not have to be in the res/raw folder. I can move it inside assets folder if it makes things easier...
     

    Advertisement
  2. JiMMaR

    JiMMaR Well-Known Member

    Joined:
    Jun 12, 2010
    Messages:
    363
    Likes Received:
    57
    from my testing , .wav files didn't work on my phone
    use mp3 or ogg (ogg is better)

    I know this is not your question here, but thought I'd mention it :D
     

Share This Page

Loading...