Skip to content
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

Panicks on getting default speakers #55

Open
GabrielleShull opened this issue Feb 18, 2023 · 4 comments
Open

Panicks on getting default speakers #55

GabrielleShull opened this issue Feb 18, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@GabrielleShull
Copy link

A compiled example panics when running let mut speakers = Speakers::default();

To reproduce the bug:

  1. Go to the wavy documentation page.
  2. Copy the dependencies to the Cargo.toml file
  3. Replace the contents of the main.rs file with the example code.
  4. Enter RUST_BACKTRACE=1 cargo run in the terminal.
  5. See the error in the backtrace:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/gabbie/.cargo/registry/src/github.com-1ecc6299db9ec823/wavy-0.8.1/src/ffi/linux/speakers.rs:87:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::panicking::panic
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
   3: core::option::Option<T>::unwrap
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/option.rs:755:21
   4: <wavy::ffi::speakers::Speakers as core::default::Default>::default
             at /home/gabbie/.cargo/registry/src/github.com-1ecc6299db9ec823/wavy-0.8.1/src/ffi/linux/speakers.rs:86:13
   5: <wavy::speakers::Speakers as core::default::Default>::default
             at /home/gabbie/.cargo/registry/src/github.com-1ecc6299db9ec823/wavy-0.8.1/src/speakers.rs:66:21
   6: record_n_play::main
             at ./src/main.rs:32:24
   7: core::ops::function::FnOnce::call_once
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5

My expectation was that audio would be recorded and played back in real time.

Laptop information:

  • OS: NixOS 21.11.337975.eabc3821918 (Porcupine) with Linux kernel version 5.15.50
  • Model: HP Laptop 14-dk0028wm

I look forward to learning from this.
Thanks!

@AldaronLau
Copy link
Member

@GabrielleShull Thanks for opening this issue! It looks like the wavy docs are suggesting an older version of wavy. Does it still happen if you change wavy to 0.9?

@AldaronLau AldaronLau added the bug Something isn't working label Feb 18, 2023
@LennyPenny
Copy link

LennyPenny commented Mar 3, 2023

yes, on 0.9 I get

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/wavy-0.9.1/src/ffi/linux/microphone.rs:79:18
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: core::option::Option<T>::unwrap
             at /build/rustc-1.67.1-src/library/core/src/option.rs:778:21

(also nixos 22.11)

@AldaronLau
Copy link
Member

@GabrielleShull @LennyPenny can one of you (or both) run:

arecord --dump-hw-params default

And provide the command's output? I think that might give us more context into why this is happening.

@LennyPenny
Copy link

LennyPenny commented Mar 5, 2023

~> arecord --dump-hw-params default
Warning: Some sources (like microphones) may produce inaudible results
         with 8-bit sampling. Use '-f' argument to increase resolution
         e.g. '-f S16_LE'.
Recording WAVE 'default' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "ALSA Capture":
--------------------
ACCESS:  MMAP_INTERLEAVED MMAP_NONINTERLEAVED RW_INTERLEAVED RW_NONINTERLEAVED
FORMAT:  U8 S16_LE S24_LE S32_LE FLOAT_LE S24_3LE S24_3BE
SUBFORMAT:  STD
SAMPLE_BITS: [8 32]
FRAME_BITS: [8 2048]
CHANNELS: [1 64]
RATE: [1 384000]
PERIOD_TIME: (0 4294967295)
PERIOD_SIZE: (0 2097152]
PERIOD_BYTES: [128 2097152]
PERIODS: [2 1024]
BUFFER_TIME: (2 4294967295]
BUFFER_SIZE: [1 4194304]
BUFFER_BYTES: [256 4194304]
TICK_TIME: ALL
--------------------

(I aborted it after 10s as it didnt print anything new)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants