[Under Evaluation] Sound Player ... NO NOT Player Player …… Sound Player

On 12/09/2021 I posted the following question located here: How do I keep music playing on external player?
Question was: I have developed an app to time my exercise. When I play an internal sound "one minute" to notify my exercise period has one minute to go it causes my external (default) music player to pause. I want to find a way to prevent the player from pausing.

The result of this discussion is to know that Android music players have an event within them whereby you can automatically pause your player in order to allow another one to play should someone do this. THANK YOU Taifun for pointing this out to me.

In my case I wanted only to play my sound (short) while music continues to play without the music being interrupted. To my dismay there are no music players that I can find that will allow this. They ALL pause as soon as another sound is played.

SOLUTION:
MIT AI has a "Player" object and it also has a "Sound" object. Cell phones (as well as PCs) have multiple sound channels. You may have noticed this when you attempt to adjust volume and suddenly there are several volumes that come up. Music, Alarm, Bell, Notify and others will appear. Just when you think you understand them all, your earphone volume will spring up!

I have read many articles here and on the internet and YouTube. I have not seen any that distinguish between "Player" and "Sound". In this tutorial I wish to show this difference since it is possible to play both at the same time. I have not seen any blocks of how to use "Sound" and more importantly how to use "Sound" to play multiple sounds like you can with the music "Player".

Here I use the "Sound" object and play from a list in a similar way that you would use "Player" object. The most important part of my ability to perform this "Sound Player" is to be able to know when the sound has stopped playing. To be able to do so I used Taifun's Player extension which is found here: https://puravidaapps.com/player.php

In his extension he has a method called “TaifunPlayer.Duration” which will measure, in milliseconds, the length of a sound file. I start playing the sound just long enough to measure its size and set a timer that will end as soon as the sound is over, which allows me to calculate when to begin playing the next sound.

A HUGE THANK YOU to Taifun for his many contributions to the MIT AI community.

1 Like
  1. Is this a solution to your original problem in your other topic? If so, it doesn't appear to explain how it resolves that problem (external player pauses...) unless I am missing something...
  2. Did you consider the MinimumInterval property for a sound, which ensures that (with the same sound component ) the next sound will not be played until the current one has finished?
  3. Or just use a player component which gives you the completed event

Your right !! I made a mistake in testing along the way obviously :frowning: Evidently using Taifun's extension is to cause the same result as the Player object in MIT AI. I thought I had tested that but evidently I was confused in process.

  1. I definitely did play the sound object multiple times while playing music with no pause.

  2. I believe sending two .wav files at the sound object with MinimumInterval resulted in only the second wav being played. How can I send 3-5 .wav files to "Sound" object and have them play consecutively?

  3. The Player object is the problem so I don't understand

The Sound component can only play sounds for 4-5 sec.

Everything else on this topic has already been said.