gpt4 book ai didi

audio - 如何使用 SoX 修剪音频文件的结尾?

转载 作者:行者123 更新时间:2023-12-03 08:53:50 26 4
gpt4 key购买 nike

使用 Sox,如何将音频文件缩短 5 秒,从末尾修剪?

例如,这是从头开始修剪文件的方法:

    sox input output trim 5000

这是在最后添加 5 秒静音的方法:
    sox input output pad 0 5000

最佳答案

语法是 sox input output trim <start> <duration>
例如sox input.wav output.wav trim 0 00:35将前 35 秒输出到 output.wav .

(你可以知道长度是多少 sox input -n stat )

来自 SoX documentationtrim命令:

Cuts portions out of the audio. Any number of positions may be given; audio is not sent to the output until the first position is reached. The effect then alternates between copying and discarding audio at each position. Using a value of 0 for the first position parameter allows copying from the beginning of the audio.

For example,

sox infile outfile trim 0 10

will copy the first ten seconds, while

play infile trim 12:34 =15:00 -2:00

and

play infile trim 12:34 2:26 -2:00

will both play from 12 minutes 34 seconds into the audio up to 15 minutes into the audio (i.e. 2 minutes and 26 seconds long), then resume playing two minutes before the end of audio.



dpwe's comment ,位置值被解释为相对于前一个位置,除非它们以 = 开头(在这种情况下,它们相对于文件的开头)或 - (在这种情况下,它们相对于文件的末尾)。

因此,从末尾修剪 5 秒将是 sox input output trim 0 -5

关于audio - 如何使用 SoX 修剪音频文件的结尾?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9667081/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com