Skip to content

Commit

Permalink
Exponential volume
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaschan committed Oct 18, 2023
1 parent 0ad6eee commit ce825db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ impl AudioProcessor<'_> {
let volume = { *self.volume.lock().unwrap() };
if volume != 100 {
let mut audio_data = chunk.audio_data;
let volume_multiplier = ((volume as f32 / 100.0) - 1.0).exp2();
for sample in audio_data.iter_mut() {
*sample *= volume as f32 / 100.0;
*sample *= volume_multiplier;
}
chunk.audio_data = audio_data;
}
Expand Down

0 comments on commit ce825db

Please sign in to comment.