Expand description
A sine oscillator
Fields
srate: f32
Sample rate
phase: f32
Oscillator phase
init_phase: f32
Initial phase offset
Implementations
sourceimpl Sin
impl Sin
pub fn new(nid: &NodeId, _node_global: &NodeGlobalRef) -> Self
pub const freq: &'static str = "Frequency of the oscillator.\n"
pub const det: &'static str = "Detune the oscillator in semitones and cents. \ the input of this value is rounded to semitones on coarse input. \ Fine input lets you detune in cents (rounded). \ A signal sent to this port is not rounded.\n\ Note: The signal input allows detune +-10 octaves.\ "
pub const pm: &'static str = "Phase modulation input or phase offset. Use this for linear FM/PM modulation.\n"
pub const sig: &'static str = "Oscillator signal output.\n"
pub const DESC: &'static str = r#"Sine Oscillator This is a very simple oscillator that generates a sine wave. "#
pub const HELP: &'static str = r#"A Sine Oscillator This is a very simple oscillator that generates a sine wave. The ~~freq~~ parameter specifies the frequency, and the ~~det~~ parameter allows you to detune the oscillator easily. You can send any signal to these input ports. The ~~det~~ parameter takes the same signal range as ~~freq~~, which means, that a value of 0.1 detunes by one octave. And a value 1.0 detunes by 10 octaves. This means that for ~~det~~ to be usefully modulated you need to attenuate the modulation input. For linear FM, you can use the ~~pm~~ input. It allows you to modulate the phase of the oscillator linearly. It does so *through zero* which means that the pitch should not detune by the amount of modulation in low frequencies. You can do exponential FM with this node using the ~~det~~ or ~~freq~~ input, but for easy exponential FM synthesis there might be other nodes available. "#
pub fn graph_fun() -> Option<GraphFun>
Trait Implementations
sourceimpl DspNode for Sin
impl DspNode for Sin
sourcefn set_sample_rate(&mut self, srate: f32)
fn set_sample_rate(&mut self, srate: f32)
Updates the sample rate for the node.
sourcefn process(
&mut self,
ctx: &mut dyn NodeAudioContext,
_ectx: &mut NodeExecContext,
_nctx: &NodeContext<'_>,
_atoms: &[SAtom],
inputs: &[ProcBuf],
outputs: &mut [ProcBuf],
ctx_vals: LedPhaseVals<'_>
)
fn process(
&mut self,
ctx: &mut dyn NodeAudioContext,
_ectx: &mut NodeExecContext,
_nctx: &NodeContext<'_>,
_atoms: &[SAtom],
inputs: &[ProcBuf],
outputs: &mut [ProcBuf],
ctx_vals: LedPhaseVals<'_>
)
The code DSP function. Read more
Auto Trait Implementations
impl RefUnwindSafe for Sin
impl Send for Sin
impl Sync for Sin
impl Unpin for Sin
impl UnwindSafe for Sin
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more