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: 
BradC
Binge Watcher

Re: Optimal bitrate for roAudioResource

"Romans_I_XVI" wrote:
I still have the behavior where it sometimes only plays 50% of the sound effect or not at all of multiple activate in a short period of time.


As Joel said, it's important to note that if you trigger a sound, it will stop any currently playing sound. This is by design. So, if for example, you shoot, and play a shoot sound, and then shoot again before the shoot sound completes, the first shoot sound will cut off as the new shoot sound is triggered. This is how it's supposed to happen unless you use the method Joel outlined. I can tell you from experience that will (or used to) crash players like the HD, so be careful before using it.


Another thing you might do is something I've done in most of my games, and prioritize your sounds. For example, a shot may be a more important sound than an explosion. So if something is about to explode, you can check if the shot sound is playing, and if so, you just skip the explosion sound, because it's really not as important as having the feedback to the player of the shot sound. It's a bit of a pain, but the results are worth it in lots of cases (imo)
♦MiniGolf♦HangMan♦Brain Puck♦Retro Tennis♦BORK♦FLIP♦Pathogen♦Pathogen 2♦Shut the Box♦Birdie♦Logic♦Dots♦Pool♦küglo♦Bubble Wrap♦Trivia Channel♦Mancala♦Air Hockey♦Weather♦CAMERA♦Your Photos Screensaver♦Desert Beauty Screensaver♦Wild Lakes Screensaver♦
0 Kudos
EnTerr
Roku Guru

Re: Optimal bitrate for roAudioResource

That thing about audio channel and maxSimulStreams() is undocumented, right?
I cannot find a read on it and http://sdkdocs.roku.com/display/sdkdoc/ifAudioResource does not show 2nd argument for Trigger().

Seems quite useful, so... document it, pls?

Hat-tip @BradC: doing triage on the audio (prioritizing) - that is smart!
0 Kudos
Komag
Roku Guru

Re: Optimal bitrate for roAudioResource

Okay, so this thread is really important for me now, working through audio issues.

First off I have a problem with a certain sound effect that sometimes cuts out and then NEVER works again! It's a sound when the player is hit, and the problem seems to occur when I have multiple enemies hitting the player at the same time. I assume it might have something to do with the sound being called twice at the same time.
here is the sound.GetMetaData() info:
NumChannels: 1
SamplesPerSecond: 44100
BitsPerSample: 16
Length: 10752
I even tried a test function (triggered by my pressing Replay on my remote) to invalidate all the existing roAudioResource objects and rebuild/refresh them all over again, but it didn't help, the sound will never play again, forever. This is a serious problem!

Also, regarding the undocumented roAudioResource.MaxSimulStreams():
My Roku HD 2500 says 1, but my Roku 2 XS 3100 says 2. I'd be interested to know what all the other models (non-classic) say, as I'd really love to implement two sound effects at the same time on boxes that can.

And if I want to prioritize my sounds, how? I see that I can check if a particular sound is playing using sound.IsPlaying(), but I can't simply check WHAT sound is playing. Are you saying that if I want to prioritize, I'd have to run a series of individual sound.IsPlaying() checks for each sound I don't want to override?

EDIT - My Roku 1 2710 reports 1 MaxSimulStreams as well.
ignoring classic models, and listing models listed on wikipedia:
MODEL.....AUDIO STREAMS
2400
2450
2500.......1
3000
3050
3100.......2
3400
3420
3500
2700
2710.......1
2720
4200
0 Kudos
Komag
Roku Guru

Re: Optimal bitrate for roAudioResource

One of my problems is now solved - the hitPlayer sound that used to cut out FOREVER was my own dumb fault - my player was DEAD after a while, and I have the sound set up to only play when he's alive, haha. Smiley LOL So that at least is not a Roku bug.

But now I've discovered something more troubling:
HDMI audio is less reliable than AV audio!
Roku 1 2710
AV audio - works reliably, all sounds play at correct volume, all sounds work, nothing broken.
HDMI audio - the first few (3 or 4) sounds don't play at all, every time. Then sounds start working, but volume adjusts sometimes for no reason, some play quiet, most normal, some silent (either 0 volume or not playing, can't tell), no pattern that I can tell.
This is all with my sound effect volumes all at 100. I tried setting all volumes to 50, same thing happens, first few sounds don't play, then they play but vary in volume randomly, most are normal, but every so often one is quiet or silent.
0 Kudos
squirreltown
Roku Guru

Re: Optimal bitrate for roAudioResource

Is the AV going through an amp and the HDMI TV only? Maybe an auto-leveling TV feature you forgot about? Sure sounds like one of those silly compressors TV's have.
Kinetics Screensavers
0 Kudos
Romans_I_XVI
Roku Guru

Re: Optimal bitrate for roAudioResource

If I play sounds repeatedly they get quite. Wait a second and they back to regular volume. Doesn't affect my gameplay much though so just left it be.
0 Kudos
Komag
Roku Guru

Re: Optimal bitrate for roAudioResource

You know, I think you may be on to something squirreltown - I'm beginning to suspect that the TV (actually a monitor with HDMI input and built in speakers) is basically turning off the volume unless it detects a signal, then it fades the volume back in - I think. I'll test it further. Crap, that would explain this big "bug" I "discovered", and make me look really foolish in the process! :oops: :oops: :oops: Or could it be the Roku doing that?
0 Kudos
Komag
Roku Guru

Re: Optimal bitrate for roAudioResource

I've also been meddling with bitrates and such for my sound effects.

Why is the recommendation 44.1khz 16bit mono? I can make sound effects at 22.050khz 8bit mono that sound pretty much exactly the same, with 1/4 the file size! Since I'm planning 20-40 different sound effects, the file size difference really starts to add up if I want to include them in the package.
0 Kudos
RokuJoel
Binge Watcher

Re: Optimal bitrate for roAudioResource

Some sample rates are glitchy with roAudioResource, and some won't play at all. I was working a few weeks ago on creating a speech enabled version of one of my channels, so that it would read the text on the screen, even if music was playing with roAudioPlayer. To do this I modified some open source text-to-speech software to output .wav files that could be played by roAudioResource. Anything but 16bit 44.1khz would not play consistently, words were cut off, repeated, silent... so if you want your SFX to be more or less consistent and reliable, they should be 16b/44.1khz.

- Joel
0 Kudos
Komag
Roku Guru

Re: Optimal bitrate for roAudioResource

Does anyone know what the NumChannels is in the GetMetaData()? I'm guessing it's stereo (2) vs mono (1), but I just wanted to double check
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.