I can think of a couple possibilities none of which are good. You may have a wire in the tablet that is touching another component and grounding the speaker connection or there could be a fault with your speaker output port. It does sound from your description like a hardware issue. You could try for an exchange if it's new enough or go for a repair.
I have a similar problem. After a while my tablet speakers stop working only the headphones work! After flashing everything works again for a while than the same problem! I have no clue whats causing this issue...
I already flashed the latest Rom e the problem persists! And i don't like to be flashing it all the time.
If it works consistently for a while after you flash then quits you need to take a hard look at all the apps you have installed as a hardware problem would likely be more consistent. And sound enhancing or modification apps would be first on the list.