Abstract:
The present invention relates to an audio processing system and method for automatically adjusting volume. The method includes steps of: calculating a noise level as a reference noise level; periodically calculating a new noise level of a predetermined time period, and dividing the reference noise level by the new noise level to obtain a ratio; sampling digital audio signals generated by a decoding unit to obtain a plurality of amplitude values, periodically calculating an audio energy value of the predetermined time period; multiplying the audio energy value by the ratio to obtain a reference audio energy value; calculating a gain value according to the reference audio energy value and the default gain value; updating the default gain value with the gain value; and signaling the gain amplifier to amplify the analog audio signals received with the gain value, thereby protecting users&#39; hearing.

Description:
BACKGROUND OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates to an audio processing technology, and more particularly to an audio processing system and method for automatically adjusting volume according to variations of the ambient noise level. 
   2. General Background 
   The continuous development of new digital technologies has helped to make audio processing devices (such as an MP3 player) popular. Fidelity and quality of music output from the audio processing devices have also improved. However, when a listener is enjoying music in an environment whose noise level changes frequently, the listener needs to manually adjust volume accordingly. Consequently, it is irritating to the listener, and especially it is dangerous for the listener while driving a car. 
   In order to solve the problems mentioned, an related art provides an automatic volume control system for compensating ambient noise. The automatic volume control system automatically adjusts a gain value of a gain amplifier according to variations of the ambient noise level. However, a sound loudness depends more on the gain value of the gain amplifier, and not on the sound energy. 
   Therefore, a heretofore unaddressed need exists in the industry to overcome the aforementioned deficiencies and inadequacies. 
   SUMMARY OF THE INVENTION 
   The present invention provides an audio processing system and method for automatically adjusting volume. The audio processing system evaluates ambient noise level, and automatically adjusts audio energy value of a predetermined time period according to variations of the ambient noise level. 
   The audio processing system includes a command input unit, a storage unit, a processing unit, a decoding unit, a digital/analog converter, a microphone, an analog/digital converter and a gain managing unit. The command input generates a playing command and an adjusting command in response to operational inputs. The storage unit stores a plurality of audio files and a default gain value. The processing unit fetches one audio file from the plurality of audio files in response to the playing command. The decoding unit decodes the fetched audio file to generate digital audio signals. The digital/analog converter converts the digital audio signals to analog audio signals. The microphone collects ambient noises and generates corresponding analog noise signals. The analog/digital converter converts the analog noise signals to digital noise signals. The gain managing unit includes a noise processing module, an audio processing module, a gain calculating module and a gain adjusting module. The gain adjusting module adjusts the default gain value stored in the storage unit to an adjusted gain value, updates the default gain value with the adjusted gain value, and signals a gain amplifier to amplify the analog audio signals converted by the digital/analog converter with the adjusted gain value in response to the adjusting command. The noise processing module calculates a noise level of the digital noise signals, stores the noise level as a reference noise level, and periodically calculates a new noise level of the digital noise signals with a predetermined time period, and divides the new noise level by the reference noise level to obtain a ratio of the new noise level to the reference noise level. The audio processing module samples the digital audio signals by the decoding unit to obtain a plurality of amplitude values, and periodically calculates an audio energy value of the predetermined time period according to the amplitude values sampled within the predetermined time period and the default gain value. The gain calculating module multiplies the audio energy value by the ratio of the new noise level to the reference noise level to obtain a reference audio energy value, calculates a gain value according to the reference audio energy value and the default gain value, and updates the default gain value with the gain value. Wherein the gain adjusting module signals the gain amplifier to amplify the analog audio signals converted by the digital/analog converter with the gain value. 
   The audio processing system includes a command input unit, a storage unit, a processing unit, a decoding unit, a digital/analog converter, a microphone, an analog/digital converter and a gain managing unit. The command input generates a playing command and an adjusting command in response to operational inputs. The storage unit stores a plurality of audio files and a default gain value. The processing unit fetches one audio file from the plurality of audio files in response to the playing command. The decoding unit decodes the fetched audio file to generate digital audio signals. The digital/analog converter converts the digital audio signals to analog audio signals. The microphone collects ambient noises and generates corresponding analog noise signals. The analog/digital converter converts the analog noise signals to digital noise signals. The processing unit includes a gain adjusting module, a noise processing module, an audio processing module and a gain calculating module. The gain adjusting module adjusts the default gain value stored in the storage unit to an adjusted gain value, updates the default gain value with the adjusted gain value, and signals a gain amplifier to amplify the analog audio signals converted by the digital/analog converter with the adjusted gain value in response to the adjusting command. The noise processing module calculates a noise level of the digital noise signals, stores the noise level as a reference noise level, and periodically calculates a new noise level of the digital noise signals within a predetermined time period, and divides the new noise level by the reference noise level to obtain a ratio of the new noise level to the reference noise level. The audio processing module samples the digital audio signals generated by the decoding unit to obtain a plurality of amplitude values, and periodically calculates an audio energy value of the predetermined time period according to the amplitude values sampled within the predetermined time period and the default gain value. The gain calculating module multiplies the audio energy value by the ratio of the new noise level to the reference noise level to obtain a reference audio energy value, calculates a gain value according to the reference audio energy value and the default gain value, and updates the default gain value with the gain value. Wherein the gain adjusting module signals the gain amplifier to amplify the analog audio signals converted by the digital/analog converter by the gain value. 
   The audio processing method includes steps of: receiving an adjusting command; adjusting a default gain value stored in a storage unit to an adjusted gain value, and updating the default gain value with the adjusted gain value; signaling a gain amplifier to amplify analog audio signals converted by a digital/analog converter with the adjusted gain value; calculating a noise level, and storing the noise level in the storage unit as a reference noise level; periodically calculating a new noise level of a predetermined time period, and dividing the new noise level by the reference noise level to obtain a ratio of the new noise level to the reference noise level; sampling digital audio signals generated by a decoding unit to obtain a plurality of amplitude values, and periodically calculating an audio energy value of the predetermined time period according to the amplitude values sampled within the predetermined time period and the default gain value; multiplying the audio energy value by the ratio of the new noise level to the reference noise level to obtain a reference audio energy value; calculating a gain value according to the reference audio energy value and the default gain value; updating the default gain value with the gain value; and signaling the gain amplifier to amplify the analog audio signals converted by the digital/analog converter by the gain value. 
   Other systems, methods, features, and advantages will be or become apparent to one with skill in the art upon examination of the following drawings and detailed description. It is intended that all such additional systems, methods, features, and advantages be included within this description, be within the scope of the present invention, and be protected by the accompanying claims. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIG. 1  is a block diagram of a hardware infrastructure of an audio processing system for automatically adjusting volume in accordance with a preferred embodiment of the present invention; 
       FIG. 2  is a schematic diagram of main function modules of a gain managing unit of  FIG. 1 ; 
       FIG. 3  is a common flowchart of playing an audio file; 
       FIG. 4  is a flowchart of a preferred audio processing method for automatically adjusting volume by utilizing the audio processing system of  FIG. 1  in according with the preferred embodiment of the present invention; 
       FIG. 5  is a block diagram of a hardware infrastructure of an audio processing system for automatically adjusting volume in accordance with an alternative preferred embodiment of the present invention; and 
       FIG. 6  is a schematic diagram of main function modules of a processing unit of  FIG. 5 . 
   

   DETAILED DESCRIPTION OF THE INVENTION 
   The audio processing system of the present invention can automatically adjust volume according to variations of the ambient noise level. The audio processing system can be incorporated in a car stereo system and portable electrical devices such as an MP3 player, an electronic book, a mobile telephone, and so on. The following detailed description of the embodiments is made with reference to the attached drawings. 
     FIG. 1  is a block diagram of a hardware infrastructure of an audio processing system for automatically adjusting volume in accordance with a preferred embodiment of the present invention. The audio processing system  10  includes a storage unit  11 , a command input unit  12 , a processing unit  13 , a decoding unit  14 , a digital/analog (D/A) converter  15 , a gain amplifier  16 , and a sound output device  17 . 
   The storage unit  11  stores a plurality of audio files, a default gain value, and a decoding program. The storage unit  11  can be a flash storage, a hard disk driver, and the like. The processing unit  13  controls components of the audio processing system  10 . The processing unit  13  can be a digital signal processor (DSP), a processing unit (CPU), and the like. 
   The command input unit  12  generates control commands after receiving operational inputs. The control commands include a playing command for playing an audio file, and an adjusting command for adjusting a gain value of the gain amplifier  16 . The processing unit  13  fetches the audio file to be played from the storage unit  11  after receiving the playing command. 
   The decoding unit  14  invokes the decoding program stored in the storage unit  11 , decodes the audio file fetched by the processing unit  13 , generates digital audio signals, and sends the digital audio signals to the D/A converter  15 . The D/A converter  15  converts the digital audio signals generated by the decoding unit  14  into analog audio signals. 
   The gain amplifier  16  amplifies the analog audio signals converted by the D/A converter  15  with the default gain value stored in the storage unit  11 , thereby yielding amplified analog audio signals. The sound output device  17  receives the amplified analog audio signal and produces corresponding sounds. The sound output device  17  can be an earphone or a speaker. 
   The audio processing system  10  further includes a gain managing unit  18  integrated with the processing unit  13 , a microphone  19 , and an analog/digital (A/D) converter  20 . The microphone  19  collects ambient noises and generates corresponding analog noise signals. The analog/digital converter  20  converts the analog noise signals to digital noise signals, and sends the digital noise signals to the gain managing unit  18 . 
   Referring to  FIG. 2 , the gain managing unit  18  includes a noise processing module  180 , an audio processing module  181 , a gain calculating module  182 , and a gain adjusting module  183 . The noise processing module  180  receives the digital noise signals sent from the analog/digital converter  20 , calculates a noise level of the digital noise signals, and stores the noise level in the storage unit  11  as a reference noise level. The noise processing module  180  periodically calculates a new noise level of the digital noise signals within a predetermined time period, and divides the new noise level by the reference noise level to obtain a ratio of the new noise level to the reference noise level. 
   The audio processing module  181  samples the digital audio signals generated by the decoding unit  14  to obtain a plurality of amplitude values, obtains the default gain value stored in the storage unit  11 , and periodically calculates an audio energy value of the digital audio signals within the predetermined time period. The audio energy value is calculated according to the default gain value and the plurality of amplitude values by: Q=[Σ(mi*V) 2 /N] 1/2 , wherein N represents a count of the amplitude values sampled within the predetermined time period, i is any natural number from 1 to N, V represents the default gain value, mi represents the amplitude values sampled within the predetermined time period, Q represents the audio energy value of the predetermined time period. 
   The gain calculating module  182  multiplies the audio energy value by the ratio of the new noise level to the reference noise level to obtain a reference audio energy value, reads the default gain value stored in the storage unit  11 , calculates a new gain value for calculating the audio energy value, and updates the default gain value with the new gain value. 
   The gain adjusting module  183  signals the gain amplifier  16  to amplify the analog audio signals received from the D/A converter  15  with the new gain value. 
     FIG. 3  is a common flowchart for playing an audio file. In step S 30 , the command input unit  12  generates the playing command after receiving the operational input on one audio file of the plurality of audio files stored in the storage unit  11 . In step S 31 , the processing unit  13  fetches the audio file from the plurality of audio files in response to the playing command. 
   In step S 32 , the decoding unit  14  decodes the fetched audio file to generate the digital audio signals, and sends the digital audio signals to the D/A converter. In step S 33 , the D/A converter  15  converts the digital audio signals to the analog audio signals. 
   In step S 34 , the gain managing unit  13  controls/signals the gain amplifier  16  to amplify the analog audio signals with the default gain value stored in the storage unit  11 , thereby yielding amplified analog audio signals. In step S 35 , the sound output device  17  receives the amplified analog audio signals and produces corresponding sounds. 
     FIG. 4  is a flowchart of a first preferred audio processing method for automatically adjusting volume by utilizing the audio processing system  10  of  FIG. 1 . In step S 40 , the gain adjusting module  183  adjusts the default gain value stored in the storage unit  11  to an adjusted gain value in response to the adjusting command, signals the gain amplifier  16  to amplify the analog audio signals received from the D/A converter  15  with the adjusted gain value, and updates the default gain value with the adjusted gain value. 
   In step S 41 , the noise processing module  180  receives the digital noise signals from the analog/digital converter  20 , calculates a noise level of the digital noise signals, and stores the noise level in the storage unit  11  as the reference noise level. 
   In step S 42 , the noise processing module  180  periodically calculates a new noise level of the digital noise signals of the predetermined time period, and divides the new noise level by the reference noise level to obtain a ratio of the new noise level to the reference noise level. 
   In step S 43 , the audio processing module  181  samples the digital audio signals generated by the decoding unit  14 , obtains the plurality of amplitude values of the digital audio signals, obtains the default gain value stored in the storage unit  11 , and periodically calculates the audio energy value of the digital audio signals within the predetermined time period according to the default gain value and the plurality of amplitude values. 
   In step S 44 , the gain calculating module  182  detects if the ratio of the new noise level to the reference noise level equals to one. If the ratio of the new noise level to the reference noise level equals to one, the procedure goes to step S 42 ; otherwise, in step S 45 , the gain calculating module  182  multiplies the audio energy value calculated by the ratio of the new noise level to the reference noise level to obtain a reference audio energy value, and obtains the default gain value stored in the storage unit  11 . 
   In step S 46 , the gain calculating module  182  calculates the new gain value for calculating the audio energy value according to the reference audio energy value and the default gain value, and updates the default gain value with the new gain value. 
   In step S 47 , the gain adjusting module  183  signals the gain amplifier  16  to amplify the analog audio signals by the new gain value, and the procedure goes to step S 42 . The step S 42  to step S 47  is performed recursively until the audio processing system  10  receives another adjusting command for adjusting the default gain value. The step S 40  to step S 47  is performed recursively until the audio processing system  10  is turned-off. 
     FIG. 5  is a block diagram of a hardware infrastructure of an audio processing system  100  for automatically adjusting volume in accordance with an alternative embodiment of the present invention. The audio processing system  100  of the alternative embodiment is the same as that of the preferred embodiment, except that the gain managing unit  18  is configured in the processing unit  53 . 
   Therefore, referring to  FIG. 6  in the alternative embodiment, the processing unit  53  further has the function as well as the gain managing unit  18  in  FIG. 1 . That is, the processing unit  53  has a noise processing module  530 , an audio processing module  531 , a gain calculating module  532 , and a gain adjusting module  533 , which respectively performs the same functions as the noise processing module  180 , the audio processing module  181 , the gain calculating module  182 , and the gain adjusting module  183  of the gain managing unit  18 . 
   It is understood that the invention may be embodied in other forms without departing from the spirit thereof. Thus, the present examples and embodiments are to be considered in all respects as illustrative and not restrictive, and the invention is not to be limited to the details given herein.