Comments (5)
Sure. Difference function and autocorrelation are quite similar.
In MPM, normalized square difference and autocorrelation functions are basically the same thing. I found in some exploration (https://github.com/sevagh/pitch-detection/tree/master/misc/mcleod#51---peak-picking-with-parabolic-interpolation---putting-it-all-together) that once you add the rest of the algorithm, autocorrelation and NSDF perform the same.
As a plus, I can use the same autocorrelation function in YIN (
Lines 91 to 102 in 34b198b
from pitch-detection.
Thanks for explaining your approach in MPM.
Also, one more thing in YIN implementation remains unclear for me.
In the code above you are using:
ya->out_real[0] + ya->out_real[1] - 2 * ya->out_real[tau];
Why ya->out_real[1]
is used here?
In my understanding this algorithm shoud look like:
T prefix_sum = 0;
for (int tau = 0; tau < ya->N / 2; tau++)
{
ya->yin_buffer[tau] = 2 * ya->out_real[0] - prefix_sum - 2 * ya->out_real[tau];
prefix_sum += audio_buffer[tau];
}
So we add sum of all squares(ya->out_real[0]
) and sum of all squares which start from tau
(ya->out_real[0] - prefix_sum
)
from pitch-detection.
I did that with trial and error.
You can see I used to have different code - similar to yours but missing the prefix_sum (maybe that's why it never worked): 521481b#diff-ec0aedadeb2a8475b194edb462daf8fcd235be1a347ae5d49feddbe7ede87559L112
from pitch-detection.
I would take a look at ya->out_real[1]
(maybe print it). Perhaps by luck it's some approximation of the original algorithm.
from pitch-detection.
Thanks, for clarification. In the end, the best method is one which works :)
from pitch-detection.
Related Issues (20)
- Transcriber example HOT 2
- Absorb yin and mpm repos here
- Guitar tuner example HOT 3
- Docs HOT 1
- Could you give an example code to detect pitch? HOT 6
- ma'c
- How can I use it in mac os? HOT 1
- YIN vs McLeod pitch detection accuracy HOT 7
- Implement pYIN (probabilistic YIN) HOT 6
- Implement SWIPE HOT 6
- Implement CREPE HOT 2
- C API
- wrong results with different buffer sizes in the sinewave example HOT 4
- Add Aud-SWIPE-P (parallel SWIPE)
- Android/Oboe tutorial/doc
- the error of the project HOT 6
- Additional compiler flags maybe needed HOT 2
- Create a GitHub Action that builds and runs unit tests HOT 5
- systematic comparison of methods HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pitch-detection.