-
Notifications
You must be signed in to change notification settings - Fork 346
[project-s] 出力する音声が0dBを超えないようにする #1593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[project-s] 出力する音声が0dBを超えないようにする #1593
Conversation
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
理解が浅いのですがちょこっとコメントしています!
| options: LimiterOptions = { inputGain: 0, outputGain: 0, release: 0.25 } | ||
| ) { | ||
| this.inputGainNode = new GainNode(audioContext); | ||
| this.compNode = new DynamicsCompressorNode(audioContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
どれくらいこれの影響が出てるか可視化しておくと音声合成の傾向掴めて便利かもと&なんか音量編になったときのデバッグに便利かもとかちょっと思いました。
.reductionで値が取れるらしいので、どこかで監視しておいてなにか変な値になったらwarn出すと参考になるかも?
(かなり思いつきレベルの提案です)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
確かにリダクションが確認できると後々デバッグなどで役立ちそう&UIでも圧縮中(音が大きすぎる)かどうか確認できると良さそうです。後でこれらも実装したいと思います!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sigprogramming @Hiroshiba
ありがとうございます、すごい…!LGTMです!!
詳細まで見られていない&自分担当の分の実装する余力ないのにコメントだけするのはだいぶアレかなあなのですが、レビューなので以下、念のため確認です…!
目的と実装
- ノーマライズではなく、クリップ抑制を目的としたコンプレッサー(リミッター的動作)+クリップリミッターの実装
- コンプレッサーとしてはスレッショルドが-5db/レシオ1:20/アタック0sec/リリース0.25sec/ニー8で固定値
- おそらく単一トラックではなく、マルチトラック用(未確認)
気になる点
- エンジンからの生音と音(波形)は変わってしまうかも…?(それ込みでVoiceVoxの音とする or パラメータ変更できたりOFFも可能であればよさそう)
- エンジン出力時点でクリップしている場合にはクリップ抑制にならない可能性?(このPRの目的外)
|
レビューありがとうございます! @romot-co
一応
再生時は音割れ防止のためにリミッターはONのままが良いかなと思います。 |
内容
出力する音声が0dBを超えないようにします。
Limiterで大きい音を抑え、抑えきれなかった音をClipperで-1~1の範囲にクリップします。Limiterは内部でDynamicsCompressorNodeを使用していて、パラメーターは以下のように設定しています。DynamicsCompressorNodeではメイクアップゲインが自動で設定されますが、音圧を上げることが目的ではないので、GainNodeを繋いでメイクアップゲインで上がった分を下げています。コンプレッションカーブは以下のようになります。

Limiter、Clipperは以下のページを参考に実装しています。コンプレッサーやリミッターについては、以下のYouTubeの動画がわかりやすいです。
関連 Issue
ref #1578
その他