There are different ESP32 Audio boards available that can be programmed with the Espressif ADF Framework. The ADF Framework contains an abstraction layer to support different codec audio chips (ES8388 ...
Default value for maximum measurement distance is 4m, since HC-SR04 sensor can't measure reliably beyond that. However, if you are using another sensor or if you you don't care about distances larger ...