Introduction
Features
When two CTAG connected in daisy chain mode
- 4 stereo input channels and 8 stereo output channels
- 16 bits per sample for TDM 8 input channels and 16 output channels at 48KHz
- 24 bits per sample for TDM 8 input channels and 8 output channels at 48 KHz
- CTAG face 2/4 board can be configured either I2S master or I2S Slave
- TDM Audio driver round trip time is 9.6 ms
- Reverb effect using freeverb algorithm on the stereo channel input
Implemenation :
The two CTAG board connected to the teensy 3.6 forming daisy chain mode to expand the system to 8 ADCs and 16 DACs. The Master AD1938 in the diagram provides the bit clock(BLCK) and frame sync (LRCLK)for both Teensy and slave AD1938 codec.
The existing Teensy audio library doesn’t have support for the AD1938 control and 16 channel TDM support in the I2S slave mode. This project adds the following extension to the Teensy audio library.
- SPI driver for AD1938 codec: This driver was implemented by AudioControlAd1938 class. This audio control class is derived from the base class of “AudioControl“ existing in Teensy audio library. This Class has SPI write and SPI read function according to AD1938 codec protocol and using these function, codec registers are configured.
- I2S driver in TDM Slave mode: This driver was implemented by I2SInputTDMSlave/I2SOutputTDMSlave class and they are derived from AduioOuputTDM and AduioInputTDM classes respectively. In this class I2S registers and eDMA setup are configured for TDM 16 channel input and output and Teensy as I2S slave.
- Freeverb Audio Effect: Artificial Reverberation using Freeverb algorithm was implemented by AudioEffectFreeveb class. It is a popular implementation of the Schroeder reverberator program by “Jezar at Dreampoint‘’. It uses four Schroeder allpass filters in series and eight parallel Schroeder-Moorer filtered – feedback comb-filter for each audio channel.
After the all the classes are developed they are tested using the PCM pass through application. For the PCM pass through, I2S TDM class and Freeverb classes are connected as shown in the below figure.
The Audio PCM is given from PC to ADC input of AD1938 codec and the out from the DAC of AD1938 is connected to Speaker.By varying the freeverb parameters the effect is heard/ recorded on the live data.
Evaluation:
The following are the three aspects measured using oscilloscope and teensy library functions.
- I2S driver Latency:
By using oscilloscope the latency can be measured. Oscilloscope captures the transmitted and received signal, the figure below shows the delay between signals and it is around 9ms.
- CPU Consumption
- I2S driver – 2%
- Freeverb Algorithm – 22%
- Memory foot-print
The following table shows the measured memory details
Source References:
- https://ccrma.stanford.edu/~jos/pasp/Freeverb.html
- CTAG face 2/4: Soundcard based on AD1938 audio codec
- Teensy Audio driver: Development of SPI and I2S driver in Teensy Slave mode.
- Freeverb Algorithm: Reverb effect using a freeverb algorithm for the teensy audio driver.
Full Report
- The full master thesis report is available here.