On my fully updated Ubuntu 18.04.3 system, audio doesn't work unless I switch between outputs. When I boot my PC, the right output (stereo speakers) is already selected by default, but there is no audio from Chromium, Firefox, VLC or any other program. However, the GNOME speakers test works. I can hear "front left" and "front right" from there, but no audio from other programs. In order to fix that, I can simply switch to another audio output (e.g. HDMI out) and then switch back to the stereo speakers, and the audio will magically work. Any idea why? It's not a big deal because it takes a couple of seconds to switch between outputs, but it's kind of annoying to do that after every reboot.
I have this shellcheck
warning I can't figure out:
In /mnt/e/bin/iconic line 540:
printf "FALSE|" >> "$IconsRaw" # Select field number 1
^-- SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
I've noticed many of us here use shellcheck to fix our bash scripts / shell commands so I hope the question is on topic.
As per comments posting relevant section of bash script:
if [[ "$X" == "?" || "$Y" == "?" ]] ; then
: # Bad X or Y offset usually "Link to Name.ext~" (backup name)
else
let i++
printf "FALSE|" >> "$IconsRaw" # Select field number 1
printf "%s|" "$i" >> "$IconsRaw" # 2
printf "%s|" "${File##*/}" >> "$IconsRaw"
printf "%s|" "$Linkless" >> "$IconsRaw" # 4
printf "%s|" "$Date" >> "$IconsRaw" # 5
printf "%s|" "$X" >> "$IconsRaw" # 6
echo "$Y" >> "$IconsRaw" # 7
fi
Solution
Thanks to accepted answer and comments I've learned that shellcheck
not only catches errors in your code, but also suggests performance improvements. In this case the filename $IconsRaw
was being opened and closed many times with each printf
and echo
.
The more efficient bash code:
# X,Y screen coordinates invalid on backup files ending with "~"
! [[ "$X" == "?" || "$Y" == "?" ]] && { let i++; echo \
"FALSE|$i|${File##*/}|$Linkless|$Date|$X|$Y" >> "$IconsRaw"; }
I would like to modify the pitch of my audio output.
I know you can use software such as PlayItSlowly to listen to an audio file and alter the pitch in the process, but what I am looking for is a way to modify the pitch just as I do with the volume.
I can do it on Windows with Realtek's sound manager, so I guess there must be a way to do it on Linux as well.
I am using dual monitors, and I want to be able to play a movie with sound on the TV (through vlc or something) and then play youtube or some games with my headphones on my laptop. Is there anyway I can choose what hardware each application uses?
I've tried using pavucontrol
, but am not given an option to change the output device.
EDIT:
jeggy@localhost:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC665 Analog [ALC665 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC665 Digital [ALC665 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
I want to write batch or something, that will write output of top
into a file on login.
I did top >> output-file
, but it contains some strange character!
Can somebody give a simple tutorial about how to write batch file in Linux?