BeagleBoard/GSoC/BeagleBoneAVB

Personal Details
Name:                Indumathi Duraipandian

IRC:                 indu

Github:              https://github.com/induarun9086

School:              Fachhochschule, Kiel

Country:             Germany

Primary Languages:   English, Tamil

Typical work hours:   10-12, 14-16, 20-22 CEST

Project Details
With it’s compact size, high processing power and low power consumption the beagle range of single board computers are a best fit for portable audio processing platforms. For any good audio processing engine routing audio from and to the device is a high priority. Recording multi-channel audio from several different audio sources (ex: Microphones, stream servers, DVD players etc…) and transmitting multi-channel output audio for several different audio sinks (ex: Speakers, external amplifiers, streaming servers etc…) require several different connections from and to the audio processing engine when using traditional analog or digital audio connections. For an embedded system such as the beagle the audio video bridging protocol over Ethernet provides the required flexibility to scale to complex audio processing platforms with less hardware complexity. For building a AVB node the stream reservation protocol and the precision time protocol are to be built in the linux kernel. A demo application will be included for a stereo speaker system with two individual beagle boards. The first board will decode a stereo audio file (ex: mp3 files stored in local disk) and play one channel of the audio through its speakers (ex: left channel) and then it transmits the second channel (ex: right channel) to the second device over AVB which plays back the second channel through its speakers. The objective is to achieve frame synchronization over such a system. This can be tested by recording the output from both devices and analyzing with an audio analyzer. In this case one device acts as a AVB master node and the second device acts as a AVB slave node.

Timeline

 * 2017-05-30
 * 1) High level design of the required implementation.
 * 2) Prepare and bringup of the required hardware and work environment setup.


 * 2017-06-06
 * 1) Implementation of the real time clock for the precise time protocol(PTP).
 * 2) Start implementation of the precise time protocol.


 * 2017-06-13
 * 1) Precise time protocol implementations for both master and slave configurations and providing APIs for time synchronization in the upper level protocols.


 * 2017-06-20 to 2017-07-04
 * 1) Implementation of AVB ALSA Sound card inside the sound system.


 * 2017-07-11 to 2017-07-25
 * 1) Implementation of the stream reservation protocol for both master and slave configurations and provide APIs for initiating and configuring a stream reservation.
 * 2) Implementation of the standard IEEE1722 to stream the audio content over the ethernet along with the presentation time in the AVB synchronised time base.


 * 2017-08-01
 * 1) Demo application implementation for the server node. UI design to start decoding of a user provided audio file and starting the audio transfer.


 * 2017-08-08
 * 1) Demo application implementation for the slave node for receiving the data and playback synchronously. Documentation on how to use the demo application.


 * 2017-08-15
 * 1) Final Buffer time for additional tasks, documentation, improvements etc...

Experience and approach
Embedded software development, kernel development and basic understanding of the networking concepts are required for the implementation proposal provided above. With my past experience on projects described below I hope i can provide the required expertise needed to make the proposal a reality. Apart from this I also have expertise in OSI networking model, strong debugging skills and build systems, versioning systems knowledge. And also I have 3 years development experience in team development environments in industry.
 * “Content Aware Smart homes” - Development on embedded system with a pure C implementation of image processing algorithms. https://github.com/induarun9086/MasterProject
 * “NoSQL implementation with IPC” - Development of the NoSQL database with client and servers running in different platforms (windows, linux, osx etc…). Developed in C++11. Uses several RTOS concepts and synchronization primitives. https://github.com/induarun9086/NoSQLDatabase

Contingency:
I can use the vast documentation available through forums, wikis and other means to find solutions for my problems. And also as a last resort I can also consult my colleagues and other faculties in my university for further support.

Benefits:
To bring the power of the synchronous audio capabilities of the AVB protocol to low power embedded systems based on beagle boards.

Documentation
gPTPd: https://github.com/induarun9086/gPTPd

-> gPTP deamon implementing the delay measurement, synchronization and best master selection algorithms. -> The synchronization time is available in the PTP hardware clock. (/dev/ptp0) -> To start in deamon mode just run "sudo ./gPTPd"

snd_avb: https://github.com/induarun9086/beagleboard-linux/tree/4.4/sound/drivers/avb.c

-> ALSA virtual sound device driver. By default uses the "eth0" ethernet device. -> 2 Channel playback and record driver with max sample rate of 48kHz. -> Implementes the MSRP algorithm to setup AVB streaming.

avbtest: https://github.com/induarun9086/avbtest

-> Demo Application to test the AVB software stack for synchronized audio streaming.

Test setup:

-> Beagle bone black 1 with CTAG face 2|4 multichannel audio card attached. -> Beagle bone black 2 connected to BBB 1 with an ethernet cross cable. -> gPTP deamon is running on both devices and both BBBs are synchronized. -> AVB virtual device driver is loaded. -> avbtest application is executed in -b mode with -s option in BBB1. -> avbtest application is executed in -a mode with -t option in BBB2. -> The test applications should be started one after another within short duration. -> BBB1 playsback the given wav file in the first stereo channel at the next second tick which is a multiple of three. -> BBB2 playsback the same wav file through ethernet AVB with presentation time as the next second tick which is a multiple of three. -> BBB1 receives the AVB stream and plays it back through the second stereo channel at the given presentation time. -> Both these stereo channels are recorded and tested for synchronization.



Results:

-> It was possible to start playback of the original stream and the stream received through AVB at the same instance. -> But because of OS scheduling constrains the two playback threads actually starts around 100us apart. -> And also after recording the output the both streams are synchronized with each other with a difference of around 100 samples. -> This is basically a limitation of the test application and not of the AVB stack. -> By implememting a real time application I hope it is possible to create a much more synchronized system.