0

I'm trying to record exactly the digital signal that my computer is playing. For example, if I was to play a WAV file using an audio player, I would like to be able to reconstitute such file from the recording.

As I understand it, it's not doable with compressed format (such as mp3) because the file is uncompressed by the application reading it and what is actually sent to the sound card (I guess?) is uncompressed raw data. And it would be impossible to get back the original mp3 from that. The best I could have would be the mp3 embedded in WAV or whatever lossless compression such as FLAC.

So far, I'm using Audacity to record sound coming from the computer. However, I'm wondering: does such recording records raw digital data going to the sound card, or does it capture analog data going out of the sound card and converts it back to digital?

Also, this requires to tweak the level of recording in Db in the Pulse Audio Volume Control. Depending on the level of course the final WAV won't be the same, so I don't know how to get a final WAV that would match the one that is originally played.

Well, actually this approach doesn't even work properly for me as the recording in Audacity doesn't have the same pitch. But as I'm not sure this is the correct path in a first place, I would like to know more before trying to debug that.

I don't know whether what I'm trying to do is possible in a first place.

closed as off-topic by dr01, techraf, HalosGhost, countermode, sam Oct 18 '16 at 15:13

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    I'm voting to close this question as off-topic because it is not related to Unix&Linux and would fit more on superuser.com . – dr01 Oct 18 '16 at 14:13
2

On most mid-to-high end soundcards, it is possible to record the live audio mixture being played. That is to say, the sum of all audio tracks being sent to the soundcard DAC. So this is pure digital.

For that purpose, the soundcard driver should provide a "mix" input channel that you can record from in any DAW.

To put it in perspective, this operation can be compared to a screenshot, or a screencast. Indeed, if you display a JPEG picture, a screenshot will give you a raw representation of the JPEG picture , with possibly some distortions from the displaying piece of software (crop, resize, aliase, color profile, etc.), and also anything that is around (other windows) and above (cursor, overlaying windows, transparent shadow of another window). In no way can you get the exact original JPEG file directly by doing a screenshot.

This is the same with audio. The player application can alter the volume, apply equalization, introduce saturation or even glitches if latency problem occurs.

However, if you respect some conditions you can get an exact replication of the audio data :

  • lossless audio file
  • lossless audio player
  • no latency problem
  • same bit depth
  • same sampling frequency
  • only one audio file being played

Then you will only have to edit manually the beginning and the end of the audio recording.

0

If you are already using Pulseaudio: Every sink has a "monitor" source that you can use to get the exact data that's going out from the sink. Assuming that the ALSA driver isn't messing with what it gets from Pulseaudio, that would be exactly what plays on your speakers. You can record that in whatever way and whatever format you want, for example using parec.

If you are using a single application to play sound, very often this application also has options to output to a file instead.

Not the answer you're looking for? Browse other questions tagged or ask your own question.