I had this same problem and it was driving me nuts trying to fix it because whenever I booted into Windows 10, sound worked fine. Meanwhile, on Ubuntu 18.04, I found a number of helpful web pages with suggestions for troubleshooting audio problems.
The suggestion that worked for me was running 'sudo alsamixer' in a terminal window. I didn't even have success with this until I started to approach the problem with the expectation that things were gonna work realized I needed to be able to tell when they did.
I have provided some very basic instructions below that I hope might help someone troubleshooting audio problems. While steps 3 and onward are specific to alsamixer (version 1.1.3), steps 1 and 2 may help a person detect when things are working for other changes. If you are already familiar with alsamixer, then I'm sure you will understand that we are looking for any playback settings that may be muting output or producing output at a volume to low to be heard. In my case, it was the muting of one particular item that actually produced audio through the speakers.
- Turn speakers on to HALF volume, NOT full volume
- Start the audio source you want to hear through the speakers. It is important that the audio source provide continuous test audio so that you will hear the audio through the speakers once the correct setting is discovered and adjusted.
- Open a terminal window
- Enter the following command:
- Assuming the application launches and you can see the UI, proceed with the remaining steps.
- Press F6 to select the desired soundcard
- Press F3 to ensure we are only exploring [Playback] settings
We're gonna change the volume level or mute status of various items to see if the change causes audio to come through the speakers. The currently selected item is the one on the left. By moving the right arrow key we can select the item to its right. We will slowly explore each item until we go all the way to the right. You will see the name of the currently selected item appear in the upper right of the screen next to "Item:"
- Use the right and left arrow keys to move to different items.
- Note the current volume level or mute status.
- If the item volume indicator has a little box with "MM" or "0", try toggling the mute status with the "M" on the keyboard. If you do not hear audio from the speakers, then toggle the item again to put it back to its original state.
- If the item volume has a vertical box, use the up and down arrow keys to raise the volume level all the way to the top. If this does not result in audio being output from the speaker, then lower the volume back to its original value.
- Repeat steps 7 through 10 until you hear the test audio from the speakers or until you reach the last item on the right.
My apologies if you get all the way to the right without any improvement in your audio configuration.
In my case, I have an ancient Creative Labs SoundBlaster Audigy 2 ZS sound card. Everything worked right out of the box when I first installed Ubuntu, but some later actions on my part broke the audio configuration to where I could hear audio through headphones but nothing came through the speakers, even if I physically disconnected the headphones (which I also tried since some cards auto-toggle speakers when headphones are connected/disconnected).
When I followed the steps above, I came to the item: Audigy Analog/Digital Output Jack, which was set to "0" (enabled), I toggled to mute ("MM"), thereby turning the item "[Off]". The moment I did this, I actually got sound output through the speakers. Makes no sense to me at all why enabling this item would DISABLE output to speakers and vice-versa, but I'm so happy to have finally found this setting and fixed my audio configuration, and can now listen through speakers or headphones as I choose.