0

Playing multiple sound files with Expansion Module



Hi, I've searched the forum for info on the Expansion Module which you can connect to the HD1010. It has three audio outputs and I would like to play three mp3-files simultaneoulsly, routing one to each output. How do I go about doing that? I want them to start playing (in sync) as soon as the HD1010 boots up, and then play the three files in loop and in sync (the soundfiles are the exact same lenght). Is this possible to do?

7 comments

  • 0
    Avatar
    Benny Britten-Austin


    OK, I've got so far as to get the HD1010 to start playing and looping three soundfiles through the EM100 with the help of the sample scripts found here:
    http://forums.roku.com/viewtopic.php?f=19&t=25245
    However the soundfiles do not start simultaneously, there is about a half second delay between them, is there a way start all three of them at the same time? And preferably "resync" them at each loop?

    My script code as it is now:
    debug=true
    a1=createobject("roAudioPlayer")
    a2=createobject("roAudioPlayer")
    a3=createobject("roAudioPlayer")
    gpio=createobject("roGpioControlPort")

    p=createobject("roMessagePort")
    a2.SetPort(p)
    gpio.SetPort(p)
    gpio.EnableInput(1) 'using gpio 1 on the brightsign


    rem video mode
    mode=createobject("roVideoMode")
    mode.SetMode("1920x1080x60i")

    REM Settings
    a1.SetAudioOutput(0)
    a1.MapStereoOutput(1) 'expander 1
    a2.SetAudioOutput(0)
    a2.MapStereoOutput(2) 'expander 2
    a3.SetAudioOutput(0)
    a3.MapStereoOutput(3) 'expander 3

    Start:
    a1.PlayFile("track1.mp3")
    a2.PlayFile("track2.mp3")
    a3.PlayFile("track3.mp3")

    listen:
    msg = wait(0,p)

    if type(msg) = "roAudioEvent" then
    if msg.GetInt() = 8 then
    'a1.Stop()
    'a2.Stop()
    'a3.Stop()
    goto start
    endif

    else if type(msg) = "roGpioButton" then
    a1.PlayFile("track1.mp3")
    a2.PlayFile("track2.mp3")
    a3.PlayFile("track3.mp3")
    endif

    goto listen

  • 0
    Avatar
    RokuLyndon


    I think what you'll need to do is insert silence into two of your audio files to get them to start together. Your script is setup properly.
  • 0
    Avatar
    Benny Britten-Austin


    Do you mean to extend two of the soundfiles with silence in the begining to compensate for the start delay?
    This means that the sound files will be of different length and when they loop the "sync" will be off, and this will then increase for each loop. Or am I missunderstanding what you mean?
  • 0
    Avatar
    RokuLyndon


    You said there's a delay in the start. So, you would pad the front of each audio file so they start together. At the end of the audio, they would restart with the same padding in the front, so they should be in sync each time.
  • 0
    Avatar
    Benny Britten-Austin


    There is only a delay when the files starts playing after boot up of the HD1010, when they loop there is no delay (it's back to back) so the delay (as far as I can hear) is constant. If I pad the soundfiles they will sound in sync the first time but when they loop the padding will disrupt the "sync" and after the second loop it will be even more, and so on.
    Could a solution be to restart the files after each time they play?
  • 0
    Avatar
    RokuLyndon


    I'm a little confused.

    So, the delay occurs after bootup, correct? BUt, once the files start looping it's fine?
  • 0
    Avatar
    Benny Britten-Austin


    Yes, after boot up the HD1010 first starts to play track1.mp3 then after about half a second track2.mp3 starts to play and after another half second track3.mp3 starts to play. Without knowing how the HD1010 works I would guess it is buffering data before it starts to play?
    When the soundfiles loop there is no delay however so the time difference between the audio files stays the same.
Please sign in to leave a comment.