12 lines
No EOL
342 B
Python
12 lines
No EOL
342 B
Python
# Print out realtime audio volume as ascii bars
|
|
|
|
import sounddevice as sd
|
|
import numpy as np
|
|
|
|
def callback(indata: np.ndarray, outdata: np.ndarray, frames: int, time, status) -> None:
|
|
print(indata.shape)
|
|
volume_norm = np.linalg.norm(indata)*10
|
|
print ("|" * int(volume_norm))
|
|
|
|
with sd.Stream(callback=callback):
|
|
sd.sleep(10000) |