Allow the microphone to be specified when using the 'ffmpeg_microphone' audio pipeline utility function
Author: jrhe
Pull request: no
Labels: name: Feature request

name: Audio

### Feature request

The 'ffmpeg_microphone' audio pipeline utility function currently doesn't allow the user to specify which microphone to use.

### Motivation

`ffmpeg_microphone` sets a microphone based on the operating system. This microphone may not always be the one the user wants to use, or may be a virtual device created by an application. 

I'm using macOS Sonama, where the device defaults to device '0' of type 'avfoundation'. On my machine this corresponds to the 'Microsoft Teams Audio' device where I want to use my Macbook's microphone which is device 1. No idea why Microsoft Teams needs it's own device!

See the following listing from the ffmpeg command:
```❌1 👾 ❯ ffmpeg -f avfoundation -list_devices true -i ""
[...]
[AVFoundation indev @ 0x124e04290] AVFoundation video devices:
[AVFoundation indev @ 0x124e04290] [0] FaceTime HD Camera
[AVFoundation indev @ 0x124e04290] [1] J’s phone Desk View Camera
[AVFoundation indev @ 0x124e04290] [2] Capture screen 0
[AVFoundation indev @ 0x124e04290] AVFoundation audio devices:
[AVFoundation indev @ 0x124e04290] [0] Microsoft Teams Audio
[AVFoundation indev @ 0x124e04290] [1] MacBook Pro Microphone
[AVFoundation indev @ 0x124e04290] [2] J’s phone Microphone
[...]
```


### Your contribution

I'm can submit a PR to add this functionality, but want to get agreement on the function interface changes first.

I'm unsure if it's enough to allow the ffmpeg input device parameter '-i' to be changed, or if the format '-f' parameter might also need to be changed in some cases. I don't think that mac supports anything except AVFoundation so just the input device would be sufficient for my use case. Unsure about Linux and Windows.

Just adding a parameter would be simplest:
```def ffmpeg_microphone(
    sampling_rate: int,
    chunk_length_s: float,
    format_for_conversion: str = "f32le",
    ffmpeg_input_device: Optional[str] = None,
):```

Alternatively we could allow users to specify arbitrary ffmpeg command line options to override:
```def ffmpeg_microphone(
    sampling_rate: int,
    chunk_length_s: float,
    format_for_conversion: str = "f32le",
    ffmpeg_options: Optional[List[str]] = None,
):```

The function parameters would also need to be specified on the `ffmpeg_microphone_live` function and passed through.

Comments:
cc @kamilakesbi @sanchit-gandhi 

Hi @jrhe, 

Thanks for submitting this issue! 

There are indeed several requests to allow specifying the microphone in `ffmpeg_microphone' (see issues #31393 / #31074 / #28154). 

It would be really nice if you could add this functionality with a PR. Perhaps you could include the changes suggested by @ruisilvestre in PR #31393 to select the default microphone by default (using `:default` instead of `:0`) and only change it if specified by the user. 

Unfortunately, I'm also a Mac user. So far I haven't seen any issues with Linux/Windows, so it might be best to start with the first approach you suggested (just change the ffmepg input device parameter `-i`), and do a follow-up PR if there are new requests.