-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add CombDetector, a naive polyphonic pitch detector #6
base: master
Are you sure you want to change the base?
Conversation
hi alessandro, that's very nice of you. so, i gave it a try and it does not work. actually i have been thinking of using the fact i know which frequency is the parasite string and to filter it out but i'm really a beginner with sound processing and my attempt also did not work. i've uploaded my code here : https://gitlab.ensimag.fr/wagnerf/listen/ thanks for your help |
Thank you for providing the sound samples, I was too lazy to record them myself :) So I played around with the F# A mandolin sample from your report and the polyphonic detector actually works better than I expected. I'm writing some test cases using it so you can use it as an example. I'll push the test cases tomorrow to this branch, but in the meantime this is the preliminary result I'm getting: For reference I'm using the samples 4000...20384 from your wave file (remove the plucking part and cutting the low volume tail). I pick a 4096 sample moving window (the window moves by 2048 samples at each iteration) and feed it to the polyphonic detector. As you can see from the output, in most cases the algorithm is able to detect both notes (without considering the octave)
|
hey that's really nice. I'll definitely give it a try again. maybe my window size was too small actually. by the way i was wondering how you handle the moving part. since your input is a slice you are forced to copy the whole window at least from time to time (in my current code i do it at each move). I've changed a bit the input types to allow structs which are not slices : the drawback is that the input types are less readable somehow. the inner code does not change much though. as a side note i'm going to be traveling home today, so i might be offline for a few days but i'll definitely be back soon. thanks again and have a nice christmas. |
I added a few tests that use recordings of real instruments (for example your mandolin), see my latest commit to this PR.
Yes, I'm making a copy (see the
I wouldn't worry about the performance hit of copying the full window when consecutive windows are overlapping instead of the smaller part that is changing.
However, I'm open to consider a change to the signature of the input types, if it increases the compatibility of the library with different common inputs. Could you give me some examples?
Thank you, have fun on your break! |
hi alessandro, happy new year. so, i took a quick look.
|
hi, so i did some more testing. i get consistent results now. the bad news is that in my specific case the comb detector did not really manage to improve detections. the good news is that i will get a steady stream of mis-identified samples now. i'm also still going to use the multi pitch detector when i add chords. as a side note i wonder if it would'nt be a better api to add a new method to the Fred |
I'm not sure I want to add another method to the basic I will also include the tips you gave above regarding the loop in the Finally, I'll write an isolated function to apply the comb filter to a signal, so you can play around with the various mis-identified samples and check if tweaking the parameters in the filter could help or if it's a hopeless approach. |
hi, sorry for the delay. I tried another api. in my opinion it is better. you don't need an extra trait, you don't need to box the detector and you get an iterator instead of a vector. i did it quite quickly so, it's untested for now but i just re-factored your code. |
actually I maybe found something nice. if i decrease the clarity threshold then suddenly the polyphonic detector gives me better results than the standard one. it actually makes sense i guess. i'll do more testing with that. |
Sorry for the delay, I need to get around to reviewing and merging you branch! I'm surprising that the results improve, the first pitch detected by the polyphonic and regular detector should be the same (given the same clarity value). I might make sense that a lower clarity gives you better results though, with a value too high it's possible that we discard relevant peaks. But with a value too low we may pick irrelevant noise frequencies. What value is working best for you? |
hi, no worry for the delays, it's all fine. |
Simple approach to attempt multi pitch detection:
The new
CombDetector
does the following:Caveats: