Вы находитесь на странице: 1из 97

AudioinembeddedLinuxsystems

Audio
inembedded
Linuxsystems
FreeElectrons

1
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Rightstocopy
Copyright20042009,FreeElectrons
feedback@freeelectrons.com
Documentsources,updatesandtranslations:
http://freeelectrons.com/docs/audio
Corrections,suggestions,contributionsand
translationsarewelcome!
AttributionShareAlike3.0 Latestupdate:Sep15,2009
Youarefree
tocopy,distribute,display,andperformthework
tomakederivativeworks
tomakecommercialuseofthework
Underthefollowingconditions
Attribution.Youmustgivetheoriginalauthorcredit.
ShareAlike.Ifyoualter,transform,orbuilduponthiswork,you
maydistributetheresultingworkonlyunderalicenseidenticalto
thisone.
Foranyreuseordistribution,youmustmakecleartoothersthelicense
termsofthiswork.
Anyoftheseconditionscanbewaivedifyougetpermissionfromthe
copyrightholder.
Yourfairuseandotherrightsareinnowayaffectedbytheabove.
Licensetext:http://creativecommons.org/licenses/bysa/3.0/legalcode
2
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Scopeofthistraining

AudioinembeddedLinuxsystems
Thistrainingtargetsthedevelopmentofaudiocapable
embeddedLinuxsystems.Thoughitcanbeusefultoplayingor
creatingsoundonGNU/Linuxdesktops,itisnotmeanttocover
everythingaboutaudioonGNU/Linux.
Linux2.6
ThistrainingonlytargetsnewsystemsbasedontheLinux2.6
kernel.Thisway,youleveragethemostadvancedtechnology
anddon'tlearnaboutsomethinggettingobsolete.

3
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Contents(1)

Introduction AdvancedLinuxSound
Glossary Architecture(ALSA)

Audiocodecsandfileformats ALSAkerneldrivers
Kernellowlatencyrequirements
Systemperspective
ALSAuserspaceinterface
Systemoverview
Soundservers

4
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Contents(2)

FreeSoftwareaudio
Audioplayersfortheembeddedtarget
Audioencoders
Creatingyourownapplications
Miscellaneous
Speechsynthesis
Audiodistributions
References

5
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
QuickGlossary

PCM:PulseCodeModulation
Digitalaudioencoding,representingtheamplitudeofasignalat
uniformintervals.
Codec:coder/decoder
Programordevicecodingand/ordecodingadatastreamora
signal.
MIDI:MusicalInstrumentDigitalInterface.
Standardtocontrolelectronicmusicalinstruments.
Seehttp://wikipedia.orgfordetails!

6
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

FreeSoftwareAudio
Audiocodecsandfileformats

7
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
MP3

MPEG1AudioLayerIII Themostpopular.Usershavelots
fromtheFraunhoferSociety offilesinthisformat.

Lossyaudioformat FreeSoftwareencodersand
decodersexist
Bitratesfrom32to320kbit/s
Butreliesonpatentedalgorithms.
Qualitydependsonthebitrate: Dependingonwhichcountryyou
128192:good,192224:very sellto,youmayhavetopayfora
good,224320:excellent license.
Dependsalsoprettymuchonthe Licensescanapplytoencoding,
encoderandonthesource. decodingorevensongs!
Dependsonthelistenertoo! Askforlegaladvice!

Seehttp://en.wikipedia.org/wiki/Mp3fordetails

8
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AAC

AdvancedAudioCoding Usedonsomeonlinemusicstores
MPEG4Audio (AppleiTunes)andportableplayers
(AppleiPod).
StandardformatfromtheMPEG
group:Dolby,Fraunhofer,AT&T, Alsoburdenedbypatents,likeMP3.
Sony,andNokia Licenseneededtoencodeandread
thisformat.
Lossyaudioformat
FreeSoftwaredecodersavailable.
DesignedtoreplaceMP3.
Consistentlybetteraudioquality JustoneFreeSoftwareencoder
thanMP3atlowerbitrates. available(faac).

CanbeDRMencrypted
(FairPlay).

Moredetailsonhttp://en.wikipedia.org/wiki/Advanced_Audio_Coding

9
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
RealAudio

FromRealNetworks FreeSoftwaredecoderavailable:
mplayer
http://realnetworks.com/
Mainlyusedforstreaming,usedby
Lossyaudioformat
asignificantnumberofonline
Proprietaryformat media.
Usefulformobiledevices
Designedfor
connectingtothesemedia.
verylowbandwidthconnections.
Onlyproprietaryencoders.
Bitrates:12to800kbit/s
RealNetworksencoderfreeof
NowusesAACat128kbit/sand
chargeonlyforpersonaluse.
more.
Losslessformatalsosupported

Moredetailsonhttp://en.wikipedia.org/wiki/Real_Audio

10
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
WMA

WindowsMediaAudio Nowsupportedbymoreandmore
digitalplayersandonlinemusic
Microsoftproprietary,asa stores.UsersmayaskforWMA
alternativetoMP3(patentedby playingcapability.
somebodyelse)andnowAAC.
LackofFreeSoftwareplayers
Almostalwaysencapsulatedinan (exceptlibavcodec)and
AdvancedSystemsFormat(ASF) encoders.
file.
Reliesonpatentedalgorithms.
Fileextensions:asforwma
Licensesmayapplytoencoding,
Supportsconstantandvariable decodingorevensongs,thoughMS
bitrates,andlosslesscompression. isstillverytolerantsofar(toachieve
CanbeDRMencrypted. dominance).

Seehttp://en.wikipedia.org/wiki/WMAfordetails

11
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OggVorbis

FromtheXiphfoundation Growinginpopularity.Moreand
http://xiph.org/ morehardwareplayersavailable.

Ogg:containerformultimedia Xiph.orgreleaseslibrariesundera
streams BSDstylelicenseandGPLfor
tools.
Vorbis:lossyaudioformat
VariousFreeSoftwaredecoders
Open,patentandroyaltyfree! andencodersavailable.Supported
bymanyproprietaryplayerstoo.
Bitratesfrom45to500kbit/s
Variablebitrate
AchievesbetterqualitythanMP3
atlowbitrates.

Seeforhttp://en.wikipedia.org/wiki/Ogg_vorbisdetails

12
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OggSpeex

FromtheXiphfoundation Constantorvariablebitrate,
http://www.speex.org/ from2to44kbit/s.

Ogg:container Listentosampleson
Usualfileextension:.spx http://speex.org/samples/.

Speex:lossyaudiodedicatedto FreeSoftwareencoder,
speechencoding. decodersandapplications
available.
TargetsVoiceoverIP
applications,voicemail Evensupportedbyproprietary
archival,audiobooks... tools(e.g.MSNetMeeting).

Open,patentandroyaltyfree!
Seehttp://en.wikipedia.org/wiki/Speexfordetails

13
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Flac

http://flac.sourceforge.net/ LibrariesavailableunderaBSD
SupportedbyXiph.org likelicense,andtoolsunderthe
GPL.
Losslessaudiocompression
format FreeSoftwareplayersavailable.
Compressaudiofilesatnorisk! Evenstartstobesupportedby
Preferredformatfortradinglive hardwareplayers.
musiconline.
Supportsstreaming.
Ogg:alsousedasacontainer.
Integeronlycoderanddecoder
available.

Seehttp://en.wikipedia.org/wiki/FLACfordetails

14
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Compressionrateexamplecomparison(1)

Format/ 64kbit/s 128kbit/s 192kbit/s 256kbit/s


bitrate
Wav 100.00%
MP3 4.6%(22:1) 9.1%(11:1) 13.6%(7:1) 18.2%(5:1)
(lame3.96.1)
OggVorbis 4.3%(23:1) 8.5%(12:1) 12.7%(8:1) 17.7%(6:1)
(oggenc1.0.1)
Flac(flac
1.1.0) 56.30%
bzip2(1.0.2) 89.50%

Source:OmaraPortuondo,FlordeAmor(CubanSalsa)

15
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Compressionrateexamplecomparison(2)

Compressionrate(sameexample)
120

100

Wav
80 MP3
OggVorbis
Flac
60
bzip2

40

20

0
64kbit/s 128kbit/s 192kbit/s 256kbit/s

16
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

Systemperspective

17
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Traditionalsystemarchitecture

Userapplications
App1 App2 App3
(concurrentaccess
toresources)

Sounddriverdevices(/dev)

Linuxkernel

Sounddrivers

Hardware

18
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OSS

TheOpenSoundSystem
http://www.4fronttech.com/oss.html
OldsoundcardsupportsysteminLinuxversionsupto2.4.
Stillusedforsomecardsin2.6(portingtoALSAinprogress).
OriginatesfromtheLinuxdriverfortheSoundBlaster16soundcard.
Extendedtosupportother(oftencompatible)soundcards.
Wasalsomadeavailableasaproprietaryandenhancedversionof
OSS,alsotargetingotherUnixsystems(suchasSolaris).
June14,2007:opensourced,buttoolate?
EvenifsomedriversarereportedtobebetterthanALSAones,
unlikelytobemergedinmainstreamLinuxsources.

19
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OSSsounddevices

Mainones /dev/sequencer
Audiosequencer(MIDI)
/dev/dsp
D/AandA/Dconverterdevice, /dev/sequencer2
access,togenerateaudioor Alternatesequencerdevice
toreadaudioinput.
Tocreatethedevicefiles:
/dev/mixer sudomknod/dev/dspc143
Mixercontrol sudomknod/dev/mixerc140
(mainlyforcontrollingvolume) Themajorandminornumbersfor
/dev/audio thesedevicesaredefinedin
Suncompatibledigitalaudio Documentation/devices.txt
(.aufileformat) inthekernelsources.

20
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OSSdspinterface

APIforaccessingplaybackandcapturecontrols
Writingto/dev/dsp:playback
Readingfrom/dev/dsp:capture(recording)
Onlyoneapplicationcanopen/dev/dspatattime.
Fullduplex(playingandrecording)notpossible.
Availableioctlsettings:samplesizeandsamplerate,
numberofreadorwritechannels(1:mono,2:stereo).
Moredetailson
http://www.oreilly.de/catalog/multilinux/excerpt/ch1405.htm

21
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OSSmixerinterface

CAPIforaccessingmixercontrols:mainlysettingchannel
volume(left,rightormono),andselectingrecordingsources.
Mainlybasedonioctlcommands,
toeitherqueryPCMdevicecapabilitiesandparameters
ortoassignvaluestotheseparameters.
Applicationsdon'thavetoopen/dev/mixertoissuethese
ioctls.Theycanalsouse/dev/dspifitisalreadyopen.
Settingsarekeptevenaftertheapplicationsexit.
Moredetailson
http://www.oreilly.de/catalog/multilinux/excerpt/ch1407.htm

22
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OSSissuesandlimitations

AtthetimeALSAwascreated.
Nosupportforsoftwaremixing
Nosupportforfullduplex.
Nohardwaremidisupport.
Lackofsupportforadvancedfeaturesofmanypopular
soundcards(liketheGravisUltrasoundone).
TheOSSdevelopersdecidedtogoclosedsource.
Communitydeveloperschosetocreateawholenew
system.

23
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
UsefullinksaboutOSS

O'Reilly'sMultimediaGuide(currentlyoutofprint)
Freeexcerpt:ProgrammingSoundDevices
http://www.oreilly.de/catalog/multilinux/excerpt/ch1401.htm
FullofdetailsabouttheOSSAPI.

24
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

Systemperspective
ALSAkerneldrivers

25
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSA

AdvancedLinuxSoundArchitecture
http://www.alsaproject.org/
ProjecttoprovidefullaudioandMIDIfunctionalitytoLinux.
OfficialLinuxsoundsystemsinceLinux2.6.
Startedin1998byJaroslavKysela,originallytofullysupport
allthefeaturesoftheGravisUltrasoundcard.
OSSemulation:fullysupportsapplicationsoriginallycreatedfor
OSS(stillaccessing/dev/sound,/dev/dspor/dev/mixer).
Devicefilesin/dev/snd/.
Youdon'tneedtousethemdirectly.Usealsalibinstead.

26
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAkernelspacefeatures

Efficientlyandfullysupportsfromconsumersoundcards
toprofessionalmultichannelaudiointerfaces,bringing
featuresnotsupportedbyOSS,suchashardwarebased
MIDIsynthesis,softwaremixingofmultiplechannelsand
fullduplexoperation.
SupportsSMP(multiprocessor)systems.
Threadsafedevicedriversanduserspacelibrary.
ConsistentandgenericcontrolAPI
formanaginghardwarecontrols.
Fullymodularizedsounddrivers.
Sharescodeforsimilarchipsets.

27
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSA/procinterface

/proc/asound/version
ALSAversion
/proc/asound/cards
Listofavailablesoundcards
0[I82801DBICH4]:ICH4Intel82801DBICH4
Intel82801DBICH4withSTAC9750/51at0xf4fff800,irq5
1[Modem]:ICHMODEMIntel82801DBICH4Modem
Intel82801DBICH4Modemat0xb400,irq5

/proc/asound/devices
Listofcarddevices
/proc/asound/card<i>/id
Cardidentifier
/proc/asound/card<i>/pcm[c|p]<j>/info
Informationaboutacapture(c)orplayback(p)PCMdevice.
Moreonhttp://alsa.opensrc.org/index.php/Proc_asound_documentation

28
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAandLinux2.6sources

OfficialLinux2.6sourcesnowuseALSA
However,Linuxreleasesdonotalways
includethelatestALSAreleases.
Example:Linux2.6.25(Apr.16,2008)includesALSA1.0.16rc2
(Jan.29,2008),andnotALSA1.0.16(Feb.6,2008).
HowtochecktheALSAversioninyourkernelsources?
Seeinclude/sound/version.h.
HowtochecktheALSAversioninyourrunningsystem?
cat/proc/asound/version.
Ifneeded,youmayinstallamorerecentALSAversion.

29
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
CreatingALSAdevicefiles(1)

Notneededifyouhaveanelaboratesystemwithudev.
Youcanusethebelowudevrulestocreatethesedevicefiles
automatically
(puttheserulesinafilein/etc/udev/rules.d):

#Sounddevices,groupunder/dev/snd
KERNEL=="controlC[09]*",NAME="snd/%k"
KERNEL=="hwC[D09]*",NAME="snd/%k"
KERNEL=="midiC[D09]*",NAME="snd/%k"
KERNEL=="pcmC[D09cp]*",NAME="snd/%k"
KERNEL=="seq",NAME="snd/%k"
KERNEL=="timer",NAME="snd/%k"
Inanembeddedsystem,youcancreatethesedevicefilesmanually.

30
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
CreatingALSAdevicefiles(2)

ALSAdevicefilesareeasytocreatebyhand!
mkdir/dev/snd
cat/proc/asound/devices cd/dev/snd
0:[0]:control mknodcontrolC0c1160
8:[00]:rawmidi mknodmidiC0D0c1168
16:[00]:digitalaudioplayback mknodpcmC0D0pc11616
17:[01]:digitalaudioplayback mknodpcmC0D1pc11617
24:[00]:digitalaudiocapture mknodpcmC0D0cc11624
33::timer mknodtimerc11633

C:Card
device 0:Cardnumber
Minor number D:Device
number 0/1:Devicenumber
card p/c:playback/capture
number

31
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
DummyALSAdriver

DummyALSAdevicediscardinganysoundplayedonit.
Canbeusefultotestyouraudioapplicationseveniftheaudio
hardwareisnotreadyyet,ortocheckthatwhetherproblemscome
fromyourexperimentaldriverorfromyourexperimental
application.
Touseit:
>modprobesnddummy
>cat/proc/asound/cards
0[I82801DBICH4]:ICH4Intel82801DBICH4
Intel82801DBICH4with
STAC9750,51at0xf4fff800,irq5
1[Dummy]:DummyDummy
Dummy1

32
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
WritingALSAdrivers

Usefulreferences
"WritinganALSADriver",TakashiIwai
http://www.alsaproject.org/~iwai/writinganalsadriver/
Averycomprehensiveguide!
Wemadesmallcontributionstoit.
ALSAdriverAPIreference
http://www.alsaproject.org/~iwai/alsadriverapi/

33
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

Systemperspective
Kernelrequirementsforsound

34
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Realtimerequirementsforaudio

Verylowlatencyrequirementsinsomeaudioapplications
<3ms,whentheoutputiscombinedwiththeoriginalsignal.
Otherwise,combfiltering.
Audioapplicationsneedhighpriority,sothattheoutputdevices
arealwaysfed.Otherwise:choppyaudio.
Musicians:needtohearimmediatelywhattheyareplaying.
Whenaudioneedstobeinsyncwithvideo.
Audiocommunications.

35
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ReducingLinuxlatency

StandardLinux:latencycanreacha100msmagnitude.
Typicaltargetlatency:1to5ms.
HardrealtimeLinux(suchasRTAI)wouldcomplicate
applicationdevelopmenttoomuch(specialAPItostartreal
timejobs).
SinceLinux2.2and2.4,lowlatencypatches
havebeenusedbyaudiousers.
BetterresponsivenessinstandardLinux2.6,
butnotenoughyet.
Fortunately,realtimepreemptpatchesnowsatisfyLinuxaudio
userneeds.Thesystemcanreachlatenciesunder100s.

36
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Realtimepreemptionpatches

http://www.kernel.org/pub/linux/kernel/projects/rt/
PatchesfromIngoMolnar,ThomasGleixner,andthekernel
developmentcommunitytoeliminatesourcesoflatency.
Theypatientlyhavetheirchangesacceptedinthe
mainstreamLinuxkernel,andfindsolutionswhichdonot
hurtthegeneralpurposenatureofLinux.
Availableformosthardwarearchitecturessupportedby
Linux,inparticularonembeddedones.Gettingstableon
mostcommonplatforms.
Seeourhttp://freeelectrons.com/articles/realtime/
presentationfortechnicalandusagedetails.

37
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

Systemperspective
ALSAuserspaceinterface

38
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAuserspacefeatures

Basedonthealsalibuserspacelibrary
todelegatesoundcontroltouserspace.
Lotsoffunctionalitiesprovidedtouserprograms,
suchassoftwaremixing(dmix).
SupportfortheolderOSSAPI,
providingbinarycompatibilityformostOSSprograms.
Supportsuserspecificconfiguration($HOME/.asoundrc)
Multithreadsafe
Essentialcapabilityforthedesignofmodernaudioapplications.

39
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsalib

Namedlibasoundin/usr/lib
Size:784KBonUbuntu8.04(i386)
Thesizecanbereducedbyremovingfeatures
atconfigurationtime.

40
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAsystemarchitecture

App1 App2 App3 Userapplications


(concurrentaccess
toresources)
alsalib
Nolongerneeded
toaccess
Sounddriverdevices(/dev)
/dev/files!
Linuxkernel
Sounddrivers

Hardware

41
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsamixer

Userinterfacetosetchannelvolumecontrol,
andmicrophoneinputlevel.
Textonly(ncurses).Easytouseinembeddedsystems!

42
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
amixer

Samefunctionalityasalsamixer,butfromthecommandline(orfrom
scripts).Examples:
Examples:
amixerc1ssetLine,080%,40%unmutecap
Setsthesecondsoundcard'sleftlineinputvolumeto80%andrightline
inputto40%,unmuteit,andselectitasasourceforcapture
(recording).
amixerc2csetiface=MIXER,name='LinePlayback
Volume",index=140%
Setsthethirdsoundcard'ssecondlineplaybackvolume(s)to40%
amixerc2csetnumid=3440%
Setsthe34thsoundcardelementto40%

43
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsactl

Commandavailabletotherootuser
alsactlstore[card_num]
Storesthecurrentalsamixersettings
in/etc/asound.state.
Otherwise,notsavedafterreboot.
alsactlrestore[card_num]
Restoresthesavedalsamixerstate.
alsactlpower[card_num][state]
Displays/setsthepowerstateofsoundcards.

44
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsalibconfiguration

ElaboratePCMstreamhandlingcanbedefinedbyeachuser!
/etc/asound.conf
Systemwidedefinitions
$HOME/.asoundrc
Userspecificdefinitions

45
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAdevicenaming

alsalibuseslogicaldevicenamesratherthandevicefiles
Eitherrawhardwaredevices:hw:i,jorplughw:i,j
i:cardnumber,j:devicenumberonthecard
plughw:automaticallyconvertsthesampleformat,rate,
accesstypeandnumberofchannelstothehardware'snative
format.
hw:requiresacompatibleconfiguration.
Oraliases
(definedin/etc/asound.conforin$HOME/.asoundrc)
default:hw:0,0
Orplugins(seenextpage)

46
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAdevicenamingexample

Giveanametoyoursoundcards
Example:(in/etc/asound.conforin$HOME/.asoundrc):
pcm.acmesound{
typehw
card0
device0
}
YoucannowbuildmorePCMdeviceswithit,
andofcourseuseittoplaysound:
aplayDacmesoundrageagainstthewindows.wav

47
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsalibPCMplugins

Userinterfacetoalsalibforuseinthecommandline
orin/etc/asound.confor$HOME/.asoundrc
ExtendsthefunctionalityandfeaturesofPCMdevices.
Correspondtoalsaliblibraryfunctions.
Acceptsparameters,whichcanalsobepassed
throughthecommandline.
InasystemrunningALSA,allthepluginsaredefinedin
/usr/share/alsa/alsa.conf
(themasterconfigurationfileforALSA).
Usefultoseewhattheirparametersare.
Seehttp://www.alsaproject.org/alsadoc/alsalib/pcm_plugins.html

48
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Afewpluginexamples

hw:itisitselfaplugin,givingaccesstothespecifiedhardware.
copy:copiesthecontentsofaPCMstreamtoanother
null:discardsthecontentsofaPCMstream
file:storesthecontentsofaPCMstreamtoafile.
Canalsobeusedtouseafileasaninputdatastream.
tee:playstheaudioonaPCMstream
anddumpsittoafiletoo.
dmix:mixesseveralstreams.
Enabledasdefaultforsoundcardswithouthardwaremixing.
multi:combinesseveralhardwarePCMdevices
intoavirtualone.
More:rateandformatconversion,softvolume,etc.

49
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Theplugplugin

plugautomaticallyperformschannelduplication,samplevalue
conversionandresamplingwhennecessary.
Forexample,dmixneedstoresamplealltheaudiotothesame
samplerate(48000Hzbydefault)beforedoingthemixingwork.
That'swhymostofthetimedmixisusedtogetherwithplug
(examplesarecomingsoon).
hwplug:usedtodirectlydotheplugworkandplayonthe
specifiedhardware(wealreadyexplainedit).

50
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
DefiningPCMdevicesfromothers

YoucanuseplugtocreatemorePCMdevicesfromothers:
Rateconversiondevice Virtualdevicerecordingtoagiven
pcm.f44100{ file:
typeplug pcm.recorder{
slave{ typeplug
pcmdefault slave{
rate44100 pcm"file:sound.raw"
} aPCMdevicename,
}
} } aPCMdevicename, pluginparameters
herethefileplugin!
Exampleuse: Exampleuse:
aplayDf44100foo.wav aplayFrecorderbar.wav

51
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Plugindeclarationexample
pcm.tee{
@args[SLAVEFILEFORMAT]
@args.SLAVE{
typestring
} From/usr/share/alsa/alsa.conf
@args.FILE{
typestring
} Youcanseewhatthepluginparametersare.
@args.FORMAT{
typestring
defaultraw
}
typefile
slave.pcm$SLAVE
file$FILE
format$FORMAT
}
pcm.file{
@args[FILEFORMAT]
@args.FILE{
typestring
}
@args.FORMAT{
typestring
defaultraw
}
typefile
slave.pcmnull
file$FILE
format$FORMAT
}

52
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Playingsoundexamples

aplayDhw:0,0yoohoo.wav
Playstothefirstdeviceonthefirstsoundcard.
aplayDplughw:1,0yoohoo.wav
Playstothefirstdeviceonthesecondsoundcard,
withautomaticconversiontoasampleratesupportedbythiscard.
aplayDmycardyoohoo.wav
PlaystothemycardPCMdevice
(definedin/etc/asound.conforin$HOME/.asoundrc)
aplayDnullyoohoo.wav
PlaystotheNullplugin
aplayDfile:/tmp/sounddump.raw
Playstothefileplugin,passing/tmp/sounddump.rawasa
parametertothisplugin.

53
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Softwaremixingexample

ALSAmakesiteasytomixseveralaudiosources:
Runthebelow2commands:
alsaplayerdplug:dmixsimon.ogg&
alsaplayerdplug:dmixgarfunkel.ogg&
Withaplay(supportingmainlyWAVfiles):
aplayDplug:dmixsimon.wav&
aplayDplug:dmixgarfunkel.wav&
Youcanrunanynumberofparallelprocesses.
Similarly,youcanaccessotherpluginsandsettheirparameters
fromthecommandline.
Ifyoudon'thavehardwaremixingsupport,rememberthatmixingis
enabledbydefault.Youdon'tevenhavetospecifytheplugin!

54
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Otherutilities

speakertest(alsautilspackage)
AllowstotestdifferentALSAconfigurations
Example:
speakertestf440tsine
Generatesandplaysa440Hzsinesignal.
speakertestc2twav
Saysfrontleftinthefrontleftspeaker,and
frontrightintherightleftspeaker(c:numberofchannels)

55
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Recordingsound

Easytodofromthecommandline
Firstmakesureyourmicrophoneisenabled.
Inalsamixer,selectthecapturedevices,andenableyour
microphone(maybeanotherdevicedependingonyourcard),
andifneededadjusttherecordinglevel.
Thenrecordfromyourmicrophonewiththearecordcommand:
arecordfcdinput.wav(CDqualitywavfile).
Typemanarecordformoreoptions.

56
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
alsalibAPI
LowlevelAPIforsoundprogramming.Mostapplicationsshouldprobably
bewrittenwithhigherlevelAPIs
Seehttp://0pointer.de/blog/projects/guidetosoundapis
InALSA
Controlinterface:generalpurposefacilityformanagingregistersofsoundcardsand
queryingavailabledevices.
PCMinterface:managingdigitalaudiocaptureandplayback.
Mixerinterface:controlsthedevicesonsoundcardsthatroutesignalsandcontrol
volumelevels.Builtontopofthecontrolinterface.
Timerinterface:accesstotiminghardwareonsoundcards,usedforsynchronizing
soundevents.
RawMIDIinterface:accesstoaMIDIbusonasoundcard.Worksdirectlywiththe
MIDIevents.Protocolandtimingmanagementuptotheprogrammer.
Sequencerinterface:ahigherlevelinterfaceforMIDIprogrammingandsound
synthesisthantherawMIDIinterface.HandlesmuchoftheMIDIprotocolandtiming.

57
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Openingandclosingadevice
Openingadevice
intsnd_pcm_open( snd_pcm_t**handle,
constchar*name,
snd_pcm_stream_tstream,
intmode)
handleisareturnedvalue,containinganhandletoreferencethe
openedsounddevice
nameisthenameofthesounddevicetoopen.Canbedefault
orhw:0,0,plughw:1,0,etc.
streamiseitherplaybackorcapture
modecanbe0(defaultvalue),orcanbeusetorequestnon
blockingorasynchronousmodes
Closingadevice
int snd_pcm_close(snd_pcm_t*pcm)
58
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Openingandclosing:example

#include<alsa/asoundlib.h>

intret;
snd_pcm_t*handle;

ret=snd_pcm_open( &handle,"default",
SND_PCM_STREAM_PLAYBACK,
0);

/*Usehandle*/

snd_pcm_close(handle);

59
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
PCMdeviceparameters
APCMhandleisconfiguredthroughparameters,usinga
snd_pcm_hw_params_tstructure
Structureallocation
snd_pcm_hw_params_alloca()
Initializationtodefaultvalues
int snd_pcm_hw_params_any(snd_pcm_t*pcm,
snd_pcm_hw_params_t*params)
Modificationoftheparameters
snd_pcm_hw_params_set_access(),
snd_pcm_hw_params_set_format(),
snd_pcm_hw_params_set_channels(),etc.
Associatingtheparameterstothedevice
intsnd_pcm_hw_params(snd_pcm_t*pcm,
snd_pcm_hw_params_t*params)
60
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
PCMdeviceparametersexample

snd_pcm_hw_params_t*params;

snd_pcm_hw_params_alloca(&params);
snd_pcm_hw_params_any(handle,params);

snd_pcm_hw_params_set_access
(handle,params, SND_PCM_ACCESS_RW_INTERLEAVED);

snd_pcm_hw_params_set_format
(handle,params,SND_PCM_FORMAT_S16_LE);

snd_pcm_hw_params_set_channels
(handle,params,2);

val=44100;
snd_pcm_hw_params_set_rate_near
(handle,params,&val,&dir);

rc=snd_pcm_hw_params(handle,params);

61
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
PCMperiod

Theperiodisthenumberofframesplayedorrecordedbetween
twosoundinterrupts
Itssizeinframescanbereadusing
snd_pcm_hw_params_get_period_size()
Thesizeinframecanbeconvertedtoasizeinbyteswiththe
propermultiplier(4forstereo16bits)
Itsdurationcanbereadusing
snd_pcm_hw_params_get_period_time()
Itisalsopossibletoconfiguretheperiodlength,between
minimumandmaximumvaluesexportedbyALSA
ItallowstomakeabalancebetweenlatencyandCPUusage
Itisthenbesttoworkwithbuffersofasizecorrespondingtothe
period
62
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Playingsound

Playingisdoneusing
snd_pcm_sframes_tsnd_pcm_writei
(snd_pcm_t*pcm,constvoid*buffer,
snd_pcm_uframes_tsize)
pcmisthePCMhandle
bufferthebuffercontainingthedatatobeplayedintheproper
format
sizethenumberofframesinthebuffertoplay
Returnsthenumberofplayedframes,oranerror.Iftheerroris
EPIPE,itmeansthatanunderrunoccured:theprogramdidn't
feeddatafastenoughforthesoundcard
Theiinsnd_pcm_writei()standsforinterleaved.Anon
interleavedvariantexists,snd_pcm_writen().

63
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
RecordingsoundandotherAPIs
Similarly,recordingisdoneusing
snd_pcm_sframes_tsnd_pcm_readi
(snd_pcm_t*pcm,void*buffer,
snd_pcm_uframes_tsize)
WhenEPIPEisreturned,anoverrunoccurred(theapplication
didn'trecordthedatafastenough)
Andthecorrespondingnoninterleavedvariant
snd_pcm_readn()
Thesetwofunctionsblockuntiltheframehasbeenplayedor
recorded.Other,morecomplicated,I/Omodesareavailablewith
ALSA
Asynchronousinterface,notificationbysignal.Becareful,signals
aredifficult!
MemorymappedAPI
64
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
PCMstatesandxrunrecovery

EachPCMhandleisassociatedwithastate
open,setup,prepare,running,xrun,draining,
paused,suspended,disconnected
Aftertheconfiguration,thedeviceisinthepreparestate,and
anyreadorwritewillmoveittotherunningstate
Andunderrunoroverrunwhilereadingorwritingwillmoveitto
thexrunstate
Acalltosnd_pcm_prepare()isthennecessarytoputitbackin
theproperstate
BeforeclosingthePCMhandle,it'sbesttodraintheremaining
buffersusingsnd_pcm_drain().

65
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
SALSAlibrary

http://www.alsaproject.org/main/index.php/SALSALibrary
Small,lightweight,hotandspicyversionoftheALSAlibrary,
mainlyforembeddedsystemswithlimitedresources.
DesignedtobesourcelevelcompatiblewithALSAlibraryAPIfor
limitedcontents.
Notsupported:ALSAsequencer,pcmpluginsandconfiguration.
Noformatconversion!
Size:reportedtobe1/10thoflibasound.

66
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
ALSAdocumentation

Kernelsources:
Documentation/sound/alsa
OfficialALSAdocumentation
http://www.alsaproject.org/main/index.php/Documentation
AcloselookatALSA
(usefulexplanationsaboutALSAconfigurationandplugins)
http://www.volkerschatz.com/noise/alsa.html
ALSAWiki:lotsofresources!
http://alsa.opensrc.org/

67
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

Systemperspective
Soundservers

68
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Soundserverbasedsystemarchitecture

App1 App2 App3 Soundserverstake


careofhandling
soundserver soundresource
accessand
alsalib soundflows
betweenapps
Sounddriverdevices(/dev)
Linuxkernel
Sounddrivers

Hardware

69
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Traditionalsoundservers

Handlemultipleaudiostreams,butprimarilydesignedfor
incidentalsoundsupportsuchasdesktopeventsoundsand
lightweightgamesound.
aRts(artsd)anAnalogRealTimeSynthesizer
UsedbyKDEuntilversion3.ReplacedbyPhononinKDE4.
http://www.artsproject.org/
esound(esd)theEnlightenedSoundDaemon
UsedbyGnome
http://www.tux.org/~ricdude/EsounD.html
Bothprojectshaveachievedtheirgoals.Noactivedevelopment.

70
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
JackAudioConnectionKit

http://jackaudio.org/
Newsoundserverdesigned
fromthegroundupforprofessionalaudiowork.
SupportsPOSIXcompliantoperatingsystems,
suchasGNU/LinuxandMacOSX.
Mainfocus
Lowlatencyoperation,
takingadvantageofLinuxlowlatencycapabilities.
Synchronousexecutionofallclients.
Notdesignedforembeddedsystemsandnotreallyuseful
forthem,exceptforprofessionalaudiodevices

71
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
PulseAudio

http://pulseaudio.orgbyLennartPoettering
AnincreasinglypopularsoundserverforPOSIXandWin32systems.
Intendedtobeadropinreplacementtoesound.
Betternetworkingsupport(streaming).
Library:LGPL,forconnectiontotheserver
Serverdaemon:GPL.Alsobasedonplugins(modules).
Canbeusedbyesound,ALSA,OSS,gstreamerapplications...
Lowlatencyoperationandlatencymeasurement.
Nowfeaturesintegeronlyresampling(goodforFPUlessembedded
systems)
ThedefaultsoundserverinFedora(sinceversion8)
andUbuntu(since8.04).
Thebestchoiceforembeddedsystemsifyouneedasoundserver!
72
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

FreeSoftwareAudio
Audioplayers
fortheembeddedLinuxtarget

73
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Consolebasedsoundplayers

alsaplayeritext
AlsaPlayer'stextinterface.Universalandpowerful.Canbe
builtwithoutGTK.
mplayer
Anotheruniversalsolution.Mostformatssupportedthrough
plugins.Evensupportsonlinestreams!
ogg123
Ogg/VorbisplayerfromXiph.org.

74
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Otherconsolebasedsoundplayers

aplay
FromtheALSAproject.
Supportedformats:wav,au(Sun),voc(SoundBlaster)

75
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Integeronlyaudiodecoders

Targetedtoarchitectureswithnohardwarefloatingpoint
unit(suchasARMones)
Tremorlibrary(BSDlicense,fromXiph.org)
http://xiph.org/vorbis/
CanplayanyOggVorbisfileorstream.
Theprojectevenincludesalowmemorybranch.
MAD:MPEGAudioDecoder(GNUGPL)
http://www.underbit.com/products/mad/
CandecodeMPEGAudiolayerI,IIandIII.
Library(libmad)andcommandlinefrontend
(madplay).

76
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

FreeSoftwareAudio
Encoders

77
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
LAME

LAMEAin'tanMp3Encoder:http://lame.sourceforge.net/
License:LGPL
MPEG1,2and2.5layerIIIencoding.
Constantandvariablebitratessupported
QualitycomparabletoFraunhoferencodingenginesand
substantiallybetterthanmostotherencoders.
GPLGPSYCHOpsychoacousticandnoiseshapingmodel:
http://lame.sourceforge.net/gpsycho/gpsycho.html
Availableasasharedlibrary,embeddedinmanyapplications
Usesubjecttopatentsinsomecountries!

78
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Miscmp3encoders

GOGO:http://freshmeat.net/projects/gogo/
PatchagainstLAMEdoublingitsspeed,usingMMX,3D
Now!,andSSEifsupportedbyyourprocessor.

79
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
OggVorbisencoder

OggEnc
ReleasedwithOggVorbissoftwarefromXiph.org.
Simpleexample:
oggencinput.wavb128M160ooutput.ogg
Nointegeronlyencoderavailableyet.
Reliesheavilyonfloatingpointcomputation.

80
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Speexencoder

speexenc
Releasedwiththespeexpackagefromhttp://speex.org/
Simpleexample:
speexencquality7input.wavoutput.spx
Seemanspeexencforfullcommandlineoptions
Nointegeronlyencoderavailableyet

81
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Flacencoder

flac
Availablefromhttp://flac.sourceforge.net
Samecommandforencodinganddecoding
Seemanflacforcommandlineoptions
Youcanchoosethecompressionrate.
Justslowertoencode,ofcoursenoqualitylossatall!
Theencoderanddecodercannowbecompiled
inintegeronlymode!

82
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

FreeSoftwareAudio
Creatingyourownapplications

83
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
gstreamer(1)

http://gstreamer.freedesktop.org
Acrossplatformframework
forbuildingmultimediaapplications.
Supportedplatforms:
Linux(x86,arm,ppc),Solaris,(x86andsparc),MacOSX,Windows.
Smallcorelibraryoflessthan150KB.
Alreadyusedinembeddedsystems(suchastheNokia770).
License:LGPL
Manyaudioandmultimediaapplicationsarenowbasedonit:
http://gstreamer.freedesktop.org/apps/
Highlights:Rythmbox,Totem(Gnome),Kaffeine(KDE),amaroK.

84
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
gstreamer(2)

gstreamerusestheabstractionofpipeline.
Elementsinapipelineareimplemented
byplugins.Noneedtorecompile
applicationswhenanewpluginisadded.
Lotsofpluginsareavailable:
videoandaudiodecoders(formostexistingformats),
encoders,andfilters.Thepluginsmakeiteasytousethedifferent
coding/decoding/filterlibrarieswithouthavingtolearntheirAPI.
gstreamerwillreallymakeiteasiertocreateyourcustom
multimediaapplicationforyourembeddedsystem!
Seehttp://gstreamer.freedesktop.org/documentation/fordetails.

85
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Variousutilities

libfishsound
http://www.annodex.net/software/libfishsound/index.html
Simpleprogramminginterfacefordecodingandencodingaudio
datausingcodecsfromXiph.org(mainlyVorbisandSpeex).
License:BSDlike.

86
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
AudioinembeddedLinuxsystems

FreeSoftwareAudio
Miscellaneous

87
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Speechsynthesis

Flite:http://www.speech.cs.cmu.edu/flite/
FestivalLitefromtheCarnegieMellonUniversity
Festivalisafreespeechsynthesisprogram,
butitisfarfrommeetingtherequirementsofembedded
systems.
UnlikeFestival,Fliteislight(<4MB),veryfast(verywellsuited
forslowCPUs),portable(writteninC),andthreadsafe.
TypicallytargetsdeviceslikePDA,GPSorphones.

88
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Variousapplications

Ecasound:http://www.eca.cx/ecasound/
Multitrackaudioprocessingpackage.Canbeusedfor
simpletaskslikeaudioplayback,recordingandformat
conversions,aswellasformultitrackeffectprocessing,
mixing,recordingandsignalrecycling.Supportsawide
rangeofaudioinputs,outputsandeffectalgorithms.
LADSPA(LinuxAudioDeveloper'sSimplePluginAPI)
http://www.ladspa.org/
Apluginaudioprocessorframework.
Severalsoundeffectpluginsavailable(reverb,etc.).

89
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Audiodistributions

UsefultodiscoverLinuxsoundapplications!
UbuntuStudio:http://ubuntustudio.org/
AUbuntubasedsystem(withaliveCD)
formultimediacreating(sound,graphics,video)
64studio:http://www.64studio.com
Debianbaseddistributionforaudioandmultimediacreation.
Moreinterestingdistributionsonhttp://linuxsound.org/distro.html

90
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Usefulreading

IntroductiontoLinuxAudio,byFilippoPappalardo
http://www.osnews.com/story.php?news_id=6720
Averyniceandsyntheticreview.Goodsummary.

91
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Freemusicandsounds

Artistssharingtheircreationsunderafreelicense!
Devicemakers:canbeusedinproductdemos.
Jamendo:http://www.jamendo.com
Verypopular.Manyartists.Manyusers.Allsongsseemtobeavailablein
bothmp3andOgg/Vorbis.Artistsgetsomefundingwithrevenuesfrom
commercialsandgiftsfromusers.
Freesound:http://www.freesound.org/
FreesoundsamplesreleasedunderaCreativeCommonslicense.
Greatformakingsoundcapabledevices!
YahooCreativeCommonsSearch:http://search.yahoo.com/cc
MakesiteasytofindworksreleasedwithaCreativeCommonslicense.
Moresimilarsitesonhttp://creativecommons.org/audio/

92
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Usefullinks

Sound&MIDISoftwareForLinux
http://sound.condorow.net/
ThemostexhaustivecatalogofLinuxaudioprojects,
programsandarticles!
FreeBSDaudiosoftwarecatalog
http://www.freebsdsoftware.org/audio/
AnextensivelistofUnixprogramsforaudio.
LinuxAudioUserGuide
http://lau.linuxaudio.org/
AcollectionofdocumentsandHOWTOs.

93
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Conclusion

ThemajorstrengthoftheLinuxsoundsolutionisagainits
modularity.Eachmoduletakescareofasingletask,anddoesit
verywell.
ALSA:providesaunifiedinterfacetothehardware.
Soundserver:takescareofmanagingsharedaccessto
soundresourcesbysoundapplications.
Soundlibraries:decode,encode,ortransformsound.
Userapplications:providegivenfunctionalitiestotheend
user.
Anotherstrengthisthatthewholesoftwaresolutioncanbe
developedonthePChostinparallelwithembeddedHWand
SWdevelopment.
94
FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Relateddocuments

Allourtechnicalpresentations
onhttp://freeelectrons.com/docs

Linuxkernel
Devicedrivers
Architecturespecifics
EmbeddedLinuxsystemdevelopment

FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Howtohelp

Youcanhelpustoimproveandmaintainthisdocument...
Bysendingcorrections,suggestions,contributionsand
translations
Byaskingyourorganizationtoorderdevelopment,consulting
andtrainingservicesperformedbytheauthorsofthese
documents(seehttp://freeelectrons.com/).
Bysharingthisdocumentwithyourfriends,colleagues
andwiththelocalFreeSoftwarecommunity.
Byaddinglinksonyourwebsitetoouronlinematerials,
toincreasetheirvisibilityinsearchengineresults.

FreeElectrons.Kernel,driversandembeddedLinuxdevelopment,consulting,trainingandsupport.http//freeelectrons.com
Linuxkernel
Linuxdevicedrivers
FreeElectrons
Boardsupportcode Ourservices
Mainstreamingkernelcode
Kerneldebugging
CustomDevelopment
Systemintegration
EmbeddedLinuxTraining
EmbeddedLinuxdemosandprototypes
Allmaterialsreleasedwithafreelicense! Systemoptimization
UnixandGNU/Linuxbasics Applicationandinterfacedevelopment
Linuxkernelanddriversdevelopment
RealtimeLinux,uClinux Consultingandtechnicalsupport
Developmentandprofilingtools Helpindecisionmaking
Lightweighttoolsforembeddedsystems Systemarchitecture
Rootfilesystemcreation Systemdesignandperformancereview
Audioandmultimedia Developmenttoolandapplicationsupport
Systemoptimization Investigatingissuesandfixingtoolbugs