From 6970d2b81e4c2c64382c9c17968a59b3d5540767 Mon Sep 17 00:00:00 2001 From: Spencer Russell Date: Wed, 23 Mar 2016 23:41:26 -0400 Subject: [PATCH] updates audiometer example for recent Stream changes --- examples/audiometer.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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)