Git Product home page Git Product logo

Comments (7)

Rodrigodd avatar Rodrigodd commented on August 17, 2024

Oh no, I may have published the wrong branch in crates.io. The wasm-resume branch contains a function to resume the AudioContext in Wasm, but it depends on an unpublished version of cpal (needs this commit).

I will try to yank that version and publish a new one.

But for the time being, you can patch cpal in your Cargo.toml:

[patch.crates-io]

# audio-engine 0.2.2 needs a unpublished version of cpal
cpal = { git = "https://github.com/RustAudio/cpal.git", rev = "b1457e5945cfeb136b7b04c8870b63c2ae3f2212" }

from audio-engine.

markusmoenig avatar markusmoenig commented on August 17, 2024

Thanks for the answer and suggestion. But if this patch applied I still get the above compiler errors.

from audio-engine.

Rodrigodd avatar Rodrigodd commented on August 17, 2024

I published a new version that should solve that error.

But I think that the patch also should have solved the problem. Are you sure that the patch was being applied? It only works if it is put in the Workspace root or in the Cargo.toml of the crate being build (don't work if put in a dependency). You can confirm if it is being applied by running cargo tree, cpal should contain the GitHub address.

But in any case, the new version should solve this. Can you confirm if it works now?

from audio-engine.

markusmoenig avatar markusmoenig commented on August 17, 2024

Yes, it compiles now. It was my error as you said, did not put the patch into the workspace.

Ok, it compiles now! However I get a crash when I try to decode my wav file.

I will try to narrow it down and also try different wav files. I embed my files use rust_embed.

[Error] panicked at 'called Result::unwrap() on an Err value: TooWide', /Users/markusmoenig/.cargo/registry/src/github.com-1ecc6299db9ec823/audio-engine-0.2.3/src/wav.rs:41:36

Stack:

@http://127.0.0.1:8080/client_standalone_web.js:331:30
wasm-stub@[wasm code]

.wasm-function[console_error_panic_hook::hook::h4d011d5e076e94ae]@[wasm code] .wasm-function[core::ops::function::Fn::call::h032de97329426c04]@[wasm code] .wasm-function[std::panicking::rust_panic_with_hook::he2a025723e105e28]@[wasm code] .wasm-function[std::panicking::begin_panic_handler::{{closure}}::hd9f8c213ec91b9d5]@[wasm code] .wasm-function[std::sys_common::backtrace::__rust_end_short_backtrace::h6efd730283875809]@[wasm code] .wasm-function[rust_begin_unwind]@[wasm code] .wasm-function[core::panicking::panic_fmt::hb02133958c1e7d35]@[wasm code] .wasm-function[core::result::unwrap_failed::h68fdaca771c68bb6]@[wasm code] .wasm-function[audio_engine::converter::SampleRateConverter::new::h4769ca637db84d56]@[wasm code] .wasm-function[audio_engine::engine::AudioEngine::new_sound::ha9f989d0b0f42578]@[wasm code] .wasm-function[ as core::future::future::Future>::poll::h1abde6f002602186]@[wasm code] .wasm-function[wasm_bindgen_futures::task::singlethread::Task::run::h639c8475153e992e]@[wasm code] .wasm-function[wasm_bindgen_futures::queue::Queue::new::{{closure}}::h358ade576eab6a3c]@[wasm code] .wasm-function[+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h94dac06645129eaa]@[wasm code]

wasm-stub@[native code]
__wbg_adapter_50@http://127.0.0.1:8080/client_standalone_web.js:223:134
real@http://127.0.0.1:8080/client_standalone_web.js:200:21
promiseReactionJob@[native code]

(anonymous function) (client_standalone_web.js:343)
wasm-stub
<?>.wasm-function[console_error_panic_hook::hook::h4d011d5e076e94ae]
<?>.wasm-function[core::ops::function::Fn::call::h032de97329426c04]
<?>.wasm-function[std::panicking::rust_panic_with_hook::he2a025723e105e28]
<?>.wasm-function[std::panicking::begin_panic_handler::{{closure}}::hd9f8c213ec91b9d5]
<?>.wasm-function[std::sys_common::backtrace::__rust_end_short_backtrace::h6efd730283875809]
<?>.wasm-function[rust_begin_unwind]
<?>.wasm-function[core::panicking::panic_fmt::hb02133958c1e7d35]
<?>.wasm-function[core::result::unwrap_failed::h68fdaca771c68bb6]
<?>.wasm-function[audio_engine::converter::SampleRateConverter<T>::new::h4769ca637db84d56]
<?>.wasm-function[audio_engine::engine::AudioEngine::new_sound::ha9f989d0b0f42578]
<?>.wasm-function[<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h1abde6f002602186]
<?>.wasm-function[wasm_bindgen_futures::task::singlethread::Task::run::h639c8475153e992e]
<?>.wasm-function[wasm_bindgen_futures::queue::Queue::new::{{closure}}::h358ade576eab6a3c]
<?>.wasm-function[<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h94dac06645129eaa]
wasm-stub
__wbg_adapter_50 (client_standalone_web.js:223:135)
real (client_standalone_web.js:200)
promiseReactionJob

from audio-engine.

markusmoenig avatar markusmoenig commented on August 17, 2024

I get the same error when I play natively on my Mac. Seems to be an unsupported audio sample format ?

from audio-engine.

Rodrigodd avatar Rodrigodd commented on August 17, 2024

Seems to be an unsupported audio sample format?

Yes, currently the wave decoder only supports decoding WAV files with a bit depth of 16 bits or lower (the entire audio engine uses i16).

But the engine should at least convert the samples to i16 (and should not panic).

I will close this issue as solved and open a new one for this.

from audio-engine.

Rodrigodd avatar Rodrigodd commented on August 17, 2024

Opened #2

from audio-engine.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.