LWN.net Logo

Advertisement

GStreamer, Embedded Linux, Android, VoD, Smooth Streaming, DRM, RTSP, HEVC, PulseAudio, OpenGL. Register now to attend.

Advertise here

TDC: Audio routing for vehicles

By Nathan Willis
May 30, 2013

One of the oft-cited tensions in the Tizen project (as in its predecessor, MeeGo) is that the end goal is to offer a common application platform for some Linux systems that are strikingly different under the hood. That is, application developers are understandably interested in offering their social networking apps and games on phones, smart TVs, and in-vehicle entertainment units—but the hardware and environments defining these products can be radically different. Phones have battery life and tiny screens to consider; smart TVs have the "ten foot UI" and users' aversion to keyboards. But perhaps the clearest challenge in this space has always been in-vehicle infotainment (IVI) systems, where audio routing is the canonical illustration of how different the car is from a desktop Linux system. Media playback, hands-free phone calls, navigation, and alert messages all contend for the right to deliver audio to the driver and passengers, without distracting the driver.

Intel's Jaska Uimonen presented the solution in the works for Tizen IVI at the 2013 Tizen Developer Conference in San Francisco. The audio management problem, he explained, comes down to three core issues: routing, policy-controlled volume, and policy-controlled preemption. The routing issue involves multiplexing the multiple audio input and output points of a vehicle (such as speaker sets for front and rear seats, headphone jacks, hands-free microphones, traditional audio dash-units, and hot-pluggable Bluetooth devices—a category that can include headsets and mobile phones). The users' expectation is that audio will always be routed to the correct zone, but a wide array of combinations is possible, and configuration can change on the fly. For example, an incoming hands-free phone call may need to target the driver alone, while the radio continues to play to the other seats (perhaps including the front passenger seat). This differs from mobile device audio management, Uimonen said, which typically makes a "select and route" decision; IVI audio requires a full switching matrix.

But there is still more. In addition to simply connecting each audio stream to the appropriate port, Uimonen said, the audio manager must also mix the volumes of the audio streams in a useful and safe manner. Turn-by-turn navigation directions are more important to hear than the radio, and thus the radio volume should dip momentarily for each navigation instruction—and hopefully do so smoothly. Then again, there are also situations when one audio stream may need to preempt others entirely, such as a safety alarm. Exactly which preemption and volume scenarios are appropriate is a system policy decision, of course, which will likely vary from manufacturer to manufacturer. Thus Tizen IVI's audio management framework needs to be flexible enough to support configurable policies.

Sound off

The audio management solution developed for Tizen IVI uses PulseAudio for routing, which is not surprising, although it does introduce some new code to support the notion of audio "zones" (e.g., driver, passenger, rear seat entertainment unit, etc.) which is not found in PulseAudio on the desktop. It implements the necessary policy-based decision making with Murphy, a relatively new "resource routing" engine started in 2012.

Murphy maintains an internal database of system state for whichever resources it is responsible for routing (audio, video, and network streams are the example uses). Policies for resource control are described in Lua statements, and separate plugins can implement control for each resource Murphy monitors. The Murphy daemon will listen for events from different sources (such as udev or Websockets), and can execute scripts or C programs to re-route resources in response.

For example, in the IVI audio scenario, a Bluetooth headset appearing or disappearing would trigger a D-Bus event from BlueZ, while a speed-sensitive volume adjustment might read speedometer data from the vehicle's CAN bus or Automotive Message Broker. The Murphy-driven audio manager runs as a plugin to PulseAudio; thus when a Murphy policy rule dictates routing a particular input to a particular output, the plugin should connect the associated PulseAudio sources and sinks.

But the actual implementation is a bit more complicated, because PulseAudio does not natively support certain useful options, such as combining sinks and sources or combining multiple sinks. Thus, the Tizen IVI audio manager adds the concept of "nodes"—essentially an abstraction layer, nodes represent a "routing endpoint" which might have a source (e.g., microphone) and a sink (e.g., speaker). A telephony application needs both to function, so the routing policy treats them as a single object. Playing audio over all of the speaker sets in the vehicle might actually involve routing the same audio stream to multiple independent speaker clusters, so the routing policy offers a "combined" node that serves them all.

The audio policies are based around tagging each audio stream with a class; for example, "music," "navigation," or "ui event." The system integrator can then write routing, volume, and preemption rules based on the class of the stream and the various nodes in the car. Obviously not every possible node will be present when the car leaves the factory (Bluetooth headsets and portable music players being the most obvious examples), but there are generally a fixed number of speaker and microphone devices, and only a handful of well-understood hot-pluggable device types to worry about.

When an application creates a new audio stream, the system automatically creates a default route for it based on its class (which might specify that "music" streams are routed to the whole-car speaker system, but "navigation" streams are routed to the front-seat speakers only). Users can request an explicit route to override the default if desired, assuming there is application support, that is.

This explicit routing feature is designed to work with GENIVI's audio management system, although GENIVI's system is not currently built for Tizen images. However, the GENIVI system does define the client-side interface through which applications can request specific audio routing, and since GENIVI is an industry-wide effort, the Tizen system supports the interface. As for application support within the existing Tizen application ecosystem, Uimonen noted that Tizen's WebKit runtime has been patched to support tagging streams with classes; HTML5 applications can tag their <audio> and <video> elements. There is no word yet on progress of the feature in Tizen's native application APIs.

The answer is simple. Volume.

The volume and preemption rules for audio streams prioritize certain classes over others, Uimonen explained, but the audio manager's decision to lower the volume of a stream is hidden from the application itself. Permitting applications to know when their volume level was being lowered in the mix might have some unwanted effects, he said—misbehaving applications might fight it by raising the volume of the stream, which is dangerous on its own but could also potentially lead to race conditions between competing applications.

The audio manager also adds one more feature to PulseAudio: the ability to smoothly ramp up or ramp down the volume of a stream. The plan is to send that patch upstream, Uimonen said, although it has not been sent yet. The other code is available in the Tizen repositories under the "IVI" profile. All of the code to implement the audio manager will be open source, however, the actual policies and configurations are hardware-specific; as with other such system configuration points, it may be expected that many auto manufacturers will choose not to release their audio routing config files or scripts.

Uimonen commented that the volume ramping work and the other additions to PulseAudio are hopefully going to be merged with the project upstream, because there are use cases outside of the IVI context that would benefit from the ability to perform more complex audio routing. That list might include home theater systems or whole-house audio setups, but even the basic desktop configuration these days is likely to incorporate multiple sound devices (Bluetooth, USB audio adapters, and so on). For the moment, then, the unusual demands of the IVI industry may be pushing development, but ultimately everyone stands to gain.

[The author wishes to thank the Linux Foundation for travel assistance to Tizen Dev Con.]


(Log in to post comments)

TDC: Audio routing for vehicles

Posted May 31, 2013 4:16 UTC (Fri) by dlang (✭ supporter ✭, #313) [Link]

I've been wanting something along these lines for a number of years for use in emergency services communications. typically there are radios and speakers stuffed wherever they can fit.

It would be much nicer to feed each radio into a common system and have the result able to be mixed to multiple sets of outputs.

It sounds as if this comes extremely close to what I was thinking of. The only additional feature I would want is the ability to 'position' an audio source. If you have multiple radios you need to listen to, you could position them at different 'positions' in your audio space. This could be done as the audio is fed into the system, but it's much better if you can do it as you feed the audio out to the zones, that way you can have things positioned differently for a person using headphones than you do for speakers in an operations center (where you can actually position the audio 360 degrees around the room)

This sort of capability has a lot of other uses. Think of people who may be on troubleshooting calls where they want to have one phone line open to sysadmins fixing the problem and another open to managers talking about the impact of the problem. Today this is almost impossible to do, but with VoIP and proper positioning of the sources, you could potentially not only differentiate the different calls by position, but also the individual speakers, allowing for much better identification of who is saying what.

TDC: Audio routing for vehicles

Posted Jun 3, 2013 1:50 UTC (Mon) by pr1268 (subscriber, #24648) [Link]

When an application creates a new audio stream, the system automatically creates a default route for it based on its class (which might specify that "music" streams are routed to the whole-car speaker system, but "navigation" streams are routed to the front-seat speakers only). Users can request an explicit route to override the default if desired, assuming there is application support, that is.

Wow... When reading this article, my head was spinning by then.

I'm not that old, but I can remember riding in cars which had an AM radio, only one speaker, two knobs (volume and tuning), and five mechanical preset buttons. How times have changed!

TDC: Audio routing for vehicles

Posted Jun 4, 2013 8:53 UTC (Tue) by micka (subscriber, #38720) [Link]

> For example, an incoming hands-free phone call may need to target the driver alone

I think that's a bad example, the driver is in any case the last resort when choosing who to deliver a phone call to, even hand-free.

TDC: Audio routing for vehicles

Posted Jun 4, 2013 9:05 UTC (Tue) by dlang (✭ supporter ✭, #313) [Link]

well, wouldn't that depend on if the call is incoming or outgoing?

for an outgoing call initiated by the driver, I think it would be a great idea not to flood the entire car with the call.

TDC: Audio routing for vehicles

Posted Jun 4, 2013 9:18 UTC (Tue) by micka (subscriber, #38720) [Link]

Well that's true.

Not flooding the car with the call might not change anything.
I suppose that means the driver (or the person on the phone in the car) is supposed to have a headset so the other persons don't hear what is received.
But they'll have to bear at least what's told by the person in the car. So maybe half the communication can't be hidden.

And if the caller already has a headset, is all of this really useful ?

TDC: Audio routing for vehicles

Posted Jun 4, 2013 10:41 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

Yes. For example, my car has a built-in high-powered (3W!) cell phone which can be used far outside of normal reception areas. It would be nice to make it available to passengers.

Then there are RVs and mini-vans where the passengers can realistically talk over the phone without the driver even hearing them.

TDC: Audio routing for vehicles

Posted Jun 4, 2013 11:09 UTC (Tue) by hummassa (subscriber, #307) [Link]

> Yes. For example, my car has a built-in high-powered (3W!) cell phone which can be used far outside of normal reception areas. It would be nice to make it available to passengers.

Do you mind if I ask which car and/or which high-powered cell phone unit, for reference? This would be immensely useful to me, too...

TDC: Audio routing for vehicles

Posted Jun 4, 2013 11:13 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

Sure, it's an OnStar phone. My vehicle is Chevy Volt, but you can install OnStar on any vehicle (they sell special kits).

TDC: Audio routing for vehicles

Posted Jun 4, 2013 11:17 UTC (Tue) by micka (subscriber, #38720) [Link]

> my car has a built-in high-powered (3W!) cell phone which can be used far outside of normal reception areas

You know what, that made me realize something completely out of topic : I havent actually thought about reception area for a very long time and I wasn't even aware of it.

That drove me to check the GSM service in my country (France), which appeared to be between 99 % and 99,9 % (depending on provider) on 2012-01, and 3G was 93-98 (modulo roaming agreements).

Completely out of topic, but I wouldn't have even checked without this comment.

TDC: Audio routing for vehicles

Posted Jun 4, 2013 14:36 UTC (Tue) by anselm (subscriber, #2796) [Link]

The caveat here is that mobile communications providers like to measure their coverage area in »percent of population reached«. This means that even with near-100% coverage on paper, there may be huge swathes of countryside out in the boonies, where hardly anyone lives, with poor to no actual coverage. (This may not be a big issue in places like France or Germany; more so with, say, Canada or Sweden.)

TDC: Audio routing for vehicles

Posted Jun 4, 2013 14:51 UTC (Tue) by micka (subscriber, #38720) [Link]

One again, true, I only paid attention to the numeric value. those are explicitely percentage of population values.

The territory coverage is "only" 97,8 %. The difference is probably in the mountain areas.

TDC: Audio routing for vehicles

Posted Jun 6, 2013 16:26 UTC (Thu) by Quazatron (guest, #4368) [Link]

This is a perfect example of why open source matters: the needs of a specific sector ends up benefiting the whole system.

Now I hope the automotive industry would require built-in equalizer/compressor/spatializers so that the desktop could also have it.

I find it lacking that every media player brings its own equalizer implementation, but if you use other audio sources (flash, games) you don't have that control over the sound quality.

I know, I know... "patches welcome". :-)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds