Skip to content

Waveform audio input on ledmatrix #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 9, 2023
Merged

Conversation

zachfeldman
Copy link
Contributor

@zachfeldman zachfeldman commented Apr 16, 2023

Trying to work with an example at https://github.com/Rahix/visualizer2/blob/canon/README.md and @JohnAZoidberg 's boilerplate eq module code to get the ledmatrix to show a rough waveform of actual current audio input!

Got it working at this point. This is just grabbing the audio input stream with some Rust wrappers for it cpal https://github.com/RustAudio/cpal and https://github.com/diwic/alsa-rs to access the underlying alsa layer at the system level.

Demo:
https://photos.app.goo.gl/C6NMsZdKnLAnXpwW9

Testing Instructions

cargo run --target x86_64-unknown-linux-gnu -p inputmodule-control led-matrix --input-eq

Then make some noise, assuming your microphone/input is on - try clapping, singing, putting on some music decently loudly, etc!

Next on the to-do list:

@zachfeldman zachfeldman changed the title Waveform audio input Waveform audio input on ledmatrix Apr 16, 2023
@zachfeldman zachfeldman force-pushed the waveform-audio-input branch 2 times, most recently from e2459b3 to b2f44db Compare April 20, 2023 02:55
@zachfeldman
Copy link
Contributor Author

@JohnAZoidberg any tips on how to solve the problem with the build? It seems like some of the crates are defining duplicate symbols but not even sure where to start debugging that :)...

@JohnAZoidberg
Copy link
Member

@JohnAZoidberg any tips on how to solve the problem with the build? It seems like some of the crates are defining duplicate symbols but not even sure where to start debugging that :)...

You've got AnalyzerResult twice in the code. Just need to remove that.

@JohnAZoidberg
Copy link
Member

Oh you mean = note: rust-lld: error: duplicate symbol: _rphal_unsigned_divmod when building the FW, not the tool.
Yeah... that's because it tried to build with multiple different incompatible versions of the rp2040-hal crate.
I thought I had fixed it already.

@JohnAZoidberg
Copy link
Member

Can confirm it works

@zachfeldman
Copy link
Contributor Author

zachfeldman commented Apr 27, 2023

@JohnAZoidberg no rush at all, but I think this is ready for another review when you are.

Thanks for the help whipping it into shape!

@zachfeldman zachfeldman force-pushed the waveform-audio-input branch from 1480692 to 4d67b67 Compare April 29, 2023 18:27
@zachfeldman zachfeldman force-pushed the waveform-audio-input branch from cedc355 to 70d14a2 Compare April 29, 2023 18:52
@zachfeldman
Copy link
Contributor Author

zachfeldman commented Apr 29, 2023

@JohnAZoidberg I made the audio-visualizations an optional feature but for some reason even when I build without it the Cargo.lock still gets updated. I restored the one from main, but should I just push the modified one when I build? I imagine next time someone does a build it'll get modified anyway, and the main thing that'll improve build times is making it an optional feature, it may not matter that the Cargo.lock is longer now, right?

EDIT: A bit of Googling made me realize this is expected behavior rust-lang/cargo#10801 so I removed the commit to restore Cargo.lock. Build times are still faster with this as an opt-in feature and it's clear it's just in the Cargo.lock as part of how this currently works.

@zachfeldman zachfeldman force-pushed the waveform-audio-input branch from 70d14a2 to 7bba3fb Compare April 30, 2023 14:09
@JohnAZoidberg
Copy link
Member

Yeah, that's perfectly fine. A bit odd, but does no harm.

Signed-off-by: Daniel Schaefer <[email protected]>
Signed-off-by: Daniel Schaefer <[email protected]>
chrono = "0.4.23"

# For audio visualizations
vis-core = { git = 'https://github.com/Rahix/visualizer2.git', rev = '1fe908012a9c156695921f3b6bb47178e1332b92', optional = true }
Copy link
Member

Choose a reason for hiding this comment

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

Any reason to pin this specific commit?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I guess since it's the latest one on their master, and they don't do releases (yet).
Ok, that's fine.

@JohnAZoidberg
Copy link
Member

Alright, let's go ahead and merge this!
Feel free to improve upon it.

@JohnAZoidberg JohnAZoidberg merged commit c6b55fc into main May 9, 2023
@JohnAZoidberg JohnAZoidberg deleted the waveform-audio-input branch May 9, 2023 01:54
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.

2 participants