w WAN_0247 DRC Attack and Decay Times for Real Audio Signals INTRODUCTION Dynamic range controllers (DRCs) are systems used to dynamically adjust the signal gain in conditions where the input amplitude is unknown or varies over a wide range. Attack and decay rate settings control how quickly the DRC changes the gain. Under controlled conditions using artificial signals it is possible to measure attack and decay times. However, in typical use cases, where real audio signals are being processed, attack and decay periods merge into each other and measuring times becomes impractical. Attack and decay settings are defined based on the operation of the DRC rather than the observed attack or decay times. SCOPE This application note applies to the following Wolfson audio CODECs only: • WM8903 / WM8910 / WM8904 / WM8912 / WM8918 The following topics are covered: • Overview of DRC Operation. • Explanation of how DRC attack and decay times are generated. • Specification of DRC attack and decay rates in the datasheet. • Attack and decay times when applied to real audio signals. • How to choose attack and decay settings. For more general information on DRC operation and use cases, please refer to Wolfson Application Note WAN_0215 “DRC Operation in Wolfson Audio CODECs”. WOLFSON MICROELECTRONICS plc To receive regular email updates, sign up at http://www.wolfsonmicro.com/enews September 2010, Rev 1.0 Copyright ©2010 Wolfson Microelectronics plc WAN_0247 Customer Information OPERATION OF THE DRC The DRC is a digital block within the digital audio path that can be used to apply compression or automatic level control. During compression a change in input amplitude will result in a smaller change at the output. For example, if there is a compression ratio of ¼ then a 4dB change in amplitude at the input will result in a 1dB change in amplitude at the output. Figure 1 shows a typical transfer curve of input amplitude verses output amplitude for a DRC, where DRC_KNEE_OP, DRC_KNEE_IP, DRC_LO_COMP and DRC_HI_COMP are user defined variables. DRC Output Amplitude (dB) (Y0) “knee” DRC_KNEE_OP C DR P COM _HI_ DRC P OM _C O _L DRC_KNEE_IP 0dB DRC Input Amplitude (dB) Figure 1 DRC Input/Output Transfer Function The DRC works by changing the gain dynamically as a function of the input signal amplitude. Attack and decay settings are used to control the time period over which the gain changes. An attack time is a period over which the gain is decreasing; a decay time is a period over which the gain is increasing. Attack and decay times are show in Figure 2. Figure 2 DRC Attack and Decay Times w Customer Information Rev 1.0 September 2010 2 WAN_0247 Customer Information GENERATION OF ATTACK AND DECAY TIMES For the purpose of explaining attack and decay times, the DRC can be simplified into the block diagram shown in Figure 3. There are five blocks shown; a rectifier, gain controller, peak detector, reciprocal function and multiplier. The DRC can be viewed as a variable gain amplifier where the output of the peak detector is 1/gain. Figure 3 Simplified DRC Block Diagram The gain controller takes a rectified version of the input signal and applies the transfer characteristic of the DRC (shown in Figure 1). The output of the gain controller is the input to the peak detector, which is used to apply the attack and decay times over which the gain is changed. It works as shown in Figure 4 and Figure 5, where the red trace is the output of the peak detector. The peak detector output tracks the input; rising when less than the input and falling when greater than the input. The rate of the rising slope is determined by the DRC attack rate setting, whilst the rate of the falling slope is determined by the DRC decay rate setting. Figure 4 shows how the peak detector output settles at close to the peak level when the input amplitude is constant and then tracks up after a sudden increase in input amplitude. The reciprocal of this is applied as the gain and produces the attack period in the DRC output. During the attack period, the rise in peak detector output level is made up from alternating periods of attack and decay slopes. The decay slope will have an impact on the attack period; however since decay slopes are usually significantly slower than the attack slopes that impact should be minor. Figure 4 DRC Attack Operation The diagram in Figure 5 illustrates how the decay is generated by the DRC. This is slightly different compared to attack because the peak detector output falls at a constant rate determined by the decay slope only. The principle of operation is still the same. w Customer Information Rev 1.0 September 2010 3 WAN_0247 Customer Information Figure 5 DRC Decay Operation DATASHEET SPECIFICATION OF ATTACK AND DECAY The datasheets specify a list of attack and decay rates in seconds/6dB that can be configured on the device. These numbers relate to the rates of the attack and decay slopes as shown in Figure 4. These slopes can be measured on the CODEC by using a DC step input as shown in Figure 6. By measuring the attack or decay time and the change in output level (also change in gain) the slope rate can be calculated in seconds/6dB. Figure 6 Measuring Attack/Decay Slope Rates The decay time for a sudden decrease in amplitude of a sinusoidal input can be calculated directly from the decay rate in the datasheet since the peak detector output level falls at a constant rate along a single decay slope (see Figure 5). For attack times however, in most cases, the peak detector output level climbs and falls every wavelength (see Figure 4). Therefore the attack time for a sudden increase in amplitude of a sinusoidal input will be longer than would be calculated from the attack rate in the datasheet. w Customer Information Rev 1.0 September 2010 4 WAN_0247 Customer Information ATTACK/DECAY IN REAL AUDIO SIGNALS Real audio signals are irregular and vary over time. The test conditions required to accurately measure attack and decay times are not applicable to real audio. The attack and decay times involved when applying the DRC to audio data change dynamically and are difficult to quantify. It is important to note that although it is difficult to measure attack and decay times in real audio signals, the effect of changing attack and decay rates is predictable. For any given input signal, if the attack setting is increased all attack periods will be increased. Similarly for decay, if the decay setting is increased all decay periods will be increased. As a result, the qualitative effect of a change in attack or decay will be predictable. CONFIGURING ATTACK AND DECAY SETTINGS Ideal attack and decay settings are subjective and may differ slightly from person to person and between different kinds of audio. Attack and decay settings should be chosen through an iterative process of listening and fine tuning. It is recommended to have the attack and decay rates as fast as possible without experiencing audio artefacts such as “gain pumping” and “clicking”. “Clicking” is an audible artefact caused by very fast changes in gain. It may sound like a faint crackling noise. This can be resolved by increasing the attack rate. “Gain Pumping” is when the gain changes are audibly perceived as though someone is manually increasing the volume. This can be can be solved by increasing the decay rate. These artefacts will also be affected by other DRC settings such as the compression ratio. A softer compression will reduce chance of creating audible artefacts. The following process is suggested for choosing attack and decay settings: 1. Configure all other DRC settings. 2. Minimise attack and decay rates. 3. Increase decay rate until gain pumping is removed. 4. Increase attack rate until clicking is removed. SUMMARY It is not practical to specify the attack and decay times that can be expected when using the DRC with real audio signals. The datasheet definition of the attack and decay rates is based upon the operation of the DRC and can be replicated using a DC step input. When configuring the DRC, the attack and decay rates should be chosen based on listening tests. w Customer Information Rev 1.0 September 2010 5 WAN_0247 Customer Information TECHNICAL SUPPORT If you require more information or require technical support, please contact the nearest Wolfson Microelectronics regional office: http://www.wolfsonmicro.com/contact or one of our global distributors: http://www.wolfsonmicro.com/distribution w Customer Information Rev 1.0 September 2010 6 Customer Information WAN_0247 IMPORTANT NOTICE Wolfson Microelectronics plc (“Wolfson”) products and services are sold subject to Wolfson’s terms and conditions of sale, delivery and payment supplied at the time of order acknowledgement. Wolfson warrants performance of its products to the specifications in effect at the date of shipment. Wolfson reserves the right to make changes to its products and specifications or to discontinue any product or service without notice. Customers should therefore obtain the latest version of relevant information from Wolfson to verify that the information is current. Testing and other quality control techniques are utilised to the extent Wolfson deems necessary to support its warranty. Specific testing of all parameters of each device is not necessarily performed unless required by law or regulation. In order to minimise risks associated with customer applications, the customer must use adequate design and operating safeguards to minimise inherent or procedural hazards. Wolfson is not liable for applications assistance or customer product design. The customer is solely responsible for its selection and use of Wolfson products. Wolfson is not liable for such selection or use nor for use of any circuitry other than circuitry entirely embodied in a Wolfson product. Wolfson’s products are not intended for use in life support systems, appliances, nuclear systems or systems where malfunction can reasonably be expected to result in personal injury, death or severe property or environmental damage. Any use of products by the customer for such purposes is at the customer’s own risk. Wolfson does not grant any licence (express or implied) under any patent right, copyright, mask work right or other intellectual property right of Wolfson covering or relating to any combination, machine, or process in which its products or services might be or are used. Any provision or publication of any third party’s products or services does not constitute Wolfson’s approval, licence, warranty or endorsement thereof. Any third party trade marks contained in this document belong to the respective third party owner. Reproduction of information from Wolfson datasheets is permissible only if reproduction is without alteration and is accompanied by all associated copyright, proprietary and other notices (including this notice) and conditions. Wolfson is not liable for any unauthorised alteration of such information or for any reliance placed thereon. Any representations made, warranties given, and/or liabilities accepted by any person which differ from those contained in this datasheet or in Wolfson’s standard terms and conditions of sale, delivery and payment are made, given and/or accepted at that person’s own risk. Wolfson is not liable for any such representations, warranties or liabilities or for any reliance placed thereon by any person. ADDRESS: Wolfson Microelectronics plc Westfield House 26 Westfield Road Edinburgh EH11 2QB United Kingdom Tel :: +44 (0)131 272 7000 Fax :: +44 (0)131 272 7001 w Customer Information Rev 1.0 September 2010 7