tests: fix audio recording test

To calculate frequency it needs to use samples per second (44100), not
samples pre recording lenght. This caused shorter recordings to not fit
into the margin.
This commit is contained in:
Marek Marczykowski-Górecki 2020-08-07 01:55:10 +02:00
parent 3815e0b5cf
commit 1abf949faf
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -458,7 +458,7 @@ class TC_00_AppVMMixin(object):
(rec[:-1] < -threshold))[0]
np.seterr('raise')
# compare against sine wave frequency
rec_freq = rec_size/np.mean(np.diff(crossings))
rec_freq = 44100/np.mean(np.diff(crossings))
if not sfreq*0.8 < rec_freq < sfreq*1.2:
self.fail('frequency {} not in specified range'
.format(rec_freq))