pub struct Duration;Expand description
weirdnet.duration: changes the length of a sound and nothing else.
| Parameter | Range | Default |
|---|---|---|
mode | stretch or trim | stretch |
ratio | 0.25 to 4: new length divided by old length | 1 |
target_ms | 0 to 60000: the new length; 0 uses ratio instead | 0 |
fade_ms | 0 to 1000: the fade-out at the cut (trim only) | 5 |
quality | fast or good (stretch only) | good |
- Stretch makes the sound that many times as long and keeps its pitch (a phase-vocoder style stretch from Signalsmith Stretch,
so attacks soften a little at strong ratios; the result’s length is exact). A ratio of 2 doubles the length. Following a tempo from
reference_bpmtobpmis a ratio ofreference_bpm / bpm. - Trim cuts the sound to the new length with a short fade-out and never lengthens it; nothing else changes.
With the defaults, or whenever the new length equals the old, the input’s samples come back unchanged (shared, not copied).
Stretch needs the crate feature stretch (on by default); without it stretch mode is an error and trim still works.
Trait Implementations§
Source§impl Plugin for Duration
impl Plugin for Duration
Source§fn id(&self) -> &'static str
fn id(&self) -> &'static str
The stable id, for example
"weirdnet.gain". Saved in projects, so it never changes.Source§fn process(
&self,
input: &Waveform,
values: &ParamValues,
) -> Result<Waveform, PluginError>
fn process( &self, input: &Waveform, values: &ParamValues, ) -> Result<Waveform, PluginError>
Processes
input. values are already resolved against Plugin::params: complete, typed and in range.
Returns a new waveform (which may share the input’s samples when nothing changed) or an error.Auto Trait Implementations§
impl Forget for Duration
impl Freeze for Duration
impl Move for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnsafeUnpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more