[][src]Struct pvoc::PhaseVocoder

pub struct PhaseVocoder { /* fields omitted */ }

A phase vocoder.

Roughly translated from http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/

Methods

impl PhaseVocoder[src]

pub fn new(
    channels: usize,
    sample_rate: f64,
    frame_size: usize,
    time_res: usize
) -> PhaseVocoder
[src]

Constructs a new phase vocoder.

channels is the number of channels of audio.

sample_rate is the sample rate.

frame_size is the fourier transform size. This should be a power of 2 for optimal performance. Will be rounded to a multiple of time_res.

time_res is the number of frames to overlap.

pub fn num_channels(&self) -> usize[src]

pub fn num_bins(&self) -> usize[src]

pub fn time_res(&self) -> usize[src]

pub fn sample_rate(&self) -> f64[src]

pub fn process<S, F>(
    &mut self,
    input: &[&[S]],
    output: &mut [&mut [S]],
    processor: F
) -> usize where
    S: Float + ToPrimitive + FromPrimitive,
    F: FnMut(usize, usize, &[Vec<Bin>], &mut [Vec<Bin>]), 
[src]

Reads samples from input, processes the samples, then resynthesizes as many samples as possible into output. Returns the number of samples written to output.

processor is a function to manipulate the spectrum before it is resynthesized. Its arguments are respectively num_channels, num_bins, analysis_output and synthesis_input.

Samples are expected to be normalized to the range [-1, 1].

pub fn phase_to_frequency(&self, bin: usize, phase: f64) -> f64[src]

pub fn frequency_to_phase(&self, bin: usize, freq: f64) -> f64[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.