diff --git a/examples/audiometer.jl b/examples/audiometer.jl index 1b8d261..25925b5 100644 --- a/examples/audiometer.jl +++ b/examples/audiometer.jl @@ -3,12 +3,12 @@ using PortAudio """Continuously read from the default audio input and plot an ASCII level/peak meter""" function micmeter(metersize) - mic = PortAudioSource() + mic = PortAudioStream(1, 0; bufsize=512) signalmax = zero(eltype(mic)) println("Press Ctrl-C to quit") while true - block = read(mic, 4096) + block = read(mic, 512) blockmax = maximum(abs(block)) # find the maximum value in the block signalmax = max(signalmax, blockmax) # keep the maximum value ever print("\r") # reset the cursor to the beginning of the line @@ -45,3 +45,5 @@ function barcolor(metersize, position) :yellow end end + +micmeter(80)