2 Answers
I don’t see any reason why not. All you have to do is use the ADC to convert the audio to digital data and send that somewhere (Doesn’t matter how you send it. It’s just data) where the data is converted back to audio.
There are, of course, some issues. The ADC on the ESP32 is only 8 bits so the audio quality would be terrible. You would need an external (Maybe I2S) 16bit+ at 96KHz sample rate ADC.
At any rate you can start exploring different options with this info. Good luck.