No announcement yet.

Audio on a timer to play every hour

  • Filter
  • Time
  • Show
Clear All
new posts

  • Audio on a timer to play every hour

    Hi all
    I need help with a Xmas project I am creating for my daughter. I have an mp3 with santa bells and saying ho ho ho.
    I would like Audio to play every hour.

    I have tried the code below but it keeps looping, till I change to true, false.
    Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\1 Sleigh Bell Hohoho (Christmas Sound Effects Fx).mp3", true, true);
    I have also tried adding a timer but I am doing something wrong.

    Can anyone help please.

  • #2
    Ensure the the last 2 parameters of Audio.Load() are both set to false.
    Start your Page Timer.
    Set the timer to fire every hour.

    Nb. 3600000 milliseconds = 1 hour.

    Page On Show (or Button On Click, etc)
    Audio.Load(CHANNEL_EFFECTS, "AutoPlay\\Audio\\MyAudio.mp3", false, false);
    Page.StartTimer(3600000, 10);
    Page On Timer


    • #3
      Nb. Change the first parameter to true if you want if you want the audio to play once when you first launch.


      • #4
        Actually, you might do better loading that audio into CHANNEL_BACKGROUND (or CHANNEL_NARRATION like you originally had it). Just noticed an issue with using CHANNEL_EFFECTS whereby the Timer seems to stop firing whenever you mouse over the page.

        Not sure if that's a bug (never noticed it before). Regardless, if u just stick with either CHANNEL_BACKGROUND or CHANNEL_NARRATION then it shouldn't be an issue.

        Here's just a quick demo in which audio plays at runtime and then subsequently at 5 second intervals. So, obviously you'd just change the parameter of the Page.StartTimer() command from 5000 millisecs to 3600000 millisecs.
        Attached Files


        • #5
          And just an afterthought:

          Not sure how old your kid is (but I'm guessing maybe 3 or 4?) In which case, she might dig this. Maybe it's something you can work into whatever it is you're creating there, for her?

          Any dad who sits down to invest time & energy into something for his kid is pretty cool in my book.
          Attached Files


          • #6
            #BioHazard Thank you for the help, I have tested your example and it works great just what I wanted. I was almost there with my code but could not figure out the Timer code.
            Any dad who sits down to invest time & energy into something for his kid is pretty cool in my book.
            Thank you for the kind words. My daughter is 7. I plaid the Santa's White Christmas and she loved the dears.
            The project is a santa and sleigh, flyng at the top of her screen looping, I have added a santa button that she can click on, and opens up a web browser to play online Christmas games.
            Thank you once again.


            • #7
              No worries. Forgot to mention - there's no native support for .mp3 in AMS. So, you'd either have to: re-encode your audio to an AMS supported format such as .wav or .ogg. Or alternatively, edit the AMS _res_types.xml file to recognize .mp3.

              You can do the latter by adding <Ext>mp3</Ext> to the Resources >> Audio >> Extensions section of the file. Like this:

              The _res_types.xml file is located in the AMS Data folder.
              C:\Program Files\AutoPlay Media Studio 8 Personal Edition\Data\_res_types.xml