Peterborough Linux User Group (Canada) Forum

Linux & Android => Support => Topic started by: fox on June 07, 2020, 11:46:10 AM

Title: Music playing problems on Ubuntu 20.04
Post by: fox on June 07, 2020, 11:46:10 AM
Can't figure this one out. I can play youtube videos, no problem, but most of the time songs played in Rhythmbox have no sound. Take the same song and play it in VLC or Gnome Videos and it's fine. Thinking that the problem is specific to Rhythmbox, I downloaded Clementine, but it didn't play music either. I'm guessing that VLC uses a different backend than Rhythmbox or Clementine - anyone know if that is the case?

I'm running Ubuntu 20.04 with the 4.15 kernel on my 2015 iMac. However, I tried rebooting into the "slow" 5.4 LTS kernel and that didn't change anything as far as music goes. This indicates that the problem isn't kernel-specific. It looks like some changes made in the distro from Ubuntu 19.10 to 20.04 have caused the problem. I made one other test to see if this is distro-specific; I tried the music options in Mint 19.3. Everything worked fine there. However, that doesn't tell me whether Mint version 20, based on Ubuntu 20.04, won't be problematic on this computer.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: buster on June 07, 2020, 05:33:34 PM
" It looks like some changes made in the distro from Ubuntu 19.10 to 20.04 have caused the (media) problem."

You could drag the music you want to play into the Win7 VM.You may have to open the sound card from the top left of vmware. Then play the music in Media Player. Minimize the VM window and Bob's your uncle.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: fox on June 07, 2020, 06:26:42 PM
Wouldn't work. If sound isn't working from the host, it wouldn't work from the VM.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: buster on June 07, 2020, 07:06:44 PM
But your sound does work! And I quote: 'Take the same song and play it in VLC or Gnome Videos and it's fine'.

It will take only a moment or two to try. Give it a shot.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: Jason on June 07, 2020, 07:09:05 PM

Sound might be working in the host, though. It doesn't sound like you've localized the problem to whether it's a program or the sound settings of the OS.

I installed Clementine in Kubuntu 20.04 and it works fine for me. I do notice if you go into Clementine's Preferences and Playback settings, there are a lot of options for Audio output there.

Rhythmbox works for me as well but doesn't appear to have audio settings that I can see. Once I started it, there was no icon anywhere to close it after I clicked the close/minimize button. I had to kill the process with extreme prejudice.

VLC Player also works for me. It also has a bunch of different audio settings.

I didn't bother with testing Gnome Videos.

You didn't mention if sound work generally for the OS. Does it beep or whatever Ubuntu does when you get an error message? Or can you go into a sound setting and run a sound test? Some of the programs may take their queues from the desktop media settings unless you specifically change them and some use their own by default.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: Jason on June 07, 2020, 07:11:29 PM
Quote from: buster on June 07, 2020, 07:06:44 PM
But your sound does work! And I quote: 'Take the same song and play it in VLC or Gnome Videos and it's fine'.


I was going to note that, too. :) But having to run Win7 in Linux host just to play music? Eww. But I guess it's better than the other way around. :)
Title: Re: Music playing problems on Ubuntu 20.04
Post by: buster on June 07, 2020, 07:18:03 PM
Or use VLC. No real problem.

Or follow Jason's advice and poke about Clementine or Rythmbox.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: fox on June 07, 2020, 11:14:20 PM
Quote from: Jason Wallwork on June 07, 2020, 07:09:05 PM
....
You didn't mention if sound work generally for the OS. Does it beep or whatever Ubuntu does when you get an error message? Or can you go into a sound setting and run a sound test? Some of the programs may take their queues from the desktop media settings unless you specifically change them and some use their own by default.

This is one of the odd things. Ubuntu sounds work, but when going into the Sound settings, no sound comes out of the test.It gets weirder. I rebooted and checked for audio in a youtube video in Firefox. No audio. I looked in the Sound setting and the output device was my dongle that the external speakers are plugged into. I then switched the device to my internal speakers. Sound played in same video. I then switched back to the dongle. Sound played in the same video. I opened up Rhythmbox and played a song. It played. All the while, the sound test didn't output any sound. So next I tried several songs; all played.

I then opened up another youtube video and lo and behold, no audio! Changed the sound output to internal audio and the audio worked in the same youtube video. Tested that audio in the Sound panel, no output. Tried Rhythmbox with the internal speakers, no sound. Changed sound output to the dongle with external speakers, and audio continued to play in the youtube video. But no sound in Rhythmbox. So, just on a whim, I opened up Pulse Audio Volume Control and found that the sound for Firefox was set on the external speakers but in Rhythmbox it was on the internal speaker! Changed that to the external speaker, and Rhythmbox played! Until I looked at the Pulse Audio Volume Control Panel, I didn't even know that output devices could be set to different devices in different applications, as this was not an option that showed in the Gnome Sound preference pane.

I made another set of tests using Pulse Audio Volume Control, and for this I added VLC so that I could manipulate the audio output device for each of Firefox (youtube), Rhythmbox and VLC separately. All three played when the device was the external speakers, and none played when its setting was the internal speakers. In effect, the Gnome Sound preference pane was lying to me. To do one final test of this, I rebooted and immediately opened up Pulse Audio Volume Control. I then started a youtube video in Firefox, followed by a song in Rhythmbox and finally, a song in VLC. PAVC this time appeared to save the settings to external speakers from the previous boot, and in all three cases, the sound played.

Now with sound settings OK, I had to do one more test; the one Buster recommended. I opened up the Peppermint vm in VMware Player, installed Rhythmbox and tried to play a song. No sound. Looking at the PAVC, I could see why immediately, as it chose internal audio as the default for the "new" application. When I changed this default to the external speakers, the song played.

So here is how I sum things up.
- The default output device for any application that wasn't previously playing audio is the internal speakers.
- My supposition is that unplugging the dongle will result in a reset to the default: the internal speakers.
- If I set the sound output for a given application to the external speakers, the sound will work until something resets the sound.
- If sound isn't working in a given application, it is only necessary to go to PAVC and set the sound for that app to external speakers.
- The Gnome Sound Preference Pane is not giving me correct input as to which device the sound is being played through.

Thanks, guys, for all of the suggestions.

Title: Re: Music playing problems on Ubuntu 20.04
Post by: Jason on June 08, 2020, 10:08:15 AM
I was going to mention trying the pulse audio control but I thought maybe you had already tried that.

When I was having issues with Skype and Zoom trying to get my audio working, I saw a video that recommended installing pavucontrol. I did that. I'm not even sure I had to change anything, but it fixed the audio. I made a post about this but I can't find it now so I think it was lost in the Great Forum Purge. Although most Linux users think it's one or the other, it's actually not that simple. From the Wikipedia entry on PulseAudio (https://en.wikipedia.org/wiki/PulseAudio):

QuoteIn a typical installation scenario under Linux, the user configures ALSA to use a virtual device provided by PulseAudio. Thus, applications using ALSA will output sound to PulseAudio, which then uses ALSA itself to access the real sound card. PulseAudio also provides its own native interface to applications that want to support PulseAudio directly, as well as a legacy interface for ESD applications, making it suitable as a drop-in replacement for ESD

This sounds (see what I did there?) confusing but the last sentence is the most important. Applications can access PulseAudio through ALSA, or they can directly access PulseAudio. But all apps are using PulseAudio ultimately. I think the apps you were having trouble with were trying to access PulseAudio directly and because of that, the typical audio controls didn't work, you needed the PulseAudio controls (pavucontrol). If all this confuses you, don't worry. It still confuses me a little bit.

The end result is that sometimes you need to install pavucontrol to get things working and then bring it up (it should be called PulseAudio Volume Control) and fiddle with the settings. It all depends on the particular program.

I didn't know you could change the volume for separate applications. I wanted to see this in action so I started Spotify and it showed up under the PulseAudio volume control under Playback. Then I started Clementine, which didn't, and I couldn't play anything, not even muted. It would say it was playing and then immediately say it stopped.

So I opened up preferences for clementine and looked under playback -> audio output -> output device. It was set to 'Default device on Output audio through OpenAL'. Clicked on it to get the dropdown list and chose 'Default device on Plays audio to a PulseAudio server', and voila! And it showed up in the list of Playback devices now. After that changing the option in the dropdown list didn't seem to have any effect, even after quitting Clementine and re-opening it. Weird. Rhythmbox also still worked and showed up on the list.

The reason some apps that worked for me right away and not you is probably because I already had pavucontrol installed to fix the Zoom audio issue. Btw, I see that the Plasma tray sound control (regular not pulseaudio) has an applications tab that lets me control sound in separate apps. I would expect that Gnome has that, too? No?

Title: Re: Music playing problems on Ubuntu 20.04
Post by: Jason on June 08, 2020, 10:17:27 AM
Incidentally, here's a stupid Linux trick you can do.

Open up Rhythmbox, start playing something. Leave it running. Uninstall it. Music keeps playing. We've probably all noticed that you can update an app in Linux while you're using it. You might not have noticed that you don't get the new version until you close the program and re-open it. I didn't know that extended to pulling the rug out from under the program!
Title: Re: Music playing problems on Ubuntu 20.04
Post by: fox on June 08, 2020, 10:50:49 AM
Quote from: Jason Wallwork on June 08, 2020, 10:08:15 AM
....
The reason some apps that worked for me right away and not you is probably because I already had pavucontrol installed to fix the Zoom audio issue. Btw, I see that the Plasma tray sound control (regular not pulseaudio) has an applications tab that lets me control sound in separate apps. I would expect that Gnome has that, too? No?

I already had pavucontrol installed before the problem, so just having it installed didn't fix the problem. Using it did, however.

In answer to your second question, Gnome Sound control lets me control the volume of separate applications running with audio, but not the sound output device. It gives only one sound output device and it wasn't accurate like pavucontrol.
Title: Re: Music playing problems on Ubuntu 20.04
Post by: buster on June 08, 2020, 11:02:19 AM
Well, lots of interesting sound problems to solve. Some people have all the fun.