Source Academy Modules
    Preparing search index...

    Function make_sound

    • Makes a Sound with given wave function and duration. The wave function is a function: number -> number that takes in a non-negative input time and returns an amplitude between -1 and 1.

      Parameters

      • wave: Wave

        wave function of the Sound

      • duration: number

        duration of the Sound

      Returns Sound

      with wave as wave function and duration as duration

      const s = make_sound(t => Math_sin(2 * Math_PI * 440 * t), 5);