piano-rs icon indicating copy to clipboard operation
piano-rs copied to clipboard

No sound

Open troublew opened this issue 6 years ago • 7 comments

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!

troublew avatar Nov 08 '17 18:11 troublew

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.

ritiek avatar Nov 08 '17 20:11 ritiek

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.

darrenldl avatar Jan 03 '18 09:01 darrenldl

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..

ritiek avatar Jan 03 '18 16:01 ritiek

I think include_bytes! macro might work?

I didn't look into your asset loading code though, so I might wrong.

darrenldl avatar Jan 15 '18 06:01 darrenldl

Just to confirm what @darrenldl said. I ran into exact same issue and running in a dir containing asset worked.

jsomedon avatar Aug 25 '18 07:08 jsomedon

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).

micouy avatar Oct 07 '19 16:10 micouy

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.

ritiek avatar Oct 08 '19 08:10 ritiek