8 reasons to use Bpod's new HiFi module

Share this on: 


Bpod now has a scalable solution for precision psychoacoustics.

Delivering precise audio stimuli with Bpod has been a frustrating experience for many in our user community. Our existing solutions had either lacked industry standard audio quality, or relied on a non-realtime computing environment to trigger PC sound cards. We measured timing characteristics of audio playback in the latter case, but updates to the non-realtime operating systems and software dependencies affected timing properties of sound playback in ways we couldn't predict or control. The ideal audio solution would not have to be re-characterized each time an OS or software dependency is updated.

We designed the new Bpod HiFi Module HD to fulfill this need. It uses PJRC's lightning-fast Teensy 4.1 microcontroller platform to directly control DAC2 HD, a new high resolution sound card developed by HiFiBerry for Raspberry Pi. Interfacing these two incredible pieces of hardware was not trivial - but we think it was well worth the trouble.

Here are 8 reasons why:

1. Its timing precision is unmatched. When a sound is triggered by the Bpod finite state machine, 192kHz stereo playback begins after only 0.22 ± 0.01ms - less than the width of an action potential. Importantly, the same latency and jitter also apply when an ongoing sound is stopped. The following plot shows sound onset latency from a test run of 10,000 trials (all trials shown):

2. It does not require down-time. In experiments with multiple trials, the next trial's sound set can be loaded to the device without interrupting playback or affecting the current sound set. This enables experiments with continuous behavioral data acquisition if used with our TrialManager class or Brody Lab's BControl.

3. An isolated TTL output provides audio sync to other instruments. The HiFi module's Arduino-language firmware has the ability to set a digital output line in synchrony with audio sampling. An advanced isolator IC (Analog Devices ADUM6200) exposes this sync signal to other instruments without the risk of creating a ground loop.

4. It can transform and synthesize sound. Our current firmware supports a configurable 2,000-sample amplitude envelope that is applied at sound onset, and in reverse at sound offset (even when sounds are stopped during playback). This can mitigate speaker pop, or create "fade-in" and "fade-out" effects. The firmware also has some rudimentary synthesis functions. It can generate white noise or pure tones with configurable frequency and amplitude. Synth playback can span the intervals between sounds (e.g. to mask ambient sounds with white noise) or it can act as the entire stimulus set.

5. With Full Speed USB2.0, audio data transfers rapidly. At 480Mbit/s, Teensy 4.1 has a faster USB data connection than any previous Arduino-compatible microcontroller. In practice, data transfer time includes MATLAB or Python overhead, and generally averages ~40-50Mbit/s for sounds of 1s or more.

6. Its ultrasonic range is usable. At its maximum sampling rate of 192kHz, HiFi Module HD can render pure tones at frequencies across the rodent hearing range. For a 60kHz pure tone sampled at 192kHz, the following plot compares the input data vs. the output signal. The output shown was captured from the HiFi Module's output channels with an oscilloscope:

And the following spectrogram shows a frequency sweep across the rodent hearing range, acquired from the HiFi module output with an isolated NI USB-6211 DAQ card. Two important notes: 1. Three visible lines above the frequency sweep are aliasing artifacts, peaking at the nyquist frequency of the NI DAQ's 200kHz sampling rate. 2. The noise floor of the acquisition system (not specified) is limited by its bit depth (16 bit; 96dB theoretical max SNR) and its self-noise.

7. The SD model includes a headphone amplifier output. The HiFi module hardware supports two HiFiBerry sound cards - DAC2 HD and DAC2 Pro. This article focused on the 'HD' version of the HiFi module. For applications that can tolerate audio playback with a higher noise floor and distortion in the ultrasonic range (comparable to most high-end portable music players), we also developed the 'SD' version of the HiFi module, outfitted with DAC2 Pro. This version has an audio DAC with lower SNR and higher THD, and lacks the HD model's custom analog output stage. At the expense of these, it adds a headphone amplifier with software-adjustable gain. Together with low-cost headphone drivers (e.g. this), the SD model provides a complete consumer grade audio system for applications where the purpose of sound is to provide feedback cues that are distinct and easily differentiable.

8. It is low-cost and 100% open source!. As with all instruments developed at Sanworks, we made the Bpod HiFi module's software, firmware and CAD files open. This provides a DIY option for labs with funding constraints, and keeps the instrument supremely flexible for the end users when needs arrive that we hadn't anticipated.





Comments (0)