visualizer2 icon indicating copy to clipboard operation
visualizer2 copied to clipboard

Failed to build input stream: FormatNotSupported

Open shenshouer opened this issue 3 years ago • 3 comments

Cannot run on my Macbook Pro :

MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
Processor 2 GHz Quad-Core Intel Core i5
Graphics Intel Iris Plus Graphics 1536 MB

Darwin bogon 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
% cargo run -p noa-35c3 
warning: field `rate` is never read
  --> vis-core/src/recorder/cpal.rs:42:5
   |
41 | pub struct CPalRecorder {
   |            ------------ field in this struct
42 |     rate: usize,
   |     ^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
   = note: `CPalRecorder` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

warning: `vis-core` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/noa-35c3`
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.decay": 2000.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.trigger": 0.4 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.low": 50.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.high": 100.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.fourier_length": 16 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.beat.downsample": 10 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.rate": 8000 (default)
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier] FourierAnalyzer(0x7ff7b5c692e0):
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Fourier Length      =       16
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Buckets             =        8
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Downsampled Rate    =      800 (8000 / 10)
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Lowest  Frequency   =   50.000 Hz
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Highest Frequency   =  400.000 Hz
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.fourier.length": 512 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.fourier.window": "none" (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.fourier.downsample": 5 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.rate": 8000 (default)
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier] FourierAnalyzer(0x7ff7b5c69f58):
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Fourier Length      =      512
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Buckets             =      256
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Downsampled Rate    =     1600 (8000 / 5)
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Lowest  Frequency   =    3.125 Hz
[2022-09-21T11:55:46Z DEBUG vis_core::analyzer::fourier]     Highest Frequency   =  800.000 Hz
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.recorder": "cpal" (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.rate": 8000 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.buffer": 16000 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "audio.read_size": 256 (default)
[2022-09-21T11:55:46Z DEBUG vis_core::frames] Conversion Time: 3.333333ms
[2022-09-21T11:55:46Z DEBUG ezconf::config] "window.width": 1280 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "window.height": 720 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.rows": 50 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.num": 30 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.note_width": 6 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.width": 10.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.depth": 30.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.mid_dist": 0.1 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.base_height": 0.2 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.speed": 0.1 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.slowdown": 0.995 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.speed_deviation": 50.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.amp_top": 0.7 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.amp_bottom": 0.2 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.fps": 30 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.colors": [[0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0]] (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.cols.note_roll": 20 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.camera.height": 1.0 (default)
[2022-09-21T11:55:46Z DEBUG ezconf::config] "noa.camera.look_height": 0.8 (default)
Oh noez! Panic! 💥
Message:  Failed to build input stream: FormatNotSupported
Location: vis-core/src/recorder/cpal.rs:78

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Oh noez! Panic! 💥
Message:  called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Location: noa-35c3/src/main.rs:221

cargo run -p noambition report the same error!

shenshouer avatar Sep 21 '22 12:09 shenshouer

Hi,

I've heard of this problem from others as well. The issue is that apparently MacOs and Windows can't do sample-rate conversion automatically so the sample-rate we use must be the native sample-rate of the device.

First of all, instead of cargo run -p noambition, do cd noambition; cargo run. This way, it will pick up the visualizer.toml configuration file inside the directory.

In this config file, you can then adjust the sample-rate (rate) to your native one.

Rahix avatar Sep 21 '22 19:09 Rahix

Hi, I changed the rate in file visualizer.toml in noa-35c3

[audio]
window = "nuttall"
conversions = 300
#rate = 8000
rate = 44100
read_size = 256
recorder = "cpal"

and do cargo run, got another error:

noa-35c3 % cargo run
warning: field `rate` is never read
  --> vis-core/src/recorder/cpal.rs:42:5
   |
41 | pub struct CPalRecorder {
   |            ------------ field in this struct
42 |     rate: usize,
   |     ^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
   = note: `CPalRecorder` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis

warning: `vis-core` (lib) generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 0.50s
     Running `/Users/sope/workspaces/rust/visualizer2/target/debug/noa-35c3`
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.decay": 2000.0 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.trigger": 0.4 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.low": 50.0 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.high": 100.0 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.fourier_length": 16 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.beat.downsample": 10 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.rate": 44100
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier] FourierAnalyzer(0x7ff7bc919280):
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Fourier Length      =       16
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Buckets             =        8
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Downsampled Rate    =     4410 (44100 / 10)
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Lowest  Frequency   =  275.625 Hz
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Highest Frequency   = 2205.000 Hz
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.fourier.length": 512 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.fourier.window": "none" (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.fourier.downsample": 5 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.rate": 44100
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier] FourierAnalyzer(0x7ff7bc919ef8):
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Fourier Length      =      512
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Buckets             =      256
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Downsampled Rate    =     8820 (44100 / 5)
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Lowest  Frequency   =   17.227 Hz
[2022-09-22T02:17:34Z DEBUG vis_core::analyzer::fourier]     Highest Frequency   = 4410.000 Hz
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.recorder": "cpal"
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.rate": 44100
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.buffer": 16000 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "audio.read_size": 256
[2022-09-22T02:17:34Z DEBUG vis_core::frames] Conversion Time: 3.333333ms
[2022-09-22T02:17:34Z DEBUG ezconf::config] "window.width": 1280 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "window.height": 720 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.rows": 50
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.num": 30
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.note_width": 6
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.width": 10.0
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.depth": 30.0
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.mid_dist": 0.1
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.base_height": 0.2 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.speed": 0.1
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.slowdown": 0.995
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.speed_deviation": 50.0
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.amp_top": 0.7
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.amp_bottom": 0.2
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.fps": 40
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.colors": [[0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0], [0.0, 0.267958, 0.476371, 1.0], [0.0, 0.408597, 0.113741, 1.0]]
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.cols.note_roll": 20 (default)
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.camera.height": 1.0
[2022-09-22T02:17:34Z DEBUG ezconf::config] "noa.camera.look_height": 0.8
Oh noez! Panic! 💥
Message:  assertion failed: x >= 0.0
Location: vis-core/src/analyzer/spectrum.rs:113

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Oh noez! Panic! 💥
Message:  called `Result::unwrap()` on an `Err` value: CompilationError("ERROR: 0:7: Use of undeclared identifier 'gl_FragColor'\n", Fragment)
Location: noa-35c3/src/main.rs:221

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

shenshouer avatar Sep 22 '22 02:09 shenshouer

Message:  called `Result::unwrap()` on an `Err` value: CompilationError("ERROR: 0:7: Use of undeclared identifier 'gl_FragColor'\n", Fragment)

Right, this is an OpenGL error... I'm not sure, it looks like the shaders can't be compiled on your system. Maybe you can find out whether there is something that needs to be done differently here. It seems that the gl_FragColor approach is not allowed on your platform for some reason...

Rahix avatar Sep 22 '22 21:09 Rahix