Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

massive refactoring for v0.2.0 #18

Merged
merged 24 commits into from
Apr 28, 2024
Merged

massive refactoring for v0.2.0 #18

merged 24 commits into from
Apr 28, 2024

Conversation

phip1611
Copy link
Owner

@phip1611 phip1611 commented Apr 7, 2024

  • simpler code
  • more reliable detection
  • beat detection based on envelope detection
  • more basic building blocks
  • layered abstractions, more fine-grained testing
  • prevent unnecessary copies/buffering where possible

Closes #17
Closes #15
Closes #13
Closes #12
Closes #11
Closes #6

Missing (so far)

  • the cpal/recording module
  • the examples
  • a live beat detection

The focus is now on working on the waveform (after applying a
low-pass filter). I created multiple simple basic building blocks
that I thoroughly test on real world audio samples. This commit is
the first one where the code reliably detects the two envelopes
(beats) in the "sample1_lowpassed--double-beat.wav" file.

The next step is to ensure that the following samples work:
- holiday_lowpassed--single-beat.wav
- sample1_lowpassed--long.wav
- holiday_lowpassed--long.wav
phip1611 added 15 commits April 28, 2024 12:03
Unnecessary, over-engineered.
The relatively complex AudioInput type (complex because large base
of the code need adoptions) is very nice as this way, users do not
necessarily need to create intermediate arrays with their data.

Thus, the copying into the internal buffer (after applying the
low pass filter), is the only copying needed. Performance, yay!
Ran `cargo +nightly clippy`.
This is useful of you want to check if a previously detected
beat is still inside the audio window.
This is useful of you want to check if a previously detected
beat is still inside the audio window.
Yes, the Greenday Holiday example misses a few beats. But hell,
this took so long, I'm finally getting good-enough results! The hard
work and countless refactorings finally paid out!
@phip1611 phip1611 force-pushed the dev-2.0 branch 2 times, most recently from 6b41cb0 to fdaf360 Compare April 28, 2024 19:43
Required because of the "dep:" syntax in Cargo.toml file
no-std by default, but has optional std feature
The .abs() method is in libstd but not libcore. So I have
to use libm functionality to be nostd compatible.
This saves possibly hundreds or thousands of instructions as the
same operation doesn't have to be done again and again.
@phip1611 phip1611 changed the title XXX WIP massive refactoring for v0.2.0 massive refactoring for v0.2.0 Apr 28, 2024
@phip1611 phip1611 merged commit be9c7e6 into main Apr 28, 2024
14 checks passed
@phip1611 phip1611 deleted the dev-2.0 branch April 28, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment