print("caching data...")
caching = True
+ all_spectrums = np.zeros((segment_count, window_height, window_size, 3), dtype=np.uint8)
+
for segment_index in tqdm(range(segment_count)):
# get the specturm of the current sample
segment_start = segment_index * segment_samples
if segment_index == 10:
cv.imwrite("spectrum_sample.jpg", spectrum)
- np.save(f"cache/frame{segment_index}.npy", spectrum)
+ all_spectrums[segment_index] = spectrum
+ #np.save(f"cache/frame{segment_index}.npy", spectrum)
segment_index = 0
print("cached!")
while segment_index < segment_count:
- spectrum = np.load(f"cache/frame{segment_index}.npy")
+ spectrum = all_spectrums[segment_index]#np.load(f"cache/frame{segment_index}.npy")
# display and capture
camera.display(spectrum)
# define parameters
sample_rate = 22_050
-window_size = 150
+# 64 81 100 121 144 169 192 225
+window_size = 144
window_height = 80
+hop_size = window_size // 2
+
caching = False
if __name__ == "__main__":