Is there a way to make audio keeps playing without fading the volume down when I use
audio.rewind(song)
?
Is there a way to make audio keeps playing without fading the volume down when I use
audio.rewind(song)
?
Do you mean a constantly looping track? The “audio.play” API lets you set a “loops” setting if so. However, I imagine your track is configured so that a direct loop will cause the “beat” to incorrectly mesh in rhythm? So you’re fading it out at the end, and then fading it back in? Let me know exactly what you’re attempting to do, and I can suggest a more specific solution.
Thanks,
Brent
audio.play(wind, {channel = myMusicChannel, loops = -1});
I’m using that after I found out that audio.rewind was not replaying the song. The issue is that using “loops”, the wind sound stops and then starts again, giving no sense of continuity.
Hi @WilerJr,
I haven’t heard your “wind” track, so a suggestion is tricky to make. Can you get by with a very quick fade-out, rewind, and fade-in? Or does this have to be a constant looping soundtrack with no breaks or fluctuations in volume?
This have to be a constant looping, Brent, with no breaks…
Admittedly, this could be tricky… you might need to actually queue up two duplicate tracks, and then a few seconds near the end of the first, start fading it out over the course of 2-4 seconds, while simultaneously fading the second one in over the same timespan, thus creating a gradual “audio transition”. I’ve never tried this so I can’t vouch for how well it would actually sound, but it’s worth considering.
While Brent’s suggestion would end up requiring two audio streams playing simultaneously at some point, out of curiosity, are you able to edit the audio file in a sound editor like Sound Forge (Mac/Win) or Sound Studio (Mac) so that it sounds seamless in the editor when looped? No fades, just blend the beginning with the end?
Then when you start the app, do a fadeIn and just loop forever, or until you want to manually fade it out?
Editing my wind sound I could decrease the silence at the end of the track, but I’ll think of some sound to hide the “last” silence time. Anyway, I’m going to try you idea; it’s a very good idea. Thanks you very much for the help, Brent.
I’ll not mark the post as solved because of my main question: “How to make audio keeps playing when device is suspended? (Android)”.
I used Audacity to cut the silence at the beginning and the end of the track, but even so I still got a little silence at the end. haha But I’ll keep trying.
I have a good sound editor in front of me right now, if you’re willing for me to take a crack at it. Let me know. I’ve been playing with seamless audio loops for a few of my apps, and it all sounds clean.
On a sidenote, you can grab my custom ringtones on my website to get a taste of what I can do to cut down good portions of songs into 40-second excerpts.
I couldn’t open your files because I don’t have an iPhone, but thanks anyway. I tried “cuting” the seams of the songs and it’s working well; not perfectly, but well.
Thanks, Raphael.
No problem, don’t hesitate to hit me up if you want me to tweak it.
Ok. Thanks.
Hi @WilerJr,
Just a note, I looked into your request for playing audio while (device) suspended in Android, and it’s not currently possible. Sorry about that, and I apologize for the delay on getting you an answer.
Brent
Ah. Bad news, but thanks, anyway.