Music Module Performance

I have a basic application and I would expect an audio file to play every time I click the button. However this isn’t the case. If I click at a faster rate, nothing plays. I’ve tried a few different variants but nothing seems to improve the perf. Everything should be in memory.


private byte[] song = null;
		
void ProgramStarted()
{
	Debug.Print("Program Started");

	button.ButtonPressed += button_ButtonPressed;

	music.SetVolume(255);
	song = Resources.GetBytes(Resources.BinaryResources.trombone);
}

void button_ButtonPressed(Button sender, Button.ButtonState state)
{
	Debug.Print("1 " + DateTime.Now);
			
	music.Play(song);
}

What behaviour are you after? a stuttering effect when you press multiple times quickly OR just to play through once and if hit again in a short time just continue playing?

Assumption 1 second long file

I click the button once, small lag but livable.

I click the button every 500ms, I may get it to play the first time but past that it refuses to play until I wait a few seconds.

Extremely easy to repo

As Dr9 ask, what do you expect to happen?

I would expect one of the following to happen:

  • multiple outputs at the same time (overlapping sounds)
  • for the current sound to stop and new sound to play

I expect the module to act like a real world application would.

  1. Module does not support multiple “outputs”.
  2. There is a command to stop playing. No sure what happens with multiple plays without a stop.

You can get the source for the music module driver and make it do whatever
you want it to do, or write your application to achieve what you expect
given the current characteristics of the driver.

The module does act like a real world application. This module is not a Gravis Ultrasound running on your desktop PC. Here’s the datasheet for the decoder IC, you can read up on its exact capabilities: http://www.vlsi.fi/fileadmin/datasheets/vlsi/vs1053.pdf