-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_effects.h
More file actions
76 lines (66 loc) · 2.92 KB
/
custom_effects.h
File metadata and controls
76 lines (66 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ./custom_effects.h
// 新規作成:ExciterとGlossEnhancerエフェクトのクラス定義
#pragma once
#include "AudioEffect.h"
#include "SimpleBiquad.h"
#include <vector>
#include <string>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
/**
* @class Exciter
* @brief 高周波数帯域に特化したハーモニックエキサイター
*
* クロスオーバーフィルタで高域成分を抽出し、それにサチュレーションを適用して
* 明瞭度やディテールを復元します。
*/
class Exciter : public AudioEffect {
public:
void setup(double sr, const json& params) override;
void process(std::vector<float>& block, int channels) override;
void reset() override;
const std::string& getName() const override { return name_; }
private:
// ◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️↓修正開始◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️
std::string name_ = "exciter";
// ◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️↑修正終わり◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️
bool enabled_ = true;
double sample_rate_ = 48000.0;
double crossover_freq_ = 7800.0;
double drive_ = 1.0;
double mix_ = 0.2;
// 2チャンネル分のフィルター
SimpleBiquad highpass_filter_l_, highpass_filter_r_;
SimpleBiquad lowpass_filter_l_, lowpass_filter_r_;
float processSample(float sample, SimpleBiquad& hpf, SimpleBiquad& lpf);
float saturate(float x);
};
/**
* @class GlossEnhancer
* @brief サウンドに艶と輝きを与えるプレミアム・グロス・エンハンサー
*
* 複数のフィルターとサチュレーションを組み合わせて、音楽的な倍音、
* プレゼンス、エアー感を調整します。
*/
class GlossEnhancer : public AudioEffect {
public:
void setup(double sr, const json& params) override;
void process(std::vector<float>& block, int channels) override;
void reset() override;
const std::string& getName() const override { return name_; }
private:
// ◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️↓修正開始◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️
std::string name_ = "gloss_enhancer";
// ◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️↑修正終わり◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️◾️
bool enabled_ = true;
double sample_rate_ = 48000.0;
double harmonic_drive_ = 0.35;
double even_harmonics_ = 0.28;
double odd_harmonics_ = 0.18;
double total_mix_ = 0.22;
// 2チャンネル分のフィルターと状態
SimpleBiquad dc_blocker_l_, dc_blocker_r_;
SimpleBiquad presence_filter_l_, presence_filter_r_;
SimpleBiquad air_filter_l_, air_filter_r_;
float processSample(float sample, SimpleBiquad& dc, SimpleBiquad& pres, SimpleBiquad& air);
};