Forked from varqox/recording_application_and_microphone.md
Created
April 6, 2021 12:42
-
-
Save vaimr/503c6276eeb49b2f90cdea82bc62f84a to your computer and use it in GitHub Desktop.
Revisions
-
varqox revised this gist
Oct 17, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,6 +27,8 @@ pacmd load-module module-combine-sink sink_name=combined sink_properties=device. ``` ## Step 3. Attach microphone to `recording` sink _Protip: If you ommit this step you may record multiple apps without microphone._ First we have to locate our microphone as a source: ```sh pacmd list-sources | egrep '^\s+name: .*' | grep input @@ -40,7 +42,6 @@ Now we attach it to `redording` sink: ```sh pacmd load-module module-loopback source=alsa_input.pci-0000_00_1f.3.analog-stereo sink=recording latency_msec=1 ``` ## Step 4. Channel applications through the `combined` sink to record them (this step can be done after step 5. -- you can change what apps you record without stopping recording) Open `pavucontrol`, go to `Playback` tab and change sink to `combined`. _Hint: the application won't appear there unless it is producing sound._ -
varqox revised this gist
Dec 28, 2019 . No changes.There are no files selected for viewing
-
varqox revised this gist
Dec 28, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,6 +44,7 @@ _Protip: If you ommit this step you may record multiple apps without microphone. ## Step 4. Channel applications through the `combined` sink to record them (this step can be done after step 5. -- you can change what apps you record without stopping recording) Open `pavucontrol`, go to `Playback` tab and change sink to `combined`. _Hint: the application won't appear there unless it is producing sound._  ## Step 5. Record audio -
varqox revised this gist
Dec 28, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,7 +44,7 @@ _Protip: If you ommit this step you may record multiple apps without microphone. ## Step 4. Channel applications through the `combined` sink to record them (this step can be done after step 5. -- you can change what apps you record without stopping recording) Open `pavucontrol`, go to `Playback` tab and change sink to `combined`. _Hint: the application won't appear there unless it is producing sound._  ## Step 5. Record audio With the above setup, you can start and stop recording at any time. To record `recording` sink, use: -
varqox created this gist
Dec 28, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ # How to record multiple applications and microphone into one audio file on Linux ## Step 0. Terminology Sinks are for output, sources are for input. To stream source to sink a loopback must be created. More shall you find [there](https://gavv.github.io/articles/pulseaudio-under-the-hood/#key-abstractions). ## Step 1. Create output sink that will be recorded Our output sink will be named `recording`. ```sh pacmd load-module module-null-sink sink_name=recording sink_properties=device.description=recording ``` ## Step 2. Create output sink that will forward data to `recording` and the default sink -- your headphones (using speakers is not a good idea because they will be recorded by microphone for the second time) First we have to locate our output sink: ```sh pacmd list-sinks | egrep '^\s+name: .*' ``` For me it prints: ``` name: <alsa_output.pci-0000_00_1f.3.analog-stereo> name: <bluez_sink.4C_87_5D_07_5B_C4.a2dp_sink> ``` So I choose `bluez_sink.4C_87_5D_07_5B_C4.a2dp_sink` as my output sink because its my headphones (the other represents my speakers). Now we can combine it with our new `recording` sink into `combined` sink: ```sh pacmd load-module module-combine-sink sink_name=combined sink_properties=device.description=combined slaves=recording,bluez_sink.4C_87_5D_07_5B_C4.a2dp_sink ``` ## Step 3. Attach microphone to `recording` sink First we have to locate our microphone as a source: ```sh pacmd list-sources | egrep '^\s+name: .*' | grep input ``` For me it produced: ``` name: <alsa_input.pci-0000_00_1f.3.analog-stereo> ``` So `alsa_input.pci-0000_00_1f.3.analog-stereo` represents my microphone. Now we attach it to `redording` sink: ```sh pacmd load-module module-loopback source=alsa_input.pci-0000_00_1f.3.analog-stereo sink=recording latency_msec=1 ``` _Protip: If you ommit this step you may record multiple apps without microphone._ ## Step 4. Channel applications through the `combined` sink to record them (this step can be done after step 5. -- you can change what apps you record without stopping recording) Open `pavucontrol`, go to `Playback` tab and change sink to `combined`. _Hint: the application won't appear there unless it is producing sound._ TODO: add screenshots ## Step 5. Record audio With the above setup, you can start and stop recording at any time. To record `recording` sink, use: ```sh parecord --channels=2 -d recording.monitor output.wav ``` It will save recording to `output.wav` file. To stop recording press `Crtl-C` (kill the parecord with SIGINT). _Protip: You can change recorded applications while recording by controlling which ones output to `combined` sink as was shown in step 4._