xiongyihui/python-webrtc-audio-processing

类型错误问题

Opened this issue · 1 comments

after build the package, I run the code from Useage,then got a TypError:

TypeError: in method 'AudioProcessingModule_process_stream', argument 2 of type 'std::string const &'

Anyone can help me?

Hello!

I got the same issue using python 3. Try using this modified version of the example:

# !/usr/bin/env python3
from webrtc_audio_processing import AudioProcessingModule as AP
import numpy as np

ap = AP(enable_vad=True, enable_ns=True)
ap.set_stream_format(16000, 1)      # set sample rate and channels
ap.set_ns_level(1)                  # NS level from 0 to 3
ap.set_vad_level(1)                 # VAD level from 0 to 3

audio_10ms_array = np.zeros(160, dtype=np.int16)

# only support processing 10ms audio data each time
audio_out = ap.process_stream(audio_10ms_array.astype(np.int16).tostring())

print('voice: {}'.format(ap.has_voice()))

I don't usually program in python, so perhaps it is not the more direct way to achive the argument as string, but I hope it works also for you.

Best.