# Recording from Stereo Mix and microphone simultaneously

**URL:** https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927
**Category:** FMOD Studio
**Created:** [January 10, 2017, 10:42pm UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927 "2017-01-10T22:42:50Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 10, 2017, 10:42pm UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/1 "2017-01-10T22:42:50Z")

</div>

I’ve just implemented audio recording for the purpose of merging the Stereo Mix output with captured video to produce a complete movie of gameplay.

I create a new FMOD::Sound and then use FMOD::System::recordStart to write the output to it. Poll with getRecordPosition and encode to mp3 when there’s enough data.

We’d now like to also record the output of the microphone and merge that with the video and Stereo Mix, to support voice overs. The Stereo Mix volume would be reduced so the voice over could be clearly heard. This would be useful for making tutorials, as well as in-game support for Let’s Play videos.

When I call recordStart for the microphone driver id as well, it returns FMOD\_ERR\_RECORD. If I call it for the microphone without calling it for the stereo mix first, I can capture the mic fine.

Is this an absolute limitation of FMod that prevents recording of more than once device at a time?

I am working in Windows only at the moment, so the next step would be to attempt to use the Waveform-Audio recording interface instead. Are there any issues with using this along-side FMod?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 12, 2017, 12:09am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/2 "2017-01-12T00:09:07Z")

</div>

> [@](#):
>
> I’ve just implemented audio recording for the purpose of merging the Stereo Mix output with captured video to produce a complete movie of gameplay.
> 
> I create a new FMOD::Sound and then use FMOD::System::recordStart to write the output to it. Poll with getRecordPosition and encode to mp3 when there’s enough data.
> 
> We’d now like to also record the output of the microphone and merge that with the video and Stereo Mix, to support voice overs. The Stereo Mix volume would be reduced so the voice over could be clearly heard. This would be useful for making tutorials, as well as in-game support for Let’s Play videos.
> 
> When I call recordStart for the microphone driver id as well, it returns FMOD\_ERR\_RECORD. If I call it for the microphone without calling it for the stereo mix first, I can capture the mic fine.
> 
> Is this an absolute limitation of FMod that prevents recording of more than once device at a time?
> 
> I am working in Windows only at the moment, so the next step would be to attempt to use the Waveform-Audio recording interface instead. Are there any issues with using this along-side FMod?

Are you trying to do this with a non-fmod game? If the game was written with fmod you wouldnt need to use recording of stereo mix, but just insert a capture DSP into the game’s DSP signal chain.

---

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 12, 2017, 12:30am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/3 "2017-01-12T00:30:20Z")

</div>

No, it’s using FMod. Are you saying if I use a capture DSP I can record from the mic at the same time?

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 14, 2017, 6:57am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/4 "2017-01-14T06:57:05Z")

</div>

Yes, you should avoid stereo mix if you want to have it run on more than 1 machine. it is purer (ie you get the direct, unmixed signal from the game) if you put a capture dsp at the head of the signal (ie System::getMasterChannelGroup, ChannelGroup::addDSP). Then all you should have is a single mic being used as normal.

---

<div class="post-metadata">

### Author: ![Kryofenix](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kryofenix](https://qa.fmod.com/u/Kryofenix)
#### Post date: [January 11, 2017, 2:08pm UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/5 "2017-01-11T14:08:12Z")

</div>

I know it’s not a direct answer to your question, but i’m really interested in how you managed to reliably capture Stereo Mix. I’m using WASAPI and capturing it is not so much a problem but playing it back in a FMOD::Sound while i’m capturing has proven to come with a ton of problems no matter the approach i take. I would love to hear how you did it.

---

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 11, 2017, 8:22pm UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/6 "2017-01-11T20:22:15Z")

</div>

Hi Samuel,

It’s pretty much as I describe it above. I’m selecting the stereo mix driver, calling recordStart with that driver id, which sends data to the Sound object passed. I then poll the recording with getRecordPosition and use lock/unlock to extract the PCM data in my update loop. The Sound is not playing simultaneously, it’s just receiving the data.

The core of it I took from the output\_mp3 sample. I just had to change where it got the data and how it decided to encode and write a new chunk. I made the Sound object a discrete number of chunk samples in length (20\*2304 for now) and when getRecordPosition passes another 2304 sample boundary I encode and write that chunk.

Hope that helps.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 12, 2017, 12:58am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/7 "2017-01-12T00:58:23Z")

</div>

You can record simultaneously from multiple record devices, but not all record devices can record into the correct format (ie spdif in for example).  
My own test allowed 2 out of 4 devices in my control panel to record at the same time (a webcam and sb audigy mic input)

Check the log when an error happens, ie I get AUDCLNT\_E\_DEVICE\_IN\_USE on one device.

---

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 12, 2017, 1:28am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/8 "2017-01-12T01:28:35Z")

</div>

> [@](#):
>
> You can record simultaneously from multiple record devices, but not all record devices can record into the correct format (ie spdif in for example).  
> My own test allowed 2 out of 4 devices in my control panel to record at the same time (a webcam and sb audigy mic input)
> 
> Check the log when an error happens, ie I get AUDCLNT\_E\_DEVICE\_IN\_USE on one device.

They record fine independently, so I don’t think it’s an unsupported format issue. I did try to use the Waveform-Audio mic recording and that behaved in the same way: one or the other worked, but not both at the same time.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 12, 2017, 1:56am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/9 "2017-01-12T01:56:32Z")

</div>

You asked if there was a limitation and the answer was no, there’s not, so multiple device recording is available. If there is an error please check the log (using fmodL.dll for example) and we can determine why there is an error. It is most likely going to be device or OS (or format) related. OUTPUT\_DSOUND mode is an alternative to try in this case.

---

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 13, 2017, 5:05am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/10 "2017-01-13T05:05:55Z")

</div>

This is what I get and I don’t know how to interpret it. It doesn’t seem to match any of the AUDCLNT\_E\_ codes, and doesn’t make sense as bit flags. Any idea?

[ERR] OutputWASAPI::recordStart : IAudioClient::Initialize returned 8007001F.

---

<div class="post-metadata">

### Author: ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)
#### Post date: [January 13, 2017, 10:41pm UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/11 "2017-01-13T22:41:50Z")

</div>

Hi Tim,  
The error is listed here [https://msdn.microsoft.com/en-us/library/windows/desktop/dd319335(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/windows/desktop/dd319335(v=vs.85).aspx)

ERROR\_GEN\_FAILURE  
0x8007001F  
May be used to indicate that the device has stopped responding (hung) or a general failure has occurred on the device. The device may need to be manually reset.

---

<div class="post-metadata">

### Author: ![tauld](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@tauld](https://qa.fmod.com/u/tauld)
#### Post date: [January 14, 2017, 4:50am UTC](https://qa.fmod.com/t/recording-from-stereo-mix-and-microphone-simultaneously/12927/12 "2017-01-14T04:50:38Z")

</div>

Right, thanks. Sounds serious. I tried using setOutput(FMOD\_OUTPUTTYPE\_DSOUND). The behavior is the same but there is no error in the log.

Is it worth trying the DSP approach for stereo mix while using recordStart for the microphone?
