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: 
EugeneZ
Channel Surfer

Audio for games - playing music without MIDI support?

This question is for people who develop games for ROKU.

When you play a game, typically you have some light motivating music playing in the background.

But ROKU does not support MIDI files.

It does not have a synthesizer, and can't make a sound of given frequency.

How do you deal with that? Do you just package mp3s with your channels (4MB is the maximum, right?)

You would need about 1MB of mp3 instead of 20K of MIDI.

And "Options sidebar" keeps popping onto the screen if you use mp3 playing facility (Audio or roAudioPlayer).

Is there something better?

Thanks!

0 Kudos
5 REPLIES 5
renojim
Community Streaming Expert

Re: Audio for games - playing music without MIDI support?

This is a good question for @Romans_I_XVI .

You don't necessarily have to package the audio file with the app if you can host it somewhere and download it when you channel/app starts.  cachefs would be a good place for it.

Do you have game=1 in your manifest?

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
EugeneZ
Channel Surfer

Re: Audio for games - playing music without MIDI support?

I was not aware of game=1

Thanks!

 

0 Kudos
Romans_I_XVI
Roku Guru

Re: Audio for games - playing music without MIDI support?

I just saw I was tagged here. I actually just got done figuring out how to include a full soundtrack which was almost 200MB originally. Basically my solution was to use ffmpeg to reduce the file size as much as possible without losing too much quality.

Here's a good reference document - https://trac.ffmpeg.org/wiki/Encode/AAC

My best result was accomplished by converting to mono with a 24k bitrate using libfdk and the aac_he profile. Here's what I did:

ffmpeg -i input.ogg -c:a libfdk_aac -vn -ar 44100 -b:a 24k -ac 1 -profile:a aac_he -movflags +faststart output.m4a

 

0 Kudos
necrotek
Roku Guru

Re: Audio for games - playing music without MIDI support?

Years ago I was attempting to build an XM module player.  I never got it to work correctly but it does make noise. It would parse the file and generate a short wave file that I would play as an audio resource. At the end of processing the audio I don't know how much headroom would be available for gameplay though. 

In the end my solution is similar to Romans_I_XVI.  There is always hosting the audio elsewhere, but for a game I would rather have the audio available even if the internet is unavailable. 

0 Kudos
necrotek
Roku Guru

Re: Audio for games - playing music without MIDI support?

The manifest entry for game=1 was supposed to eliminate some audio issues like gaps in sequential playing of audio tracks.  I don't know if it actually fixed anything. Any device after the Roku 3 has had a big gap between audio in a playlist so loops don't work well.

gameintegerAvailable since Roku OS 9

All game channels must add the game manifest entry to their manifest file. This flag prevents the channel from having audio/sound effects delays in the game.
game=1

 

I have never noticed a sidebar when playing audio player or audio resource.

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.