piano-rs
piano-rs copied to clipboard
No sound
Hie, So with the last release, I can "press piano keys" with my keyboard (before, the application would close immedialty if I press any key). But the problem is that I don't have sound at all. Do I need pulseaudio to be installed, or is alsa enough (i don't have pulseaudio installed).
Thanks!
This tool uses the rodio crate to play sounds which in turn depends on cpal crate. If there is no sound, it is probably cpal at fault. Do you hear any sound on running cpal's beep.rs example? If not, you'll get better help opening an issue there.
I'm experiencing the same issue, but when I launch piano-rs
(the cargo installed version) when the current directory contains the assets
folder, it works fine.
Tested this for the cloned git repo, and also when i copied the assets
folder into another directory. Both cases work, but once assets
folder is not visible in the currency directory, piano-rs
just exits as soon as i press a key.
Yep, I recommend to install piano-rs using git clone. I released on cargo just for testing purpose, I am still not sure what is the best way to link external assets with cargo..
I think include_bytes! macro might work?
I didn't look into your asset loading code though, so I might wrong.
Just to confirm what @darrenldl said. I ran into exact same issue and running in a dir containing asset
worked.
Same thing here. @darrenldl is right, you load the samples dynamically and you could just include them using include_bytes!
. This way your samples will be hard-coded during compilation (and therefore shipped with the binary).
I see. However, since the sound files are not ours and have been taken from http://multiplayerpiano.com, I think we should avoid going as far as to ship the sound files with the binary itself. That way, if mutliplayerpiano guys decide they no longer want us to use their sound files, one can simply overwrite the files in the assets directory with other sound files and keep going without breaking existing binaries. If that makes sense.
Another benefit of loading assets dynamically is that people can experiment with their own sound files if they wish to without having to re-compile.