【问题标题】:How can I play sound like from my microphone in (Discord, Skype and e.g.) | python我怎样才能在(Discord、Skype 等)中播放来自我的麦克风的声音 | Python
【发布时间】:2023-01-15 10:12:50
【问题描述】:

我如何使用 python 像通过麦克风一样播放声音(让来自 Skype、Discord 的人听到我想要的声音)。类似于 OBS 虚拟相机,但带有麦克风。不使用其他程序

我没有在互联网上找到任何东西。

【问题讨论】:

  • 来自 Skype 的人已经可以听到您的声音。这就是 Skype 的目的,所以你是在问如何录制声音并在不和谐的情况下播放它?
  • 是的,我的意思是

标签: python text-to-speech microphone voice-control


【解决方案1】:

实际上有几十个例子。你只需要在谷歌上搜索“用 python 录制语音”或类似的搜索。

这是一个现成的录音示例:

# import required libraries
import sounddevice as sd
from scipy.io.wavfile import write
import wavio as wv
  
# Sampling frequency
freq = 44100
  
# Recording duration
duration = 5
  
# Start recorder with the given values 
# of duration and sample frequency
recording = sd.rec(int(duration * freq), 
                   samplerate=freq, channels=2)
  
# Record audio for the given number of seconds
sd.wait()
  
# This will convert the NumPy array to an audio
# file with the given sampling frequency
write("recording0.wav", freq, recording)
  
# Convert the NumPy array to audio file
wv.write("recording1.wav", recording, freq, sampwidth=2)

它可能有助于增加更多的清晰度以获得超出此范围的答案。

【讨论】:

  • 重读我的问题。我需要以相同语音聊天(例如 Discord)的方式播放声音,我在哪里可以听到该声音
猜你喜欢
  • 2011-08-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-22
  • 1970-01-01
  • 2015-10-31
相关资源
最近更新 更多