Institutionen För Systemteknik Department of Electrical Engineering
Total Page:16
File Type:pdf, Size:1020Kb
Institutionen för systemteknik Department of Electrical Engineering Examensarbete Digital compensation of distortion in audio systems Examensarbete utfört i elektroniksystem vid Tekniska högskolan i Linköping av Fredrik Bengtsson, Rikard Berglund LiTH-ISY-EX--10/4367--SE Linköping 2010 Department of Electrical Engineering Linköpings tekniska högskola Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping Digital compensation of distortion in audio systems Examensarbete utfört i elektroniksystem vid Tekniska högskolan i Linköping av Fredrik Bengtsson, Rikard Berglund LiTH-ISY-EX--10/4367--SE Handledare: Kent Palmkvist isy, Linköpings universitet Pär Gunnars Risberg Actiwave AB Examinator: Kent Palmkvist isy, Linköpings universitet Linköping, 6 May, 2010 Avdelning, Institution Datum Division, Department Date Elektroniksystem Department of Electrical Engineering 2010-05-06 Linköpings universitet SE-581 83 Linköping, Sweden Språk Rapporttyp ISBN Language Report category — Svenska/Swedish Licentiatavhandling ISRN Engelska/English Examensarbete LiTH-ISY-EX--10/4367--SE C-uppsats Serietitel och serienummer ISSN D-uppsats Title of series, numbering — Övrig rapport URL för elektronisk version http://www.es.isy.liu.se http://www.ep.liu.se Titel Digital kompensering av distorsion i ljudsystem Title Digital compensation of distortion in audio systems Författare Fredrik Bengtsson, Rikard Berglund Author Sammanfattning Abstract The advancements of computational power in low cost FPGAs are giving the op- portunity to implement real-time compensation of loudspeakers and audio systems. The need for expensive commercial audio systems is reduced when the fidelity of much cheaper audio systems easily can be improved by real-time compensation. The topic of this thesis is to investigate and evaluate methods for digital com- pensation of distortion in audio systems. More specifically, a VHDL module is implemented to, when necessary, alleviate the problem of drastically deteriorating fidelity of the bass appearing when the input power is too high. Nyckelord Keywords Distortion, Digital Compensation, Signal Processing, Digital Filters, Audio Sys- tems, Amplifiers, Modelling, Audio Compressor, Audio Limiter Abstract The advancements of computational power in low cost FPGAs are giving the op- portunity to implement real-time compensation of loudspeakers and audio systems. The need for expensive commercial audio systems is reduced when the fidelity of much cheaper audio systems easily can be improved by real-time compensation. The topic of this thesis is to investigate and evaluate methods for digital com- pensation of distortion in audio systems. More specifically, a VHDL module is implemented to, when necessary, alleviate the problem of drastically deteriorating fidelity of the bass appearing when the input power is too high. v Acknowledgments We would like to thank: Kent Palmkvist Pär Gunnars Risberg Everyone at Actiwave AB Sebastian Abrahamsson Markus Råbe for their help in this thesis. Fredrik Bengtsson and Rikard Berglund vii Contents 1 Background 1 1.1 Introduction............................... 1 1.2 Purpose ................................. 1 1.3 Goals .................................. 2 1.4 Outlineofthereport.......................... 2 1.5 Denotationsanddefinitions . 3 2 Related theory and research 5 2.1 Energyandpower ........................... 5 2.1.1 Averagepseudopower . 5 2.1.2 Rootmeansquare ....................... 5 2.2 Distortion................................ 6 2.2.1 Undersampling ......................... 6 2.2.2 Totalharmonicdistortion . 6 2.2.3 Modulationdistortion . 6 2.2.4 IMDvs.THD ......................... 7 2.3 Non-linearitiesinaudiosystems. 7 2.3.1 Amplifier ............................ 7 2.3.2 Loudspeakers .......................... 7 2.4 Filters.................................. 8 2.4.1 Analogfilters .......................... 8 2.4.2 Digitalfilters .......................... 8 2.4.3 IIRfilters ............................ 9 2.4.4 FIRfilters............................ 10 2.5 Class-Damplifiers ........................... 11 2.6 Audiocompressor............................ 11 2.6.1 Functionality .......................... 11 2.6.2 Limiter ............................. 13 3 Test equipment 15 3.1 LoudspeakerA ............................. 15 3.2 Amplifiers................................ 16 3.2.1 AmplifierA........................... 16 3.2.2 AmplifierB........................... 17 ix x Contents 3.2.3 AmplifierC........................... 18 3.3 Soundcard ............................... 18 3.4 Microphone ............................... 19 3.5 Digitaloscilloscope . .. .. .. .. .. .. .. .. .. .. .. 19 4 Investigation 21 4.1 Analysisofaudiosequences . 21 4.2 Identifyingthecauseofdistortion. .. 22 4.3 Modelofclipping............................ 23 4.3.1 Onetonetest.......................... 23 4.3.2 Twotonetest.......................... 27 4.3.3 Conclusion ........................... 28 4.4 Saturationofamplifiers . 28 4.4.1 Voltagesaturation . 28 4.4.2 Over-currentprotection . 28 4.5 Voltage saturation/frequency dependency . ... 28 4.5.1 Bass/midrangedrivertest . 29 4.5.2 Fullrangeloudspeakertest . 30 4.6 Conclusion ............................... 31 5 The proposed solution 33 5.1 Basicfunctionalityofthemodel. 33 5.2 Essentialstructureofthelimiter . 34 5.2.1 LPprefiltering ......................... 34 5.2.2 LPpostfiltering......................... 34 5.2.3 Preservinga full frequencyrangesignal . 34 5.3 Amplitude reduction of the bass channel . 34 5.3.1 Timemultiplexing . .. .. .. .. .. .. .. .. .. 35 5.3.2 Scaling ............................. 36 5.3.3 FFTandnotchfilter. .. .. .. .. .. .. .. .. .. 38 5.3.4 Discussionandconclusions . 38 5.4 Choiceoffilters............................. 39 5.4.1 Crossover ............................ 39 5.5 Thedecisionmakingblock. 40 5.5.1 Themaximumblock . .. .. .. .. .. .. .. .. .. 41 5.5.2 Directsteering ......................... 41 5.6 Optionalfunctionality . 42 5.7 Thevolumecontrol........................... 43 5.8 Thecompletelimiter .......................... 44 5.9 Limitersimulations. .. .. .. .. .. .. .. .. .. .. .. 44 5.9.1 Limitation of a sinusoid with constant amplitude . .. 45 5.9.2 Limitationofarampingsinusoid . 46 5.9.3 Limitationofmusic . .. .. .. .. .. .. .. .. .. 47 5.10Conclusion ............................... 47 Contents xi 6 VHDL implementation 49 6.1 FPGA.................................. 49 6.2 Clockdomains ............................. 49 6.3 Implementation and optimization . 50 6.3.1 Biquads ............................. 50 6.3.2 Decisionmakingblock . 50 6.3.3 Miscellaneous.......................... 50 6.4 Volumecontrol ............................. 51 7 THD measurements 53 7.1 IntroductiontoTHDmeasurements . 53 7.2 THDmeasurement ........................... 53 7.2.1 Datacollection ......................... 54 7.3 Results.................................. 54 8 Conclusions and discussion 57 8.1 Audibleimprovement. 57 8.2 Regardingthemodel .......................... 58 8.2.1 Functionalityofthemodel. 58 8.2.2 Futureworkanddiscussion . 58 8.3 Supplementaryconclusion . 60 Bibliography 61 Chapter 1 Background 1.1 Introduction The advancements of computational power in low cost FPGAs are giving the op- portunity to implement real-time compensation of loudspeakers and audio systems. The need for expensive commercial audio systems is reduced when the fidelity of much cheaper audio systems easily can be improved by real-time compensation. Today it is possible to implement hardware that digitally compensates for e.g. phase delays, loudspeaker characteristics and distortion. The topic of this master thesis is to investigate and evaluate methods for digital compensation of distortion in audio systems. It is well known that a lot more energy is needed to produce a loud bass sound than a loud high-pitched sound, i.e., most of the sound energy in music comes from the kick drum and the bass guitar or bass synthesizer [16]. However, the limitations of amplifiers and loudspeakers will result in drastically deteriorating fidelity when playing too loud, which is the problem to be solved. Therefore, a hardware module, described in VHDL, will be implemented in order to, when necessary, reduce the problem of arising distortion. The area of interest is digital compensation of audio systems. The main ques- tions are: Is it possible to identify the cause of audible distortion due to too high volume in the audio system and digitally compensate for this with a real-time com- pensating module in hardware? If yes, is this a reliable and flexible implementation that is applicable in different audio systems? The answers to these questions, among with others, will be presented in this master thesis. 1.2 Purpose The purpose of this thesis is to gain further knowledge of the distortion rendered by too high input volume and how to compensate for this. The work was done at Actiwave AB. There were four main tasks: 1 2 Background 1. Investigate how a too high input signal rendering audible distortion is digi- tally detected in an audio system. 2. Determine how the distortion can be compensated and develop a model solving the problem stated above. 3. Implement a VHDL module, similar to the earlier developed model, accord- ing to hardware limitations and processing time in a real-time hardware system. 4. Present data comparing the distortion in the audio system when compensa- tion is on and off. 1.3 Goals The main goals are to develop a fully working model in Scilab or Simulink and implement