SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
Real-time Audio on Embedded Linux


                                              April, 2011

                                           Remi Lorriaux
                                       Adeneo Embedded

                               Embedded Linux Conference 2011




Remi Lorriaux - ELC 2011   1
Agenda

●   Introduction to audio latency
●   Choosing a board for our project
●   Audio using a vanilla kernel
●   Audio using a real-time kernel
●   JACK on our embedded device
●   Conclusion

Remi Lorriaux - ELC 2011   2
Who am I?

●   Software engineer at Adeneo Embedded
    (Bellevue, WA)
     ●   Linux, Android
     ●   Main activities:
          –   Firmware development (BSP adaptation, driver
              development, system integration)
          –   Training delivery


●   Guitar player (at home)

Remi Lorriaux - ELC 2011            3
Context and objectives
●   Case study
     ●   Using a generic embedded device, see how we can
         create a Linux system
     ●   Does not necessarily apply to all types of devices
     ●   Not an in-depth study of real-time systems


●   Focus on software integration
     ●   Not an exhaustive review of all software solutions
     ●   We want to use open source components


Remi Lorriaux - ELC 2011        4
A typical audio chain


                           ADC




                                             DAC
                                 CPU / DSP




●   Digital processing made with a DSP or a
    general-purpose CPU
●   CPUs used in embedded devices generally
    have sufficient power to do the audio
    processing in software

Remi Lorriaux - ELC 2011            5
Typical audio chain on Linux
                 Application



     Server (e.g. JACK, PulseAudio)                                    Application



                                       alsa-lib
                                                read(), write(), poll(), select(), mmap()...


                                 ALSA kernel driver
              Capture buffer                                          Output buffer
                                      INT   DMA

                                      Hardware



Remi Lorriaux - ELC 2011                    6
Audio Latency

●   Delay between an action and its effect, e.g.
     ●   Pressing a key → Hearing a note
     ●   Record input → Processed output
●   Causes
     ●   Physical: 3ft away from loudspeakers ~ 3ms latency
     ●   Hardware: conversion can cause delays
         (magnitude: 40/Fs)
     ●   Software: various levels of buffering


Remi Lorriaux - ELC 2011        7
Audio Latency


●   Consequences on applications:
     ●   Music: critical issue
     ●   Communications: larger latencies can be tolerated
         but still have to be limited (Android specifies
         continuous output latency < 45 ms, continuous
         input latency < 50 ms)
     ●   Audio/Video playback: larger latencies can be
         tolerated as long as synchronization is maintained



Remi Lorriaux - ELC 2011         8
Measuring audio latency
●   Measuring total latency (including hardware):
     ●   Use an oscilloscope or a soundcard
     ●   Can measure the difference between 2
         measurements to assess software changes

●   Measuring software latency
     ●   ALSA: use latency test in alsa-lib (can automatically
         figure out the optimal latency through trial and error)
     ●   JACK: jdelay, qjacklam


Remi Lorriaux - ELC 2011          9
Buffering
 ●   ALSA uses periods: blocks of audio samples
 ●   Size and number is configurable on runtime by applications
 ●   At the end of each period, an interrupt is generated.
     → Shorter periods: more interrupts
     → Shorter periods + less periods: lower latency


          p1                p2              p3               p4

                                                                   INT




Application fills output buffer                     Samples sent to device


 Remi Lorriaux - ELC 2011            10
Reducing audio latency
●   Buffering creates latency
    → Solution: Reduce buffering

●   Reducing buffer size
    → Interrupts are generated more frequently
    → The system has less time to process the
    buffers: risk of over/underrun
    → The system must be designed to schedule
    the different tasks on time

Remi Lorriaux - ELC 2011   11
Tuning the latency


●   alsa-lib provides “latency”
     ●   Test tool used for measuring latency between
         capture and playback
     ●   Audio latency is measured from driver (difference
         when playback and capture was started)
     ●   Can choose a real-time priority (we changed the
         code to make it configurable at runtime)




Remi Lorriaux - ELC 2011       12
Tuning the latency
●   Trial and error:
     ●   Start with a low latency value
     ●   Load the system (CPU, IO stress, your
         application...)
     ●   If XRUN or bad sound quality → Increase the
         latency (periods number and size)
●   “latency” can do it for you automatically:
         > latency ­m [minimum latency in 
         frames] ­M [maximum latency in frames] 
         ­r [sample rate] ­S [priority] ­p


Remi Lorriaux - ELC 2011        13
Loading the system
●   Ideally:
     ●   Realistic load (i.e. your end applications)
     ●   Worst-case scenario

●   Our experiment:
     ●   Stress tests from the Linux Test Projet (LTP)
          –   CPU stress
          –   Memory allocation
     ●   Generate IO interrupts copying from block devices
     ●   cyclictest


Remi Lorriaux - ELC 2011          14
Choosing a board for our project
●   Deciding factors:
     ●   Pick a board that is supported in the latest mainline
         kernel with real-time patches (2.6.33)
     ●   Tested real-time features (Open Source Automation
         Development Lab)
     ●   Pick a board that was available at the time
     ●   Power and features did not matter (except for audio)


●   Other boards could have been chosen (e.g.
    BeagleBoard)


Remi Lorriaux - ELC 2011         15
Our project: Hardware
●   Zoom™ AM3517 EVM Development Kit (AM3517 EVM)
●   ARM™ Cortex™-A8 600 MHz
    → Powerful, but real-time issues still have to be taken into account
●   Ethernet, USB, SD, NAND, Wireless, CAN, LCD, Video capture...
    → Many ways to generate software interrupts
●   Audio in/out (obviously!)




Remi Lorriaux - ELC 2011                16
Our project: Software
●   Bootloader
     ●   U-Boot (Built by Arago)
●   Kernel
     ●   2.6.33
     ●   Patched to 2.6.33.7
     ●   Patched to 2.6.33.7.2-rt30 (RT version)
●   Root filesystem
     ●   Built by Arago
     ●   Customized recipe (arago-console-image.bb + JACK)
     ●   Test applications: alsa-lib tests, LTP, rt-tests

Remi Lorriaux - ELC 2011           17
Our project: Software challenges
●   Support for the AM3517 EVM in mainline 2.6.33
    is somewhat minimal (this has changed a lot)

●   Ported some of the board code/drivers from TI's
    PSP (2.6.32): audio, SD/MMC

●   Still, not many drivers are supported on our test
    system (not exactly a real-life example)


Remi Lorriaux - ELC 2011   18
Experiment #1: Vanilla kernel


●   Vanilla kernel: no RT patches
●   Kernel configuration (see files/kernel/am3517_std_defconfig)
         CONFIG_PREEMPT_DESKTOP=y
         CONFIG_PREEMPT=y
    (other preemption schemes not investigated)




Remi Lorriaux - ELC 2011         19
Experiment #1: First observation
●   The priority of latency has to be set to real-time
    otherwise, it over/underruns for low latency values
    (under 1024 samples @ 44.1 kHz)
●   Even using a non-RT kernel, once the application
    priority is increased, it runs fine when competing with
    other “stress” processes (can be different in the real
    world)
●   cyclictest also exhibits this behavior
    → Use sched_setscheduler() or chrt and set your
    audio thread priority to SCHED_RR or
    SCHED_FIFO


Remi Lorriaux - ELC 2011      20
Experiment #1: CPU usage vs latency
●   Measured with no load:
         > ./latency -m 64 -M 64 -r 44100 -p -S 60
    → Low-latencies can generate a large CPU load!
    Latency (samples)      Latency (@ 44.1kHz)   CPU Load (%)

    64                     1.5 ms                65%

    128                    2.90 ms               3%

    1024                   23 ms                 < 1%

    8192                   185 ms                < 1%




Remi Lorriaux - ELC 2011             21
Experiment #1: Loading the system
●   Creating CPU load:
     ●   LTP CPU stress test
         → Competition between processes (preemptible)
●   Creating IRQ pressure:
     ●   Transfers from SD Card

●   Result: Works fine with 1.5ms latencies
    → Vanilla + SCHED_FIFO did the trick


Remi Lorriaux - ELC 2011       22
Why use a real-time kernel?
●   Tuning the application priority and audio buffering
    requirements can be sufficient for “soft real-time”
    audio systems – where occasional errors do not
    cause unacceptable audio quality consequences
    BUT:
●   There is still a lot of non-preemptible code in the
    vanilla kernel
    ●   Interrupt handlers, tasklets...
    ●   Regions protected by spinlocks (depending on the number
        of processors on your system)



Remi Lorriaux - ELC 2011            23
CONFIG PREEMPT RT Patch

●   Using the CONFIG PREEMPT RT Patch gives
    you:
     ●   Almost full-preemption
     ●   Threaded interrupts: ability to prioritize interrupts
         like processes → your application can have a
         higher priority than hardware interrupts
         → Lower risk of over/underruns




Remi Lorriaux - ELC 2011          24
Making the system real-time
●   Apply the CONFIG PREEMPT RT Patch on
    vanilla kernels.
     ●   Latest available version: patch-2.6.33.7.2-rt30
     ●   Also set the configuration
●   Difficult task on non-mainline/recent kernels
     ●   Making non-mainline boards compatible can be
         difficult (check locks and interrupt management in
         drivers and platform code, make sure that the
         timers are appropriate)
     ●   Cannot apply the patch on proprietary drivers


Remi Lorriaux - ELC 2011        25
Checking the real-time behavior

●   Check that the patch has been correctly applied:
    ●   Running “ps” on the device will show that IRQs are
        threaded
    ●   Use cyclictest to check the scheduling latency under load
        → The non-RT kernel fails right away under high IRQ
        pressure
        → Latencies remain bounded with RT
    ●   Use ftrace to see advanced information (see kernel
        documentation for usage) – changes the timing behavior of
        the system!




Remi Lorriaux - ELC 2011          26
Tuning the real-time system
●   Set the priority of IRQs and processes
    (decreasing priority):
     ●   (High-resolution) Timers (especially since we are
         using a tickless system!)
     ●   Audio (e.g. DMA on our platform)
     ●   Your audio process
     ●   Other interrupts
     ●   Other processes

     ●   More information (FFADO project)


Remi Lorriaux - ELC 2011        27
Tuning audio parameters (RT edition)
●   Same process as the non-RT experiment: trial and error
●   Use the results provided by cyclictest to adjust the latency, e.g.
●   Does not solve the problem of using shared hardware resources
    (e.g. DMA, busses...)
    → Requires careful platform and driver design

root@am3517-evm:~# cyclictest -t5 -n -p 60
policy: fifo: loadavg: 10.89 9.99 6.83 12/76 1342
T: 0 ( 1338) P:60 I:1000 C: 42699 Min:      21 Act:   36 Avg:   37 Max:     96
T: 1 ( 1339) P:59 I:1500 C: 28463 Min:      25 Act:   41 Avg:   37 Max:    135
T: 2 ( 1340) P:58 I:2000 C: 21344 Min:      25 Act:   37 Avg:   39 Max:    111
T: 3 ( 1341) 41 Avg:   39 Max:     111    22 Act:   54 Avg:   38 Max:     91
T: 3 ( 1341) P:57 I:2500 C: 17140 Min:      22 Act:   41 Avg:   38 Max:     91
T: 4 ( 1342) P:56 I:3000 C: 14283 Min:      25 Act:   27 Avg:   38 Max:     86




Remi Lorriaux - ELC 2011                   28
Experiment #2: RT Audio

●   Dirty trick: Added udelay(1000) in the USB
    interrupt handler!
    → Simulate IRQ pressure since the kernel for
    our board did not support ethernet, display...
    → Not a perfect example

●   Result: Works flawlessly with 1ms latency



Remi Lorriaux - ELC 2011   29
Improving the experiment


●   Run typical applications (UI, gstreamer,
    LADSPA...)

●   More stress on the interrupts: Network, Display,
    Video Capture...




Remi Lorriaux - ELC 2011   30
High-end audio applications: JACK
●   System for handling real-time, low latency audio (and MIDI)
●   Cross-platform: GNU/Linux, Solaris, FreeBSD, OS X and
    Windows
●   Server/client model
●   Connectivity:
    ●   Different applications can access an audio device
    ●   Audio applications can share data between each other
    ●   Support for distributing audio processing across a network, both
        fast & reliable LANs as well as slower, less reliable WANs.
●   Designed for professional audio work



Remi Lorriaux - ELC 2011              31
JACK: latency and real-time
●   JACK does not add latency

●   An RT kernel is needed only if:
    ●   You want to run JACK with very low latency settings that
        require real-time performance that can only be achieved
        with an RT kernel
    ●   Your hardware configuration triggers poor latency
        behaviour which might be improved with an RT kernel
●   Most users do not need an RT kernel in order to use
    JACK, and most will be happy using settings that are
    effective without an RT kernel


Remi Lorriaux - ELC 2011         32
JACK on our platform

●   Built using OpenEmbedded (added the recipe
    to our image)
●   Used straight out of the box

●   Set priorities:
     ●   Make jackd have SCHED_FIFO priority (like your
         audio application seen before)
     ●   More information: FFADO wiki



Remi Lorriaux - ELC 2011      33
Experiment #3: JACK on our platform
root@am3517­evm:~#jackd ­R ­P 60 ­d alsa ­i 2 ­r 44100 ­o 2 ­ ­p 64 ­n 6 &
root@am3517­evm:~# jackd 0.118.0                                                
Copyright 2001­2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and ot.
jackd comes with ABSOLUTELY NO WARRANTY                                         
This is free software, and you are welcome to redistribute it                   
under certain conditions; see the file COPYING for details                      
                                                                                
JACK compiled with System V SHM support.                                        
loading driver ..                                                               
apparent rate = 44100                                                           
creating alsa driver ... hw:0|hw:0|64|3|44100|2|2|nomon|swmeter|­|32bit         
control device hw:0                                                             
configuring for 44100Hz, period = 64 frames (1.5 ms), buffer = 6 periods        
ALSA: final selected sample format for capture: 16bit little­endian             
ALSA: use 3 periods for capture                                                 
ALSA: final selected sample format for playback: 16bit little­endian            
ALSA: use 3 periods for playback                                                
                                                                                
root@am3517­evm:~# jack_simple_client                                           
engine sample rate: 44100  




Remi Lorriaux - ELC 2011                       34
Experiment #3: JACK on our platform


●   JACK works fine on our platform with
    < 10 ms latency


    (Note: simplest possible test, so this is a best-
    case value)




Remi Lorriaux - ELC 2011   35
Using multi-core systems
●   Embedded systems can have multi-core architectures:
    ●   Several CPUs
    ●   Mixed CPU/DSP
●   The audio processing can be assigned to a particular
    core
●   Example: TI Audio SoC example (Mixed DSP and ARM
    core)

●   Shared hardware resources is still important (bus
    contention, DMA access...)



Remi Lorriaux - ELC 2011      36
Conclusion
●   Trade-offs:
     ●   CPU/power consumption
     ●   Latency
     ●   Design complexity


●   Tune your priorities/audio parameters first and
    load your system
     ●   Procedure similar to desktop environments (well
         documented)


Remi Lorriaux - ELC 2011       37
Conclusion


●   Adding real-time support:
     ●   Not necessarily trivial or required
     ●   Depends on the implementation
     ●   Non-RT kernel can be surprisingly adequate for
         “soft real-time” audio




Remi Lorriaux - ELC 2011         38
Questions?




Remi Lorriaux - ELC 2011   39
Appendix: Files
●   The files used for this experiment should be
    attached with the presentation
●   Just run or have a look at the different scripts
●   Run (in order):
     ●   oe_prepare.sh: installs prerequisites for
         Arago/OpenEmbedded (some other changes might
         be needed)
     ●   oe_download.sh: downloads and installs custom
         recipes for OE
     ●   oe_build.sh: builds OE


Remi Lorriaux - ELC 2011          40
Appendix: Files
●   Run (continued):
     ●   uboot_build.sh: builds U-Boot (sources pulled from
         OE)
     ●   kernel_download.sh: downloads the kernel sources
         and applies relevant patches for our experiments
     ●   kernel_build.sh: builds the RT and non-RT kernel
     ●   apps_build.sh: builds extra test applications out of
         the OE tree
     ●   sd_flash.sh: flashes the bootloader + kernel + rootfs
         on an SD Card


Remi Lorriaux - ELC 2011        41
Appendix: References
●   Real-Time Linux wiki: Lots of information about
    the RT patch and testing procedures
●   The JACK Audio Connection Kit: General
    presentation. Also covers audio topics on Linux
●   FFADO wiki: How to tune audio parameters
●   ALSA wiki: General documentation and ALSA
    samples
●   JACK: Developer documentation, tuning...
●   AM3517 EVM: Board specification and tools


Remi Lorriaux - ELC 2011   42
Audio in linux embedded

Weitere ähnliche Inhalte

Was ist angesagt?

Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Linaro
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overviewVijayGESYS
 
Webinar presentation on AUTOSAR Multicore Systems
Webinar presentation on AUTOSAR Multicore SystemsWebinar presentation on AUTOSAR Multicore Systems
Webinar presentation on AUTOSAR Multicore SystemsKPIT
 
LCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLinaro
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLinaro
 
Introduction of android treble
Introduction of android trebleIntroduction of android treble
Introduction of android trebleBin Yang
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom BoardPatrick Bellasi
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Reliability, Availability and Serviceability on Linux
Reliability, Availability and Serviceability on LinuxReliability, Availability and Serviceability on Linux
Reliability, Availability and Serviceability on LinuxSamsung Open Source Group
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIeJin Wu
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLinaro
 
AMBA3.0 james_20110801
AMBA3.0 james_20110801AMBA3.0 james_20110801
AMBA3.0 james_20110801James Chang
 

Was ist angesagt? (20)

I2c drivers
I2c driversI2c drivers
I2c drivers
 
Android Audio System
Android Audio SystemAndroid Audio System
Android Audio System
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overview
 
Webinar presentation on AUTOSAR Multicore Systems
Webinar presentation on AUTOSAR Multicore SystemsWebinar presentation on AUTOSAR Multicore Systems
Webinar presentation on AUTOSAR Multicore Systems
 
LCA13: Power State Coordination Interface
LCA13: Power State Coordination InterfaceLCA13: Power State Coordination Interface
LCA13: Power State Coordination Interface
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
 
Toolchain
ToolchainToolchain
Toolchain
 
Introduction of android treble
Introduction of android trebleIntroduction of android treble
Introduction of android treble
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Linux Porting to a Custom Board
Linux Porting to a Custom BoardLinux Porting to a Custom Board
Linux Porting to a Custom Board
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Reliability, Availability and Serviceability on Linux
Reliability, Availability and Serviceability on LinuxReliability, Availability and Serviceability on Linux
Reliability, Availability and Serviceability on Linux
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
44CON 2014 - Stupid PCIe Tricks, Joe Fitzpatrick
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
AMBA3.0 james_20110801
AMBA3.0 james_20110801AMBA3.0 james_20110801
AMBA3.0 james_20110801
 

Andere mochten auch

Embedded Linux Multimedia
Embedded Linux MultimediaEmbedded Linux Multimedia
Embedded Linux MultimediaCaglar Dursun
 
오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)승훈 오
 
學生學習歷程簡報
學生學習歷程簡報學生學習歷程簡報
學生學習歷程簡報Fang-fang
 
Tg discussion guide90
Tg discussion guide90Tg discussion guide90
Tg discussion guide90lschmidt1170
 
Geog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt friGeog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt frilschmidt1170
 
Pi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassPi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassAna Menezes
 
Tutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareTutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareAnnie Nitzschke Peña
 
Isabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantIsabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantAchim D. Brucker
 
UDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIIUDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIINEEVEE Technologies
 

Andere mochten auch (20)

Embedded Linux Multimedia
Embedded Linux MultimediaEmbedded Linux Multimedia
Embedded Linux Multimedia
 
오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)오픈세미나 플러그인만들기(한번더)
오픈세미나 플러그인만들기(한번더)
 
學生學習歷程簡報
學生學習歷程簡報學生學習歷程簡報
學生學習歷程簡報
 
Kpi publikovani 2
Kpi publikovani 2Kpi publikovani 2
Kpi publikovani 2
 
r3-4-2009f_xts5000_new
r3-4-2009f_xts5000_newr3-4-2009f_xts5000_new
r3-4-2009f_xts5000_new
 
Tg discussion guide90
Tg discussion guide90Tg discussion guide90
Tg discussion guide90
 
CV_Jeeshan CPE
CV_Jeeshan CPECV_Jeeshan CPE
CV_Jeeshan CPE
 
CV_SANJAY SOHIL
CV_SANJAY SOHILCV_SANJAY SOHIL
CV_SANJAY SOHIL
 
Geog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt friGeog 5 fa 2012 schmidt fri
Geog 5 fa 2012 schmidt fri
 
Grouping objects
Grouping objectsGrouping objects
Grouping objects
 
Brain maturation
Brain maturationBrain maturation
Brain maturation
 
Pi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision ClassPi3 Ef 7 Pe Revision Class
Pi3 Ef 7 Pe Revision Class
 
Tutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshareTutorial para crear cuenta en slideshare
Tutorial para crear cuenta en slideshare
 
Rreflexion cuento
Rreflexion cuentoRreflexion cuento
Rreflexion cuento
 
Heap and Partners
Heap and PartnersHeap and Partners
Heap and Partners
 
Isabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantIsabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof Assistant
 
Device driver
Device driverDevice driver
Device driver
 
UDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIIIUDPSRC GStreamer Plugin Session VIII
UDPSRC GStreamer Plugin Session VIII
 
2014 April 17- Fox Valley Program
2014 April 17- Fox Valley Program2014 April 17- Fox Valley Program
2014 April 17- Fox Valley Program
 
Java Thread
Java ThreadJava Thread
Java Thread
 

Ähnlich wie Audio in linux embedded

A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. TanenbaumA Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaumeurobsdcon
 
Shak larry-jeder-perf-and-tuning-summit14-part1-final
Shak larry-jeder-perf-and-tuning-summit14-part1-finalShak larry-jeder-perf-and-tuning-summit14-part1-final
Shak larry-jeder-perf-and-tuning-summit14-part1-finalTommy Lee
 
UNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsUNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsButtaRajasekhar2
 
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be SlowELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be SlowBenjamin Zores
 
AMP Kynetics - ELC 2018 Portland
AMP  Kynetics - ELC 2018 PortlandAMP  Kynetics - ELC 2018 Portland
AMP Kynetics - ELC 2018 PortlandKynetics
 
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandNicola La Gloria
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and InsightsGlobalLogic Ukraine
 
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA Camp
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA CampDESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA Camp
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA CampFPGA Central
 
Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfhik_lhz
 
PowerDRC/LVS 2.2 released by POLYTEDA
PowerDRC/LVS 2.2 released by POLYTEDAPowerDRC/LVS 2.2 released by POLYTEDA
PowerDRC/LVS 2.2 released by POLYTEDAAlexander Grudanov
 
Porting_uClinux_CELF2008_Griffin
Porting_uClinux_CELF2008_GriffinPorting_uClinux_CELF2008_Griffin
Porting_uClinux_CELF2008_GriffinPeter Griffin
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Michael Christofferson
 
01 Computer Basics (Ch1.1).pptx
01 Computer Basics (Ch1.1).pptx01 Computer Basics (Ch1.1).pptx
01 Computer Basics (Ch1.1).pptxsarah380333
 
Embedded platform choices
Embedded platform choicesEmbedded platform choices
Embedded platform choicesTavish Naruka
 
Current and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on LinuxCurrent and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on Linuxmountpoint.io
 
LAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMGLAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMGLinaro
 
Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Igalia
 
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitchDPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitchJim St. Leger
 

Ähnlich wie Audio in linux embedded (20)

A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. TanenbaumA Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
 
Lect17
Lect17Lect17
Lect17
 
Shak larry-jeder-perf-and-tuning-summit14-part1-final
Shak larry-jeder-perf-and-tuning-summit14-part1-finalShak larry-jeder-perf-and-tuning-summit14-part1-final
Shak larry-jeder-perf-and-tuning-summit14-part1-final
 
Optimizing Linux Servers
Optimizing Linux ServersOptimizing Linux Servers
Optimizing Linux Servers
 
UNIT 3 - General Purpose Processors
UNIT 3 - General Purpose ProcessorsUNIT 3 - General Purpose Processors
UNIT 3 - General Purpose Processors
 
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be SlowELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
ELCE 2011 - BZ - Embedded Linux Optimization Techniques - How Not To Be Slow
 
AMP Kynetics - ELC 2018 Portland
AMP  Kynetics - ELC 2018 PortlandAMP  Kynetics - ELC 2018 Portland
AMP Kynetics - ELC 2018 Portland
 
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portlandAsymmetric Multiprocessing - Kynetics ELC 2018 portland
Asymmetric Multiprocessing - Kynetics ELC 2018 portland
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA Camp
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA CampDESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA Camp
DESIGN CHOICES FOR EMBEDDED REAL-TIME CONTROL SYSTEMS @ 4th FPGA Camp
 
Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmf
 
PowerDRC/LVS 2.2 released by POLYTEDA
PowerDRC/LVS 2.2 released by POLYTEDAPowerDRC/LVS 2.2 released by POLYTEDA
PowerDRC/LVS 2.2 released by POLYTEDA
 
Porting_uClinux_CELF2008_Griffin
Porting_uClinux_CELF2008_GriffinPorting_uClinux_CELF2008_Griffin
Porting_uClinux_CELF2008_Griffin
 
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0Four Ways to Improve Linux Performance IEEE Webinar, R2.0
Four Ways to Improve Linux Performance IEEE Webinar, R2.0
 
01 Computer Basics (Ch1.1).pptx
01 Computer Basics (Ch1.1).pptx01 Computer Basics (Ch1.1).pptx
01 Computer Basics (Ch1.1).pptx
 
Embedded platform choices
Embedded platform choicesEmbedded platform choices
Embedded platform choices
 
Current and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on LinuxCurrent and Future of Non-Volatile Memory on Linux
Current and Future of Non-Volatile Memory on Linux
 
LAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMGLAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMG
 
Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)Embedded Graphics Drivers in Mesa (ELCE 2019)
Embedded Graphics Drivers in Mesa (ELCE 2019)
 
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitchDPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
DPDK Summit - 08 Sept 2014 - NTT - High Performance vSwitch
 

Kürzlich hochgeladen

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 

Kürzlich hochgeladen (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 

Audio in linux embedded

  • 1. Real-time Audio on Embedded Linux April, 2011 Remi Lorriaux Adeneo Embedded Embedded Linux Conference 2011 Remi Lorriaux - ELC 2011 1
  • 2. Agenda ● Introduction to audio latency ● Choosing a board for our project ● Audio using a vanilla kernel ● Audio using a real-time kernel ● JACK on our embedded device ● Conclusion Remi Lorriaux - ELC 2011 2
  • 3. Who am I? ● Software engineer at Adeneo Embedded (Bellevue, WA) ● Linux, Android ● Main activities: – Firmware development (BSP adaptation, driver development, system integration) – Training delivery ● Guitar player (at home) Remi Lorriaux - ELC 2011 3
  • 4. Context and objectives ● Case study ● Using a generic embedded device, see how we can create a Linux system ● Does not necessarily apply to all types of devices ● Not an in-depth study of real-time systems ● Focus on software integration ● Not an exhaustive review of all software solutions ● We want to use open source components Remi Lorriaux - ELC 2011 4
  • 5. A typical audio chain ADC DAC CPU / DSP ● Digital processing made with a DSP or a general-purpose CPU ● CPUs used in embedded devices generally have sufficient power to do the audio processing in software Remi Lorriaux - ELC 2011 5
  • 6. Typical audio chain on Linux Application Server (e.g. JACK, PulseAudio) Application alsa-lib read(), write(), poll(), select(), mmap()... ALSA kernel driver Capture buffer Output buffer INT DMA Hardware Remi Lorriaux - ELC 2011 6
  • 7. Audio Latency ● Delay between an action and its effect, e.g. ● Pressing a key → Hearing a note ● Record input → Processed output ● Causes ● Physical: 3ft away from loudspeakers ~ 3ms latency ● Hardware: conversion can cause delays (magnitude: 40/Fs) ● Software: various levels of buffering Remi Lorriaux - ELC 2011 7
  • 8. Audio Latency ● Consequences on applications: ● Music: critical issue ● Communications: larger latencies can be tolerated but still have to be limited (Android specifies continuous output latency < 45 ms, continuous input latency < 50 ms) ● Audio/Video playback: larger latencies can be tolerated as long as synchronization is maintained Remi Lorriaux - ELC 2011 8
  • 9. Measuring audio latency ● Measuring total latency (including hardware): ● Use an oscilloscope or a soundcard ● Can measure the difference between 2 measurements to assess software changes ● Measuring software latency ● ALSA: use latency test in alsa-lib (can automatically figure out the optimal latency through trial and error) ● JACK: jdelay, qjacklam Remi Lorriaux - ELC 2011 9
  • 10. Buffering ● ALSA uses periods: blocks of audio samples ● Size and number is configurable on runtime by applications ● At the end of each period, an interrupt is generated. → Shorter periods: more interrupts → Shorter periods + less periods: lower latency p1 p2 p3 p4 INT Application fills output buffer Samples sent to device Remi Lorriaux - ELC 2011 10
  • 11. Reducing audio latency ● Buffering creates latency → Solution: Reduce buffering ● Reducing buffer size → Interrupts are generated more frequently → The system has less time to process the buffers: risk of over/underrun → The system must be designed to schedule the different tasks on time Remi Lorriaux - ELC 2011 11
  • 12. Tuning the latency ● alsa-lib provides “latency” ● Test tool used for measuring latency between capture and playback ● Audio latency is measured from driver (difference when playback and capture was started) ● Can choose a real-time priority (we changed the code to make it configurable at runtime) Remi Lorriaux - ELC 2011 12
  • 13. Tuning the latency ● Trial and error: ● Start with a low latency value ● Load the system (CPU, IO stress, your application...) ● If XRUN or bad sound quality → Increase the latency (periods number and size) ● “latency” can do it for you automatically: > latency ­m [minimum latency in  frames] ­M [maximum latency in frames]  ­r [sample rate] ­S [priority] ­p Remi Lorriaux - ELC 2011 13
  • 14. Loading the system ● Ideally: ● Realistic load (i.e. your end applications) ● Worst-case scenario ● Our experiment: ● Stress tests from the Linux Test Projet (LTP) – CPU stress – Memory allocation ● Generate IO interrupts copying from block devices ● cyclictest Remi Lorriaux - ELC 2011 14
  • 15. Choosing a board for our project ● Deciding factors: ● Pick a board that is supported in the latest mainline kernel with real-time patches (2.6.33) ● Tested real-time features (Open Source Automation Development Lab) ● Pick a board that was available at the time ● Power and features did not matter (except for audio) ● Other boards could have been chosen (e.g. BeagleBoard) Remi Lorriaux - ELC 2011 15
  • 16. Our project: Hardware ● Zoom™ AM3517 EVM Development Kit (AM3517 EVM) ● ARM™ Cortex™-A8 600 MHz → Powerful, but real-time issues still have to be taken into account ● Ethernet, USB, SD, NAND, Wireless, CAN, LCD, Video capture... → Many ways to generate software interrupts ● Audio in/out (obviously!) Remi Lorriaux - ELC 2011 16
  • 17. Our project: Software ● Bootloader ● U-Boot (Built by Arago) ● Kernel ● 2.6.33 ● Patched to 2.6.33.7 ● Patched to 2.6.33.7.2-rt30 (RT version) ● Root filesystem ● Built by Arago ● Customized recipe (arago-console-image.bb + JACK) ● Test applications: alsa-lib tests, LTP, rt-tests Remi Lorriaux - ELC 2011 17
  • 18. Our project: Software challenges ● Support for the AM3517 EVM in mainline 2.6.33 is somewhat minimal (this has changed a lot) ● Ported some of the board code/drivers from TI's PSP (2.6.32): audio, SD/MMC ● Still, not many drivers are supported on our test system (not exactly a real-life example) Remi Lorriaux - ELC 2011 18
  • 19. Experiment #1: Vanilla kernel ● Vanilla kernel: no RT patches ● Kernel configuration (see files/kernel/am3517_std_defconfig) CONFIG_PREEMPT_DESKTOP=y CONFIG_PREEMPT=y (other preemption schemes not investigated) Remi Lorriaux - ELC 2011 19
  • 20. Experiment #1: First observation ● The priority of latency has to be set to real-time otherwise, it over/underruns for low latency values (under 1024 samples @ 44.1 kHz) ● Even using a non-RT kernel, once the application priority is increased, it runs fine when competing with other “stress” processes (can be different in the real world) ● cyclictest also exhibits this behavior → Use sched_setscheduler() or chrt and set your audio thread priority to SCHED_RR or SCHED_FIFO Remi Lorriaux - ELC 2011 20
  • 21. Experiment #1: CPU usage vs latency ● Measured with no load: > ./latency -m 64 -M 64 -r 44100 -p -S 60 → Low-latencies can generate a large CPU load! Latency (samples) Latency (@ 44.1kHz) CPU Load (%) 64 1.5 ms 65% 128 2.90 ms 3% 1024 23 ms < 1% 8192 185 ms < 1% Remi Lorriaux - ELC 2011 21
  • 22. Experiment #1: Loading the system ● Creating CPU load: ● LTP CPU stress test → Competition between processes (preemptible) ● Creating IRQ pressure: ● Transfers from SD Card ● Result: Works fine with 1.5ms latencies → Vanilla + SCHED_FIFO did the trick Remi Lorriaux - ELC 2011 22
  • 23. Why use a real-time kernel? ● Tuning the application priority and audio buffering requirements can be sufficient for “soft real-time” audio systems – where occasional errors do not cause unacceptable audio quality consequences BUT: ● There is still a lot of non-preemptible code in the vanilla kernel ● Interrupt handlers, tasklets... ● Regions protected by spinlocks (depending on the number of processors on your system) Remi Lorriaux - ELC 2011 23
  • 24. CONFIG PREEMPT RT Patch ● Using the CONFIG PREEMPT RT Patch gives you: ● Almost full-preemption ● Threaded interrupts: ability to prioritize interrupts like processes → your application can have a higher priority than hardware interrupts → Lower risk of over/underruns Remi Lorriaux - ELC 2011 24
  • 25. Making the system real-time ● Apply the CONFIG PREEMPT RT Patch on vanilla kernels. ● Latest available version: patch-2.6.33.7.2-rt30 ● Also set the configuration ● Difficult task on non-mainline/recent kernels ● Making non-mainline boards compatible can be difficult (check locks and interrupt management in drivers and platform code, make sure that the timers are appropriate) ● Cannot apply the patch on proprietary drivers Remi Lorriaux - ELC 2011 25
  • 26. Checking the real-time behavior ● Check that the patch has been correctly applied: ● Running “ps” on the device will show that IRQs are threaded ● Use cyclictest to check the scheduling latency under load → The non-RT kernel fails right away under high IRQ pressure → Latencies remain bounded with RT ● Use ftrace to see advanced information (see kernel documentation for usage) – changes the timing behavior of the system! Remi Lorriaux - ELC 2011 26
  • 27. Tuning the real-time system ● Set the priority of IRQs and processes (decreasing priority): ● (High-resolution) Timers (especially since we are using a tickless system!) ● Audio (e.g. DMA on our platform) ● Your audio process ● Other interrupts ● Other processes ● More information (FFADO project) Remi Lorriaux - ELC 2011 27
  • 28. Tuning audio parameters (RT edition) ● Same process as the non-RT experiment: trial and error ● Use the results provided by cyclictest to adjust the latency, e.g. ● Does not solve the problem of using shared hardware resources (e.g. DMA, busses...) → Requires careful platform and driver design root@am3517-evm:~# cyclictest -t5 -n -p 60 policy: fifo: loadavg: 10.89 9.99 6.83 12/76 1342 T: 0 ( 1338) P:60 I:1000 C: 42699 Min: 21 Act: 36 Avg: 37 Max: 96 T: 1 ( 1339) P:59 I:1500 C: 28463 Min: 25 Act: 41 Avg: 37 Max: 135 T: 2 ( 1340) P:58 I:2000 C: 21344 Min: 25 Act: 37 Avg: 39 Max: 111 T: 3 ( 1341) 41 Avg: 39 Max: 111 22 Act: 54 Avg: 38 Max: 91 T: 3 ( 1341) P:57 I:2500 C: 17140 Min: 22 Act: 41 Avg: 38 Max: 91 T: 4 ( 1342) P:56 I:3000 C: 14283 Min: 25 Act: 27 Avg: 38 Max: 86 Remi Lorriaux - ELC 2011 28
  • 29. Experiment #2: RT Audio ● Dirty trick: Added udelay(1000) in the USB interrupt handler! → Simulate IRQ pressure since the kernel for our board did not support ethernet, display... → Not a perfect example ● Result: Works flawlessly with 1ms latency Remi Lorriaux - ELC 2011 29
  • 30. Improving the experiment ● Run typical applications (UI, gstreamer, LADSPA...) ● More stress on the interrupts: Network, Display, Video Capture... Remi Lorriaux - ELC 2011 30
  • 31. High-end audio applications: JACK ● System for handling real-time, low latency audio (and MIDI) ● Cross-platform: GNU/Linux, Solaris, FreeBSD, OS X and Windows ● Server/client model ● Connectivity: ● Different applications can access an audio device ● Audio applications can share data between each other ● Support for distributing audio processing across a network, both fast & reliable LANs as well as slower, less reliable WANs. ● Designed for professional audio work Remi Lorriaux - ELC 2011 31
  • 32. JACK: latency and real-time ● JACK does not add latency ● An RT kernel is needed only if: ● You want to run JACK with very low latency settings that require real-time performance that can only be achieved with an RT kernel ● Your hardware configuration triggers poor latency behaviour which might be improved with an RT kernel ● Most users do not need an RT kernel in order to use JACK, and most will be happy using settings that are effective without an RT kernel Remi Lorriaux - ELC 2011 32
  • 33. JACK on our platform ● Built using OpenEmbedded (added the recipe to our image) ● Used straight out of the box ● Set priorities: ● Make jackd have SCHED_FIFO priority (like your audio application seen before) ● More information: FFADO wiki Remi Lorriaux - ELC 2011 33
  • 34. Experiment #3: JACK on our platform root@am3517­evm:~#jackd ­R ­P 60 ­d alsa ­i 2 ­r 44100 ­o 2 ­ ­p 64 ­n 6 & root@am3517­evm:~# jackd 0.118.0                                                 Copyright 2001­2009 Paul Davis, Stephane Letz, Jack O'Quinn, Torben Hohn and ot. jackd comes with ABSOLUTELY NO WARRANTY                                          This is free software, and you are welcome to redistribute it                    under certain conditions; see the file COPYING for details                                                                                                        JACK compiled with System V SHM support.                                         loading driver ..                                                                apparent rate = 44100                                                            creating alsa driver ... hw:0|hw:0|64|3|44100|2|2|nomon|swmeter|­|32bit          control device hw:0                                                              configuring for 44100Hz, period = 64 frames (1.5 ms), buffer = 6 periods         ALSA: final selected sample format for capture: 16bit little­endian              ALSA: use 3 periods for capture                                                  ALSA: final selected sample format for playback: 16bit little­endian             ALSA: use 3 periods for playback                                                                                                                                  root@am3517­evm:~# jack_simple_client                                            engine sample rate: 44100   Remi Lorriaux - ELC 2011 34
  • 35. Experiment #3: JACK on our platform ● JACK works fine on our platform with < 10 ms latency (Note: simplest possible test, so this is a best- case value) Remi Lorriaux - ELC 2011 35
  • 36. Using multi-core systems ● Embedded systems can have multi-core architectures: ● Several CPUs ● Mixed CPU/DSP ● The audio processing can be assigned to a particular core ● Example: TI Audio SoC example (Mixed DSP and ARM core) ● Shared hardware resources is still important (bus contention, DMA access...) Remi Lorriaux - ELC 2011 36
  • 37. Conclusion ● Trade-offs: ● CPU/power consumption ● Latency ● Design complexity ● Tune your priorities/audio parameters first and load your system ● Procedure similar to desktop environments (well documented) Remi Lorriaux - ELC 2011 37
  • 38. Conclusion ● Adding real-time support: ● Not necessarily trivial or required ● Depends on the implementation ● Non-RT kernel can be surprisingly adequate for “soft real-time” audio Remi Lorriaux - ELC 2011 38
  • 40. Appendix: Files ● The files used for this experiment should be attached with the presentation ● Just run or have a look at the different scripts ● Run (in order): ● oe_prepare.sh: installs prerequisites for Arago/OpenEmbedded (some other changes might be needed) ● oe_download.sh: downloads and installs custom recipes for OE ● oe_build.sh: builds OE Remi Lorriaux - ELC 2011 40
  • 41. Appendix: Files ● Run (continued): ● uboot_build.sh: builds U-Boot (sources pulled from OE) ● kernel_download.sh: downloads the kernel sources and applies relevant patches for our experiments ● kernel_build.sh: builds the RT and non-RT kernel ● apps_build.sh: builds extra test applications out of the OE tree ● sd_flash.sh: flashes the bootloader + kernel + rootfs on an SD Card Remi Lorriaux - ELC 2011 41
  • 42. Appendix: References ● Real-Time Linux wiki: Lots of information about the RT patch and testing procedures ● The JACK Audio Connection Kit: General presentation. Also covers audio topics on Linux ● FFADO wiki: How to tune audio parameters ● ALSA wiki: General documentation and ALSA samples ● JACK: Developer documentation, tuning... ● AM3517 EVM: Board specification and tools Remi Lorriaux - ELC 2011 42