diff --git a/_audio_effect_8h_source.html b/_audio_effect_8h_source.html index a220fe6c07..60d1ca1796 100644 --- a/_audio_effect_8h_source.html +++ b/_audio_effect_8h_source.html @@ -448,10 +448,10 @@
457 
458 
466 class Compressor : public AudioEffect {
-
467 
-
469  Compressor(const Compressor &copy) = default;
+
467 public:
+
469  Compressor(const Compressor &copy) = default;
470 
-
472  Compressor(uint32_t sampleRate = 44100, int32_t attackMs=30, int32_t releaseMs=20, int32_t holdMs=10, uint8_t thresholdPercent=10, float compressionRatio=0.5){
+
472  Compressor(uint32_t sampleRate = 44100, int32_t attackMs=30, int32_t releaseMs=20, int32_t holdMs=10, uint8_t thresholdPercent=10, float compressionRatio=0.5){
473  //assuming 1 sample = 1/96kHz = ~10us
474  //Attack -> 30 ms -> 3000
475  //Release -> 20 ms -> 2000
@@ -470,33 +470,33 @@
488  recalculate();
489  }
490 
-
492  void setAttack(int32_t attackMs){
+
492  void setAttack(int32_t attackMs){
493  attack_count = sample_rate * attackMs / 1000;
494  recalculate();
495  }
496 
-
498  void setRelease(int32_t releaseMs){
+
498  void setRelease(int32_t releaseMs){
499  release_count = sample_rate * releaseMs / 1000;
500  recalculate();
501  }
502 
-
504  void setHold(int32_t holdMs){
+
504  void setHold(int32_t holdMs){
505  hold_count = sample_rate * holdMs / 1000;
506  recalculate();
507  }
508 
-
510  void setThresholdPercent(uint8_t thresholdPercent){
+
510  void setThresholdPercent(uint8_t thresholdPercent){
511  threshold = 0.01f * thresholdPercent * NumberConverter::maxValueT<effect_t>();
512  }
513 
-
515  void setCompressionRatio(float compressionRatio){
+
515  void setCompressionRatio(float compressionRatio){
516  if (compressionRatio<1.0){
517  gainreduce = compressionRatio;
518  }
519  recalculate();
520  }
521 
-
523  effect_t process(effect_t inSample) {
+
523  effect_t process(effect_t inSample) {
524  float inSampleF = (float)inSample;
525 
526  if (fabs(inSampleF) > threshold) {
@@ -568,7 +568,7 @@
592  return (int) outSampleF;
593  }
594 
-
595  Compressor *clone() { return new Compressor(*this); }
+
595  Compressor *clone() { return new Compressor(*this); }
596 
597 protected:
598  enum CompStates {S_NoOperation, S_Attack, S_GainReduction, S_Release };
@@ -601,6 +601,14 @@
audio_tools::Boost::process
effect_t process(effect_t input)
calculates the effect output from the input
Definition: AudioEffect.h:85
audio_tools::Boost::Boost
Boost(float volume=1.0)
Definition: AudioEffect.h:77
audio_tools::Compressor
Compressor inspired by https://github.com/YetAnotherElectronicsChannel/STM32_DSP_COMPRESSOR/blob/mast...
Definition: AudioEffect.h:466
+
audio_tools::Compressor::setRelease
void setRelease(int32_t releaseMs)
Defines the release duration in ms.
Definition: AudioEffect.h:498
+
audio_tools::Compressor::Compressor
Compressor(uint32_t sampleRate=44100, int32_t attackMs=30, int32_t releaseMs=20, int32_t holdMs=10, uint8_t thresholdPercent=10, float compressionRatio=0.5)
Default Constructor.
Definition: AudioEffect.h:472
+
audio_tools::Compressor::Compressor
Compressor(const Compressor &copy)=default
Copy Constructor.
+
audio_tools::Compressor::setCompressionRatio
void setCompressionRatio(float compressionRatio)
Defines the compression ratio from 0 to 1.
Definition: AudioEffect.h:515
+
audio_tools::Compressor::setHold
void setHold(int32_t holdMs)
Defines the hold duration in ms.
Definition: AudioEffect.h:504
+
audio_tools::Compressor::process
effect_t process(effect_t inSample)
Processes the sample.
Definition: AudioEffect.h:523
+
audio_tools::Compressor::setThresholdPercent
void setThresholdPercent(uint8_t thresholdPercent)
Defines the threshod in %.
Definition: AudioEffect.h:510
+
audio_tools::Compressor::setAttack
void setAttack(int32_t attackMs)
Defines the attack duration in ms.
Definition: AudioEffect.h:492
audio_tools::Delay
Delay/Echo AudioEffect. See https://wiki.analog.com/resources/tools-software/sharc-audio-module/barem...
Definition: AudioEffect.h:253
audio_tools::Delay::Delay
Delay(uint16_t duration_ms=1000, float depth=0.5, float feedbackAmount=1.0, uint32_t sampleRate=44100, bool zeroIfBufferEmpty=false)
e.g. depth=0.5, ms=1000, sampleRate=44100
Definition: AudioEffect.h:256
audio_tools::Delay::process
effect_t process(effect_t input)
calculates the effect output from the input
Definition: AudioEffect.h:306
diff --git a/classaudio__tools_1_1_compressor-members.html b/classaudio__tools_1_1_compressor-members.html index 8313b819a1..00ce5dbc75 100644 --- a/classaudio__tools_1_1_compressor-members.html +++ b/classaudio__tools_1_1_compressor-members.html @@ -77,15 +77,19 @@ attack_count (defined in Compressor)Compressorprotected AudioEffect()=default (defined in AudioEffect)AudioEffect clip(int32_t in, int16_t clipLimit=32767, int16_t resultLimit=32767)AudioEffectinlineprotected - CompStates enum name (defined in Compressor)Compressorprotected - copyParent(AudioEffect *copy) (defined in AudioEffect)AudioEffectinlineprotected - gain (defined in Compressor)Compressorprotected - gain_step_attack (defined in Compressor)Compressorprotected - gain_step_release (defined in Compressor)Compressorprotected - gainreduce (defined in Compressor)Compressorprotected - hold_count (defined in Compressor)Compressorprotected - id()AudioEffectinline - id_value (defined in AudioEffect)AudioEffectprotected + clone() (defined in Compressor)Compressorinlinevirtual + Compressor(const Compressor &copy)=defaultCompressor + Compressor(uint32_t sampleRate=44100, int32_t attackMs=30, int32_t releaseMs=20, int32_t holdMs=10, uint8_t thresholdPercent=10, float compressionRatio=0.5)Compressorinline + CompStates enum name (defined in Compressor)Compressorprotected + copyParent(AudioEffect *copy) (defined in AudioEffect)AudioEffectinlineprotected + gain (defined in Compressor)Compressorprotected + gain_step_attack (defined in Compressor)Compressorprotected + gain_step_release (defined in Compressor)Compressorprotected + gainreduce (defined in Compressor)Compressorprotected + hold_count (defined in Compressor)Compressorprotected + id()AudioEffectinline + id_value (defined in AudioEffect)AudioEffectprotected + process(effect_t inSample)Compressorinlinevirtual recalculate() (defined in Compressor)Compressorinlineprotected release_count (defined in Compressor)Compressorprotected S_Attack enum value (defined in Compressor)Compressorprotected @@ -94,11 +98,16 @@ S_Release enum value (defined in Compressor)Compressorprotected sample_rate (defined in Compressor)Compressorprotected setActive(bool value)AudioEffectinlinevirtual - setId(int id)AudioEffectinline - State (defined in Compressor)Compressorprotected - threshold (defined in Compressor)Compressorprotected - timeout (defined in Compressor)Compressorprotected - ~AudioEffect()=default (defined in AudioEffect)AudioEffectvirtual + setAttack(int32_t attackMs)Compressorinline + setCompressionRatio(float compressionRatio)Compressorinline + setHold(int32_t holdMs)Compressorinline + setId(int id)AudioEffectinline + setRelease(int32_t releaseMs)Compressorinline + setThresholdPercent(uint8_t thresholdPercent)Compressorinline + State (defined in Compressor)Compressorprotected + threshold (defined in Compressor)Compressorprotected + timeout (defined in Compressor)Compressorprotected + ~AudioEffect()=default (defined in AudioEffect)AudioEffectvirtual