https://unix.stackexchange.com/questions/396123/how-to-recor...
This will let you record from your built-in microphone.
If you want to record direct output, download Blackhole and route the audio through the virtual device: https://github.com/ExistentialAudio/BlackHole
Audio quality will need a bit of tweaking with gain.