note struct

This commit is contained in:
2026-03-11 08:55:56 -06:00
parent 2cdfcb72ee
commit 0d4d92f374
2 changed files with 17 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ use itertools::Itertools;
mod flags;
mod syn;
mod note;
fn main() {
let flags = flags::Flags::new();
@@ -12,7 +13,7 @@ fn main() {
flags.sample_rate,
);
// Play some notes (middle C, E, G). // 16 channels actually // 60=c 64=e 67=g //up to 128velocity though dont go below 50 tbh // 12 notes per octave
syn.note_on(0, 64 + 12, 127);
syn.note_on(0, note::new("any").i32(), 127);
play(syn, flags.sample_rate, flags.bpm, flags.smallest_note);
}
@@ -21,7 +22,7 @@ fn play(mut s: syn::Syn, sample_rate: usize, bpm: usize, smallest_note: usize) {
let params = tinyaudio::prelude::OutputDeviceParameters {
channels_count: 2,
sample_rate: sample_rate,
channel_sample_count: sample_rate / bpm * 60 / smallest_note,
channel_sample_count: sample_rate / bpm * 60 / smallest_note,
};
let sample_count = (params.channel_sample_count) as usize;