Skip to content

Commit

Permalink
XXX wip
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Apr 8, 2024
1 parent d967644 commit 5e5a873
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Binary file added res/sample_1_double_beat.wav
Binary file not shown.
11 changes: 9 additions & 2 deletions src/audio_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ use core::time::Duration;
use ringbuffer::{ConstGenericRingBuffer, RingBuffer};

/// Default buffer size for [`AudioHistory`]. For a typical (and to be expected)
/// sampling frequency of 44100Hz, this corresponds to 200ms which is more than
/// sampling frequency of 44100Hz, this corresponds to 1000ms which is more than
/// enough to detect beats that are typically at 60Hz, with a period duration
/// of 20ms (or 20Hz at 50ms). This results in roughly 35kib of stack usage
/// for the audio buffer.
pub const DEFAULT_BUFFER_SIZE: usize = 44100 / 5;
///
/// TODO I plan to reduce this to 500, 300, or even 200ms to reduce memory usage.
/// However, during development, a large ubffer size is necessary to tune the
/// algorithm in a way that it reliably works for data analysis when the full
/// sample is in memory. If that works reliably, I can test the library in a
/// "data streaming approach" and discover beats one by one. However, for now,
/// I keep it very basic and easy.
pub const DEFAULT_BUFFER_SIZE: usize = 44100;

/// Sample info with time context.
#[derive(Copy, Clone, Debug)]
Expand Down

0 comments on commit 5e5a873

Please sign in to comment.