我正在使用SOX混合音频.
这个命令SOX -m voice.wav audio.wav final.wav就是我正在使用的.
我的目标是延迟10秒的voice.wav,如果我尝试使用延迟10.0,那么我有双重声音.
怎么样对?
我在应用程序中使用SoX。应用程序使用它对音频文件应用各种操作,例如修剪。
这工作正常:
from subprocess import Popen, PIPE
kwargs = {'stdin': PIPE, 'stdout': PIPE, 'stderr': PIPE}
pipe = Popen(['sox','-t','mp3','-', 'test.mp3','trim','0','15'], **kwargs)
output, errors = pipe.communicate(input=open('test.mp3','rb').read())
if errors:
raise RuntimeError(errors)
Run Code Online (Sandbox Code Playgroud)
这将导致大文件出现问题,因为read()将完整文件加载到内存中;这很慢,可能会导致管道缓冲区溢出。存在一种解决方法:
from subprocess import Popen, PIPE
import tempfile
import uuid
import shutil
import os
kwargs = {'stdin': PIPE, 'stdout': PIPE, 'stderr': PIPE}
tmp = os.path.join(tempfile.gettempdir(), uuid.uuid1().hex + '.mp3')
pipe = Popen(['sox','test.mp3', tmp,'trim','0','15'], **kwargs)
output, errors = pipe.communicate()
if errors:
raise RuntimeError(errors)
shutil.copy2(tmp, 'test.mp3')
os.remove(tmp)
Run Code Online (Sandbox Code Playgroud)
所以问题如下:除了为 Sox C …
我正在使用WebRTC从网页录制输入麦克风并通过SoX处理它.
问题是,Firefox录制的是Opus Audio格式(根据VLC媒体信息),在Ogg容器中,SoX不喜欢它:
/opt/local/bin/sox FAIL formats: can't open input file `/Users/[...]/public/audio/7a0d13a501.ogg': Input not an Ogg Vorbis audio stream
有没有办法让它与SoX一起使用?或者我应该使用另一个命令行音频工具?
我想重新采样我在文件夹上获得的一堆wav文件.
我的脚本是这样的:
for f in *.wav; do sox “$f” -r 48000 “${f%%%.wav}.wav”; done
Run Code Online (Sandbox Code Playgroud)
控制台给我这个错误:"sox FAIL格式:无法打开输入文件`"90.wav"':没有这样的文件或目录"等等,放置在该文件夹上的300个文件.
如何批量处理这些文件?为什么它给我这个错误?
非常感谢!
解:
for i in *wav; do echo $i; sox $i -r 48000 ${i%%.wav}r.wav; done
Run Code Online (Sandbox Code Playgroud) 目前,我已经创建了一个简单的脚本,该脚本使用 synusoids 生成几个蜂鸣声,然后将它们连接起来,以获得更复杂的声音。我使用 bash 脚本来做到这一点,因为我无法理解如何简单地使用 sox 来做到这一点...我的 play 脚本类似于
count=0
while [ 1 ]
do
play -n synth 1 sine C
play -n synth 0.2 sine E
play -n synth 0.2 sine C
play -n synth 0.2 sine E
if [ $count -eq 5 ]
then
sleep 1
count=0
fi
count=$(($count+1))
done
Run Code Online (Sandbox Code Playgroud)
这产生了类似意大利救护车的东西。当然,这不是目的,但想法是......我怎样才能用一个命令产生几个连续的正弦而不需要不同的命令?
我正在寻找一种快速,最好是标准的库机制来确定wav文件的位深度,例如“ 16位”或“ 24位”。
我正在使用对Sox的子过程调用来获取过多的音频元数据,但是子过程调用非常慢,并且我目前只能从Sox可靠地获得的唯一信息是位深度。
内置的wave模块不具有“ getbitdepth()”之类的功能,并且与24位的wav文件也不兼容-我可以使用wave模块使用“ tryexcept”来访问文件元数据(如果可以,请手动记录它是16位的),然后调用sox(在sox将执行分析以准确记录其位深度的位置)上。我担心的是,这种方法感觉像是猜测。如果读取8位文件怎么办?如果不是,我将手动分配16位。
SciPy.io.wavefile也与24位音频不兼容,因此会产生类似的问题。
本教程非常有趣,甚至包括一些非常低级的脚本示例(至少对于Python来说是低级),这些示例可从wav文件头中提取信息-不幸的是,这些脚本不适用于16位音频。
有什么方法可以简单地(无需调用sox)确定我要检查的wav文件的位深度?
我正在使用的wave标头解析器脚本如下:
import struct
import os
def print_wave_header(f):
'''
Function takes an audio file path as a parameter and
returns a dictionary of metadata parsed from the header
'''
r = {} #the results of the header parse
r['path'] = f
fin = open(f,"rb") # Read wav file, "r flag" - read, "b flag" - binary
ChunkID=fin.read(4) # First four bytes are ChunkID which must be "RIFF" in ASCII …Run Code Online (Sandbox Code Playgroud) 我尝试将 pcm 文件转换为 wav,但无论我尝试多少(或几个)选项,总是收到 FAIL 格式错误。我想知道我需要做什么才能获取 pcm 文件的文件处理程序。再次安装 sox 并更新终端没有任何反应。\n我知道这个问题以前曾在这里出现过,现在在这里但遗憾的是,没有人给出解决问题的答案。
\n\n这是我尝试过的命令:
\n\nsox -t raw -r 44000 --bits 16 \xe2\x88\x92e signed-integer -c 2 -B \\\n infile.pcm /wav/outfile.wav channels 1\nRun Code Online (Sandbox Code Playgroud)\n\n这是它抛出的错误:
\n\nsox FAIL formats: no handler for file extension `pcm\'\nRun Code Online (Sandbox Code Playgroud)\n\npcm 文件具有以下属性:
\n\n我需要它只给我语音(因此从立体声转换为单声道,但只从左声道获取信息)和 wav 文件,所以我正在使用的程序可以处理它。
\nAm trying to call the speech-to-text api of google console for nodejs and apparently is working, but when i try to run the example provider for here the example node MicrophoneStream.js and doing the installation like this here, am having the following error.
STDERR: sox FAIL sox: Sorry, there is no default audio device configured
i dont really know how to pass the device with arguments and i assuming is the default microphone but not sure cause in some …
正如标题所示,我有一个音频文件,我想将通道数更改为任意数字...知道通道数可以是 8 我该怎么做。它不必是单声道或立体声。
有些人建议使用sox,但如果您知道其他工具也没关系
如果我获取一个 mp3 文件并尝试使用我的普通用户帐户使用 来收听它sox file.mp3 -d,它会完美地工作。但是,如果我在执行完之后尝试做同样的事情sudo su,则会产生:Home directory not accessible: Permission denied。
用例如下:
我的 .bashrc 在我的 root 帐户和普通用户帐户之间链接。我的 .bashrc 中的一个特定行使用google_speech(它利用了 sox,它似乎使用pulseaudio 作为默认值):
function sayhi() {
if [ "$EUID" -ne 0 ]; then
printf "Hi, $USER! Your directory is currently "${PWD}""
google_speech -l en "HELLO $USER!"
else
printf "Woah, we have a Superuser on our hands. Best be careful!"
google_speech -l en "WARNING: ROOT ACTIVATED"
fi
}
sayhi &
Run Code Online (Sandbox Code Playgroud)
这意味着如果我做了类似的事情,sudo su我最终应该让我的计算机与我对话。相反,我得到: …