File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def show(self, data):
5454
5555group = displayio .Group (scale = 3 )
5656graph = RollingGraph (3 )
57- fft_size = 128
57+ fft_size = 256
5858
5959# Add the TileGrid to the Group
6060group .append (graph )
@@ -71,7 +71,7 @@ def show(self, data):
7171
7272# Main Loop
7373def main ():
74- max_all = 1
74+ max_all = 10
7575
7676 while True :
7777 mic .record (samples_bit , len (samples_bit ))
@@ -81,16 +81,20 @@ def main():
8181 # to change any zeros to nonzero numbers
8282 spectrogram1 = ulab .vector .log (spectrogram1 + 1e-7 )
8383 spectrogram1 = spectrogram1 [1 :(fft_size // 2 )- 1 ]
84- min_curr = min (spectrogram1 )
85- max_curr = max (spectrogram1 )
84+ min_curr = ulab . numerical . min (spectrogram1 )[ 0 ]
85+ max_curr = ulab . numerical . max (spectrogram1 )[ 0 ]
8686
8787 if max_curr > max_all :
8888 max_all = max_curr
8989 else :
9090 max_curr = max_curr - 1
9191
92+ print (min_curr , max_all )
93+ min_curr = max (min_curr , 3 )
9294 # Plot FFT
9395 data = (spectrogram1 - min_curr ) * (51. / (max_all - min_curr ))
96+ # This clamps any negative numbers to zero
97+ data = data * ulab .array ((data > 0 ))
9498 graph .show (data )
9599
96100main ()
You can’t perform that action at this time.
0 commit comments