processing / processing-sound

Audio library for Processing built with JSyn
https://processing.org/reference/libraries/sound/
GNU Lesser General Public License v2.1
149 stars 50 forks source link

No sound on Linux distributions using pavucontrol #16

Open liquidev opened 6 years ago

liquidev commented 6 years ago

When I try to play a sound file, there's no sound at all. pavucontrol doesn't list my sketch as an audio source.

WysokiStudent commented 5 years ago

Same issue here:

Uninstalling pavucontrol and its dependencies causes the program to have sound again, however the sound is distorted. The sound seems to be stuttering and it takes more time for the sample to be fully played out in Processing than using mplayer (about twice as long). Uninstalling pulseaudio (since it sometimes conflicts with direct ALSA usage) neither improves nor makes the situation worse.

import processing.sound.*;

SoundFile soundFile;

void setup() {
  size(800, 600);
  soundFile = new SoundFile(this, "dump_truck.wav");
  soundFile.play();
}

void draw() {
}

Sound sample taken from: http://soundbible.com/1909-Dump-Truck.html Converted from mp3 to wav using: ffmpeg -i Dump_Truck-Mike_Koenig.mp3 dump_truck.wav Using mplayer on dump_truck.wav yields the expected sound.

Removing the draw() function also causes Processing to be silent. Although this function is present in the reference docs it is not stated in the text that it is necessary to overwrite it.

Edit: The uninstalled packages (along with pavucontrol) are:

cybergrunge-ops commented 3 years ago

why is there still not a solution to this?!

robog-two commented 2 years ago

Same issue here? No error, no indication of failure. Upon opening Catia (which shows connections, sources, etc in ALSA) it is not even there. Like the program does not exist, or at least, does not play sound. Hope this helps! :)

robog-two commented 2 years ago

haha just kidding, it actually does show up, and connects properly to the respective output channels (pictured) yet there is still no sound. (Using SimplePlayback example) image

kevinstadler commented 2 years ago

@robog-two could you try calling Sound.list() and copy-pasting the output of the sketch here? I wonder if the problem is that the virtual interface provides a lot of channels, and the output is simply sent to the wrong channel. You could also try selecting the correct output device using the outputDevice() method, maybe ALSA isn't selected as the default.

Also, are you using pavucontrol or is this a general ALSA problem?

robog-two commented 2 years ago

1) image

2) no dice with outputDevice(), though there is an audible pop on the speakers from device 1 (working? sort of?) And that was using the sin oscillator SinOsc sin = new SinOsc(this); sin.play(200, 0.2); sin = new SinOsc(this); sin.play(205, 0.2);

3) Pavucontrol is sort of... not the problem. Pavucontrol is actually just the GUI frontend for configuring PulseAudio, and, I actually don't use pulse at all - though I believe it is emulated by PipeWire (and probably that is what Processing is connected to). Catia is actually an interface for the JACK audio subsystem which is why it only shows information gathered from ALSA through JACK. Welcome to linux audio. 💩

Also, seeing as this issue is from 2018 - it is likely a pulse issue since PipeWire wasn't the default in Ubuntu & derivatives until last year, and its emulation is often less buggy than pulse itself, as crazy as that sounds.

4) From my investigation with Catia (manually forcing the outputs to speakers) audio does not play from any of the outputs it exposed.

robog-two commented 2 years ago

woah no way, I actually DID have pavucontrol installed? anyways, uninstalled it, same issue listed above

Uninstalling pavucontrol and its dependencies causes the program to have sound again, however the sound is distorted. The sound seems to be stuttering and it takes more time for the sample to be fully played out in Processing than using mplayer (about twice as long).

robog-two commented 2 years ago

this is the strangest thing I have ever experienced

robog-two commented 2 years ago

And now sound is gone again when trying the SimplePlayback example, and again again when going back to the sine oscillator.

kevinstadler commented 2 years ago

So the current state is no sound at all, or distorted sound?

robog-two commented 2 years ago

Yes, and apparently shifting between the two at random. I wonder if installing or uninstalling pavucontrol restarts a service that may be freeing memory (?) or something similar, thus creating a temporary fix.