To compile for the S2 version in PIO, use the following under your platform_override.ini - keep in mind that the pins have been defined for my purple lolin_S2 type of board (easy to get from AliExpress, very common and cheap), your board may have a different pin arrangement and memory (flash and PS) so check and adapt accordingly:
[env:lolin_s2_mini]
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.02.00/platform-espressif32.zip
board = lolin_s2_mini
board_build.f_flash = 80000000L
board_build.flash_mode = qio ; reports dio anyhow
upload_speed = 460800 ;921600
board_build.partitions = tools/WLED_ESP32_4MB_1MB_FS.csv
build_unflags = ${common.build_unflags}
-D USERMOD_DALLASTEMPERATURE ;; disabled because it hangs during usermod setup on -S2 (autodetect broken?)
-D USE_ALT_DISPLAY ;; four line display seems to have problems with I2C - it hangs during usermod setup
-D USERMOD_FOUR_LINE_DISPLAY ;; see above
-D USERMOD_ROTARY_ENCODER_UI ;; see above
-D WLED_DEBUG
-D ARDUINO_USB_CDC_ON_BOOT
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=LolinS2
-D USERMOD_AUDIOREACTIVE
-D I2S_SDPIN=33
-D I2S_WSPIN=35
-D I2S_CKPIN=37
-D SR_FREQ_PROF=2 ;; 0 Default, 1 Line In, 2 for INMP441
-D USERMOD_CUSTOMEFFECTS
-D BOARD_HAS_PSRAM
;-D ARDUINO_USB_CDC_ON_BOOT=0
-D ARDUINO_USB_MSC_ON_BOOT=0
-D ARDUINO_USB_DFU_ON_BOOT=0
-D WLED_USE_PSRAM
-D WLED_DISABLE_INFRARED ;; save flash space
-D WLED_DISABLE_ALEXA ;; save flash space
-D WLED_DISABLE_BROWNOUT_DET
-D WLED_WATCHDOG_TIMEOUT=0
-D CONFIG_ASYNC_TCP_USE_WDT=0
-D LEDPIN=16
-D BTNPIN=0
-D HW_PIN_CLOCKSPI=7
-D HW_PIN_DATASPI=11
-D HW_PIN_MISOSPI=9
; -D STATUSLED=15
lib_deps = ${esp32s2.lib_deps}
https://github.com/blazoncek/arduinoFFT.git ; Needed for Audioreactive Mod on S2 S3 variants due to lack of FPU
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
Also, the above build will support the digital I2S input using the INMP441.