不确定您是否仍然需要答案,但我正在做类似的事情。
基本上在 Windows 平台上使用 python 来记录来自笔记本电脑麦克风的流式音频,然后处理 ANC [自动噪声消除] 的声音并将其通过带通滤波器,然后将音频流输出到蓝牙设备。
我希望最终将其移植到智能手机上,但现在使用 Python 进行原型设计要容易得多。
虽然我仍处于该项目的早期阶段,但这里有两个可能会有所帮助的图片,
1) 使用 sounddevice 将音频从麦克风流式传输到扬声器
录制外部音频并播放
请参阅此处的声音模块安装详细信息
http://python-sounddevice.readthedocs.org/en/0.3.1/
import sounddevice as sd
duration = 5 # seconds
myrecording = sd.rec(duration * fs, samplerate=fs, channels=2, dtype='float64')
print "Recording Audio"
sd.wait()
print "Audio recording complete , Play Audio"
sd.play(myrecording, fs)
sd.wait()
print "Play Audio Complete"
2)与蓝牙通信
请参阅此处的详细信息:
https://people.csail.mit.edu/albert/bluez-intro/c212.html
import bluetooth
target_name = "My Phone"
target_address = None
nearby_devices = bluetooth.discover_devices()
for bdaddr in nearby_devices:
if target_name == bluetooth.lookup_name( bdaddr ):
target_address = bdaddr
break
if target_address is not None:
print "found target bluetooth device with address ", target_address
else:
print "could not find target bluetooth device nearby"
我知道我只是在引用这些网站的示例,您可以参考这些网站以获得更多见解。
一旦我有了一个可以工作的原型,我以后会尝试在这里发布它。