Crates.io | augmented_oscillator |
lib.rs | augmented_oscillator |
version | 1.4.0 |
source | src |
created_at | 2022-01-12 15:39:25.328659 |
updated_at | 2024-01-17 09:13:43.738784 |
description | Very simple implementation of an oscillator. |
homepage | https://github.com/yamadapc/augmented-audio |
repository | |
max_upload_size | |
id | 512831 |
size | 136,291 |
Very simple implementation of an oscillator.
let sample_rate = 44100.0;
let mut osc = augmented_oscillator::Oscillator::sine(sample_rate);
osc.set_frequency(40.0); // set freq. in Hz
let _sample = osc.next_sample(); // tick the oscillator forward
use augmented_oscillator::{Oscillator, wavetable::WaveTableOscillator};
let sample_rate = 44100.0;
// let mut osc = WaveTableOscillator::new(vec![/* your wave table data */]);
// You can either ^^^^ provide your own table (and update it at runtime) or generate a table
// of a certain length (100 sample here) from a function oscillator
let mut osc = WaveTableOscillator::from_oscillator(Oscillator::sine(sample_rate), 100);
osc.set_frequency(40.0); // set freq. in Hz
let _sample = osc.next_sample(); // tick the oscillator forward
let sample_rate = 44100.0;
let mut osc = augmented_oscillator::Oscillator::new_with_sample_rate(
sample_rate,
move |phase: f32| phase.sin()
);
osc.set_frequency(40.0); // set freq. in Hz
let _sample = osc.next_sample(); // tick the oscillator forward
License: MIT