레퍼런스 p5.Oscillator

p5.Oscillator

Generate Sine, Triangle, Square and Sawtooth waveforms.

예제

구문

p5.Oscillator([frequency], [type])

매개변수

frequency
Number: frequency defaults to 440Hz
type
String: type of oscillator. Options: 'sine' (default), 'triangle', 'sawtooth', 'square'

메서드

start
Starts the oscillator. Usually from user gesture.
stop
Stops the oscillator.
amp
Adjust the amplitude of the Oscillator.
getAmp

Returns the value of output gain

freq
Adjusts the frequency of the oscillator.
getFreq

Returns the value of frequency of oscillator

setType
Sets the type of the oscillator.
getType

Returns current type of oscillator eg. 'sine', 'triangle', 'sawtooth' or 'square'.

connect

Connect to a p5.sound / Web Audio object.

disconnect

Disconnect all outputs

pan

Pan between Left (-1) and Right (1)

getPan

Returns the current value of panPosition , between Left (-1) and Right (1)

phase
Adjusts the phase of the oscillator.
add

Add a value to the p5.Oscillator's output amplitude, and return the oscillator. Calling this method again will override the initial add() with a new value.

mult

Multiply the p5.Oscillator's output amplitude by a fixed value (i.e. turn it up!). Calling this method again will override the initial mult() with a new value.

scale

Scale this oscillator's amplitude values to a given range, and return the oscillator. Calling this method again will override the initial scale() with new values.

Notice any errors or typos? Please let us know. Please feel free to edit src/Oscillator.js and open a pull request!

관련 레퍼런스