Play eternal sound

I’ve got my game to where it plays a generic “beep” sound when you touch the screen, and the farther away from the character the touch is, the higher the pitch goes. When you end the touch, it stops playing. BUT! My sound, when it changes pitch, also changes duration. That’s as it should be, obviously. But how could I get it to play at the end of each sound, so that it’s always playing?

Thanks in advance!

Caleb [import]uid: 147322 topic_id: 34275 reply_id: 334275[/import]

If you’re using audio.play() then there is a loops parameter you can set:

audio.play(myBeep, { loops = -1} )
[import]uid: 199310 topic_id: 34275 reply_id: 136288[/import]

Hm, still didn’t work. It stops after one play.

[lua]–This didn’t work
audio.play(beep, {loops=-1, channel=1, source=beepSource, duration=1000})
–Neither did this
audio.play(beep, {loop=-1, channel=1, source=beepSource, duration=1000})[/lua]

Any ideas? [import]uid: 147322 topic_id: 34275 reply_id: 136290[/import]

I think it’s because you’ve specified a duration. That will force the audio to stop no matter what.
Another thing: The “source” option is not a documented option. [import]uid: 70847 topic_id: 34275 reply_id: 136300[/import]

The source option still works, because I need to change the pitch of the sound:

http://developer.coronalabs.com/forum/2012/12/21/audio-question

But duration? I see… The thing is, I’m not a huge coding company, and I just create my audio on GarageBand. When I export it to iTunes, it puts in a huge blank portion at the end of the sound. So I have to have the duration parameter. Any other ideas? [import]uid: 147322 topic_id: 34275 reply_id: 136344[/import]

you should always create a sound as you want it to use in your app (volume- & legth-wise).
check out audacity (open source, free) http://audacity.sourceforge.net/ to trim your sound files as needed.

-finefin
[import]uid: 70635 topic_id: 34275 reply_id: 136345[/import]

I see :slight_smile:

I think this will be of interest.
http://audacity.sourceforge.net

With this you’ll be able to change pitch, trim and do many other cool things with your audio.
…and it’s Open Source and free!

I personally use Adobe Audition (formerly Cool Edit Pro). [import]uid: 70847 topic_id: 34275 reply_id: 136346[/import]

If you’re using audio.play() then there is a loops parameter you can set:

audio.play(myBeep, { loops = -1} )
[import]uid: 199310 topic_id: 34275 reply_id: 136288[/import]

Hm, still didn’t work. It stops after one play.

[lua]–This didn’t work
audio.play(beep, {loops=-1, channel=1, source=beepSource, duration=1000})
–Neither did this
audio.play(beep, {loop=-1, channel=1, source=beepSource, duration=1000})[/lua]

Any ideas? [import]uid: 147322 topic_id: 34275 reply_id: 136290[/import]

I think it’s because you’ve specified a duration. That will force the audio to stop no matter what.
Another thing: The “source” option is not a documented option. [import]uid: 70847 topic_id: 34275 reply_id: 136300[/import]

The source option still works, because I need to change the pitch of the sound:

http://developer.coronalabs.com/forum/2012/12/21/audio-question

But duration? I see… The thing is, I’m not a huge coding company, and I just create my audio on GarageBand. When I export it to iTunes, it puts in a huge blank portion at the end of the sound. So I have to have the duration parameter. Any other ideas? [import]uid: 147322 topic_id: 34275 reply_id: 136344[/import]

you should always create a sound as you want it to use in your app (volume- & legth-wise).
check out audacity (open source, free) http://audacity.sourceforge.net/ to trim your sound files as needed.

-finefin
[import]uid: 70635 topic_id: 34275 reply_id: 136345[/import]

I see :slight_smile:

I think this will be of interest.
http://audacity.sourceforge.net

With this you’ll be able to change pitch, trim and do many other cool things with your audio.
…and it’s Open Source and free!

I personally use Adobe Audition (formerly Cool Edit Pro). [import]uid: 70847 topic_id: 34275 reply_id: 136346[/import]