From 76a2496b59a59fb9c7538c2b057bc4e99b04beb6 Mon Sep 17 00:00:00 2001 From: Hongyu Li Date: Tue, 29 Mar 2022 15:09:40 -0400 Subject: [PATCH] set variable for calc to get n secs od audio --- vz_acoustic_scene_analysis/scripts/stretch_audio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vz_acoustic_scene_analysis/scripts/stretch_audio.py b/vz_acoustic_scene_analysis/scripts/stretch_audio.py index ebbe640..9285eb2 100755 --- a/vz_acoustic_scene_analysis/scripts/stretch_audio.py +++ b/vz_acoustic_scene_analysis/scripts/stretch_audio.py @@ -242,7 +242,8 @@ class ROSInterface: output= False) frames = [] - for i in range(0, int(RESPEAKER_RATE / CHUNK * seconds)): + arr_length = int(RESPEAKER_RATE / CHUNK * seconds) # get length of array to produce n seconds of audio + for i in range(0, arr_length): data = stream.read(CHUNK) a = np.frombuffer(data,dtype=np.int16)[0::6] # extracts fused channel 0 print("a type: ", type(a[0]))