|
|
@ -167,14 +167,21 @@ class NeRFReal:
|
|
|
|
#print(f'[INFO] get_audio_out shape ',frame.shape)
|
|
|
|
#print(f'[INFO] get_audio_out shape ',frame.shape)
|
|
|
|
self.streamer.stream_frame_audio(frame)
|
|
|
|
self.streamer.stream_frame_audio(frame)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
frame1 = self.asr.get_audio_out()
|
|
|
|
for _ in range(2):
|
|
|
|
frame2 = self.asr.get_audio_out()
|
|
|
|
frame = self.asr.get_audio_out()
|
|
|
|
frame = np.concatenate((frame1,frame2))
|
|
|
|
|
|
|
|
frame = (frame * 32767).astype(np.int16)
|
|
|
|
frame = (frame * 32767).astype(np.int16)
|
|
|
|
new_frame = AudioFrame(format='s16', layout='mono', samples=frame.shape[0])
|
|
|
|
new_frame = AudioFrame(format='s16', layout='mono', samples=frame.shape[0])
|
|
|
|
new_frame.planes[0].update(frame.tobytes())
|
|
|
|
new_frame.planes[0].update(frame.tobytes())
|
|
|
|
new_frame.sample_rate=16000
|
|
|
|
new_frame.sample_rate=16000
|
|
|
|
asyncio.run_coroutine_threadsafe(audio_track._queue.put(new_frame), loop)
|
|
|
|
asyncio.run_coroutine_threadsafe(audio_track._queue.put(new_frame), loop)
|
|
|
|
|
|
|
|
# frame1 = self.asr.get_audio_out()
|
|
|
|
|
|
|
|
# frame2 = self.asr.get_audio_out()
|
|
|
|
|
|
|
|
# frame = np.concatenate((frame1,frame2))
|
|
|
|
|
|
|
|
# frame = (frame * 32767).astype(np.int16)
|
|
|
|
|
|
|
|
# new_frame = AudioFrame(format='s16', layout='mono', samples=frame.shape[0])
|
|
|
|
|
|
|
|
# new_frame.planes[0].update(frame.tobytes())
|
|
|
|
|
|
|
|
# new_frame.sample_rate=16000
|
|
|
|
|
|
|
|
# asyncio.run_coroutine_threadsafe(audio_track._queue.put(new_frame), loop)
|
|
|
|
# frame = (frame * 32767).astype(np.int16).tobytes()
|
|
|
|
# frame = (frame * 32767).astype(np.int16).tobytes()
|
|
|
|
# self.fifo_audio.write(frame)
|
|
|
|
# self.fifo_audio.write(frame)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|