Go step by step and test.
1. Reset PRAM: Reset NVRAM or PRAM on your Mac - Apple Support
Settings that can be stored in NVRAM include sound volume, display resolution, startup-disk selection, time zone,
and recent kernel panic information.
The settings stored in NVRAM depend on your Mac and the devices that you're using with your Mac.
2. Reset SMC: How to reset the SMC of your Mac - Apple Support Choose the appropriate method.
Quote:
Resetting the system management controller (SMC) can resolve certain issues related to power, battery, fans,
and other features.
3. Launchpad > Other > AudioMIDI Setup > Sidebar > MacBook Pro Speakers Output
Make sure no item under Mute is enabled.
4. Try suggestions given in this article.
https://support.apple.com/en-us/HT203186