diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-06-19 21:09:47 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-06-19 21:09:47 +0200 |
commit | d8df88e8b299fe697ff695f61cd1e85032530a84 (patch) | |
tree | b69a0d674e4775ff14b0b8f107e91e70b6827479 /src | |
parent | 9076fd7a7cef6bde83bdf52d41e45a3e0d540a2f (diff) | |
download | glutte-o-matic-d8df88e8b299fe697ff695f61cd1e85032530a84.tar.gz glutte-o-matic-d8df88e8b299fe697ff695f61cd1e85032530a84.tar.bz2 glutte-o-matic-d8df88e8b299fe697ff695f61cd1e85032530a84.zip |
Widen frequency range of tone test
Diffstat (limited to 'src')
-rw-r--r-- | src/common/src/Audio/tone.c | 6 | ||||
-rwxr-xr-x | src/tone-test-sim/analyse.py | 2 | ||||
-rw-r--r-- | src/tone-test-sim/src/test.c | 29 |
3 files changed, 30 insertions, 7 deletions
diff --git a/src/common/src/Audio/tone.c b/src/common/src/Audio/tone.c index 2cd97a9..60226ce 100644 --- a/src/common/src/Audio/tone.c +++ b/src/common/src/Audio/tone.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018 Maximilien Cuony + * Copyright (c) 2018 Maximilien Cuony, Matthias P. Braendli * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,10 +40,10 @@ static struct tone_detector detector_1750; int TONE_1750_DETECTED = 0; static void init_tone(struct tone_detector* detector, int freq, int threshold) { - detector->coef = 2.0 * arm_cos_f32(2.0 * FLOAT_PI * freq / AUDIO_IN_RATE); + detector->coef = 2.0f * arm_cos_f32(2.0f * FLOAT_PI * freq / AUDIO_IN_RATE); detector->Q1 = 0; detector->Q2 = 0; - detector->threshold = threshold ; // 200000; + detector->threshold = threshold; detector->num_samples_analysed = 0; } diff --git a/src/tone-test-sim/analyse.py b/src/tone-test-sim/analyse.py index a67644c..8222213 100755 --- a/src/tone-test-sim/analyse.py +++ b/src/tone-test-sim/analyse.py @@ -11,7 +11,7 @@ plt.scatter(dat[...,0], dat[...,1], c=dat[...,3].astype(np.float32)) plt.show() if 0: - thresholds = [800, 2000, 4000, 8000] + thresholds = [200, 2000, 4000, 8000, 12000] fig, ax = plt.subplots() diff --git a/src/tone-test-sim/src/test.c b/src/tone-test-sim/src/test.c index ca35c1c..3ba00c4 100644 --- a/src/tone-test-sim/src/test.c +++ b/src/tone-test-sim/src/test.c @@ -1,3 +1,26 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2018 Maximilien Cuony, Matthias P. Braendli + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. +*/ #include <stdio.h> #include <stdlib.h> #include <math.h> @@ -18,11 +41,11 @@ int main(int argc, char **argv) return 1; } - const int freq_start = 1750 - 175; - const int freq_stop = 1750 + 175; + const int freq_start = 1750 - 350; + const int freq_stop = 1750 + 350; for (int freq = freq_start; freq < freq_stop; freq += 20) { - for (int threshold = 800; threshold < 8000; threshold += 80) { + for (int threshold = 200; threshold < 8000; threshold += 240) { tone_init(threshold); for (size_t j = 0; j < 200; j++) { |