This how-to should show the steps required to record whatever audio is playing on your computer, similar to recording "stereo mix" in windows. This makes recording audio played by any application, including flash videos, possible.
We are using the Sound Recorder application that comes in standard Ubuntu installations. To set this up using other programs (like audacity) just substitute it in these instructions.
1. Install pavucontrol (PulseAudio Volume Control) using apt-get or the Ubuntu Software Center.
2. Open PulseAudio Volume Control. It should be in the applications menu under Sound and Video.
3. Open Sound Recorder and start recording. Playing any sound at this point would be helpful, as your level indicator should react once you have finished.
4. Go to the "Recording" tab in the PulseAudio Volume Control window.
5. Make sure that "Applications" is selected in the drop down menu on the "Recording" tab.
6. Choose "Monitor of Internal Audio Analog Atereo" from the "Record Stream from" menu in the Sound Recorder entry of the application list.
This appears to be persistent so that you will only have to do this once, but you will have to repeat these steps to record in another application.
Source from here