如何使用SoX修剪音频文件的结尾? [英] How do you trim the audio file's end using SoX?

查看:822
本文介绍了如何使用SoX修剪音频文件的结尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using Sox, how do I shorten an audio file by 5 seconds, trimming from the end?

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

For example, this is how to trim a file from the beginning:

    sox input output trim 5000

这是在最后增加5秒钟的沉默的方法:

This is how to add 5 seconds of silence to the end:

    sox input output pad 0 5000

推荐答案

语法为sox input output trim <start> <duration>

例如sox input.wav output.wav trim 0 00:35会将前35秒输出到output.wav.

e.g. sox input.wav output.wav trim 0 00:35 will output the first 35 seconds into output.wav.

(您可以使用sox input -n stat知道长度是什么)

(you can know what the length is using sox input -n stat)

根据trim命令的 SoX文档:

从音频中切出部分.可以给出任意数量的位置;在到达第一个位置之前,音频不会发送到输出.然后效果在每个位置的复制和丢弃音频之间交替.在第一个 position 参数中使用0值可以从音频的开头进行复制.

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.

例如,

sox infile outfile trim 0 10

将复制前十秒,而

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

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

将从音频中的12分34秒播放到音频中的15分钟(即2分26秒长),然后在音频结束前两分钟恢复播放.

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的评论 ,则 position 值将被解释为相对于先前的 position ,除非它们以=开头(在这种情况下,它们是相对于文件的开头),或者-(在这种情况下,它们是相对于文件末尾的.)

Per dpwe's comment, the position values are interpreted as being relative to the previous position, unless they start with = (in which case they are relative to the start of the file) or - (in which case they are relative to the end of the file).

因此,将结尾减少五秒钟将是sox input output trim 0 -5

So, trimming five seconds off the end would be sox input output trim 0 -5

这篇关于如何使用SoX修剪音频文件的结尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆