duration = 10

def print_sound(indata, outdata, frames, time, status):
    volume_norm = np.linalg.norm(indata) * 10
print('|' * int(volume_norm))
How to read realtime microphone audio volume in python and ffmpeg or similar