|
#include "reverb.h"
|
#include "compressor.h"
|
#include "reverb_gate.h"
|
|
int main(void)
|
{
|
Reverb<float> rvb;
|
rvb.prepare(48000);
|
rvb.setRoomSize(1.0);
|
rvb.setDecay(1.0);
|
rvb.setCutoff(5000);
|
rvb.setMix(1.0);
|
|
Compressor<float> comp;
|
comp.prepare(48000);
|
comp.setThreshold(-20.0);
|
comp.setRatio(5.0);
|
comp.setAttack(0.001);
|
comp.setRelease(0.1);
|
comp.setGain(1.0);
|
|
|
std::string output_file = "output.wav";
|
Wave w;
|
w.read_wav("E:\\music\\Voice_print\\GaoWeiDong.wav");
|
w.init_channels_maxmin();
|
w.update_channel_maxmin();
|
float gate_gain;
|
|
for (int i = 0; i < w.num_channels; ++i)
|
{
|
for (int j = 0; j < w.num_samples; ++j) {
|
gate_gain = comp.processSample(w.samples[i][j]);
|
w.samples[i][j] = rvb.processSample(w.samples[i][j]) * gate_gain;
|
}
|
}
|
|
|
|
// normalizing to db
|
LOG_INFO("normalized_volume : " << db_to_vol(-1.5f));
|
LOG_INFO("normalized_volume_db: " << -1.5f);
|
w.update_channel_maxmin();
|
w.normalize(-db_to_vol(-1.5f), db_to_vol(-1.5f));
|
w.write_wav(output_file);
|
LOG_INFO("output_file : " << output_file);
|
w.info_summary();
|
|
return 0;
|
}
|