Question: As mentioned in the title, I'm unable to simultaneously record my headset microphone *and* my desktop audio when using SimpleScreenRecorder in KDE Neon 5.24.

In the "Audio Input" section of the recording settings, I selected "PulseAudio" as **Backend**, whereas for **Source** I've tried both "Built-in Audio Analog Stereo" as well as "Monitor of Built-in Audio Analog Stereo" (see below):

[![enter image description here](https://i.stack.imgur.com/Iagkh.png)](https://i.stack.imgur.com/Iagkh.png)

When selecting "Built-in Audio Analog Stereo", the microphone gets recorded but the desktop audio does not, while the situation is exactly the opposite when I select "Monitor of Built-in Audio Analog Stereo" (can record desktop audio but not headset microphone).

Does anybody have an idea of how to solve this issue?

Answer: 
With the [standard `paste` command](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/paste.html):

```
$ paste -sd ',,\n\0' file
St1,number1,1234
St2,number2,456

```

`s`erially `paste`s the lines of `file` with `,`, `,`, *newline*, *nothing* (not a NUL character as one might think) as `d`elimiters in turn.

Or:

```
$ paste -d ',,\0' - - - - < file
St1,number1,1234
St2,number2,456

```

`paste`s stdin 4 times with `,`, `,` and *nothing* as `d`elimiters between them.
Making use of paragraph mode (-00) in Perl:

```bsh
perl -pals -F'\n' -00e 's/.*/@F/s' -- -\"=, file

```

---

Perl in line by line mode:

```bsh
perl -pe '
  chomp($_.=<>.<>),tr/\n/,/ if/./;
  eof && s/.\K$/\n/;
' file

```

---

POSIXly sed :

```bsh
sed '
  /./{H;$!d;}
  x;y/\n/,/;s/.//
' file

```

---

We can do this using `GNU csplit + xargs paste` pipeline

```bsh
csplit --suppress-matched -sz file '/^$/' '{*}'
printf '%s\n' xx* | xargs -r paste -sd,

```

---

Using `groupby` method from the `itertools` module in Python along with list comprehension:

```bsh

python3 -c 'import sys, itertools as it

ofs,(rs,ors) = ",","\n" * 2
g = lambda x: not len(x)
h = lambda x: x.rstrip(rs)

with open(sys.argv[1]) as f:
  print(*[ofs.join(igrp) for k,igrp in it.groupby(map(h,f),g) if not k],sep=ors)
' file

```

---

Output:-

```
St1,number1,1234
St2,number2,456

```

---