diff --git a/TODO.md b/TODO.md index a5ba736..7e15826 100644 --- a/TODO.md +++ b/TODO.md @@ -3,24 +3,23 @@ ## working on - [..] support more drum types (not just kick, snare, open/closed hat) - - ride, pedal HH, crash, 3 toms.. or arbitrary mappings + - [x] ride, pedal HH, [x] crash, 3 toms.. or arbitrary mappings - hacking in RIDE, by following the compiler. Almost works except JSON is strict and missing field borks it. Can I avoid? - - [ ] Add sounds for more instruments (ride, bell, pedal HH, crash, etc) + - [ ] Add sounds for more instruments (ride, bell, pedal HH, crash, etc) + - samples MVP: https://www.reddit.com/r/edmproduction/comments/4ew9ut/free_sample_pack_of_my_acoustic_drum_kit_real/ + - https://www.dropbox.com/scl/fi/60funlj95o1i8hg/Real-Drums-Vol.-1.zip ## asap -_what's must-have to make it useful to me?_ +(_what's must-have to make it useful to me? what's very important to make it engaging to me?_) -- make gold reachable +- [ ] (bug) GOLDEN MODE logic is broken. Denominator seems to be correct user_hits instead of desired notes +- [ ] make gold reachable - tweak strictness .. just a lil more generous on timing? - fix poor signaling of closed HH -- often triggers as MISSED (didn't hit? was Open HH due to midi) - -_what's very important to make it engaging to me?_ - -- quick start + gets you into flow +- [ ] quick start + gets you into flow - idea: saves whatever loop, BPM you were doing last time -- recovers on next start - capture progress over time (graph it, etc) - - [..] add better debugging for midi signals, so I can filter to important ones (e.g. can ignore polyphonic aftertouch 167 on changing HH pedal in terms of hitting notes on the beat) - can translate to names from here https://midi.org/expanded-midi-1-0-messages-list, then log better - proximate reason.. to figure out problem with closed HH not triggering diff --git a/res/sounds/crash.wav b/res/sounds/crash.wav new file mode 100644 index 0000000..1155e5d Binary files /dev/null and b/res/sounds/crash.wav differ diff --git a/res/sounds/ride.wav b/res/sounds/ride.wav new file mode 100644 index 0000000..da9d9e8 Binary files /dev/null and b/res/sounds/ride.wav differ diff --git a/res/sounds/tom-hi.wav b/res/sounds/tom-hi.wav new file mode 100644 index 0000000..578b88e Binary files /dev/null and b/res/sounds/tom-hi.wav differ diff --git a/res/sounds/tom-low.wav b/res/sounds/tom-low.wav new file mode 100644 index 0000000..d847b12 Binary files /dev/null and b/res/sounds/tom-low.wav differ diff --git a/res/sounds/tom-med.wav b/res/sounds/tom-med.wav new file mode 100644 index 0000000..8d0354b Binary files /dev/null and b/res/sounds/tom-med.wav differ diff --git a/src/audio.rs b/src/audio.rs index ead4b94..53b8a6f 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -298,8 +298,12 @@ async fn schedule_note( let sound = StaticSoundData::from_cursor( Cursor::new(f), match sound_path { - // TODO: why are we playing hihat sound more quietly? "res/sounds/open-hihat.wav" => StaticSoundSettings::new().volume(0.5), + "res/sounds/ride.wav" => StaticSoundSettings::new().volume(0.15), + "res/sounds/crash.wav" => StaticSoundSettings::new().volume(0.4), + "res/sounds/tom-hi.wav" => StaticSoundSettings::new().volume(0.25), + "res/sounds/tom-med.wav" => StaticSoundSettings::new().volume(0.25), + "res/sounds/tom-low.wav" => StaticSoundSettings::new().volume(0.25), _ => StaticSoundSettings::new(), } .start_time(ClockTime { diff --git a/src/consts.rs b/src/consts.rs index 375a866..1287ee4 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -24,13 +24,16 @@ pub const GRID_TOP_Y: f64 = 64.; pub const TICK_SCHEDULE_AHEAD: f64 = 2.; // schedule audio this many (N) ticks ahead of time (i.e. N seconds ahead if at 60bpm) // General use -pub const ALL_INSTRUMENTS: [Instrument; 6] = [ +pub const ALL_INSTRUMENTS: [Instrument; 9] = [ Instrument::ClosedHihat, Instrument::Snare, Instrument::Kick, Instrument::OpenHihat, Instrument::Ride, Instrument::Crash, + Instrument::Tom1, + Instrument::Tom2, + Instrument::Tom3, ]; pub const NUM_ROWS_IN_GRID: usize = ALL_INSTRUMENTS.len(); diff --git a/src/input.rs b/src/input.rs index c98449b..18e0bda 100644 --- a/src/input.rs +++ b/src/input.rs @@ -83,12 +83,15 @@ impl Input { for ins in ALL_INSTRUMENTS.iter() { let key_code = match ins { - Instrument::ClosedHihat => KeyCode::Z, - Instrument::Snare => KeyCode::X, - Instrument::Kick => KeyCode::C, - Instrument::OpenHihat => KeyCode::V, - Instrument::Ride => KeyCode::B, - Instrument::Crash => KeyCode::N, + Instrument::ClosedHihat => KeyCode::A, + Instrument::Snare => KeyCode::S, + Instrument::Kick => KeyCode::D, + Instrument::OpenHihat => KeyCode::F, + Instrument::Ride => KeyCode::G, + Instrument::Crash => KeyCode::H, + Instrument::Tom1 => KeyCode::J, + Instrument::Tom2 => KeyCode::K, + Instrument::Tom3 => KeyCode::L, }; if is_key_pressed(key_code) { events.push(Events::UserHit { @@ -147,7 +150,8 @@ impl Input { // // TODO: pause metronome click sound // } - if is_key_pressed(KeyCode::D) { + if is_key_pressed(KeyCode::Z) { + debug!("Key press: toggle debug mode"); events.push(Events::ToggleDebugMode); } @@ -159,7 +163,8 @@ impl Input { events.push(Events::ResetHits) } - if is_key_pressed(KeyCode::S) { + if is_key_pressed(KeyCode::X) { + debug!("Key press: save loop"); events.push(Events::SaveLoop); } @@ -186,6 +191,9 @@ struct InputConfigMidi { open_hi_hat: HashSet, ride: HashSet, crash: HashSet, + tom_1: HashSet, + tom_2: HashSet, + tom_3: HashSet, } impl InputConfigMidi { @@ -197,6 +205,9 @@ impl InputConfigMidi { Instrument::OpenHihat => &self.open_hi_hat, Instrument::Ride => &self.ride, Instrument::Crash => &self.crash, + Instrument::Tom1 => &self.tom_1, + Instrument::Tom2 => &self.tom_2, + Instrument::Tom3 => &self.tom_3, } } } @@ -212,24 +223,32 @@ fn get_midi_as_user_hits(midi_input: &MidiInput) -> Vec { open_hi_hat: HashSet::from_iter(vec![47, 51]), ride: HashSet::from_iter(vec![]), crash: HashSet::from_iter(vec![]), + tom_1: HashSet::from_iter(vec![]), + tom_2: HashSet::from_iter(vec![]), + tom_3: HashSet::from_iter(vec![]), }; let td17 = InputConfigMidi { closed_hi_hat: HashSet::from_iter(vec![42, 22]), snare: HashSet::from_iter(vec![38]), kick: HashSet::from_iter(vec![36]), - // open_hi_hat: HashSet::from_iter(vec![46, 26]), - open_hi_hat: HashSet::from_iter(vec![44]), // TODO: add pedal_hihat support // TODO: 44 IS pedal hihat + open_hi_hat: HashSet::from_iter(vec![46, 26]), // pedal_hi_hat: HashSet::from_iter(vec![44]), ride: HashSet::from_iter(vec![51, 53, 59]), crash: HashSet::from_iter(vec![49, 55, 57, 52]), + tom_1: HashSet::from_iter(vec![50, 48]), + tom_2: HashSet::from_iter(vec![47, 45]), + tom_3: HashSet::from_iter(vec![58, 43]), }; let alesis_nitro = InputConfigMidi { closed_hi_hat: HashSet::from_iter(vec![42]), snare: HashSet::from_iter(vec![38]), kick: HashSet::from_iter(vec![36]), - open_hi_hat: HashSet::from_iter(vec![46, 23]), // allow half-open (23) + open_hi_hat: HashSet::from_iter(vec![46, 23]), ride: HashSet::from_iter(vec![]), crash: HashSet::from_iter(vec![]), + tom_1: HashSet::from_iter(vec![]), + tom_2: HashSet::from_iter(vec![]), + tom_3: HashSet::from_iter(vec![]), }; let ic_midi = match midi_input.get_device_name() { diff --git a/src/main.rs b/src/main.rs index 9dadef1..6eccbb4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -206,6 +206,9 @@ fn process_input_events( 3 => Instrument::OpenHihat, 4 => Instrument::Ride, 5 => Instrument::Crash, + 6 => Instrument::Tom1, + 7 => Instrument::Tom2, + 8 => Instrument::Tom3, _ => panic!("invalid instrument idx"), }; voices.toggle_beat(ins, *beat); diff --git a/src/ui.rs b/src/ui.rs index d942bc9..48ebfb1 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -154,6 +154,9 @@ fn draw_beat_grid(desired_hits: &Voices) { Instrument::OpenHihat => "Open Hi-hat", Instrument::Ride => "Ride", Instrument::Crash => "Crash", + Instrument::Tom1 => "Tom1 (High)", + Instrument::Tom2 => "Tom2 (Med)", + Instrument::Tom3 => "Tom3 (Low)", }; // Labels in top-left of grid diff --git a/src/voices.rs b/src/voices.rs index 0baceca..f8c506b 100644 --- a/src/voices.rs +++ b/src/voices.rs @@ -17,9 +17,9 @@ pub enum Instrument { // PedalHiHat, Ride, // RideBell, - // LTom, - // MTom, - // HTom, + Tom1, + Tom2, + Tom3, Crash, } @@ -75,6 +75,9 @@ impl Voices { Instrument::OpenHihat => vo.open_hihat.clone(), Instrument::Ride => vo.ride.clone(), Instrument::Crash => vo.crash.clone(), + Instrument::Tom1 => vec![], + Instrument::Tom2 => vec![], + Instrument::Tom3 => vec![], }; data.push(Voice { instrument: *ins, @@ -116,9 +119,12 @@ impl Voices { Instrument::Snare => "res/sounds/snare.wav", Instrument::Kick => "res/sounds/kick.wav", Instrument::OpenHihat => "res/sounds/open-hihat.wav", - // TODO: Create sound files for new instruments like ride and crash - Instrument::Ride => "res/sounds/click.wav", - Instrument::Crash => "res/sounds/click.wav", + Instrument::Ride => "res/sounds/ride.wav", + Instrument::Crash => "res/sounds/crash.wav", + Instrument::Tom1 => "res/sounds/tom-hi.wav", + Instrument::Tom2 => "res/sounds/tom-med.wav", + Instrument::Tom3 => "res/sounds/tom-low.wav", + // Instrument::Metronome => "res/sounds/click.wav", } }