Skip to content

add sampleRate option to Tone.Context() #1023

@Hazmatron7

Description

@Hazmatron7

Is it possible to allow setting the sampleRate to the Tone.Context() as a constructor parameter on initialization please?

    //example:
    let context = new Tone.Context({
        latencyHint: "interactive",
        sampleRate: 44100,
        //other options etc.....
    });

Basically it should be that if parameter has a valid number use it or if undefined then use automatic detection by default (which is built in already)

The only error it will throw is this:
image

which can be useful to detect that the sampleRate isn't supported with a try/catch

And yes according to caniuse.com and MDN, It is supported to all browser now.
Except for IE of course but who cares about IE anymore lol 😆

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestkeepDon't close the issue even if it is marked as stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions