It'll be fine if everything else is fine
The #1 issue with cordage inside walls is thermal - cordage is permitted smaller wires because it's in the open air in a habitable room, where a human will notice wire problems... not packed in the wall where air cannot circulate and where it may be subject to 150F heat from solar gain.
But the sound bar draws, what... maybe 40 watts? Less than an amp on a probably #18 power cord. What could possibly go wrong?
We don't install electrical power systems based on everything going right. We wouldn't need GFCIs, grounding, or even circuit breakers, would we?
But if the speaker has a problem we want it to trip the circuit breaker. Breakers protect two ways: Instant magnetic trip (at 10x breaker rating, 150A or 200A)... or inverse-time thermal trip, the more the overload the shorter the time.
The inverse-time curve is designed to approximate the overheating of appropriately sized, appropriately rated in-wall wiring in the walls. Those wires have thermal inertia and it takes time for them to overheat. The idea is that the breaker will tolerate mild overloads for minutes (toaster + coffee maker) or significant overloads for seconds (large motor startup; power supply inrush) because the wires won't overheat that fast.
We throw a monkey-wrench in that design when we embed in the wall cordage, which has not the insulation thermal rating of other in-wall wire, nor the physical size required - #14 for 15A breaker, and #12 for 20A breaker.
PSA: Beware target fixation on bringing 120V to hard places
I can't tell you how many questions we get where someone is trying to bring serious, real, human-killing 120VAC to the most improbable of locations. And we quiz them further, and it turns out they're trying to power a security camera. That doesn't even need 120V, it needs 5V. But the only way their mind's eye can see to power it, is to bring up 120V and use the usual wall-wart. (outdoors in the rain no less). Do you see the blind-side there? They're not even considering simply extending the low-voltage wall-wart cable, a safe and legal operation which Code treats lightly because of the low voltage.