Skip to content

Updating audio parameters #2

@ben-denham

Description

@ben-denham

I'm really enjoying using this library along with leipzig for web-based music generation, they're really great.

I was wondering if there was any recommended pattern for updating an AudioParam of a node that is part of a synthesizer? For example, I would like to be able to bind the gain parameter of a gain node to some dynamic value based on a slider from an <input type="range"> element:

(defn ping [freq]
  (connect->
    (square freq)
    (percussive 0.01 0.4)
    (gain dynamic-value-here?)))

I've been trying various approaches involving calling AudioParam.setValueAtTime() from an event listener and using an AudioBufferSourceNode to provide a changing value to other nodes, but nothing I try seems to work correctly.

If work is required to the library to be able to support something like this, I'd be happy to help out if I can.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions