Closed johanndiedrick closed 4 years ago
notes from @rbracco :
In 00_core:
remove the .flip(1) from the last line of AudioToSpec.encodes
make a line that is like a2s = AudioToSpec(mel=True, to_db=True, f_max=8000, f_min=50, n_mels=128...etc) where all the possible settings are set explicitly, that way if we change defaults it won't mess with your test
that part is pretty annoying but im not sure how else to do it
make something that makes an AudioItem with a given frequency (e.g. 100hz)
make a spectrogram from that, sg = a2s(ai_100hz)
get the max row from the spectrogram like this x.max(dim=1).indices.mode().values.item()
make a test that compares x.max(dim=1).indices.mode().values.item() with the int value you got in 5, that way if it breaks we will know, so like test_eq(x.max(dim=1).indices.mode().values.item(), 11)
and if it flips, the 11th row wont be the most lit up, it will be the 117th or something
haha and this was supposed to be easy! lmk if you think of a better way
also when you make the tone, make sure it is of shape (1 x samples) not just (samples) all of our code assumes there is a channel dimension
actually one optimization is just setting the frequency super low, to say 5hz and then i think it will mean bin 0 is the most activated, that gets rid of step 5
We've had a lot of issues ensuring we don't accidentally display spectrograms upside down! This should be basic and is easily tested by generating a tone of e.g. 100hz and then making sure the spectrogram has a bar near the bottom.
@rbracco I was able to generate a spectrogram for a 100hz sine wave. Which function are we wanting to test in the notebooks?