Skip to content

Commit c6b55fc

Browse files
authored
Waveform audio input on ledmatrix (#34)
Co-authored-by: Daniel Schaefer <[email protected]> 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: - [x] Troubleshoot the `len is 34 but the index is 34` error (probably a relatively simple one to solve with how I'm constructing the `vec`) - [x] Clean up the repeated `info.volume as u8` code. I tried using `vec![info.volume as u8; 8]` but I kept getting an array index out of bounds error too - [x] Make the visualization more interesting. Right now I'm just showing the volume bar on each LED row, I should try to show a smaller one as you get farther away from the center at least. - [ ] Try to show an actual waveform, somehow, something closer to this https://www.google.com/search?q=waveform+on+an+led+display&tbm=isch&ved=2ahUKEwjWy_2kxbf-AhXRN1kFHR5KD3wQ2-cCegQIABAA&oq=waveform+on+an+led+display&gs_lcp=CgNpbWcQAzoECCMQJzoFCAAQgAQ6BwgAEBgQgARQ4QJYqBdgphhoAXAAeACAAZwEiAGZDZIBCDE0LjEuNS0xmAEAoAEBqgELZ3dzLXdpei1pbWfAAQE&sclient=img&ei=qLRAZNbXG9Hv5NoPnpS94Ac&bih=1079&biw=1918&hl=en or what you'd see on a DJ console/program https://www.google.com/search?tbm=isch&hl=en&source=hp&biw=1918&bih=1079&q=dj+program+waveform&btnG=Search+Images&gbv=2&oq=wmc+miami&gs_l=img.3..0l3j0i24l7.2490l3403l0l3554l9l9l0l2l2l0l50l117l3l3l0.frgbld.
1 parent 8b400a8 commit c6b55fc

File tree

8 files changed

+1357
-75
lines changed

8 files changed

+1357
-75
lines changed

.github/workflows/software.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install dependencies
3939
run: |
4040
sudo apt-get update
41-
sudo apt-get install -y libudev-dev
41+
sudo apt-get install -y libudev-dev libasound2-dev
4242
4343
- name: Setup Rust toolchain
4444
run: rustup show
@@ -85,7 +85,7 @@ jobs:
8585
- name: Install dependencies
8686
run: |
8787
sudo apt-get update
88-
sudo apt-get install -y libudev-dev
88+
sudo apt-get install -y libudev-dev libasound2-dev
8989
9090
- name: Setup Rust toolchain
9191
run: rustup show

0 commit comments

Comments
 (0)