BioSonix journal

ESPERDYNE Updated V1.2 - Now with USB Functionality in Integrated Firmware

One instrument for field listening, ultrasound recording and USB audio. Esperdyne V1.2 adds microphone, speaker and full-duplex operation for computers, iPhones and iPads, while retaining its standalone field functions.

· Ravi Umadi· 15 min read

Esperdyne began as a portable instrument for listening to ultrasound and saving the sounds that prompted a closer look. With V1.2, the same device also becomes a USB microphone, a USB playback device or a full-duplex audio interface. Full duplex means that it can record microphone input and play sound from a host at the same time.

This makes one build useful across several parts of a bioacoustics project: listening for bats in the field, recording into an iPad, playing experimental sounds from a computer, and collecting short recordings on microSD without a computer at all. The integrated firmware keeps both normal and USB operation available; a simple startup gesture selects which to use.

If you already have Esperdyne, you may not need to buy a separate USB sound card for these tasks. Its ADC, DAC and microphones can serve as the computer’s audio input and output. For someone building a research toolkit from hobby electronics, that is a useful saving in cost, equipment and duplicated hardware.

Download the one-page operating manual (PDF) · Firmware and build guide · Esperdyne project

Archived V1.2 release: Download from Zenodo — doi:10.5281/zenodo.24649023.

GitHub repository: Embedded Ultrasonics — Esperdyne source code, hardware and documentation.

Esperdyne connected to Chirps on an iPad in USB duplex mode, with an inset showing the handheld instrument in normal heterodyne mode
Esperdyne working with Chirps on iPad in 96 kHz stereo USB duplex mode. Inset: the same instrument held in normal heterodyne mode.

What has changed?

V1.2 retains the two microphone inputs, independent heterodyne tuning and five-second recording buffer. It adds audible-range pass-through listening, live level indicators, and USB Audio Class 2.0 operation using Phil Schatzmann’s AudioTools library with the supplied firmware patches.

There are three USB roles:

  • Microphone: send audio from Esperdyne’s microphones to the host for recording or analysis.
  • Speaker: send audio from the host to Esperdyne’s DAC for headphone listening or onward connection to a playback system.
  • Full duplex: use microphone input and playback together, as with a regular external sound card.

The role and format are chosen before flashing, in the firmware configuration. The knob selects normal or USB operation at startup; it does not change the USB profile.

USB format Microphone only Speaker only Full duplex
48 kHz stereo Yes Yes Yes
96 kHz stereo Yes Yes Yes
192 kHz mono Yes Yes Yes
192 kHz stereo Yes Yes —

All profiles use 16-bit samples. Stereo full duplex is available at 48 and 96 kHz; at 192 kHz, choose mono duplex or stereo in one direction. Stereo 192 kHz full duplex exceeds the ESP32-S3’s full-speed USB bandwidth.

Bit depth: the current firmware uses 16 bits

The supplied firmware uses 16-bit audio, including its USB profiles and standalone WAV recordings. The WM8782 also supports 20-bit and 24-bit output, but these higher bit depths are not implemented in V1.2. The present signal path therefore does not retain the ADC’s full available word length. This can matter when greater recording dynamic range is needed, although the practical benefit also depends on microphone noise, analogue circuitry and input level.

Increasing the bit depth is possible as a further development, but requires technical expertise: the ADC’s hardware word-length setting, I2S configuration, sample handling, USB descriptors and packet sizes must agree. Standalone recording would also need corresponding buffer and WAV-format changes. Higher bit depths increase data flow and memory use, so the combination of sample rate, channel count and input/output directions must remain within USB bandwidth and buffering limits. A format that works at 16 bits cannot simply be assumed to work at 24 bits. Saving a 16-bit USB stream into a 24-bit file on the host does not recover the additional ADC information.

Choose the rate for the sounds you need to measure. The theoretical upper frequency limits are 24, 48 and 96 kHz for sampling at 48, 96 and 192 kHz respectively; usable bandwidth also depends on the microphones, analogue circuitry and filters. A high sampling rate does not make an ordinary microphone sensitive to ultrasound.

The profiles have been tested on the development hardware, including left/right playback, recording and volume control. Selected profiles have also worked with Chirps on iPad, including 96 kHz stereo duplex. See the validation guide for the tested configurations and platform coverage.

Start in USB mode

  1. Install the profile you need. Follow the V1.2 build guide and use its supplied patched AudioTools library. For stereo recording and playback together, 96 kHz stereo duplex is a useful choice. For ultrasound capture to 192 kHz with simultaneous playback, choose mono duplex.
  2. Match the ADC hardware rate. The WM8782’s FSAMPEN setting must match capture: low for 48 kHz, high for 96 kHz, or high-impedance for 192 kHz. This is a hardware setting, not an on-screen option.
  3. Hold the rotary knob down and turn on the power switch. Alternatively, hold it while pressing RESET/EN.
  4. When the display says ESPERDYNE USB / RELEASE THE KNOB, release the knob. USB audio starts after release.
  5. Connect the native USB port to your computer or mobile device with a data-capable cable. Use the ESP32-S3’s USB/OTG connector, rather than the separate COM/UART programming connector.
  6. Select Esperdyne as the input and/or output in your recording software. Check the active sample rate and channel layout before recording or playback.

To return to normal operation, restart with the rotary knob released. Normal mode always captures at 192 kHz, so restore the WM8782’s 192 kHz hardware setting if you changed it for USB use.

Prefer USB at power-on? Customise the startup order

The steps above describe the source-default build, which starts in normal standalone mode. If you mainly use Esperdyne as a USB audio interface, you can make USB the default before flashing. Set ESPERDYNE_DEFAULT_USB in EsperdyneConfig.h to 1, or use the build helper’s --boot usb option. Keep it at 0 (or --boot normal) for normal standalone startup.

Startup setting Power on with knob released Hold the knob during power-on/reset
Normal default (0) Normal mode USB mode after release
USB default (1) USB mode Normal mode after release

Holding the knob always selects the other mode. The selection stays latched while you hold it; release at the prompt to start. In a USB-default build, selecting normal mode shows ESPERDYNE / RELEASE THE KNOB. USB-default operation needs neither a startup press nor an SD card; normal mode still needs microSD and the ADC set to 192 kHz.

This is independent of the USB microphone/speaker/duplex profile and sample rate. It is particularly convenient for a USB-only build, while retaining access to standalone operation on hardware equipped for it. See the startup configuration guide.

In the 192 kHz stereo microphone profile, native USB exposes audio without a serial programming port. To upload again through that connector, hold the ESP32’s BOOT button, tap RESET/EN, then release BOOT. This is different from holding the rotary knob to enter USB audio mode.

Read the activity bars and control playback

The narrow solid bars at the left and right screen edges show microphone input activity. Dotted bars show playback output. Microphone mode uses solid bars, speaker mode uses dotted bars, and full duplex shows both beside one another. These live indicators help confirm that signals are reaching the device; they are not calibrated sound-pressure meters.

In speaker and duplex modes, turn the rotary knob to adjust local playback volume. A VOLUME screen appears with a filling bar and percentage. Each click changes it by 5%, stopping at 0% and 100%. The status screen returns after a short pause.

This control is independent of the computer’s volume setting: both affect the final output. Start playback quietly. In USB mode, software on the host provides any microphone monitoring or heterodyne processing; Esperdyne does not directly route its USB microphone input to its headphones.

Use it with Chirps in the field

Chirps is my bioacoustics app for iPhone and iPad. Connect Esperdyne in a microphone or full-duplex profile to turn the mobile device into the recording and visualisation interface, with live spectrograms, waveforms and app-controlled WAV recording.

Connect before starting the stream. In Settings → Input, select Esperdyne, choose the input channel and matching sample rate, then start the stream. Confirm the actual running rate in the app’s diagnostics. Chirps currently captures one selected input channel at a time, including when a stereo interface is connected. Its input and hardware guide explains channel selection and connection details.

For listening through Esperdyne’s headphone output, use a duplex profile, check that iOS has selected Esperdyne as the output, and enable the desired monitoring mode in Chirps. The solid bars show input, and dotted bars show returned playback.

USB-C iPads have worked in development testing. Lightning iPhones need a compatible USB host adapter and adequate power; a cable that merely fits the connector is not sufficient. Verify the connection and active audio route before a field session.

Build recording and playback experiments

On a computer, Esperdyne can act as the sound card for MATLAB or Python experiments. A script can generate a stimulus, send it to the DAC and capture the microphone response in duplex mode. Speaker-only is useful when playback is the whole task; microphone-only suits recording without a playback path.

For example, use 48 kHz stereo duplex for audible stimuli and two-channel recording, or 96 kHz stereo duplex when the required frequency range extends higher. Choose 192 kHz microphone-only for stereo ultrasound recording, or 192 kHz mono duplex for simultaneous single-channel input and output.

Connect the PCM5102 DAC output to a suitable power amplifier to drive your loudspeakers. The DAC output is not a power loudspeaker output. For ultrasonic playback, the amplifier and loudspeaker must also support the intended frequencies; the sample rate alone cannot establish playback bandwidth.

Before an experiment, verify channel routing, clipping, acoustic output and timing with a test recording. A duplex USB connection does not by itself establish calibrated playback level or sample-exact acoustic timing. These checks matter when comparing animal responses or estimating delays.

Choose microphones for your application

The WM8782 accepts analogue inputs, so Esperdyne is not tied to the original analogue MEMS microphones. You can adapt the inputs for microphones suited to birds, frogs, insects, bats or other sounds, provided their bandwidth and electrical requirements match the application.

Changing microphones requires some electronics knowledge: check supply voltage, biasing, signal level, coupling, impedance and any preamplifier or input-conditioning requirements. A replacement is not necessarily a direct pin-for-pin swap, and digital I2S microphones cannot simply replace the analogue inputs. Microphones requiring phantom power need appropriate external circuitry; the WM8782 does not supply it.

This flexibility lets you retain the USB and recording functions while changing the acoustic front end. Choose the microphone for the biological question, then choose a sampling rate that preserves the frequencies it can usefully capture.

A USB-only build can omit the battery

If the instrument will only be used as a USB device, a battery is optional. The ESP32-S3’s native USB port can provide the data connection and host power for a suitably wired build.

Make sure the ADC, DAC, display and microphone circuitry receive their required supplies from the USB-powered arrangement, with sufficient current available. In the original portable wiring, connecting USB to the ESP32 does not necessarily power every peripheral. Do not assume that removing the battery alone completes the conversion. External speaker amplifiers may need their own supply.

For a portable instrument that also works independently of a host, retain the battery and power switch.

Back to standalone field recording

Once the computer work is finished, restore the 192 kHz ADC setting and insert a microSD card. Start with the knob released on a normal-default build; on a USB-default build, hold it during power-on and release at the normal-mode prompt. It is again a portable listener and recorder for animal sounds, including birds and bats within the microphone’s useful range.

The four listening modes are MX-HT, ST-HT, MX-PT and ST-PT: mixed or stereo heterodyne, and mixed or stereo pass-through. Heterodyne shifts a selected ultrasonic band into the audible range. Pass-through lets you hear audible sounds without that frequency translation.

Press RECORD to save the previous five seconds of original stereo input as a 192 kHz, 16-bit WAV file. The listening effect does not alter those saved samples. This short buffered recording is useful when a call attracts your attention before you press the button. It is not an unattended continuous recorder: capture pauses while each clip is written to SD.

Bat calls recorded in Belgaum district, Karnataka: a full five-second spectrogram and three enlarged calls with waveforms
A bat recorded with Esperdyne in Belgaum district, Karnataka. The upper panel shows five seconds from one channel; A–C show individual calls. The spectrograms share a relative colour scale and the waveforms preserve the original amplitudes.

Download the original stereo WAV (5 seconds; 192 kHz, 16-bit PCM; approximately 3.8 MB). This is the unmodified recording used for the figure; channel 2 is shown. Open the downloaded file in Spectra to inspect both channels and try heterodyne playback.

Browse your recordings with Spectra

Open the recorded WAV files in Spectra, my browser tool for inspecting bioacoustic recordings. Browse files or folders, adjust spectrogram settings, inspect spectra and export PNG figures. Normal and heterodyne playback help you listen to audible recordings and ultrasonic activity. The Spectra guide explains the workflow.

This connects the different uses of the instrument: collect a short clip on microSD, record through Chirps, or capture an experiment on a computer, then inspect the resulting files with the same analysis tools.

Firmware, operating guide and papers

Esperdyne remains an open-source instrument built from accessible hobby electronic components. V1.2 makes those components useful for more of the work around a recording: finding the sound, capturing it, playing stimuli and examining the data. For many projects, the instrument you carry into the field can now also be the audio interface you use at the desk.

If this work helps your research or teaching, you can support its continued development.