Fixed weirdness, was caused by bin selection
This commit is contained in:
parent
eb2926f525
commit
700f34e729
@ -72,16 +72,16 @@ for i in range(num_segments):
|
|||||||
return np.array([centre_frequency - width, centre_frequency + width])
|
return np.array([centre_frequency - width, centre_frequency + width])
|
||||||
|
|
||||||
def magnitude_in_band(band):
|
def magnitude_in_band(band):
|
||||||
return np.sum(normalized_magnitudes[int(band[0]):int(band[1])])
|
return np.sum(
|
||||||
|
normalized_magnitudes[int(band[0]/frequency_resolution):int(band[1]/frequency_resolution)]
|
||||||
|
)
|
||||||
|
|
||||||
scores = {
|
scores = {
|
||||||
tone:decibels(magnitude_in_band(band(frequency)))
|
tone:decibels(magnitude_in_band(band(frequency)))
|
||||||
for tone,frequency in TONES.items()
|
for tone,frequency in TONES.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
print(scores)
|
active_tones = find_top_two_keys(scores, 3.0)
|
||||||
|
|
||||||
active_tones = find_top_two_keys(scores)
|
|
||||||
if active_tones:
|
if active_tones:
|
||||||
print(active_tones)
|
print(active_tones)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user