Creating a continuous audio shuffler

I’m trying to create an app where I have a fixed set of audio file sounds and I want to just shuffle play all of them continuously. Ideally I’d like to set individual weights for how frequently to play each one.

As I’m just getting started, rough pointers on how to do this would be really helpful. I’ve gotten the audio player working and can load my songs into a list that the user can select from. But what I can’t figure out is:

  • How to select and play another song after the first song finishes with no user input
  • How to select a random song (ideally weighted by a database value for each song’s frequency)

I’m guessing there are some basic patterns for doing things like the above that I’m unaware of. Any pointers would be greatly appreciated.

Hi @efr33t :wave:

Welcome to the community :partying_face:

You mean like this right?

If it is you can copy the app and see.

Hope it helps!

Thank you

3 Likes

Wow thanks so much! This is so helpful.

I want to make sure I understand the patterns you are using. Is this correct?

  1. You have a starting song id for each user (default 1)
  2. There is a hidden input field that is set to that song id for that user
  3. There is a custom list of songs on the home screen which has a single component that is an audio player, and a filter to only be the song corresponding to the input field
  4. After the song plays it updates the user’s song id to be the next song id

Is that right? I think one thing I don’t understand is, how does it play the next song? Does setting the user’s song id change the input field automatically? And why do you use an input field instead of using the user’s song id field directly in the list filter?

The other question I have is how would you go about enabling randomly choosing a song to play if each song had a different distribution of “weight” (e.g., some should play twice as often, and the user can use a slider to set those weights)?

Anyways, thanks again, incredibly helpful to see the patterns you’re using here.

2 Likes

Your welcome :+1:

Yes. When they are Signing I have set that field to 1.Then when the user comes to the home screen first song will start.

Yes. Because the player is hiding and the list goes to the top. So I added the input and filtered. If you don’t like filter it by Logged in user. This is like Additional I think :slightly_smiling_face:

Yes. I have a added the audio Player and I maked it a list. And added the filter and added the actions to the Player in the Actions after song ends section.

Yes.

That song has a next ID. And when the song ends the user’s ID is Updating to that ID. So Coffin Dance ID is 1 and next ID is 2. Then the Taki Taki ID is 2 and when the coffin dance finished then it becomes 2 and playing Taki Taki. Like that.

Hmm. Yes. It’s like Additional I think. You can filter it by Logged in user ID.

So when the song ends then user’s ID is Updating to that song next ID and and playing other song. So believer is 1 and next id is 2 and when it finished it’s 2 and Taki Taki is starting. Like that.

I added a list and song collection. And added a filter ID is equal Input. You can add User’s ID.
And added a Update Action Update logged in user ID to current song ID.

You can check the results.

I think when you look at the app you can Understand what I did. All the best :facepunch:

Hope it helps!

Thank you

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.