Audio/ saving audio progression

Good morning everybody,

It’s been a while since I started using Corona sdk, and I have some issues so I hope that you can help me…

I’m creating a game and I would like to save the sound progression. To clarify, If a player plays for example, for 60 seconds then loses, next time he will play the game will not load the sound played last time and so on. 

( This sound will be played during the game, along with other audio files, like collision sound, game over …)

My questions are :

1- How I’m going to proceed with saving my audio progression?

2- How to stop the background sound when another plays ? 

3-How can I play a sound, when my objects passes through out an obstacle.?

4- How can I add sound with a delay, a sound that will play when the player plays for 50 seconds 

5-How can I add sound when the ball (the object) touches a specified object ( a tube; some sort of obstacle )

Here is how I added the sound:

 

local bgSound = audio.loadStream(‘story.wav’)

local explosion = audio.loadSound('explosion.caf)

  audio.play(bgSound, {loops = -1, channel = 1}) --when the game starts

function onCollision(e) – called when object collide

  audio.play(explosion)

  display.remove(ball)

end

 

I know I’ve posted a lot of questions, feel free to answer what ever question you want & thank you.

FYI - Corona SDK only allows for the recording of the external mic audio, not internal audio. Assuming the player has the sound volume at a given volume, the external audio will record the game/app audio, but it won’t sound all that great, as it will pick up other ambient noise as well.

Thank you for your answer. I want to start a sound the minute my object ( a ball) hits another object . I don’t know how to do it so can you please help me ? just like in a runner game when we collect coins and we hear a sound …  

FOR ANY ONE WHO HAS THE SAME TROUBLE, I SOLVED IT USING THIS IN MY COLLISION FUNCTION, then added some lines on my createScene…

function onCollision (event)

if (event.object1.myName == “obst1”) or (event.object1.myName == “obst2”) then
audio.play(my_sound)
end
    
if (event.object1.myName == “obst3”) then
storyboard.gotoScene(“restart”, “fade”, 400)

end
end

FYI - Corona SDK only allows for the recording of the external mic audio, not internal audio. Assuming the player has the sound volume at a given volume, the external audio will record the game/app audio, but it won’t sound all that great, as it will pick up other ambient noise as well.

Thank you for your answer. I want to start a sound the minute my object ( a ball) hits another object . I don’t know how to do it so can you please help me ? just like in a runner game when we collect coins and we hear a sound …  

FOR ANY ONE WHO HAS THE SAME TROUBLE, I SOLVED IT USING THIS IN MY COLLISION FUNCTION, then added some lines on my createScene…

function onCollision (event)

if (event.object1.myName == “obst1”) or (event.object1.myName == “obst2”) then
audio.play(my_sound)
end
    
if (event.object1.myName == “obst3”) then
storyboard.gotoScene(“restart”, “fade”, 400)

end
end