Skip to main content

RubatoProfile

Struct RubatoProfile 

Source
pub struct RubatoProfile { /* private fields */ }
Expand description

Describes how much tempo can stretch for an agent.

A RubatoProfile sets the boundaries of permissible timing flexibility. An agent with high stretch can borrow a lot of time; one with low stretch must stay close to the written tempo.

Implementations§

Source§

impl RubatoProfile

Source

pub fn new( name: impl Into<String>, max_compress: f64, max_stretch: f64, transition_rate: f64, ) -> Self

Create a new rubato profile.

Source

pub fn strict() -> Self

Strict profile: minimal tempo flexibility.

Source

pub fn moderate() -> Self

Moderate profile: balanced flexibility.

Source

pub fn expressive() -> Self

Expressive profile: wide tempo flexibility.

Source

pub fn apply(&self, base_bpm: f64, factor: f64) -> f64

Apply rubato to a base BPM, given a stretch factor.

factor ranges from -1.0 (max stretch/slow) to +1.0 (max compress/fast).

Source

pub fn min_bpm(&self, base_bpm: f64) -> f64

Compute the minimum BPM allowed by this profile.

Source

pub fn max_bpm(&self, base_bpm: f64) -> f64

Compute the maximum BPM allowed by this profile.

Source

pub fn is_within_range(&self, base_bpm: f64, actual_bpm: f64) -> bool

Whether a given BPM is within the rubato range for a base BPM.

Source

pub fn name(&self) -> &str

Source

pub fn max_compress(&self) -> f64

Source

pub fn max_stretch(&self) -> f64

Source

pub fn transition_rate(&self) -> f64

Trait Implementations§

Source§

impl Clone for RubatoProfile

Source§

fn clone(&self) -> RubatoProfile

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RubatoProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RubatoProfile

Source§

fn eq(&self, other: &RubatoProfile) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RubatoProfile

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.