Skip to content

feat: add distortion effect - #743

Merged
yara-blue merged 11 commits into
RustAudio:0.21from
setoelkahfi:feature/distortion-effect
Jun 3, 2025
Merged

feat: add distortion effect#743
yara-blue merged 11 commits into
RustAudio:0.21from
setoelkahfi:feature/distortion-effect

Conversation

@setoelkahfi

@setoelkahfi setoelkahfi commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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!

Comment thread src/source/distortion.rs Outdated
Comment thread src/source/distortion.rs Outdated
self.input.next().map(|value| {
let v = value * self.gain;
let t = self.threshold;
if v > t {

@yara-blue yara-blue Jun 1, 2025

Copy link
Copy Markdown
Member

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)

@yara-blue yara-blue left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
@yara-blue

yara-blue commented Jun 3, 2025

Copy link
Copy Markdown
Member

thanks!

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

@setoelkahfi

Copy link
Copy Markdown
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