class

DSP::SineOscillator

Inherits Reference < Object

Constructors

new(freq : Float64, sample_rate : Float64, ampl : Float64 = 1.0, phase : Float64 = 0.0, dc : Float64 = 0.0)

A new instance of Oscillator. The controllable wave parameters are frequency, amplitude, phase offset, and DC offset. The current phase angle is initialized to the given phase offset.

@param [Hash] args Hashed arguments. Required key is :sample_rate. Optional keys are :wave_type, :frequency, :amplitude, :phase_offset, and :dc_offset. See ARG_SPECS for more details.

Source

Instance methods

ampl
Source
freq
Source
freq=(freq : Float64)

Set the frequency (also updates the rate at which phase angle increments).

Source
phase
Source
phase=(phase : Float64)

Set the phase angle offset. Update the current phase angle according to the difference between the current phase offset and the new phase offset.

Source
sample

Produce one sample

Source
sample_rate
Source
samples(n : Int32)

Produce n samples

Source