Ready to start adding sound

I agree that Glitch’s GGMusic and GGSound are useful tools. They’re not free, but they’re absolutely affordable and a great value considering the time you might spend doing a task yourself.

http://www.glitchgames.co.uk/code/

Of course, you can also do it manually; you just need to study up on the sound APIs… i.e. when to load sounds vs. streams, the difference between audio “handles” versus “channels”, reserving audio channels for specific uses, setting volume on a per-channel basis if necessary, and (very important!) cleaning everything up from memory and disposing sounds when they’re no longer needed.

Brent [import]uid: 200026 topic_id: 36011 reply_id: 143119[/import]

Actually,
The Glitchgames code is free/opensource. If you want to support them then you can either but the code for one pound or buy one of their apps.

https://github.com/GlitchGames

I haven’t used the glitch games code but everyone seems to like it.

The audio api is pretty simple, just remember when you dispose a sound you use the channel not the name.
For “short” effects of 30 seconds or less use the loudSound and not the loadStream.

Keep in mind Android,can/could use not as many channels as iOS.

When using storyboard and background music put the background music on a different channel from the other sounds you might use.
You can transfer variable info from scene to scene in Story board. See which one of the two is best for you so you don’t set the variable as a global variable (which I did. I found out later on how to get the info across screens)
Why would I want to set it up as a Global? well so I can turn it off in every scene. Is this a smart/good way to do it? nope. But I din’t know the storyboard ways back then. [import]uid: 100901 topic_id: 36011 reply_id: 143120[/import]

Hi @Juf Jannie,
I didn’t realize that the GG libraries are free/donation-based. Thanks for pointing that out!

Brent [import]uid: 200026 topic_id: 36011 reply_id: 143121[/import]

Here is an example, I used some time ago. As it might be an easier start.

local options =  
{  
 channel=3,  
 loops=-1,  
 fadein=3000,  
 onComplete=gotToThisFunctionWhenTheSoundEnds  
}  
  
muziek=audio.loadStream("audio/algemeen/muziek.aac")  
audio.setVolume( 0.85)  
audio.play(muziek,options)  
audioPlaying=1  

If I only use the channel and onComplete I usually don’t make an “options” table.
I just put it in the audio.play part itself.

audio.play(music,{channel=1,onComplete=clearAudio}) [import]uid: 100901 topic_id: 36011 reply_id: 143123[/import]

Hey
Thanks Brent and Juf
Sorry I ended up being away the rest of the day yesterday.
Great info, I think I am going to check out glitches code.

Thank you for the information I needed. [import]uid: 170004 topic_id: 36011 reply_id: 143171[/import]