Creating a sound sequence

Hello, I am trying to randomly generate a sound sequence, however, the sounds all play at once, is there a way to get them play one after the other? (I thought that is what is meant to happen) Minimum time interval is set to 1000.

Also tried with just one sound component same sort of problem(only plays 1 sound with this):

Only other way I can think of doing it is to use a clock as a delay between each sound, but I would like to avoid this if possible.

Okay I manged to use the player component to play a sound sequence, but there is a fairly long delay between playing sounds, is there a way to speed it up or vary the delay between playing sounds?

This tutorial may give you more ideas. Xylophone Keep experimenting. :slight_smile:

See . Change the MinimumInterval property from its default value of 500 milliseconds to 0. This allows us to play the sound as often as we want, instead of having to wait half a second (500 milliseconds) between plays.

Thanks for the reply, yes I already looked at that tutorial, it's not quite the same but their solution uses the clock. I am aware of this way of doing it(I mentioned this in the post) ,I was just wondering if there was a way to do it without the clock as that adds a fair bit of unnecessary code in my opinion.

All your repeating conditions are a lot of unnecessary code ... :grin:
Just make a list of mp3 files. And if all mp3 files have the same name with only a number different, then you don't even need to make a list, names can be generated automatically.

I am aware of this ( reason all the files names were changed to numbers :slight_smile:). I am just testing the components and how they work so didn't put much thought into it at the time. Prefer to get it working before I condense it.

How long are the sounds? What exactly is the goal?
Post a test aia and describe precisely what should happen.

I can't post the .aia at the moment as I am on phone. But the sounds are all less than 1 second. The aim is to generate a random sequence of sounds as part of an audio based memory mini game. They thing I want to do is have the sounds play one after the other with a slight delay in between (delay varies with game difficulty). Problem is sound component plays all the sound sat the same time or just 1 sound depending on minimumtime interval. As for using the player component you can cascade the sounds but there seems to be a longish delay between playing sounds which can't be changed. Like I said I am aware that I could just use the sound component with a timer to change the delay between the sounds playing (what it's currently set to ) but I am wondering if there is a simpler way. Mainly because if I add sounds of different lengths then I would need to constantly be changing the timer interval which seems unnecessary. Ideally I would just use the player component with the when sound ends but the weird extra delay is to long.

As I said, we need a test aia.

What does that mean? How long?

It's about half a second delay between the audio playing. Again, I can't send the .aia at the moment. I will send it in the morning.

Android version, device name? Companion or APK (compiled app)?

MemoryGames.aia (820.4 KB)
Code is on the screen Sounds.
I have managed to reduce the delay slightly by editing out blank space in the audio files but the delay still seems too long. Android 11 , Samsung galaxy A52 tried on both companion and compiled app.

The delay is only a few milliseconds (far less than half a second, 500ms, if OGG format is used):

So you should use OGG format, not MP3, because of this:

MP3 basically adds a certain length of silence to the beginning and end of the track.
Note: If you want to loop a sound gaplessly, you must use OGG or WAV format and the TaifunPlayer from @Taifun.

Thanks for the reply, I didnt know that about the .mp3 format. I changed them all to .ogg files and switched to the player you suggested but now for some reason it plays all the sounds twice before going to the next one ??

and the delay between different sounds is still about the same

updated .aia file is: MemoryGames(1).aia (848.8 KB)

Been experimenting with it all day with no luck, so I am just gonna use the sound component and clock to do the delays. Even though its not the best solution because varying sound lengths mean that the gap between sounds is not constant. So if you know how to fix the other methods I would still prefer that.

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