Skip to content

Commit

Permalink
multiple sine waves: prevent clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Mar 17, 2021
1 parent e0d187b commit 4a45965
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tests/sine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ pub fn sine_wave_audio_data_multiple(
// END: add sine waves

// BEGIN: scale
// times 0.6 to prevent to harsh clipping if multiple sinus waves are added above each other
let acc = acc * i16::max_value() as f32 * 0.6;
// times 0.1 to prevent to clipping if multiple sinus waves are added above each other
let acc = acc * i16::max_value() as f32 * 0.1;
// END: scale

// BEGIN: truncate in interval
Expand Down

0 comments on commit 4a45965

Please sign in to comment.