pub struct BasicSong {
pub notes: Vec<Note>,
pub bpm: BPMChoice,
}Expand description
§Deprecated
This feature has been deprecated in the latest update. Please use the new player, not the legacy one.
Basic songs are collections of Notes. Each song can export to a .wav file.
Example:
use rs_audio::*;
let mut song = BasicSong::default();
song.play().unwrap();
let mut second_song = BasicSong::new(vec![
Note { freq: 880.0, dur: 1.0, vol: 0.20, wave: WaveForm::Sine },
Note { freq: 220.0, dur: 1.0, vol: 0.20, wave: WaveForm::Square },
Note { freq: 880.0, dur: 1.0, vol: 0.20, wave: WaveForm::Sine },
Note { freq: 220.0, dur: 1.0, vol: 0.20, wave: WaveForm::Triangle },
], BPMChoice::Default);
second_song.play().unwrap(); // Uses the main thread.
second_song.export_to_wav("test.wav".to_string());Fields§
§notes: Vec<Note>§bpm: BPMChoiceImplementations§
Source§impl BasicSong
impl BasicSong
Sourcepub fn export_to_wav(&self, filename: String) -> Result<(), Box<dyn Error>>
pub fn export_to_wav(&self, filename: String) -> Result<(), Box<dyn Error>>
§Deprecated
This feature has been deprecated in the latest update. Please use the new player, not the legacy one.
Exports a Song struct to a .wav file.
It creates a .wav file in the current directory.
Usage:
use rs_audio::*;
use rs_audio::{legacyplayer::BasicSong};
let song = BasicSong::default();
song.export_to_wav("test.wav".to_string());Trait Implementations§
Auto Trait Implementations§
impl Freeze for BasicSong
impl RefUnwindSafe for BasicSong
impl Send for BasicSong
impl Sync for BasicSong
impl Unpin for BasicSong
impl UnwindSafe for BasicSong
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