Juce中AudioSampleBuffer的延迟播放
Posted
技术标签:
【中文标题】Juce中AudioSampleBuffer的延迟播放【英文标题】:Delay playback of AudioSampleBuffer in Juce 【发布时间】:2016-03-17 14:20:11 【问题描述】:我正在编写一个卷积混响插件,并想添加一个预延迟滑块。我在两个单独的缓冲区中有“干”信号和“湿”信号用于播放,如下面的代码所示:
// copy the original signal into a "dry signal" buffer that we'll use later
AudiosampleBuffer dryBuffer(buffer.getNumChannels(), buffer.getNumSamples());
// now apply convolution to the buffer
for (int i = 0; i < buffer.getNumChannels(); ++i)
float* writePointer = buffer.getWritePointer (i % getNumOutputChannels());
const float* readPointer = buffer.getReadPointer (i % getNumInputChannels());
dryBuffer.copyFrom(
i, // destChannel
0, //destStartSample
buffer, // sourceBuffer
i, // sourceChannel
0, // sourceStartSample,
buffer.getNumSamples()
);
convolvers.getUnchecked(i % convolvers.size())->process (readPointer, writePointer, buffer.getNumSamples());
//WET MIX
buffer.applyGain(i, // channel
0, // startSample
buffer.getNumSamples(),
wetLevel->getValue() // gain
);
//DRY MIX
dryBuffer.applyGain(i,
0,
dryBuffer.getNumSamples(),
dryLevel->getValue()
);
buffer.addFrom(
i, // destChannel
0, // destStartSample
dryBuffer, // sourceBuffer
i, // sourceChannel
0, // soucreStartSample,
buffer.getNumSamples(),
1.0 // gain
);
dryBuffer 是干 AudioSampleBuffer,缓冲区是应用卷积的湿信号。如何延迟湿缓冲区的播放?
【问题讨论】:
【参考方案1】:您可以通过移动样本来延迟湿缓冲区。例如,如果您想要 2 秒延迟,您可能希望将湿缓冲区增加 2*sample_rate
并将所有样本移动 sample_rate*2*delay_amt
样本。您必须在 convolvers->process
方法中应用这些更改
【讨论】:
以上是关于Juce中AudioSampleBuffer的延迟播放的主要内容,如果未能解决你的问题,请参考以下文章
关于如何使用 JUCE 托管 VST 插件的教程? [关闭]