alesgenova / pitch-detection

A collection of algorithms to determine the pitch of a sound sample.
MIT License
231 stars 27 forks source link

Real audio samples in tests #11

Closed siefkenj closed 3 years ago

siefkenj commented 3 years ago

I notice the tests currently use auto-generated samples. I would be nice if there were some real audio samples included in the tests.

I could try and do this, but I have a few questions:

  1. I assume a subfolder inside tests is the right place for them?
  2. I assume I'll need some crate to load wav files. Does cargo make a distinction between crates needed to run tests and other crates? Am I going to bloat the executable and break WASM support if I add a crate for the tests?
alesgenova commented 3 years ago

In this WIP pull request, I started implementing something similar: #6

The way I did it, was to dump the data of a short wav file to a binary file, and then open it with rust (the scalar type and sample rate must be known, they are not part of the file).

This approach is very basic, but the reason why I did it this way (at least for now), was to avoid adding dependencies that might break the wasm target, as you also suspected.

If you would like to improve on it, I'll more than welcome a PR :)

alesgenova commented 3 years ago

Fixed by #14