Mercurial > hg > multitrack-audio-matcher
comparison src/LiveAudioInput.cpp @ 37:9806a4f22fd0
Fixed bugs in the likelohoods that caused some to zero when no events found.
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 24 Apr 2012 14:16:01 +0100 |
parents | 4be22a1a0e24 |
children |
comparison
equal
deleted
inserted
replaced
36:eb43b2a007ea | 37:9806a4f22fd0 |
---|---|
7 * | 7 * |
8 */ | 8 */ |
9 | 9 |
10 #include "LiveAudioInput.h" | 10 #include "LiveAudioInput.h" |
11 | 11 |
12 //Keeping track of incoming events | |
13 //more useful as data than anything else. But in fact, not particularly useful it seems at present | |
14 | |
15 | |
12 const double hopsize = 512;//check to see it agrees with ofxAubioOnsetDetector | 16 const double hopsize = 512;//check to see it agrees with ofxAubioOnsetDetector |
13 | 17 |
14 LiveAudioInput::LiveAudioInput(){ | 18 LiveAudioInput::LiveAudioInput(){ |
15 numberOfEvents = 0; | 19 numberOfEvents = 0; |
16 | 20 |
17 } | 21 } |
18 | |
19 | |
20 | |
21 | 22 |
22 void LiveAudioInput::addPitchEvent(const double& pitch, const double& time){ | 23 void LiveAudioInput::addPitchEvent(const double& pitch, const double& time){ |
23 | 24 |
24 AudioEvent e; | 25 AudioEvent e; |
25 e.millisTime = time; | 26 e.millisTime = time; |
30 numberOfEvents++; | 31 numberOfEvents++; |
31 | 32 |
32 } | 33 } |
33 | 34 |
34 | 35 |
35 | |
36 /* | |
37 //any point in this?? | |
38 void LiveAudioInput::addChromaEvent(const double& time){ | |
39 | |
40 AudioEvent e; | |
41 e.millisTime = time; | |
42 e.frameTime = millisToFrames(time); | |
43 | |
44 liveEvents.push_back(e); | |
45 //printf("live input pitch %f time %f ms == %f frames\n", pitch, time, e.frameTime); | |
46 numberOfEvents++; | |
47 | |
48 } | |
49 */ | |
50 | |
51 double LiveAudioInput::framesToMillis(const double& frameCount){ | 36 double LiveAudioInput::framesToMillis(const double& frameCount){ |
52 return ((frameCount*hopsize*1000.0)/44100.0); | 37 return ((frameCount*hopsize*1000.0)/44100.0); |
53 } | 38 } |
54 | 39 |
55 | 40 |
56 double LiveAudioInput::millisToFrames(const double& millis){ | 41 double LiveAudioInput::millisToFrames(const double& millis){ |
57 return ((millis*44100.0)/(hopsize*1000.0)); | 42 return ((millis*44100.0)/(hopsize*1000.0)); |
58 } | 43 } |
44 | |
45 | |
46 | |
47 /* | |
48 //any point in this?? | |
49 void LiveAudioInput::addChromaEvent(const double& time){ | |
50 | |
51 AudioEvent e; | |
52 e.millisTime = time; | |
53 e.frameTime = millisToFrames(time); | |
54 | |
55 liveEvents.push_back(e); | |
56 //printf("live input pitch %f time %f ms == %f frames\n", pitch, time, e.frameTime); | |
57 numberOfEvents++; | |
58 | |
59 } | |
60 */ |