batch-processing - 如果开始和结束时间已知,则使用 SoX 制作音频文件 block

标签 batch-processing sox

我有一个 10 分钟的音频,我想将其分成几个时间 block ,如下所示: (格式为mm:ss.frac)

 1. 1.wav -> 00.000 - 20.271
 2. 2.wav -> 20.272 - 47.550
 3. 3.wav -> 47.551 - 01:20.562

我尝试像这样使用trim命令

sox infile outfile trim 0.000 20.271 However the format is trim start [length]

最坏的情况,我将不得不计算各个 block 的持续时间。还有别的办法吗?

最佳答案

我发现最简单的解决方案是这样编写命令:

sox infile outfile start =end

在到达开始位置之前,音频不会发送到输出流,并且可以通过使用带有结束时间的“=”符号来指定结束位置。

因此,代码现在将是:

sox forth.wav 10.wav trim 303.463 =353.790
  1. 文档链接 http://manpages.ubuntu.com/manpages/precise/man1/sox.1.html
  2. 相关摘录:

trim start [length|=end] The optional length parameter gives the length of audio to output after the start sample and is thus used to trim off the end of the audio. Alternatively, an absolute end location can be given by preceding it with an equals sign. Using a value of 0 for the start parameter will allow trimming off the end only.

关于batch-processing - 如果开始和结束时间已知,则使用 SoX 制作音频文件 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32730817/

相关文章:

wolfram-mathematica - 使用 Slurm 提交 .m 批处理作业后,我可以在不更改原始提交的情况下编辑我的 .m 文件吗?

java - 尝试仅获取值的子集时,FixedLength 会出现问题

linux - 使用 sox 和 bash 将两个 wav 文件交替成一个

audio - 使用 FFmpeg(或 sox)减少立体声

audio - 如何将音频扩展到指定的长度

audio - 如何在保持音频格式 PCM = 1(线性量化)的同时将 24 位 WAV 文件转换为 32 位

php - 在Linux上使用ImageMagick命令行进行批量转换时,结果损坏

rest - Gmail API 批量获得支持?

c - 如何使用 SoX C 库混合音频文件

facebook - 有没有办法确定批量响应中的响应顺序?