 This video is going to be a little awkward to shoot because I want you guys to be able to see what I'm doing But I also want to show you what's going on on the screen over here So we're going to try to do some screen-to-screen action here But what we're looking at today is how to from the shell so you can do it in a shell script or just from from your shell Your command prompt Record audio from multiple audio devices. I have multiple audio devices hooked up to machine some of them are disabled But currently active I have my USB microphone here I have this USB headset here, which also has a microphone and then I have my analog just audio card in there which obviously has inputs and outputs and So how can we record? from maybe these two microphones at the same time to individual files so I can layer on mix them together and that's what we're going to be looking at today. So the first thing we do is look at our audio devices and Also see what's available from those because you have multiple options like instead just recording from this microphone We can record the output to the headphones too, which we'll look at in a second But we're going to start off with this command. Let's see. It's Look at my notes here. So it's PACMD, so I'm using pulse audio. I should probably say that so in this particular scenario We're using pulse audio, which is very common on most Linux desktop systems for audio and And we can use this PA for pulse audio CMD. So pulse audio command We're going to say list source outputs and we're going to enter and it gives us a bunch of information about all our audio cards But that's a little overkill. What we want to do is we want to narrow that down So we're going to grep and we're going to look for just lines that say source and Cullen in this case sensitive there. So Let's see So that now is down a little bit more now You'll notice, you know, even though I say I have three devices set up currently your seat. We're seeing five zero through four here Devices listed and you'll notice certain things like these first two I have almost identical names This one's a USB C media electronics Incorporated but one says output and one says input both of those are this USB Headphones set But one is the microphone the one that's labeled input is the microphone where again the output is the output going to this audio So if I'm playing music or a video or something some audio out to this headset I can say record whatever audio is going to this headset So that's one way to record audio from the output of different programs Although that's every program that's being played to this headset in future videos We might go over recording individually from certain applications So you might have three applications making audio, but you're only recording from one But that's the difference between those two is the input is the microphone the output is what's going to this device So let's just start off with microphones. So we're gonna add to that same command We're gonna pipe in we're gonna let's say we'll sort unique and then we'll grep for input and Oops, sorry Grep for input and there you go. We get three devices. So we have Number one there is my USB headphones. The second one is the analog audio card in my computer Actually, it's the on the motherboard and then my other USB microphone here So if we want to record from one of those we can choose to a using FFM peg So I'm gonna say FFM peg and right now I should be in an empty directory So FFM peg and I'm gonna say dash F pulse meaning that we're using pulse audios audio interface because pulse audio actually runs on top of other Audio Processes but right now we're focusing on pulse audio and I'm gonna say dash I for the input that we want and that would be this Number so whatever source it is. So let's say we want to record from my headphones here That's a number one here. So let's go ahead and say one and Then we want to map that Think of the mapping as like a track if you were using a multi-track recorder so we say map zero and Then what file we want to output to I'll say zero dot MP3 in this case But you can use whatever file format FFM peg saves to and I hit enter It's gonna start recording as you can see I go. Hello. Hello. Hello tap tap And then I'll hit control C does finish that actually Q might be a better option than control C for that But it's not a big deal either way, and I'll just use MPV. I'll say MPV Dot zero dot MP3 and I can play that file That was that microphone and now if I wanted to record let me go ahead and delete that file MP3 and I'm gonna run that same command, but now I can give it another input So I'm gonna say dash F again for pulse because I'm still using I mean you can record from multiple different audio divide Processes if you want I guess but again, we're saying pulse. I'm gonna say dash I and I Let me list out my inputs again. So Running this command again. So again dash F pulse Dash I for input and this time we'll do my other USB microphone will say for for input for it'll say dash map One so I'll be our next track there and we're gonna say one dot MP3 And now I hit enter it's recording from both these devices. So I can go test test test one two three Test test test one two three and if I hit Q this time I now should be able to list out and see that I have two files there and I think quickly use Audacity I can say audacity that MP3 zero that MP3 and then I will say discard that last project Yes, and then I'll say import audio and I'll choose the other audio file and you can see I have this top track is from my headphones and the bottom track Here is from the other microphone, and if I play them together And you can see the difference in the audio files In this top one when I was closer to that microphone, it's louder when I was closer to the other microphone It was louder now do keep in mind That although this seems synced up if you're using different devices I mean these are two different devices from different companies. They might record at different sample rates You might get out of sync after a while So play around with see what happens with your devices But I mean if you're trying to record a whole song and you got a whole band and you're using different types of input It might not sync up just a warning to you there Unless you have equipment that's meant to work together or similar enough So there's the example of that. I've got the two microphones there I don't have a microphone hooked up to the input on my onboard audio, but let's go ahead and Show you let me see Try and think of another example and again you can continue adding more and more to devices, but if I was to again list out all my Inputs and then I can also list out my outputs here There we go, so again I can play audio out to my headphones or out to my speakers through my internal Sound device and I record the audio going from there So if you wanted to record the audio going out from the device Usually there's better ways to do that like if you're trying to rip audio from like a YouTube video you're very often using YouTube DL to download the audio download the file and Pull out the audio and then convert to whatever format you want rather than doing it this way but for some reason You needed to record the audio Output from a device for whatever reason leaders quick and dirty You don't know how to download the file and you just want to record the audio It's the same exact setup except for you just change the source number to one of these outputs So if I want to record the audio output of my headphones here, I can just do this I can say instead of input one, which was the microphone on here. I can say input zero And I can say map it to one and I can give it, you know, I've named the MP3 or wave file Whatever I want we can say Headphones wave if I wanted and of course you can give it more parameters Exactly how you want to format the output of the wave or MP3 or or flak file or whatever you want But go ahead and enter there and now it's actually recording the audio going out So if I was to play audio on this with with whatever as long as it's going to that device because I can switch between my different speakers If it's going to the headset it'll record it there So I can press play on like five different applications and the audio is playing out that headset It would now be recorded to that. I'll try to put a link in the description to my notes on here And go ahead check that out. So if you're using pulse audio and you need to write a script that's going to record from multiple microphones Maybe you're just going to do a quick interview with somebody and you want to record your microphone and that or Or you're I don't know talking to someone on Google Hangouts or some other chat program where you can do voice talking And you want to be able to record it real quick with a script You can write a script and click and you can record the their audio So if I was hang outing or Skyping or whatever program you use With somebody and I want to record the audio separate I can record my voice from the microphone and their audio out to here to separate files And that way later on when I'm mixing it together I can adjust the volumes and our voices are on separate tracks, which is nice Which of course you can do with a lot of different programs Especially if you're running a jack D on your system if you do a lot of music Creation you probably have jack D on there, which is great. And yeah, you can use audacity or Hard or or some multi-track recorder But if you just wanted to have a quick little script you can click and it starts recording from set devices You can use this in a script. I thank you for watching. Please visit films by Chris calm That's Chris the K. There's a link in the description also link in the description to these notes on what we just did Also, please visit my website my patreon site patreon.com for slash my likes 1,000 I appreciate your support. You can also support me on my website through pay pay pal or Patreon and you can sort through all my videos from both my channels on my my website films by Chris calm I thank you for watching and as always I hope that you have a great day