Skip to content

Envelopes for audio file playback #501

@riknoll

Description

@riknoll

This is related to #500

Another feature that would be nice to have with the sample playback is the ability to have envelopes to control the volume and possibly pitch of the sound as an audio file is played. I'm mostly envisioning surfacing this to users as a typical ADSR envelope.

The way that @mmoskal implemented this in arcade for our synthesizer engine was to allow the user to pass in a buffer that contains instructions about changes to pitch and volume over time. Each instruction in the buffer has the following parameters:

  • Start Volume
  • End Volume
  • Start Frequency
  • End Frequency
  • Duration

I like this approach because its flexible and let me implement lots of envelope shenanigans on top of it. For example, here's some code I wrote for Arcade that supports instruments with an amp envelope, pitch envelope, amp LFO, and pitch LFO: https://github.com/microsoft/pxt-common-packages/blob/master/libs/mixer/instrument.ts#L532

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions