首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SoX FIR单线

SoX FIR单线
EN

Stack Overflow用户
提问于 2015-10-17 17:42:35
回答 1查看 1.6K关注 0票数 5

我正试图应用混响,在SoX中用脉冲响应进行卷积。下面的shell脚本完全符合我的要求:

代码语言:javascript
复制
#!/usr/bin/env bash
# 
# Convolve audio file with and impulse response (IR)
# 
# Usage:
#
#     applyReverb.sh <ir.wav> <audio.wav> <output.wav>

# IR duration (needed for zero-padding to prevent SoX from cutting 
# the resulting audio after applying the FIR filter
IR_DUR=`soxi -D $1`

# read IR from wav, resample it if necessary, make sure is mono
# and save it as plain text (.dat format in SoX). Also reduces gain 
# to prevent clipping later
sox --norm=-10 -c 1 $1 -r 44100 filter.dat

# extract the coeffients (second column, skipping the first 2 lines)
awk 'NR<3{next}{print $2}' filter.dat > filter.txt

# apply reverb using SoX's fir effect (need front zero-padding to for
# the extra samples due to the convolution
sox "|sox $2 -p pad $IR_DUR 0" --norm $3 fir filter.txt

问题

如果没有临时文件(filter.*),我如何做到这一点?我知道答案就在管道里,但我不能让它起作用。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-10-19 05:04:02

经过反复试验,我找到了我要找的东西。如果有人对此感兴趣,这就是我的解决方案:

代码语言:javascript
复制
sox --norm=-10 -c 1 $1 -r 44100 -t dat - | awk 'NR<3{next}{print $2;}' | sox "|sox $2 -p pad $d $d" --norm $3 fir -
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33189661

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档