
squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2013
06:53 AM
Default button sounds
I have some RemoteKeyPressed command that are doing what i want, but there is no sound (the standard Roku button sounds) probably because of how I've written it. Is there a way to make sure you get the regular sounds? I'm referring to the up and OK buttons. In the code below the info button sounds but the other two do not.
Thanks
while true
msg = wait(0,canvas.getmessageport())
if msg.isscreenclosed() return 0
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 10
canvas.Close()
return 0
end if
endif
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 6
canvas.Close()
return 0
end if
endif
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 2
canvas.Close()
return 0
end if
endif
end while
Thanks
Kinetics Screensavers
8 REPLIES 8
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2013
07:54 AM
Re: Default button sounds
You would need to record the sounds from the roku box and have your script manually play them back - with "roAudioResource".

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2013
08:48 AM
Re: Default button sounds
Thank you for answering. I guess the sounds would be pretty smalI and that seems easy enough. I'll have to decide how much i care. Roku channels seem to be just like the artwork I built mine to display - you are really never done, you just have to stop at some point. 😄
Kinetics Screensavers

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2013
01:08 PM
Re: Default button sounds
Well that was the buggiest thing I've dealt with on the Roku. Recorded a Roku sound (click) made it exactly 1 second, 44.1 wav 88k. It plays when it wants to. There is no reproducible pattern. Doing the exact same button presses results in something like this:
try 1 - plays
try 2 - plays
try 3 - not
try 4 - not
try 5 - not
try 6 - plays
try 7 - plays
try 8 - not
try 9 - not
try 10 - plays
the next ten will be a different set. Pressing the button longer, or reloading that sub or reloading the app doesn't matter. Exporting from Audition or Quicktime doesnt matter. Waiting in case an 88k file in ram is taking a while to load, two different buttons - doesn't matter.Its just random. About the only sure thing seems to be it wont play more than 3 times in a row. Just weird. Its an improvement over no sound ever, but I was hoping for something consistant.
try 1 - plays
try 2 - plays
try 3 - not
try 4 - not
try 5 - not
try 6 - plays
try 7 - plays
try 8 - not
try 9 - not
try 10 - plays
the next ten will be a different set. Pressing the button longer, or reloading that sub or reloading the app doesn't matter. Exporting from Audition or Quicktime doesnt matter. Waiting in case an 88k file in ram is taking a while to load, two different buttons - doesn't matter.Its just random. About the only sure thing seems to be it wont play more than 3 times in a row. Just weird. Its an improvement over no sound ever, but I was hoping for something consistant.
while true
msg = wait(0,canvas.getmessageport())
beep=CreateObject("roAudioResource", "pkg:/sound/rokusound2.wav")
if msg.isscreenclosed() return 0
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 10
canvas.Close()
return 0
end if
endif
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 6
beep.Trigger(60)
canvas.Close()
return 0
end if
endif
if msg.isRemoteKeyPressed()
if msg.GetIndex() = 2
beep.Trigger(60)
canvas.Close()
return 0
end if
endif
end while
Kinetics Screensavers
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2013
12:51 AM
Re: Default button sounds
Try putting a sleep after the trigger or waiting on isPlaying() before returning and see if it makes a difference.
-JT
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2013
07:34 AM
Re: Default button sounds
"renojim" wrote:
Try putting a sleep after the trigger or waiting on isPlaying() before returning and see if it makes a difference.
-JT
Thank you renojim. I put a sleep(1000) after the triggers and it works every time now. Amazing what a little knowledge can do for you.
If any Roku folks read this, I guess i can understand that you dont include these sounds in the SDK, if they are proprietary, but the sounds are an integral part of the UI designed by you -Roku, its why I was compeled to add them. If developers can create buttons, then the buttons should trigger sounds, or at least developers should have access to the sounds already in the box. The idea that I have to record these things myself to use them is a little " lets put on a show in the barn" rather than "come develop slick apps for our awesome box".
Thanks again renojim, I'm sure you had to spend time figuring that out originally.
Kinetics Screensavers

RokuMarkn
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2013
11:45 AM
Re: Default button sounds
You're creating a new audio resource after every message you receive. That seems excessive. Also, your destroying of the currently playing resource is probably why you're getting inconsistent results. Try moving the CreateObject out of the loop.
--Mark
--Mark

squirreltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2013
12:27 PM
Re: Default button sounds
Thank you Mark. I did have it out of the loop, Farther north in the function, but the sounds didn't play. One of the problems with not knowing much is you grab on to the first thing that works, wrong or not, and you dismiss approaches that are one change away from working. Now that you've said that I'll have another look. I seem to repeatedly have trouble with things not being recognized just a few lines later, in the same function.
Kinetics Screensavers
destruk
Streaming Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2013
12:50 PM
Re: Default button sounds
What I'd do is create it as a global object and then in any routine that needs it I just use the trigger command and the global reference.
For multiple sounds, multiple global objects with different names. It would be better if the sample didn't have to be an entire second, but past posts on the subject all recommend it be at least a second long.
For multiple sounds, multiple global objects with different names. It would be better if the sample didn't have to be an entire second, but past posts on the subject all recommend it be at least a second long.