Commands added on startup not running

hey , i m using zorin 16 beta

i wanted to apply startup sound in it
so i added a command on startup

pactl -- set-sink-volume 0 90% && paplay /home/milesdredd/Downloads/FROM\ FIREFOX/tune/robo.wav &&pactl -- set-sink-volume 0 60%
also i used command to increase volume and decrease when startup sound finishes
but it didn't worked
but i came to know that at each boot , the default selected audio output device is no working ,
so for changing it

in terminal :-

pactl list short sources


it says:-
0 alsa_output.pci-0000_00_14.2.analog-stereo.monitor module-alsa-card.c s16le 2ch 48000Hz SUSPENDED
1 alsa_input.pci-0000_00_14.2.analog-stereo module-alsa-card.cs16le 2ch 44100Hz SUSPENDED
2 alsa_output.platform-snd_aloop.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz SUSPENDED
3 alsa_input.platform-snd_aloop.0.analog-stereo module-alsa-card.cs16le 2ch 44100Hz SUSPENDED
4 noechosource module-echo-cancel.c float32le 1ch 32000Hz SUSPENDED
5 noechosink.monitor module-echo-cancel.c float32le 1ch 32000Hz SUSPENDED

and i used a command to change audio device temporarily,

pactl set-default-sink alsa_output.pci-0000_00_14.2.analog-stereo

and it worked perfectly
so at last i used combination of command in startup to run

sleep 5s && pactl set-default-sink alsa_output.pci-0000_00_14.2.analog-stereo && pactl -- set-sink-volume 0 80% && paplay /home/milesdredd/Downloads/FROM\ FIREFOX/tune/robo.wav &&pactl -- set-sink-volume 0 60%
i used this command on terminal in terminal , and there it work

**but its not working at startup .**why?
pls help me.

Try wrap it in sh -c " "

how to do ,
i dont know how to make bash script file

sh -c "sleep 5s && pactl set-default-sink alsa_output.pci-0000_00_14.2.analog-stereo && pactl -- set-sink-volume 0 80% && paplay /home/milesdredd/Downloads/FROM\ FIREFOX/tune/robo.wav && pactl -- set-sink-volume 0 60%"

not working ,
also different audio device is selected

after running this commend , system should select "speaker-built-in audio"
but its not happening
at the boot its still selected as default to "analog output " which is not running

Was that not
/bin/bash -c

1 Like

sorry,?? i didn't get

just i copied ur given command to startup:-

I was talking about start up script.
I checked this script I wrote a while ago and compared it with Storm's script.

1 Like

You don't need to make a script file if you wrapped in sh -c " ". Just fill out in between.

Ah, I see.
Thanks for the explanation.

I now remembered what I did.

I made a separate python script and call it from the startup since I thought it was easier to edit this scrip for fine adjustments rather than touching the startup statement every time I wanted to make a change.

Paplay is known to barely work.

Recommend that you use canberra-gtk-play.
From your start up, you can put the command /usr/bin/canberra-gtk-play --id="desktop-login" --description="startup login" You can add the sound file to your system sounds directory.
(I had to look up the directory)

1 Like

any sound will work if selected device will work fine ,
here, at every boot , selected audio device is not working

to play any song or any media , i have to select "speaker" manually

Well, the above will get startup sound to work.

Getting Sounds to work with the Systemd modules mess of Alsa and Pulseaudio is a whole 'nother matter.
I usually pass that buck to Zaba or Swarf. :stuck_out_tongue:

ok, how to change default selected audio device?

For me, "settings" -> "sound" and select the output device.
It will stick as a default in my setup.

1 Like

No , its not working

And i think the set of command i added in startup are working , but my default selected audio output device is not working i cant able to hear the sound , how to change ? Default audio devices

Is this helpful?

no,i have already used this,

but its not changing selected device on startup

and when i run this commad on terminal it works

1 Like

i got solution somehow,
now my speaker is working fine at startup
i dont know what workes for me , everything working fine as i wanted :heavy_heart_exclamation:
thanks to all

1 Like

That is PulseAudio in a nutshell. :expressionless: