CN107547732A - A kind of media play volume adjusting method, device, terminal and storage medium - Google Patents

A kind of media play volume adjusting method, device, terminal and storage medium Download PDF

Info

Publication number
CN107547732A
CN107547732A CN201710543150.0A CN201710543150A CN107547732A CN 107547732 A CN107547732 A CN 107547732A CN 201710543150 A CN201710543150 A CN 201710543150A CN 107547732 A CN107547732 A CN 107547732A
Authority
CN
China
Prior art keywords
volume
current environment
audio
playing
media
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710543150.0A
Other languages
Chinese (zh)
Inventor
潘宇超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Original Assignee
Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yulong Computer Telecommunication Scientific Shenzhen Co Ltd filed Critical Yulong Computer Telecommunication Scientific Shenzhen Co Ltd
Priority to CN201710543150.0A priority Critical patent/CN107547732A/en
Publication of CN107547732A publication Critical patent/CN107547732A/en
Pending legal-status Critical Current

Links

Landscapes

  • Circuit For Audible Band Transducer (AREA)

Abstract

The invention discloses a kind of media play volume adjusting method, device, terminal and storage medium, methods described includes:During media renderer plays, current environment audio is recorded;The current environment volume according to corresponding to current environment audio described in the current environment audio computer;According to the broadcast sound volume of media player described in the current environment volume adjusting.The program is during the media player of user's using terminal, by recording current environment audio every preset duration to detect the volume of current environment, after having recorded every time, calculate current environment volume corresponding to the current environment audio recorded, the broadcast sound volume of media player is finally adjusted according to the size for the current environment volume being calculated, so, realization automatically adjusts broadcast sound volume according to current environment volume in good time, operated without user, avoid the bad experience brought in the prior art because adjusting volume manually to user, improve the hommization of broadcast sound volume regulation.

Description

Media playing volume adjusting method, device, terminal and storage medium
Technical Field
The invention relates to the technical field of communication, in particular to a method, a device, a terminal and a storage medium for adjusting media playing volume.
Background
At present, with the development of communication technology, various mobile terminals have gradually become an indispensable part of people's daily life, and mobile phones, tablet computers and other terminal devices have become more and more popular in people's daily life, and users can not only exchange information through the terminals, but also perform entertainment experiences, such as listening to music, watching videos and the like.
When a user uses the media player, the user often encounters the situation of adjusting the volume, the volume adjusting mode of the media player of the existing terminal is stiff, for example, the user can generally play at a preset volume when opening the video player, and if the user wants to adjust the volume midway, the user can only adjust the volume manually, which is very inconvenient and affects the audio-visual experience of the user. For another example, in the playing process of a video, the volume of the surrounding environment where the user is located suddenly becomes quiet or noisy, and compared with the hearing habits of the user, the preset volume may appear too large or too small, so that the user cannot hear the video playing content clearly, and even if the volume is subsequently adjusted manually, the audio-visual experience of the user may be affected.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, a terminal and a storage medium for adjusting media playing volume, so as to solve the problem in the prior art that media playing volume cannot be automatically adjusted.
The first aspect of the present invention provides a method for adjusting media playing volume, which is applied to a terminal, such as a mobile phone, a tablet computer, and the like, and includes: recording the current environmental audio in the playing process of the media player; calculating the current environment volume corresponding to the current environment audio according to the current environment audio; and adjusting the playing volume of the media player according to the current environment volume.
By implementing the method described in the first aspect, in the process that a user uses a media player of a terminal, the volume of the current environment is detected by recording the current environment audio, the recording of the environment audio can be performed once every preset time, the recording time can be set as required, after the recording is completed every time, the current environment volume corresponding to the recorded current environment audio is calculated, and finally the playing volume of the media player is adjusted according to the calculated current environment volume, so that the playing volume is automatically adjusted according to the current environment volume in due time without user operation, bad experience brought to the user by manually adjusting the volume in the prior art is avoided, and the humanization of the adjustment of the playing volume is improved.
With reference to the first aspect of the present invention, in a first implementation manner of the first aspect of the present invention, the calculating, according to a current environment audio, the current environment volume corresponding to the current environment audio includes: acquiring the volume representation intensity corresponding to the current environment audio; selecting a corresponding volume calculation formula according to the volume characterization strength; and calculating the current environment volume corresponding to the current environment audio according to the volume formula.
By executing the steps, when the current environment volume is calculated, the current volume representation intensity is firstly obtained, the volume representation intensity can be selected in advance by a user, different volume representation intensities correspond to different volume calculation formulas, after the volume representation degree is determined, the volume calculation formula under the volume representation degree can be selected to calculate the current environment volume corresponding to the current environment audio, thus, the volume calculation formulas are different, the same current environment audio is fundamentally determined to have different volumes, in the practical application environment, the audio in the environment is generally uncertain, sometimes the volume distribution is uniform, sometimes the volume is greatly different in volume, therefore, for the calculation of the volume of the current environment audio, different environment characteristics can be highlighted by adopting different volume calculation formulas, the diversity of the volume representation degree is enriched, and the calculation mode of the current environment volume is enriched, the selectivity of the user for the volume adjustment requirement is also enriched, so that the calculation result can better represent the requirement of the user, and the user experience is improved.
With reference to the first embodiment of the first aspect of the present invention, in the second embodiment of the first aspect of the present invention, when the volume characterization intensity is at the first level, the volume calculation formula is determined according to the maximum value of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio.
By executing the steps, different volume representation degree levels can be preset according to needs, specifically, the first level can represent the current environment volume by calculating the maximum value of all sampling points, and the representation of the environment volume is more blocky and strong under the condition, namely, the volume adjustment of the media player is sensitive to the influence of the environment volume; the second level can represent the current environment volume by calculating the effective values of all audio sampling points, and the representation degree of the current environment volume on the current environment audio obtained by calculation of the scheme is smaller than the first level, namely the influence sensitivity degree of the volume adjustment of the media player on the environment volume is finally smaller than the condition of the first level; the third level can represent the current environment volume through the average value of all audio sampling points, under the condition, the current environment volume obtained through calculation is stable and is not easily influenced by extreme conditions, but compared with a mode of calculating through the maximum value of the audio sampling points, the representation of the environment volume is slow. It should be noted that, for different requirements, the above-mentioned three algorithms for calculating the environment volume may be considered together, and naturally, the manner of calculating the current environment volume of the present invention is not limited to the above-mentioned combination of calculation, and any volume calculation scheme that can implement the present embodiment is applicable to the present invention.
With reference to the first aspect of the present invention, in a third implementation manner of the first aspect of the present invention, the adjusting the playing volume of the media player according to the current environment volume includes: acquiring a playing volume grade corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume; and adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level.
By executing the steps, a table of the corresponding relation between the environment volume and the media playing volume can be established in advance according to the human auditory habits, the playing volume grade can be marked in the relation table, after the current environment volume is obtained through calculation, the playing volume grade corresponding to the current environment volume is obtained from the relation table, then the playing volume of the media player is adjusted according to the media playing volume corresponding to the playing volume grade, and therefore the media playing volume is not only related to the volume representation intensity selected by the user and the current environment audio frequency, but also can be influenced by the volume using habits of the user, so that the media playing volume is more in line with the personal requirements of the user, and is more humanized.
With reference to the first aspect of the present invention, in a fourth implementation manner of the first aspect of the present invention, before the adjusting the playing volume of the media player according to the current environment volume, the method further includes: and when the media player is started, controlling the media player to output playing volume at preset volume.
By executing the steps, when a user just starts the media player, the playing volume is output at the preset volume, the preset volume can be very small and can not be heard by the user, so that the situation that the playing volume is delayed before the playing volume of the media player is adjusted according to the current environment volume and is interfered by other people due to the fact that the playing volume is too large in a quiet environment is avoided, and meanwhile, the situation that the playing volume is delayed can be guaranteed.
In addition, a second aspect of the present invention provides a media playing volume adjusting device, which is used for a terminal, such as a mobile phone, a tablet computer, and the like, and includes a module or a unit for executing the media playing volume adjusting method according to the first aspect or any one of the first aspects.
For example, the apparatus comprises: the recording module is used for recording the current environmental audio in the playing process of the media player; the calculation module is used for calculating the current environment volume corresponding to the current environment audio according to the current environment audio; and the adjusting module is used for adjusting the playing volume of the media player according to the current environment volume.
Through implementing above-mentioned media broadcast volume control device, in the media player process at user's use terminal, come the volume that detects the current environment through recording current environment audio frequency, here can carry out an environment audio recording once every preset duration, record duration and can set for as required, record at every turn after finishing, calculate the current environment volume that the current environment audio frequency of recording corresponds, adjust the broadcast volume of media player according to the size of the current environment volume that obtains of calculation at last, so, realize in good time according to current environment volume automatically regulated broadcast volume, need not user operation, avoided among the prior art because of the not good experience that manual regulation volume brought for the user, the hommization of broadcast volume control has been improved.
With reference to the second aspect of the present invention, in a first embodiment of the second aspect of the present invention, the calculation module includes: the first obtaining unit is used for obtaining the volume representation intensity corresponding to the current environment audio; the selection unit is used for selecting a corresponding volume calculation formula according to the volume representation intensity; and the calculating unit is used for calculating the current environment volume corresponding to the current environment audio according to the volume formula.
By implementing the media playing volume adjusting device, when the volume of the current environment is calculated, the current volume representation intensity is firstly obtained, the volume representation intensity can be selected in advance by a user, different volume representation intensities correspond to different volume calculation formulas, after the volume representation degree is determined, the volume calculation formula under the volume representation degree can be selected to calculate the volume of the current environment corresponding to the audio of the current environment, thus, the volume calculation formulas are different, the same audio of the current environment has different volumes, in the practical application environment, the audio in the environment is generally uncertain, sometimes the volume distribution is uniform, sometimes the volume is greatly different, therefore, for the calculation of the volume of the audio of the current environment, different environment characteristics and the diversity of the volume representation degree can be highlighted by adopting different volume calculation formulas, the method enriches the calculation mode of the volume of the current environment, enriches the selectivity of the user to the volume adjustment requirement, enables the calculation result to show the requirement of the user better, and improves the user experience.
With reference to the first embodiment of the second aspect of the present invention, in the second embodiment of the second aspect of the present invention, when the volume characterization intensity is at the first level, the volume calculation formula is determined according to the maximum value of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio.
By implementing the media playing volume adjusting device, different volume representation degree levels can be preset according to needs, specifically, the first level can represent the current environment volume by calculating the maximum value of all sampling points, and the representation of the environment volume is more blocky and strong under the condition, namely, the volume adjustment of the media player is sensitive to the influence of the environment volume; the second level can represent the current environment volume by calculating the effective values of all audio sampling points, and the representation degree of the current environment volume on the current environment audio obtained by calculation of the scheme is smaller than the first level, namely the influence sensitivity degree of the volume adjustment of the media player on the environment volume is finally smaller than the condition of the first level; the third level can represent the current environment volume through the average value of all audio sampling points, under the condition, the current environment volume obtained through calculation is stable and is not easily influenced by extreme conditions, but compared with a mode of calculating through the maximum value of the audio sampling points, the representation of the environment volume is slow. It should be noted that, for different requirements, the above-mentioned three algorithms for calculating the environment volume may be considered together, and naturally, the manner of calculating the current environment volume of the present invention is not limited to the above-mentioned combination of calculation, and any volume calculation scheme that can implement the present embodiment is applicable to the present invention.
With reference to the second aspect of the present invention, in a third embodiment of the second aspect of the present invention, the adjusting module includes: the second acquisition unit is used for acquiring the playing volume level corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume; and the adjusting unit is used for adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level.
By implementing the media playing volume adjusting device, a table of the corresponding relation between the environment volume and the media playing volume can be established in advance according to the human auditory habits, the playing volume grade can be marked in the relation table, after the current environment volume is obtained through calculation, the playing volume grade corresponding to the current environment volume is obtained from the relation table, and then the playing volume of the media player is adjusted according to the media playing volume corresponding to the playing volume grade, so that the media playing volume is not only related to the volume representation intensity selected by a user and the current environment audio frequency, but also can be influenced by the volume use habits of the user, and the media playing volume is more in line with the personal requirements of the user and is more humanized.
With reference to the second aspect of the present invention, in a fourth embodiment of the second aspect of the present invention, the method further includes: and the control module is used for controlling the media player to output the playing volume at a preset volume when the media player is started before the playing volume of the media player is adjusted according to the current environment volume.
Through the implementation of the media playing volume adjusting device, when a user just starts the media player, the playing volume is output at the preset volume, the preset volume can be very small and can not be heard by the user, so that the situation that the playing volume is too large to disturb others in a quiet environment is avoided, and meanwhile, the situation that the playing volume is delayed can be avoided before the playing volume of the media player is adjusted according to the current environment volume.
The modules or units included in the media playing volume adjusting device are not limited to the above naming modes.
These aspects of the present application will be more readily apparent from the following description of the embodiments.
A third aspect of the present invention provides a terminal, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method for adjusting media playing volume according to the first aspect of the present invention or any implementation manner of the first aspect.
A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the method for adjusting media playback volume according to the first aspect of the present invention or any implementation manner of the first aspect of the present invention.
Drawings
The features and advantages of the present invention will be more clearly understood by reference to the accompanying drawings, which are illustrative and not to be construed as limiting the invention in any way, and in which:
fig. 1 shows a structure of a cellular phone in an embodiment of the present invention;
fig. 2 is a flowchart illustrating a media playback volume adjustment method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a media playback volume adjusting apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a media playback volume adjusting apparatus according to an embodiment of the present invention;
fig. 5 shows a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an application scenario of an embodiment of the present invention. The mobile terminal is a mobile device such as a mobile phone or a tablet computer, the mobile terminal takes a mobile phone as an example, a partial structural block diagram of the mobile phone is shown in fig. 1, and the mobile phone includes a radio frequency circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a wireless module 170, a processor 180, a power supply 190, and the like. Those skilled in the art will appreciate that the handset configuration shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
Wherein the RF circuit 110 is used for receiving and transmitting signals during the transmission and reception of information or a call. The memory 120 is used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 120. The input unit 130 is used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. The input unit 130 may include a touch panel 131 and other input devices 132. Other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys, a mouse, and a joystick. The display unit 140 is used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 140 may include a display panel 141. The touch panel 131 can cover the display panel 141, and when the touch panel 131 detects a touch operation on or near the touch panel 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event.
The handset may also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. The light sensor may include an ambient light sensor for adjusting the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor for turning off the display panel 141 and/or the backlight when the mobile phone is moved to the ear. The light sensor in this embodiment may be disposed on the front and back of the mobile phone, and is used to detect a shielding area when the user holds the mobile phone. The mobile phone can further comprise a pressure sensor which is arranged on the front side or the back side shell of the mobile phone and used for obtaining a shielding area when a user holds the mobile phone in a pressure detection mode. In addition, the mobile phone can be also provided with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer and an infrared sensor, which are not described in detail.
Audio circuitry 160, speaker 161, microphone 162 may provide an audio interface between the user and the handset. The wireless module 170 may be a WIFI module, which provides a wireless internet access service to the user.
The processor 180 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby integrally monitoring the mobile phone. Optionally, processor 180 may include one or more processing units. In addition, the mobile phone further comprises a power supply 190 for supplying power to each component, and the power supply 190 is logically connected with the processor 180 through a power management system, so that functions of charging, discharging, power consumption management and the like are managed through the power management system.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
Referring to fig. 2, a method for adjusting media playing volume according to an embodiment of the present invention is applied to a terminal, such as a mobile phone and a tablet computer, and the method includes:
s21: recording the current environmental audio in the playing process of the media player; in the process that a user uses a media player of a terminal, the volume of the current environment is detected by recording the current environment Audio, the recording of the environment Audio can be performed once every preset time, the recording time can be set according to needs, specifically, for example, the recording of the current environment Audio with the preset time of T seconds, the Android system provides three types of recording Audio of MediaRecorder, AudioSource and AudioRecord, and can also directly read the PCM data of the current environment Audio from a read () function of Android Audio Hardware or a tinycap tool provided in a Linux ALSA framework, and the preset time can be very short so as to avoid the delay of ring tone playing.
S22: calculating the current environment volume corresponding to the current environment audio according to the current environment audio; after having recorded the current environment audio frequency at every turn, calculate the current environment volume that current environment audio frequency corresponds promptly to according to the current environment volume of calculating at every turn to the broadcast volume of media player carries out the right-angle adjustment, it is simple and convenient to calculate the current environment volume mode through recording current environment audio frequency, does not need the terminal plus equipment to realize, and the audio frequency of on-the-spot recording has the authenticity more moreover, more is close to the actual conditions of current environment. The environment volume is recorded and calculated in a circulating mode at intervals of preset duration until the media player stops playing, so that the playing volume is timely changed along with the change of the environment volume, and compared with a mode of recording and calculating the environment volume in real time, the energy consumption of the terminal can be saved.
S23: and adjusting the playing volume of the media player according to the current environment volume. The playing volume of the media player is adjusted according to the current environment volume calculated in the step S22, so that the playing volume is automatically adjusted according to the current environment volume in good time, the playing volume of the media player is automatically adapted to the environment where the user is located, for example, in a noisy environment, the playing volume can be increased, in a relatively quiet environment, the playing volume can be decreased, and the like, user operation is not needed, poor experience of the user caused by manual volume adjustment in the prior art is avoided, and humanization of playing volume adjustment is improved.
Alternatively, step S22 may include: acquiring the volume representation intensity corresponding to the current environment audio; selecting a corresponding volume calculation formula according to the volume representation intensity; and calculating the current environment volume corresponding to the current environment audio according to a volume formula. Specifically, when the current environment volume is calculated, the current volume representation intensity is firstly obtained, the volume representation intensity can be selected in advance by a user, different volume representation intensities correspond to different volume calculation formulas, after the volume representation degree is determined, the volume calculation formula under the volume representation degree can be selected to calculate the current environment volume corresponding to the current environment audio, thus, the volume calculation formulas are different, the same current environment audio is fundamentally determined to have different volumes, in the practical application environment, the audio in the environment is generally uncertain, sometimes the volume distribution is uniform, sometimes the volume is greatly different in volume, therefore, for the calculation of the volume of the current environment audio, different environment characteristics can be highlighted by adopting different volume calculation formulas, the diversity of the volume representation degree is realized, and the calculation mode of the current environment volume is enriched, the selectivity of the user for the volume adjustment requirement is also enriched, so that the calculation result can better represent the requirement of the user, and the user experience is improved.
As a specific implementation manner, when the volume characterization intensity is at a first level, determining the volume calculation formula according to the maximum value of all audio sampling points of the current environmental audio and a reference sound pressure; or when the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio. Specifically, when the volume characterization intensity is at the first level, the volume calculation formula may be:
wherein L isPFor the current ambient volume, Prms1 is the maximum value of all audio sampling points of the current ambient audio, and Pref is the reference sound pressure; or when the volume characterization intensity is at the second level, the volume calculation formula may be:
wherein L isPFor the current ambient volume, Prms2 is the effective value of all audio samples of the current ambient audio, and Pref is the reference sound pressure; or when the volume characterization intensity is at a third level, the volume calculation formula may be:
wherein L isPFor the current ambient volume, A1Is the average of all audio sampling points of the current ambient audio, A0Is the reference amplitude. Specifically, if the volume is characterized by audio amplitude, the scheme of different volume calculation formulas for different levels of volume characterizing intensity is illustrated as follows:
a first level: in the T seconds of the current environment audio, representing the current environment volume by calculating the maximum value of all sampling points; there are two acquisition modes for the maximum of all the samples:
the first method is as follows: recording current environment audio of T seconds by using a MediaRecorder or an AudioSource, and then using a method getMaxAmplite () of the MediaRecorder or the AudioSource to acquire the maximum value of all sampling points in the T seconds.
The second method comprises the following steps: recording T seconds of audio, storing pcm audio data of the T seconds, and then circularly taking out each sampling point for comparison until the maximum value is calculated. Then, the current environment volume is calculated by adopting the following formula:
wherein L isPFor the current ambient volume, Prms1 is the maximum of all sampled points, and Pref is the reference sound pressure (typically 20 pa, the minimum sound pressure audible to humans). The representation of the current environment volume calculated by the maximum value of the audio sampling point on the environment sound is more massive and strong, but the current environment volume is influenced by the extreme data, for example, a huge sound is generated when a huge object falls off at a certain moment, if the huge sound is collected, the calculation result is very large, and the current environment is possibly quite integrally.
And (3) second grade: in the T second current environment audio, representing the current environment volume by calculating the effective values of all audio sampling points, namely storing the pcm audio data of the recorded T second current environment audio, then circularly taking out each sampling point from the pcm audio data, and calculating the root mean square value of each sampling point by adopting the following formula:
wherein,Xirepresents the value of the ith sample point, N represents the number of samples in T seconds, XrmsRepresents the root mean square of all the sampling points; then, the current environment volume is calculated by adopting the following formula:
wherein L isPFor the current ambient volume, Prms2 is the valid value for all audio samples, and Pref is the reference sound pressure (typically 20 pa, the minimum sound pressure audible to humans). The representation degree of the current environment volume on the current environment audio, which is obtained by calculating the effective values of all the audio sampling points, is smaller than the first level, namely, the influence sensitivity degree of the volume adjustment of the media player on the environment volume is finally smaller than the condition of the first level.
And a third stage: in the T second current environment audio, representing the current environment volume by the average value of all audio sampling points, namely storing the pcm audio data of the recorded T second current environment audio, circularly taking out each sampling point from the pcm audio data, solving the square sum of the sampling points, and dividing the square sum by the sampling times in T seconds; and finally, calculating the current environment volume by adopting the following formula:
wherein L isPFor the current ambient volume, A1Is the average of all audio samples, A0Is a reference amplitude (typically an amplitude corresponding to a sound pressure value of 20 pa, which may be calculated as 1 directly). The current environment volume calculated by the average value of all audio sampling points is stable and is not easily influenced by extreme conditions, but the representation of the environment volume is slower compared with a mode of calculating the maximum value of the audio sampling points.
It should be noted that, for different requirements (degree of the environmental sound characterization by the DB), the level classification of the environmental sound characterization degree may be determined by comprehensively considering the above-mentioned three algorithms for calculating the environmental sound volume, for example, T seconds are divided into n equal parts, the maximum value of the audio sampling point in each equal part is taken, then all the maximum values are summed by the square sum according to the algorithm mentioned in the preset sound sensitivity 2, and then the sum is divided by n, so that the calculated sound volume DB value is between the current environmental sound volumes corresponding to the first level and the second level. Naturally, the method of calculating the current environment volume according to the present invention is not limited to the above-described combination of calculation, and any calculation method that can implement the technical solution of the present embodiment is applicable to the present invention.
Alternatively, step S23 may include: acquiring a playing volume grade corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume; and adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level. Specifically, a table of a corresponding relationship between the environment volume and the media playing volume may be established in advance according to human hearing habits, the playing volume level may be labeled in the relationship table, after the current environment volume is obtained through calculation, the playing volume level corresponding to the current environment volume is obtained from the relationship table, and then the playing volume of the media player is adjusted by the media playing volume corresponding to the playing volume level, for example, the table of the corresponding relationship between the environment volume and the media playing volume may be established with reference to the following manner:
the Android system defines the level of the playing volume as 0-15 levels (0: the minimum volume is equivalent to silence, and 15: the maximum sound) and divides DB into 15 levels according to the decibel entry on Wikipedia, the levels are respectively corresponding to the prompt tone levels of 1-15 of the Android system, and a table of the corresponding relation between the environment volume and the media playing volume can be obtained, and the table is shown as the following table:
DB grade of the warning tone
0-10 extremely quiet, hardly felt 1
10-20 2
20-30 quiet, soft talk 3
30-35 4
35-40 5
40-45 general, ordinary indoor talk 6
45-50 7
50-55 8
55-60 9
60-65 noisy 10
65-70 11
70-80 are noisy and nerve cells may be affected 12
80-90 13
90-100 hearing impairment 14
Over 100 15
Of course, the volume level allocation shown in the above table can be reasonably adjusted according to specific situations, for example, the sound size of each level of the volume level played by the mobile phone, the degree of change between levels, and the like can be adjusted. When the current environment volume is calculated, the corresponding volume level (namely the playing volume level) can be matched from the table, and then the playing volume of the media player is adjusted to the volume level, so that the media playing volume is not only related to the volume representation strength selected by the user and the current environment audio, but also influenced by the volume use habit of the user, and the media playing volume is more in line with the personal requirements of the user and is more humanized.
Optionally, before step S23, the method may further include: and when the media player is started, controlling the media player to output the playing volume at the preset volume. Specifically, when a user just starts the media player, the playing volume is output at a preset volume, where the preset volume can be very small and can hardly be heard by the user, so as to avoid disturbing others due to too large playing volume in a quiet environment, and meanwhile, it can be ensured that the playing volume is not delayed before the playing volume of the media player is adjusted according to the current environment volume.
In the method for adjusting the volume of the media playing provided in this embodiment, in the process that a user uses a media player of a terminal, the volume of the current environment is detected by recording the current environment audio, where the recording of the environment audio can be performed once every preset time duration, the recording time duration can be set as required, after the recording is completed every time, the current environment volume corresponding to the recorded current environment audio is calculated, and finally the playing volume of the media player is adjusted according to the calculated current environment volume, so that the playing volume is automatically adjusted according to the current environment volume at proper time without user operation, bad experience brought to the user by manually adjusting the volume in the prior art is avoided, and the humanization of the adjustment of the playing volume is improved.
Referring to fig. 3, a schematic structural diagram of a media playing volume adjusting device according to an embodiment of the present invention is used in a terminal, such as a mobile phone, a tablet computer, and the like, and includes:
a recording module 31, configured to record a current environmental audio in a playing process of the media player; see step S21 in the above embodiment for details.
The calculation module 32 is configured to calculate a current environment volume corresponding to the current environment audio according to the current environment audio; see step S22 in the above embodiment for details.
And the adjusting module 33 is configured to adjust the playing volume of the media player according to the current environment volume. See step S23 in the above embodiment for details.
Optionally, in some embodiments of the present invention, as shown in fig. 4, the calculating module 32 includes: a first obtaining unit 321, configured to obtain a volume representation intensity corresponding to a current environmental audio; a selecting unit 322, configured to select a corresponding volume calculation formula according to the volume representation intensity; the calculating unit 323 is configured to calculate a current environment volume corresponding to the current environment audio according to a volume formula. For details, see the relevant detailed description in the above embodiments.
Optionally, in some embodiments of the present invention, when the volume characterizing intensity is a first level, the volume calculation formula is determined according to a maximum value of all audio sampling points of the current environmental audio and a reference sound pressure; or when the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio. For details, see the relevant detailed description in the above embodiments.
Optionally, in some embodiments of the present invention, as shown in fig. 4, the adjusting module 33 includes: a second obtaining unit 331, configured to obtain, according to a corresponding relationship between the environment volume and the media playing volume, a playing volume level corresponding to the current environment volume; the adjusting unit 332 is configured to adjust the playing volume of the media player to a media playing volume corresponding to the playing volume level. For details, see the relevant detailed description in the above embodiments.
Optionally, in some embodiments of the present invention, as shown in fig. 4, further includes: and the control module 34 is configured to control the media player to output the playing volume at a preset volume when the media player is turned on before adjusting the playing volume of the media player according to the current environment volume. For details, see the relevant detailed description in the above embodiments.
The media playing volume adjusting device provided by the embodiment is characterized in that in the process that a user uses a media player at a terminal, the volume of the current environment is detected by recording the current environment audio, the environment audio can be recorded once every preset time interval, the recording time interval can be set as required, after the recording is finished every time, the current environment volume corresponding to the recorded current environment audio is calculated, and finally the playing volume of the media player is adjusted according to the calculated current environment volume, so that the playing volume can be automatically adjusted according to the current environment volume in due time without user operation, the bad experience brought to the user due to manual volume adjustment in the prior art is avoided, and the humanization of playing volume adjustment is improved.
An embodiment of the present invention further provides a terminal, including: any one of the above embodiments of the media playing volume adjusting device.
A terminal of the present invention is described below by taking a smart phone as an example.
As shown in fig. 5, correspondingly, a terminal provided in the embodiment of the present invention includes: at least one processor 51 and a memory 52, where fig. 5 illustrates one processor, the processor 51 and the memory 52 are connected by a bus 50, the memory 52 stores instructions executable by the at least one processor 51, and the instructions are executed by the at least one processor 51, so that the at least one processor 51 performs the following method:
recording the current environmental audio in the playing process of the media player;
calculating the current environment volume corresponding to the current environment audio according to the current environment audio;
and adjusting the playing volume of the media player according to the current environment volume.
Optionally, in some embodiments of the present invention, calculating a current environment volume corresponding to the current environment audio according to the current environment audio includes: acquiring the volume representation intensity corresponding to the current environment audio; selecting a corresponding volume calculation formula according to the volume representation intensity; and calculating the current environment volume corresponding to the current environment audio according to a volume formula.
Optionally, in some embodiments of the present invention, when the volume characterizing intensity is a first level, the volume calculation formula is determined according to a maximum value of all audio sampling points of the current environmental audio and a reference sound pressure; or when the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or when the volume characterization intensity is in a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio.
Optionally, in some embodiments of the present invention, adjusting the playing volume of the media player according to the current environment volume comprises: acquiring a playing volume grade corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume; and adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level.
Optionally, in some embodiments of the present invention, before adjusting the playing volume of the media player according to the current ambient volume, the at least one processor 51 may further perform: and when the media player is started, controlling the media player to output the playing volume at the preset volume.
The related description may be understood by referring to the related description and effect corresponding to the step in fig. 2, and will not be described in detail herein.
The terminal provided by the embodiment, in the process that the user uses the media player of the terminal, the volume of the current environment is detected by recording the current environment audio, the environment audio can be recorded once every preset time, the recording time can be set as required, after the recording is finished every time, the current environment volume corresponding to the recorded current environment audio is calculated, and finally the playing volume of the media player is adjusted according to the calculated current environment volume, so that the playing volume is automatically adjusted according to the current environment volume in due time without user operation, the bad experience brought to the user by manually adjusting the volume in the prior art is avoided, and the humanization of the playing volume adjustment is improved.
The embodiment of the invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions can execute all or part of the processes in the method of the embodiment. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.

Claims (12)

1. A method for adjusting media playing volume, comprising:
recording the current environmental audio in the playing process of the media player;
calculating the current environment volume corresponding to the current environment audio according to the current environment audio;
and adjusting the playing volume of the media player according to the current environment volume.
2. The method of adjusting media playback volume according to claim 1, wherein the calculating the current ambient volume corresponding to the current ambient audio according to the current ambient audio comprises:
acquiring the volume representation intensity corresponding to the current environment audio;
selecting a corresponding volume calculation formula according to the volume characterization strength;
and calculating the current environment volume corresponding to the current environment audio according to the volume formula.
3. The media playback volume adjustment method of claim 2,
when the volume characterization intensity is in a first level, determining the volume calculation formula according to the maximum value of all audio sampling points of the current environmental audio and the reference sound pressure; or
When the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or
And when the volume characterization intensity is at a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio.
4. The method of adjusting the volume of playing media according to claim 1, wherein the adjusting the volume of playing media according to the current environment volume comprises:
acquiring a playing volume grade corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume;
and adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level.
5. The method of adjusting the volume of playing media according to claim 1, further comprising, before the adjusting the volume of playing media player according to the current ambient volume:
and when the media player is started, controlling the media player to output playing volume at preset volume.
6. A media playback volume adjustment apparatus, comprising:
the recording module is used for recording the current environmental audio in the playing process of the media player;
the calculation module is used for calculating the current environment volume corresponding to the current environment audio according to the current environment audio;
and the adjusting module is used for adjusting the playing volume of the media player according to the current environment volume.
7. The media playback volume adjustment device of claim 6, wherein the calculation module comprises:
the first obtaining unit is used for obtaining the volume representation intensity corresponding to the current environment audio;
the selection unit is used for selecting a corresponding volume calculation formula according to the volume representation intensity;
and the calculating unit is used for calculating the current environment volume corresponding to the current environment audio according to the volume formula.
8. The media playback volume adjustment device of claim 7,
when the volume characterization intensity is in a first level, determining the volume calculation formula according to the maximum value of all audio sampling points of the current environmental audio and the reference sound pressure; or
When the volume characterization intensity is in a second level, determining the volume calculation formula according to the effective values of all audio sampling points of the current environmental audio and the reference sound pressure; or
And when the volume characterization intensity is at a third level, determining the volume calculation formula according to the average value and the reference amplitude of all audio sampling points of the current environmental audio.
9. The media playback volume adjustment device of claim 6, wherein the adjustment module comprises:
the second acquisition unit is used for acquiring the playing volume level corresponding to the current environment volume according to the corresponding relation between the environment volume and the media playing volume;
and the adjusting unit is used for adjusting the playing volume of the media player to the media playing volume corresponding to the playing volume level.
10. The media playback volume adjustment device of claim 6, further comprising:
and the control module is used for controlling the media player to output the playing volume at a preset volume when the media player is started before the playing volume of the media player is adjusted according to the current environment volume.
11. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the media playback volume adjustment method of any one of claims 1 to 5 when executing the program.
12. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the media playback volume adjustment method of any one of claims 1 to 5.
CN201710543150.0A 2017-07-05 2017-07-05 A kind of media play volume adjusting method, device, terminal and storage medium Pending CN107547732A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710543150.0A CN107547732A (en) 2017-07-05 2017-07-05 A kind of media play volume adjusting method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710543150.0A CN107547732A (en) 2017-07-05 2017-07-05 A kind of media play volume adjusting method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN107547732A true CN107547732A (en) 2018-01-05

Family

ID=60970362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710543150.0A Pending CN107547732A (en) 2017-07-05 2017-07-05 A kind of media play volume adjusting method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN107547732A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361994A (en) * 2018-10-12 2019-02-19 Oppo广东移动通信有限公司 Speaker control method, mobile terminal and computer readable storage medium
CN110536023A (en) * 2019-09-29 2019-12-03 李欣钊 A kind of system intelligently adjusting device for prompt tone of electronic based on spatial volume
CN112637416A (en) * 2019-09-20 2021-04-09 北京小米移动软件有限公司 Volume adjusting method and device and storage medium
CN113676595A (en) * 2021-07-12 2021-11-19 杭州逗酷软件科技有限公司 Volume adjusting method, terminal device and computer readable storage medium
CN113993038A (en) * 2021-10-27 2022-01-28 成都颜创启新信息技术有限公司 Volume adjusting method and device, electronic equipment and computer readable storage medium
CN113993038B (en) * 2021-10-27 2024-09-27 成都知道创宇信息技术有限公司 Volume adjustment method, volume adjustment device, electronic equipment and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101924828A (en) * 2010-07-21 2010-12-22 惠州Tcl移动通信有限公司 Mobile terminal, method and device for adjusting volume thereof
CN201839344U (en) * 2010-07-21 2011-05-18 惠州Tcl移动通信有限公司 Mobile terminal capable of adjusting volume automatically
CN103152668A (en) * 2012-12-22 2013-06-12 深圳先进技术研究院 Adjusting method of output audio and system thereof
CN106161781A (en) * 2016-06-22 2016-11-23 北京小米移动软件有限公司 Method for regulation of sound volume and device
US20170161381A1 (en) * 2015-12-04 2017-06-08 Chiun Mai Communication Systems, Inc. Electronic device and music play system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101924828A (en) * 2010-07-21 2010-12-22 惠州Tcl移动通信有限公司 Mobile terminal, method and device for adjusting volume thereof
CN201839344U (en) * 2010-07-21 2011-05-18 惠州Tcl移动通信有限公司 Mobile terminal capable of adjusting volume automatically
CN103152668A (en) * 2012-12-22 2013-06-12 深圳先进技术研究院 Adjusting method of output audio and system thereof
US20170161381A1 (en) * 2015-12-04 2017-06-08 Chiun Mai Communication Systems, Inc. Electronic device and music play system and method
CN106161781A (en) * 2016-06-22 2016-11-23 北京小米移动软件有限公司 Method for regulation of sound volume and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张婧颖,孟子厚: "《音响师听力训练基础》", 31 August 2015 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361994A (en) * 2018-10-12 2019-02-19 Oppo广东移动通信有限公司 Speaker control method, mobile terminal and computer readable storage medium
CN112637416A (en) * 2019-09-20 2021-04-09 北京小米移动软件有限公司 Volume adjusting method and device and storage medium
CN110536023A (en) * 2019-09-29 2019-12-03 李欣钊 A kind of system intelligently adjusting device for prompt tone of electronic based on spatial volume
CN113676595A (en) * 2021-07-12 2021-11-19 杭州逗酷软件科技有限公司 Volume adjusting method, terminal device and computer readable storage medium
CN113676595B (en) * 2021-07-12 2023-07-21 杭州逗酷软件科技有限公司 Volume adjustment method, terminal device, and computer-readable storage medium
CN113993038A (en) * 2021-10-27 2022-01-28 成都颜创启新信息技术有限公司 Volume adjusting method and device, electronic equipment and computer readable storage medium
CN113993038B (en) * 2021-10-27 2024-09-27 成都知道创宇信息技术有限公司 Volume adjustment method, volume adjustment device, electronic equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
US11632621B2 (en) Method for controlling volume of wireless headset, and computer-readable storage medium
US11251763B2 (en) Audio signal adjustment method, storage medium, and terminal
EP2986034B1 (en) Audio system equalization for portable media playback devices
US9307340B2 (en) Audio system equalization for portable media playback devices
CN107509153B (en) Detection method and device of sound playing device, storage medium and terminal
CN103152668B (en) Adjusting method of output audio and system thereof
CN112954115B (en) Volume adjusting method and device, electronic equipment and storage medium
US20090016540A1 (en) Auditory perception controlling device and method
CN104393848B (en) Volume adjusting method and device
WO2019033987A1 (en) Prompting method and apparatus, storage medium, and terminal
CN106791067B (en) Call volume adjusting method and device and mobile terminal
CN107547732A (en) A kind of media play volume adjusting method, device, terminal and storage medium
CN109547848B (en) Loudness adjustment method and device, electronic equipment and storage medium
CN109982231B (en) Information processing method, device and storage medium
US11272304B2 (en) Method and terminal for playing audio data, and storage medium thereof
CN106550294A (en) Monitor method and device based on earphone
US20180332391A1 (en) Smart headphone device personalization system and method for using the same
CN112185324A (en) Tuning method and device, storage medium, intelligent device and tuning system
TWM519370U (en) Electronic device capable of adjusting equalizer settings according to the hearing physiological condition and audio playing device
CN105635916A (en) Audio processing method and apparatus
US10448162B2 (en) Smart headphone device personalization system with directional conversation function and method for using same
CN116132869A (en) Earphone volume adjusting method, earphone and storage medium
CN106293607B (en) Method and system for automatically switching audio output modes
CN107493376A (en) A kind of ringing volume adjusting method and device
CN108668199B (en) Loudspeaker liquid drainage method based on gain adjustment and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180105

RJ01 Rejection of invention patent application after publication