Skip to content

Conversation

@setoelkahfi
Copy link
Contributor

@setoelkahfi setoelkahfi commented Jun 1, 2025

This PR adds a simple distortion effect to the source.

Run examples:

// Basic
cargo run --example distortion

// With music files
cargo run --example distortion_wav
cargo run --example distortion_wav_alternate

@setoelkahfi setoelkahfi changed the title Feature/distortion effect feat: add distortion effect Jun 1, 2025
@setoelkahfi setoelkahfi marked this pull request as ready for review June 1, 2025 17:30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice example! its great to have more stuff showing how to use periodic_access!

self.input.next().map(|value| {
let v = value * self.gain;
let t = self.threshold;
if v > t {
Copy link
Member

@yara-blue yara-blue Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually the if/else if/else here can be replaced by f32::clamp right? Might be a little cleaner (and maybe that gets optimized in the future)

Copy link
Member

@yara-blue yara-blue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets change the if/else if/else to a f32::clamp and then we are good to merge!

@setoelkahfi setoelkahfi requested a review from yara-blue June 3, 2025 11:15
@yara-blue
Copy link
Member

Looks great! just one more thing and we can merge. This deserves a changelog entry! 🥳 🎈

@yara-blue yara-blue merged commit 4597f8a into RustAudio:0.21 Jun 3, 2025
9 checks passed
@yara-blue
Copy link
Member

yara-blue commented Jun 3, 2025

thanks!

merged into 0.21 instead of master, fixed that with some manual gitting

@setoelkahfi
Copy link
Contributor Author

Thanks!

@setoelkahfi setoelkahfi deleted the feature/distortion-effect branch June 4, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants