opensmalltalk-vm icon indicating copy to clipboard operation
opensmalltalk-vm copied to clipboard

No sound on Linux

Open contrapunctus-1 opened this issue 5 years ago • 8 comments

Apologies if this should have been a part of #360.

Running e.g. AbstractSound bachFugue play resulted in no sound. Other sound-playing applications on the system were working fine.

The VM said sound: /dev/dsp: No such file or directory

--help mentioned the following -

vm-sound-ALSA tryLoading cogspur/lib/squeak/5.0-202003021730/vm-sound-ALSA.so: dlopen: cogspur/lib/squeak/5.0-202003021730/vm-sound-ALSA.so: undefined symbol: snd_mixer_selem_is_active
vm-sound-ALSA tryLoading /home/anon/git/Cuis-Smalltalk/cogspur/lib/squeak/5.0-202003021730/vm-sound-ALSA.so: dlopen: /home/anon/git/Cuis-Smalltalk/cogspur/lib/squeak/5.0-202003021730/vm-sound-ALSA.so: undefined symbol: snd_mixer_selem_is_active

Running with -vm-sound-pulse gave no errors but I still got no sound.

OS - Linux 5.5.0-1-686 #1 SMP Debian 5.5.13-2 (2020-03-30) i686 GNU/Linux

$ cogspur/squeak --version
5.0-202003021730  Tue Mar  3 08:28:29 UTC 2020 gcc 5.4.0 [Production Spur VM]
CoInterpreter VMMaker.oscog-nice.2712 uuid: da64ef0b-fb0a-4770-ac16-f9b448234615 Mar  3 2020
StackToRegisterMappingCogit VMMaker.oscog-eem.2719 uuid: e40f3e94-3a54-411b-9613-5d19114ea131 Mar  3 2020
VM: 202003021730 https://github.com/OpenSmalltalk/opensmalltalk-vm.git
Date: Mon Mar 2 18:30:55 2020 CommitHash: 6a0bc96
Plugins: 202003021730 https://github.com/OpenSmalltalk/opensmalltalk-vm.git
Linux travis-job-56ef6ed6-a99c-4420-b3aa-37bf991d063a 4.15.0-1028-gcp #29~16.04.1-Ubuntu SMP Tue Feb 12 16:31:10 UTC 2019 i686 i686 i686 GNU/Linux
plugin path: cogspur/lib/squeak/5.0-202003021730 [default: /home/anon/git/Cuis-Smalltalk/cogspur/lib/squeak/5.0-202003021730/]

Cuis5.0-4112-32.image

contrapunctus-1 avatar Apr 22 '20 10:04 contrapunctus-1

The VM is trying to drive sound through a broken ALSA driver. Can you try these options: $ squeak -vm-sound-pulse $ squeak -vm-sound-oss $ padsp squeak -vm-sound-oss $ aoss squeak -vm-sound-oss

In each of these sessions, you can do "Beeper beep" to test sound.

kksubbu avatar Apr 22 '20 17:04 kksubbu

@kksubbu Sorry, I think that was some sound issue on this particular system. It works with -vm-sound-pulse on both this system (needed to restart PA, for some reason) and another Debian Testing system.

On a related note...does the VM try to detect which sound backend it should be using? It seems to use OSS by default, which doesn't seem to be a good choice for modern Linux systems 🤔

contrapunctus-1 avatar Apr 23 '20 18:04 contrapunctus-1

"does the VM try to detect which sound backend it should be using?" not as far as I'm aware. Having such a system would be great. Look at platforms/unix/vm/sqUnixMain.c and the soundModule there-in.

eliotmiranda avatar Apr 23 '20 21:04 eliotmiranda

You might find you have to add a function to struct Sound, such as isModulePreferred or some such to allow sqUnixMain to query the available sound modules so that they do the determination, not sqUnixMain. It appears the way Ian Piumarta (the author of this module system) envisioned it is that one would define AUDIOSERVER in the environment. See loadImplicit in sqUnixMain.c

eliotmiranda avatar Apr 23 '20 21:04 eliotmiranda

On 2020-04-23, at 2:29 PM, Eliot Miranda [email protected] wrote:

You might find you have to add a function to struct Sound, such as isModulePreferred or some such to allow sqUnixMain to query the available sound modules so that they do the determination, not sqUnixMain.

Perhaps even better, move that stuff out of the core vm code entirely and into the platform specific sound plugin code. If you don't load the plugin (because webserver, or otherwise not needing to make noises) you shouldn't even run this code. And clearly in the image, if no noise is made no plugin should be loaded to make noises.

The only bit that should be in the core vm code is to record any preference about the sound set by the command line; the plugin code should query that and do the right thing.

tim

tim Rowledge; [email protected]; http://www.rowledge.org/tim User: A harmless drudge.

OpenSmalltalk-Bot avatar Apr 23 '20 22:04 OpenSmalltalk-Bot

I was able to get sound to play with the following code in Cuis (with padsp cogspur/squeak ...):

Feature  require:  #'Sound'.

SoundPlayer boinkScale.

Although it seems to lock the VM up with an hourglass cursor, so I can't do anything else.

Running AbstractSound bachfugue play produces no sound for me and CPU usage seems to go to nearly 100% for a while.

DestyNova avatar May 09 '20 02:05 DestyNova

Oh, Beeper beep works and doesn't freeze the UI, so I guess that was somehow specific to how SoundPlayer works?

DestyNova avatar May 09 '20 02:05 DestyNova

On 23.04.2020, at 23:27, Eliot Miranda [email protected] wrote:

"does the VM try to detect which sound backend it should be using?" not as far as I'm aware. Having such a system would be great. Look at platforms/unix/vm/sqUnixMain.c and the soundModule there-in.

It tries to use the first one that loads. And this may be well OSS. (see my mail regarding default ordering).

We might need a two-stage selection here. should not be too hard.

Best regards -Tobias

OpenSmalltalk-Bot avatar May 09 '20 06:05 OpenSmalltalk-Bot