Capturing Window's audio in C#

后端 未结 3 835
無奈伤痛
無奈伤痛 2020-12-15 00:19

Is it possible to record Window\'s output sounds programmatically in C#? A bit like recording something from the \"what you hear\" or \"stereo output\" feature (without havi

3条回答
  •  天涯浪人
    2020-12-15 01:05

    This is called loopback recording, and it is possible in Windows. If you have a soundcard that supports loopback (I just checked on my low-end Toshiba laptop, and it doesn't) you can record straight from the loopback device using the waveInOpen etc. API, which is easy to use in C#. Note: recording audio in this way necessarily entails a reduction in quality, since the audio signal is converted to analog for output and then re-digitized to support the loopback interface.

    If you don't have a soundcard, WASAPI will let you do this. I suppose WASAPI can be used with C#, but it looks painful.

提交回复
热议问题