alda-lang / alda

A music programming language for musicians. :notes:
https://alda.io
Eclipse Public License 2.0
5.63k stars 292 forks source link

No Sound #491

Open iacore opened 1 year ago

iacore commented 1 year ago

🐞 Bug report 🐞

Description

alda play has no sound. No new audio source in Pulseaudio.

Steps to Reproduce

  1. alda -v2 play -c "piano: c12 e g > c4"

Does the problem happen consistently?
Yes

Expected Behavior

It should make some sound, at least.

Actual Behavior

alda doctor says everything is fine.

Environment

Operating system and version: Linux

Alda version:

$ alda version
alda 2.2.5
$ alda-player info
alda-player 2.2.5
log path: /home/user/.cache/alda/logs

Health check:

$ alda doctor
(all ok)

Logs:

qqw INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/players...
qqw INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/repl-servers...
qqw INFO  2023-10-20 06:09:28 Main.run:77 - Starting receiver, listening on port 37537...
fgx INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/players...
qqw INFO  2023-10-20 06:09:28 MidiEngine.<init>:276 - Initializing MIDI sequencer...
fgx INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/repl-servers...
qqw INFO  2023-10-20 06:09:28 MidiEngine.<init>:281 - Initializing MIDI synthesizer...
fgx INFO  2023-10-20 06:09:28 Main.run:77 - Starting receiver, listening on port 45865...
zbx INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/players...
zbx INFO  2023-10-20 06:09:28 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/repl-servers...
zbx INFO  2023-10-20 06:09:28 Main.run:77 - Starting receiver, listening on port 40081...
fgx INFO  2023-10-20 06:09:28 MidiEngine.<init>:276 - Initializing MIDI sequencer...
fgx INFO  2023-10-20 06:09:28 MidiEngine.<init>:281 - Initializing MIDI synthesizer...
zbx INFO  2023-10-20 06:09:28 MidiEngine.<init>:276 - Initializing MIDI sequencer...
zbx INFO  2023-10-20 06:09:28 MidiEngine.<init>:281 - Initializing MIDI synthesizer...
qqw INFO  2023-10-20 06:09:31 Main.run:90 - Starting player...
fgx INFO  2023-10-20 06:09:31 Main.run:90 - Starting player...
zbx INFO  2023-10-20 06:09:31 Main.run:90 - Starting player...
qqw INFO  2023-10-20 06:09:42 Main.invoke:95 - Stopping receiver...
qqw INFO  2023-10-20 06:09:42 Main.invoke:97 - Stopping player...
xnu INFO  2023-10-20 06:12:20 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/players...
xnu INFO  2023-10-20 06:12:20 StateManager.cleanUpStaleStateFiles:72 - Cleaning up stale files in /home/user/.cache/alda/state/repl-servers...
xnu INFO  2023-10-20 06:12:20 Main.run:77 - Starting receiver, listening on port 38459...
xnu INFO  2023-10-20 06:12:20 MidiEngine.<init>:276 - Initializing MIDI sequencer...
xnu INFO  2023-10-20 06:12:20 MidiEngine.<init>:281 - Initializing MIDI synthesizer...
xnu INFO  2023-10-20 06:12:22 Main.run:90 - Starting player...
daveyarwood commented 1 year ago

Hi @iacore , thanks for reporting this. Unfortunately, I don't have any strong theories about what might be the cause of the issue. Everything in the logs you posted looks normal, and the alda doctor checks passing would suggest that it's not an issue with the player processes starting or the MIDI system failing to start, etc.

My best guess is that this is some kind of Pulseaudio-related issue. Just as a point of reference, I have been using Alda for years with no issues on my Ubuntu laptops (16.04, 20.04, 22.04) with Pulseaudio.

Out of curiosity, what Linux distro are you using?

daveyarwood commented 1 year ago

And as a sanity check: is audio working for you, in general? For example, can you hear YouTube videos?

iacore commented 1 year ago

My Linux distro is Artix.

Every other application has sound.

I found a workaround to the problem

alda-player run -p 27278
ALDA_DISABLE_SPAWNING=yes alda -v 2 play -p 27278 -c 'piano: c e g'
daveyarwood commented 1 year ago

Very interesting! So it seems like maybe sound isn't being produced when the processes are spawned in the background, but it works when the process is running in the foreground :thinking:

iacore commented 1 year ago

Now the workaround doesn't work...

UlyssesZh commented 1 month ago

Same symptom. Using foreground alda-player does not fix this either. Distro is NixOS 24.05.