-
Notifications
You must be signed in to change notification settings - Fork 67
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
Adding dockerfile #84
Conversation
Thanks for the contribution. I'll leave some preliminary comments. I'll take a look at those failing tests. The wrong pitches might be legitimate - no pitch detection method is perfect (and might be off by integer multiples for different harmonics), so those tests served to show the imperfection. |
I cloned your fork and was able to build the Dockerfile. So, OK, it works good. Getting the build dependencies in a container will be helpful for lots of users. Would you like to add some usage text about the Dockerfile/docker-based build process you're envisioning? https://github.com/sevagh/pitch-detection#build-and-install Another thought - this container is definitely useful for people compiling the code and easily linking against lpitch-detection. Maybe your help text can have an example for user, or some suggestion or convenient script to let them mount their own code into the container. E.g. "first write main.cpp, then |
Sorry I had a busy week at work, looking at this now. I'll add a note about the Dockerfile. I think for the mounting I'm going to wait a bit to add that if that's okay with you. I haven't had time to actually write anything using the library yet, I can add something once I've made some more progress on my sample program. |
Looking good to me. I'll most likely cut down on the README some time in the future after accepting this, to make it more terse (but keep the essence). I won't let that block the PR though since debating writing style over GitHub will probably be exhausting. |
Can you squash your commits into 1 (https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)? Message "Add Dockerfile" should be fine. If I squash from the GitHub UI, it might erase your authorship. |
updating dockerignore updating readme with docker instructions Fixing windows path in example
Squashed! Never done that manually before! |
@sevagh, sorry to necropost, but I've been working on re-writing your code in C, where Yin was a no-brainer, but PYin is causing me a lot of headache. I'm wondering if the failing tests that esimkowitz mentions has something to do with it. Could you reproduce the issue? Because I'm getting the same failed tests and am wondering if something is "wrong" with the PYin version, or if you'd say it's working as expected? |
I just checked on this since your HN comment. I'll take a look soon. I have changed my C++ opinions dramatically since I last worked on pitch-detection, it's worth a new look. Also in pitchlite (https://github.com/sevagh/pitchlite/blob/main/src/shared.cpp) I have a slightly more efficient autocorrelation with real FFTs (and even more savings from not having std::complex vectors). |
I'm now addressing some of these errors:
These used to throw |
Regarding the unit tests for PYin, I added print statements for the pitch candidates in PYin:
So, PYin in these cases is putting the highest confidence on the inappropriate pitch. In the Piano D4 case, top 3 pitches are:
In the Guitar E2 case, top 3 pitches are:
|
Cool, here's one major fix of a bug:
The answers are still wrong, but it's much stronger for the likelier candidates than the outliers. The bug is this:
I think accumulating in the threshold is a bad error that results in huge thresholds for the highest frequencies, leading to some junk candidates having a very strong probability. |
I got all the tests passing with two more adjustments to the PYin code!
|
Super awesome! Thanks for taking the time to investigate. I did have a hunch that those pesky beta distributions had something to do with it. Looking forward to translate it into C. This library (non-GPL) uses a beta distribution with alpha 1.7 and a mean of .2 and seems to use some kind of dynamic threshold (find_valleys). Perhaps he's found a magical way - I'll have to test it after Christmas. Will return if something turns up. |
For now I'll settle for this code that gets my own unit tests passing, but that library looks like it has a good implementation. I'm using scipy to generate the beta distribution to hardcode in my code:
|
Let's move the conversation here: #87 I'm going to address some long-standing issues, including the buggy sine wave generator, etc. |
I've written a dockerfile to build and run your pitch-detection code. As it's set up right now, it builds the code and its dependencies, as well as the test and benchmark programs.
One thing I noticed is that with the latest libraries from APT, the following four tests are failing. Is this a known issue? If so, do you know which versions of which libraries are stable with the code?