pxt icon indicating copy to clipboard operation
pxt copied to clipboard

volume for sound expressions in simulator

Open srietkerk opened this issue 6 months ago • 0 comments

fixes https://github.com/microsoft/pxt-microbit/issues/5193

This pull request introduces support for specifying volume in sound expressions. The changes primarily focus on updating the playSoundExpressionAsync and related methods to include a volume parameter, and ensuring compatibility with existing components that utilize these methods.

Enhancements to sound expression functionality:

  • pxtsim/sound/soundexpression.ts: Added a volume property to the PendingSound interface and updated the __playSoundExpression and playSoundExpressionAsync methods to accept a volume parameter. Adjusted the internal logic to pass the volume value through the sound playback pipeline. [1] [2] [3] [4] [5]

Updates to components using sound expressions:

  • webapp/src/components/soundEffectEditor/SoundEffectEditor.tsx: Updated the call to playSoundExpressionAsync to include a default volume value of 127.
  • webapp/src/components/soundEffectEditor/SoundGallery.tsx: Modified the call to playSoundExpressionAsync to include a default volume value of 127.

srietkerk avatar Jun 20 '25 01:06 srietkerk