pub struct ScaleQuantizer { /* private fields */ }Expand description
Scale Quantizer
Quantizes CV input to musical scale notes. Supports major, minor, pentatonic, and chromatic scales.
Implementations§
Source§impl ScaleQuantizer
impl ScaleQuantizer
pub fn new(_sample_rate: f64) -> Self
Sourcepub fn has_custom_scale(&self) -> bool
pub fn has_custom_scale(&self) -> bool
Whether a microtuning custom scale is currently active (Q146).
Sourcepub fn set_custom_scale(&mut self, cents: &[f64])
Available on crate feature alloc only.
pub fn set_custom_scale(&mut self, cents: &[f64])
alloc only.Install a custom microtuning scale (Q146): cents are scale degrees within
one octave, in cents (0.0 is the root). The list is sorted and reduced
into [0, 1200) internally, so callers need not pre-sort. Passing an empty
slice clears the override and restores the built-in 12-TET scales.
Non-real-time: allocates. Alloc-tier only.
Sourcepub fn clear_custom_scale(&mut self)
Available on crate feature alloc only.
pub fn clear_custom_scale(&mut self)
alloc only.Clear any custom microtuning scale, restoring the built-in 12-TET scales.
Sourcepub fn load_scala(&mut self, source: &str) -> Result<(), ScalaError>
Available on crate feature alloc only.
pub fn load_scala(&mut self, source: &str) -> Result<(), ScalaError>
alloc only.Load a Scala (.scl) file body as the custom microtuning scale (Q146).
On success the parsed scale’s octave-reduced degrees become the active
scale (see set_custom_scale). On a malformed
file the current scale is left unchanged and the parse error is returned.
Non-real-time: allocates. Alloc-tier only.
Trait Implementations§
Source§impl Default for ScaleQuantizer
impl Default for ScaleQuantizer
Source§impl GraphModule for ScaleQuantizer
impl GraphModule for ScaleQuantizer
Source§fn serialize_state(&self) -> Option<Value>
Available on crate feature alloc only.
fn serialize_state(&self) -> Option<Value>
alloc only.Persist the microtuning table (Q146) so a loaded Scala/custom scale survives
to_def -> from_def. It is not a scalar ModuleIntrospection parameter, so it
travels through the reserved ModuleDef.state channel instead of parameters. A
plain (12-TET) quantizer has no custom cents and returns None, keeping state null.
Source§fn deserialize_state(&mut self, state: &Value) -> Result<(), String>
Available on crate feature alloc only.
fn deserialize_state(&mut self, state: &Value) -> Result<(), String>
alloc only.Restore the microtuning table saved by serialize_state.
An absent/empty table is a no-op (stays 12-TET); malformed cents surface a
descriptive error to the loader.
Source§fn tick(&mut self, inputs: &PortValues, outputs: &mut PortValues)
fn tick(&mut self, inputs: &PortValues, outputs: &mut PortValues)
Source§fn set_sample_rate(&mut self, _: f64)
fn set_sample_rate(&mut self, _: f64)
Source§fn process_block(
&mut self,
inputs: &BlockPortValues,
outputs: &mut BlockPortValues,
frames: usize,
)
fn process_block( &mut self, inputs: &BlockPortValues, outputs: &mut BlockPortValues, frames: usize, )
Source§fn breaks_feedback_cycle(&self) -> bool
fn breaks_feedback_cycle(&self) -> bool
Source§fn introspect(&self) -> Option<&dyn ModuleIntrospection>
fn introspect(&self) -> Option<&dyn ModuleIntrospection>
alloc only.ModuleIntrospection view, if it exposes one. Read moreSource§fn introspect_mut(&mut self) -> Option<&mut dyn ModuleIntrospection>
fn introspect_mut(&mut self) -> Option<&mut dyn ModuleIntrospection>
alloc only.introspect, used to set internal parameters.Source§impl ModuleIntrospection for ScaleQuantizer
Available on crate feature alloc only.
impl ModuleIntrospection for ScaleQuantizer
alloc only.