Skip to content

Commit

Permalink
padding fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mgonzs13 committed Jul 30, 2024
1 parent 88bc90d commit 739c275
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions whisper_ros/whisper_ros/silero_vad_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ def audio_cb(self, msg: AudioStamped) -> None:

elif self.recording and "end" in speech_dict:
self.recording = False
self.data.extend(audio_array.tolist())

if len(audio_array) / msg.audio.info.rate < 1.0:
pad_size = msg.audio.info.rate - len(audio_array)
if len(self.data) / msg.audio.info.rate < 1.0:
pad_size = msg.audio.info.chunk + \
msg.audio.info.rate - len(self.data)
self.data = self.data + pad_size * [0.0]

vad_msg = Float32MultiArray()
Expand Down

0 comments on commit 739c275

Please sign in to comment.