INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Broadcasting could not start on the 'ALSA' output [SOLVED]  (Read 118 times)

JohnDoeSama

  • Member
  • *
  • Posts: 3

Hello everyone,

After some fruitless research, I'm opening this ticket about a problem I'm having with JRiver on Linux Mint.

Indeed, after setting my audio output to my DAC in direct connection with ALSA, when I start playing a track, I get this error message :
Quote
Diffusion problem

Details :
Broadcasting could not start on the 'ALSA' output in 48hz 2ch format. [...]


To wit:
- I have no problems with the Windows version.
- I can use my DAC outside JRiver
- I've tried to authorize my various sample rates on the pipewire configuration
- It already worked! It didn't work at first, then it started to work, then it doesn't work anymore... I can't figure out what triggered these changes in behavior or how to make it work again.

Attached to the post:
- jriver's error message
- my pipewire config
- my audio output in jriver
- my configuration in dsp


I thank you in advance for your help and remain at your disposal to provide any further information.

EDIT : I corrected my pipewire config (196000 > 96000) but the problem is still there.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13610
Re: Broadcasting could not start on the 'ALSA' output
« Reply #1 on: July 01, 2024, 11:24:51 am »

MC doesn't use pipewire, it uses ALSA.
Your settings look OK to me.
Try turning on logging and posting a log here or email to bob (at) jriver (dot) com.
The audio device open is extensively logged.
Logged

JohnDoeSama

  • Member
  • *
  • Posts: 3
Re: Broadcasting could not start on the 'ALSA' output
« Reply #2 on: July 01, 2024, 01:59:30 pm »

Thanks for your feedback Bob.
Attached are the logs.

The error seems to come from the fact that ALSA is already busy.
Code: [Select]
0005097: 140457560495680: Playback: CALSAPlugin::OpenALSA: Opening audio device hw:CARD=M2496,DEV=0 failed, Error = Périphérique ou ressource occupé
I've investigated and it seems to be coming from the EasyEffect application I'm using as a DSP. When I turn it off, MC works fine.

The problem is that I'd like to be able to cohabit the two.
Any leads?

Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13610
Re: Broadcasting could not start on the 'ALSA' output
« Reply #3 on: July 02, 2024, 08:11:18 am »

Thanks for your feedback Bob.
Attached are the logs.

The error seems to come from the fact that ALSA is already busy.
Code: [Select]
0005097: 140457560495680: Playback: CALSAPlugin::OpenALSA: Opening audio device hw:CARD=M2496,DEV=0 failed, Error = Périphérique ou ressource occupé
I've investigated and it seems to be coming from the EasyEffect application I'm using as a DSP. When I turn it off, MC works fine.

The problem is that I'd like to be able to cohabit the two.
Any leads?
You can't do that if you want to use the hw: device. That's really specifying exclusive access by MC.
You could use the default or pulse audio server entries. That will require DSP studio in MC to be set to whatever the default pulse sample rate is (usually 48k but can be changed) for all sample rates.
Optionally there is a pulse pipewire pseudo device. I don't think you have that shim installed, I don't see it in your audio device list.
If you do a search for pipewire in this forum, you'll see some previous topics that may be useful.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3985
Re: Broadcasting could not start on the 'ALSA' output
« Reply #4 on: July 02, 2024, 10:56:58 am »

Optionally there is a pulse pipewire pseudo device. I don't think you have that shim installed, I don't see it in your audio device list.
this works fine, easyeffects running while MC is configured output to pipewire[ALSA] and you get audio as expected
Logged

JohnDoeSama

  • Member
  • *
  • Posts: 3
Re: Broadcasting could not start on the 'ALSA' output
« Reply #5 on: Today at 12:45:00 pm »

I'll need to dig a little deeper to figure out how to set-up the pseudo-devices because it's been a failure so far...

However, I'd like the MC audio stream to avoid any processing and be as direct as possible (for real gain? I'll be honest, I don't know but I'll sleep peacefully).
With the almighty chatgpt, I've made a little script that serves as a shortcut that lets me release alsa before launching mediacenter and relaunch easy effect when it closes.


Here's the code for those who might be interested.

Code: [Select]
#!/bin/bash

LOCKFILE="/tmp/alsa_mediacenter_lock"

# Vérifier si le script est déjà en cours d'exécution
if [ -e "$LOCKFILE" ] && kill -0 "$(cat $LOCKFILE)"; then
    echo "Le script est déjà en cours d'exécution."
    exit 1
fi

# Créer un fichier de verrouillage avec le PID du script actuel
echo $$ > "$LOCKFILE"

# Assurer la suppression du fichier de verrouillage à la fin du script ou en cas d'interruption
trap 'rm -f "$LOCKFILE"; exit' INT TERM EXIT

# Fonction pour afficher une popup et demander si les processus utilisant ALSA doivent être arrêtés
prompt_kill_processes() {
    alsa_processes=$(lsof | grep snd | awk '{print $2}' | sort -u)
    if [ -z "$alsa_processes" ]; then
        echo "Aucun processus utilisant ALSA trouvé."
        return 1
    fi

    process_list=""
    for pid in $alsa_processes; do
        process_name=$(ps -p $pid -o comm=)
        if [[ "$process_name" != "cinnamon" && "$process_name" != "csd-media-keys" && "$process_name" != "pipewire" && "$process_name" != "pipewire-pulse" && "$process_name" != "easyeffects" && "$process_name" != "wireplumber" ]]; then
            process_list+="PID: $pid ($process_name)\n"
        fi
    done

    if [ -z "$process_list" ]; then
        echo "Aucun processus non-système utilisant ALSA trouvé."
        return 1
    fi

    zenity --question --title="Processus utilisant ALSA" --text="Les processus suivants utilisent actuellement ALSA:\n\n$process_list\nVoulez-vous les arrêter ?" --width=400 --timeout=10
    return $?
}

# Identifier et demander d'arrêter les processus utilisant ALSA
if prompt_kill_processes; then
    # Couper le son
    pactl set-sink-mute @DEFAULT_SINK@ true

    alsa_processes=$(lsof | grep snd | awk '{print $2}' | sort -u)
    for pid in $alsa_processes; do
        process_name=$(ps -p $pid -o comm=)
        if [[ "$process_name" != "cinnamon" && "$process_name" != "csd-media-keys" && "$process_name" != "pipewire" && "$process_name" != "pipewire-pulse" && "$process_name" != "easyeffects" && "$process_name" != "wireplumber" ]]; then
            kill $pid
        fi
    done
else
    echo "Aucun processus non-système utilisant ALSA trouvé ou script arrêté par l'utilisateur."
fi

# Arrêter EasyEffects
flatpak kill com.github.wwmm.easyeffects

# Attendre que EasyEffects soit bien arrêté
while pgrep -x "easyeffects" > /dev/null; do
    sleep 0.5
done

# Désactiver PipeWire et ses services associés
systemctl --user mask pipewire.service pipewire-pulse.service
systemctl --user stop pipewire.service pipewire-pulse.service

# Attendre que PipeWire soit bien arrêté
while pgrep -x "pipewire" > /dev/null || pgrep -x "pipewire-pulse" > /dev/null; do
    sleep 0.5
done

# Lancer MediaCenter32
mediacenter32 &

# Attendre que MediaCenter32 se ferme
wait $!

# Couper le son
pactl set-sink-mute @DEFAULT_SINK@ true

# Réactiver PipeWire et ses services associés
systemctl --user unmask pipewire.service pipewire-pulse.service
systemctl --user start pipewire.service pipewire-pulse.service

# Attendre que PipeWire soit bien démarré
while ! pgrep -x "pipewire" > /dev/null || ! pgrep -x "pipewire-pulse" > /dev/null; do
    sleep 0.5
done

# Démarrer EasyEffects en arrière-plan
flatpak run com.github.wwmm.easyeffects --gapplication-service &

# Attendre qu'EasyEffects soit bien démarré
while ! pgrep -x "easyeffects" > /dev/null; do
    sleep 1
done

# Réactiver le son
pactl set-sink-mute @DEFAULT_SINK@ false

# Supprimer le fichier de verrouillage
rm -f "$LOCKFILE"


As a result, it completely closes firefox, vlc or any other process using alsa before launching mediacenter. I haven't been able to figure out how to do it any other way, but it fits the job.

As far as I'm concerned, the subject is solved.
Many thanks to you all.
Logged
Pages: [1]   Go Up