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

Level threshold #26

Merged
merged 2 commits into from
Jul 14, 2016
Merged

Level threshold #26

merged 2 commits into from
Jul 14, 2016

Conversation

glaurent
Copy link
Contributor

@glaurent glaurent commented Jul 9, 2016

This branch implements a "signal level threshold" feature which lets the user set a signal level below which no pitch detection is attempted. This avoids the PitchEngineDelegate to be called if there's silence or near silence.

Limitation : this feature is only implemented for the InputSignalTracker, not the OutputSignalTracker. I suppose it's possible, but since I don't know much about AVFoundation I'm not sure how to do it. It's also likely that my implementation in InputSignalTracker could be improved.

Also, there should be a way to get the peak/average levels, so the user can set the threshold without guessing.

This branch also updates the Podfile of the GuitarTuner example.

Signed-off-by: Guillaume Laurent <[email protected]>
This allows pitch detection to only be started if the input signal is above that threshold.

Two limitations :
- I don't know how a possible error in InputSignalTracker.setupAudio() should be handled
- I don't know how to do the same in OutputSignalTracker. For the moment I've just added the levelThreshold var even if it's a no-op.

Signed-off-by: Guillaume Laurent <[email protected]>
@vadymmarkov vadymmarkov merged commit 0d015ba into vadymmarkov:master Jul 14, 2016
@vadymmarkov
Copy link
Owner

Awesome, thanks for your contribution @glaurent!

@glaurent
Copy link
Contributor Author

you're welcome

@PCrompton
Copy link

@glaurent can you point me to any resources that explain the level threshold concept and how the values should be interpreted?

Thanks,

Paul

@glaurent
Copy link
Contributor Author

@PCrompton it's quite simple : the InputSignalTracker analyses the audio signal received from the device's microphone. This signal has a level. My patch simply lets you set a threshold under which the signal will not be analysed. This is a simple way to filter out low level noise and avoid recognizing "random" notes.

@PCrompton
Copy link

@glaurent I understood that much, and I noticed that you set the guitar tuner's threshold to -30.0. I played around with different values and found that above -20.0 isn't all that helpful. Does setting the threshold help to filter out harmonics? I'm having trouble below A3 detecting the correct octave. It usually interprets it as the first or second partial. For instance I play G3 and it interprets it as D5, or I play F3 and it returns F4. This is with the levelThreshold = -30.0 and let config = Config(bufferSize: 4096, transformStrategy: .fft, estimationStrategy: .hps, audioURL: nil)

@glaurent
Copy link
Contributor Author

@PCrompton you'll have to play with the setting, depending on how close the device is to the sound source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants