Google added native screen recording functionality in Android 4.4, but it only works over ADB and there's no audio output. Third-party developers have been working on ways to expand the usability of the native functionality, but the root only app SCR might be the closest to implementing sound and video perfectly after the most recent update.
In the new version, SCR gains support for experimental recording of internal audio with the video. Of course, this requires root access, and it's still a bit buggy. I had a few errors testing on the 2013 Nexus 7, but a little fiddling got everything working. There are some other apps that can record audio, but most of them are pulling it from the microphone. Koush's Mirror app can record internal audio, but it takes over the output so you can't actually hear anything while recording. With SCR, the sound still comes out of the speakers, but it's embedded in the video too.
There are a lot of settings in SCR, so make sure you try changing up the resolution and encoding if things aren't working. The free version of SCR lets you record 3 minutes of video with a watermark. The paid version is unlimited and has no watermark.