如何加载音频文件的脉冲响应使用果汁
How to load audio files for impulse responses using Juce
我目前正在为大学创建一个卷积混响插件,我已经下载了一个已经制作的卷积库,用于插件中。我有一些生成脉冲响应的代码,但我不太确定如何将实际音频文件加载到该过程中。
这是卷积类:
class FFTConvolver
{
public:
FFTConvolver();
virtual ~FFTConvolver();
/**
* @brief Initializes the convolver
* @param blockSize Block size internally used by the convolver (partition size)
* @param ir The impulse response
* @param irLen Length of the impulse response
* @return true: Success - false: Failed
*/
bool init(size_t blockSize, const Sample* ir, size_t irLen);
/**
* @brief Convolves the the given input samples and immediately outputs the result
* @param input The input samples
* @param output The convolution result
* @param len Number of input/output samples
*/
void process(const Sample* input, Sample* output, size_t len);
/**
* @brief Resets the convolver and discards the set impulse response
*/
void reset();
private:
size_t _blockSize;
size_t _segSize;
size_t _segCount;
size_t _fftComplexSize;
std::vector<SplitComplex*> _segments;
std::vector<SplitComplex*> _segmentsIR;
SampleBuffer _fftBuffer;
audiofft::AudioFFT _fft;
SplitComplex _preMultiplied;
SplitComplex _conv;
SampleBuffer _overlap;
size_t _current;
SampleBuffer _inputBuffer;
size_t _inputBufferFill;
// Prevent uncontrolled usage
FFTConvolver(const FFTConvolver&);
FFTConvolver& operator=(const FFTConvolver&);
};
下面是我用来实现脉冲响应(但不是音频文件)的代码:
//convolver
ir.ensureStorageAllocated (512);
zeromem (ir.getRawDataPointer(), 512 * sizeof(float));
ir.set (0, 1.0f);
for (int i = 0; i < 10; ++i)
{
ir.set (Random::getSystemRandom().nextInt (512),
Random::getSystemRandom().nextFloat() * 2.f - 1.f);
}
convolver.init (128, ir.getRawDataPointer(), 512);
和在进程块中…
convolver.process (inputData, channelData, buffer.getNumSamples());
谁能告诉我如何使用脉冲响应的实际音频文件?
JUCE可以在这里帮助您,文档中最相关的部分似乎是:
- AudioFormatReader
- AudioFormat: createReaderFor
最简单的解决方案是读取未压缩的。wav文件。这是一种简单的文件格式,您可以很容易地解析它。因为它是未压缩的,所以您可以使用int16_t*
相关文章:
- 当服务中的事件被触发时,如何将响应从服务发送回客户端?
- C++ 信号和插槽不工作:插槽不响应事件
- NodeJs 服务器充斥着 UDP 广播,不发送响应
- C++关于ENUM的问题。我得到的响应比枚举列表大
- 应用程序在打开的简历中捕获视频后没有响应
- 使用 cpprest (Casablanca) 返回 PDF 响应
- 为什么当通过 TCP 发送的消息速率增加时,请求-响应消息对的延迟会降低?
- 如何使用从处理程序调度的最终回调将响应异步返回给调用方on_read?
- 获取加密的正文响应WinHttp HTTPS
- QtConcurrent - 在发布到 UI 线程的数千个结果中保持 GUI 响应
- 同步读取多个 TCP 响应
- HTTP 响应格式不正确?
- 如何使用软化工具包从 OPC UA 服务器异步读取操作回调中的数据值响应中获取 NodeId 详细信息
- HTTP帖子,无需等待响应
- 问题导致程序停止响应,并且姓氏未正确打印
- AT 命令响应解析器
- 将静态 IP 分配给我的 ESP32 服务器后不再响应
- 使用FFTW进行实时脉冲响应卷积 - 结果听起来像IR是对称的
- 如何加载音频文件的脉冲响应使用果汁
- C++ 频率响应<->脉冲响应