PitchDetection: configuration for low and high notes

With recorded piano samples, it should go from do1 to mi7
This commit is contained in:
Louis-Joseph Fournier 2016-01-12 16:16:25 +01:00
parent a44bb5841c
commit 27f93603ab
4 changed files with 14 additions and 7 deletions

View file

@ -138,7 +138,7 @@ Item {
theme: main.theme
marks: [1, 2, 3, 4, 5, 6, 7, 8, 9]
marks: [1, 2, 3, 4, 5, 6, 7, 8]
//nb_marks_displayed: is_portrait ? 4 : 3
width: parent.width * 0.6

View file

@ -141,7 +141,7 @@ Item {
anchors.rightMargin: is_portrait ? (parent.width - width) / 2 : parent.width / 20
theme: main.theme
marks: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
marks: [1, 2, 3, 4, 5, 6, 7, 8]
nb_marks_displayed: is_portrait ? 4 : 3
width: is_portrait ? meter.width / 2 : parent.width / 6

View file

@ -22,6 +22,13 @@
using namespace std;
/* with scpy:
*
* nyq=rate/2
* norm=cutoff/nyq
* b, a = butter(order, norm, btype='high', analog=False)
*/
// high 10hz / 16k
static double a10[] = { 1 , -2.99214602, 2.98432286, -0.99217678 };
static double b10[] = { 0.99608071, -2.98824212, 2.98824212, -0.99608071 };

View file

@ -46,15 +46,15 @@ class PitchDetection {
static const int rate = 16000;
private:
static const int defaultNbFrame = 1024;
static const int defaultFreqMin = 50;
static const int defaultFreqMax = 2000;
static const int defaultNbFrame = 2048;
static const int defaultFreqMin = 30;
static const int defaultFreqMax = 3000;
/// number of analyses to confirm a note
static const int nbConfirm = 3;
/// number of analyses to drop a note
static const int nbDefect = 20;
static const int nbDefect = 14;
/// number of deviation values for average
static const int nbDeviationValues = 8;
static const int nbDeviationValues = 4;
LinearFilter<int16_t> *high_filter;
ZeroCross<int16_t> *cross;