Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
renojim
Community Streaming Expert

roAudioResource questions/issues

There's nothing in the documentation that says what type of WAV files are supported. I have some mono, 8 bits/sample, 11.025kHz sampling rate files that don't play when triggered, but CreateObject returns a valid object. I assume they aren't supported. I have at least one file that appears to have the same characteristics as the others, but CreateObject returns invalid. So the question is, what are the requirements for WAV files?

The next issue is GetMetaData. For the above files, I get different results whether I'm running on 3.0 or 4.1 of the firmware. Neither gets it completely right, but 3.0 gets every parameter wrong. It always shows 2 channels, 16 bits/sample, and 44100 samples per second for any WAV file I try, even a mono, 16 bits/sample, 22.05kHz sampling rate file that plays. The length is wrong as well. v4.1 shows the file as mono and gives the correct length, but the sampling rate is given as 44.1kHz. v4.1 gives correct numbers for everything except the sampling rate (which always seems to be 44.1kHz) for the 8-bit, mono, 11.025kHz files that don't play.

Any help would be appreciated.
-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.
0 Kudos
9 REPLIES 9
jbrave
Channel Surfer

Re: roAudioResource questions/issues

Actually, last time I tested 8bit files they did play but extremely quiet and distorted, had to turn tv volume all the way up to hear them!

-Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
jbrave
Channel Surfer

Re: roAudioResource questions/issues

Other considerations:

Currently seems to be a limit of about 250k file size for roAudioResource. If you get invalid while calling an roAudioResource, try making it shorter in length.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
renojim
Community Streaming Expert

Re: roAudioResource questions/issues

The one for which invalid was returned was only 60k. I was hoping for an official response from someone at Roku. I really don't feel like experimenting and no matter how you look at it GetMetaData is just plain flawed.

-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.
0 Kudos
jbrave
Channel Surfer

Re: roAudioResource questions/issues

What I do if a file wont pl
"renojim" wrote:
The one for which invalid was returned was only 60k. I was hoping for an official response from someone at Roku. I really don't feel like experimenting and no matter how you look at it GetMetaData is just plain flawed.

-JT


Hey, JT, i am just attempting to be helpful. Email me the file, I've got lots of audio tools to investigate why it wont play. I've spent quite a bit of time with roAudioResource. I've even written a .wav file reader for roku that will decode and display the audio waveform, and am 1/2 finished with the edit/write function. As to the meta data, sounds like it is just broken. But again, I've written a tool that could actually tell you the correct metadata from the .wav header.

-Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
renojim
Community Streaming Expert

Re: roAudioResource questions/issues

Joel, thanks for the offer, but I think I'm going to stay with MP3s and roAudioPlayer until the Roku1s support channel caching. I've sort of determined that 16-bit, mono, 44.1kHz WAV files work, but turning a 4k MP3 into a 140k WAV seems pretty ridiculous to me. I was going to change Video Poker over to using roAudioResource, but the size of the WAV files would make the channel so large that people would probably have to delete channels to get the updated channel (I wonder if the possibility of an updated channel being too large to fit on the box has been tested by Roku). I don't feel like hosting the WAV files myself. In the future, I'm not sure what I'll do.

-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.
0 Kudos

Re: roAudioResource questions/issues

I am getting a similar problem. I tested my code using the snake "cartoon002.wav" which is 6.99KB / 352kbps.

sound = CreateObject("roAudioResource", "pkg:/assets/audio/cartoon002.wav")
print "Sound is "+type(sound)


"Sound is Invalid"


I've tried several other short wav and mp3 files but still nothing.
0 Kudos
RokuJoel
Binge Watcher

Re: roAudioResource questions/issues

I think you are using an incorrect path to the sound somehow. I just dropped that file into a project's images folder, loaded it, interrupted the program and did this:

BrightScript Debugger> res=createobject("roAudioResource","pkg:/images/cartoon002.wav")
BrightScript Debugger> ?type(res)
roAudioResource
BrightScript Debugger> res.trigger(100)


The sound played fine. Double check the path and that you've actually included the file in the project:

BrightScript Debugger> print listdir("pkg:/assets/audio/")


- Joel
0 Kudos

Re: roAudioResource questions/issues

Ah, I've just looked in the ZIP file that is exported from Eclipse (and uploaded to the Roku device) and it doesn't contain the audio files. I can see them in Windows explorer and also in my Eclipse project directory (within /assets/audio).

Why are they not being included in the package?

EDIT:

OK, so my BrightScript project didn't automatically include the additional directories! Strangely, I am able to put the audio file into /images/ and it loads fine as roAudioResource. If I use /assets/audio/ then it still remains Invalid - even if I make sure to include that path in the build (export).
0 Kudos
malloys
Visitor

Re: roAudioResource questions/issues

"AlexHolsgrove" wrote:

OK, so my BrightScript project didn't automatically include the additional directories!


new directories are not automatically added to the export list (see the 3 exceptions below) unless they contain files that match one or more of the include file patterns (and do not match any of the patterns in the exclude file patterns) specified in the deployment user preferences ( Preferences->BrightScript->Deployment ). You can set your own include/exclude file patterns as desired ( a default set ships with the plugin, but .wav files are not in the that default list). Also, when a file is explicitly selected or deselected for export, that eclipse workspace-relative filepath is remembered going forward.

"AlexHolsgrove" wrote:

Strangely, I am able to put the audio file into /images/ and it loads fine as roAudioResource.


Since they are either required or very common, a particular set of directories is included by default ( "/source", "/images", and "/locale" ).

"AlexHolsgrove" wrote:

If I use /assets/audio/ then it still remains Invalid - even if I make sure to include that path in the build (export).

That shouldn't be the case. I've just tried it myself (using that file structure and with .wav files) and it works for me.
Are you sure you selected the entire directory? Note that a directory can be in 1 of 3 states (visually indicated in the select box), not just 2:
(1) unselected (2) fully selected and (3) partially selected. The latter occurs when only some of the files in the directory have been selected (not the entire directory itself).
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.