WO2022135527A1 - 一种视频录制方法及电子设备 - Google Patents
一种视频录制方法及电子设备 Download PDFInfo
- Publication number
- WO2022135527A1 WO2022135527A1 PCT/CN2021/140845 CN2021140845W WO2022135527A1 WO 2022135527 A1 WO2022135527 A1 WO 2022135527A1 CN 2021140845 W CN2021140845 W CN 2021140845W WO 2022135527 A1 WO2022135527 A1 WO 2022135527A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- audio
- electronic device
- sound effect
- data
- application
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 229
- 230000004044 response Effects 0.000 claims abstract description 79
- 230000008569 process Effects 0.000 claims abstract description 51
- 230000000694 effects Effects 0.000 claims description 341
- 230000015654 memory Effects 0.000 claims description 84
- 238000004590 computer program Methods 0.000 claims description 83
- 238000012545 processing Methods 0.000 claims description 66
- 230000001360 synchronised effect Effects 0.000 claims description 52
- 230000005540 biological transmission Effects 0.000 claims description 49
- 230000006870 function Effects 0.000 claims description 31
- 238000002156 mixing Methods 0.000 claims description 31
- 238000009826 distribution Methods 0.000 claims description 30
- 238000013507 mapping Methods 0.000 claims description 23
- 238000006243 chemical reaction Methods 0.000 claims description 20
- 230000002452 interceptive effect Effects 0.000 claims description 16
- 238000003860 storage Methods 0.000 claims description 12
- 238000003672 processing method Methods 0.000 claims description 10
- 230000015572 biosynthetic process Effects 0.000 claims description 6
- 238000003786 synthesis reaction Methods 0.000 claims description 6
- 230000009471 action Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 description 56
- 238000004891 communication Methods 0.000 description 50
- 238000013461 design Methods 0.000 description 44
- 238000007726 management method Methods 0.000 description 25
- 238000013145 classification model Methods 0.000 description 11
- 238000010295 mobile communication Methods 0.000 description 11
- 239000000203 mixture Substances 0.000 description 10
- 229920001621 AMOLED Polymers 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 239000008186 active pharmaceutical agent Substances 0.000 description 5
- 210000000988 bone and bone Anatomy 0.000 description 5
- 230000008859 change Effects 0.000 description 5
- 238000012790 confirmation Methods 0.000 description 4
- 239000002096 quantum dot Substances 0.000 description 4
- 239000011435 rock Substances 0.000 description 4
- 238000001228 spectrum Methods 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 3
- 230000003190 augmentative effect Effects 0.000 description 3
- 230000000739 chaotic effect Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 3
- 238000001914 filtration Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012360 testing method Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 238000013528 artificial neural network Methods 0.000 description 2
- 239000003795 chemical substances by application Substances 0.000 description 2
- 239000011521 glass Substances 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 239000003550 marker Substances 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 239000003607 modifier Substances 0.000 description 2
- 238000012805 post-processing Methods 0.000 description 2
- 230000005855 radiation Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000003416 augmentation Effects 0.000 description 1
- 238000010009 beating Methods 0.000 description 1
- 230000036772 blood pressure Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 229910001385 heavy metal Inorganic materials 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000010985 leather Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 229910052751 metal Inorganic materials 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 230000015541 sensory perception of touch Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000011664 signaling Effects 0.000 description 1
- 239000004984 smart glass Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000001755 vocal effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/63—Control of cameras or camera modules by using electronic viewfinders
- H04N23/631—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
- H04N23/632—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
- H04M1/72442—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality for playing music files
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
- H04M1/7243—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages
- H04M1/72439—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality with interactive means for internal management of messages for image or video messaging
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/44016—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving splicing one content stream with another content stream, e.g. for substituting a video clip
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/63—Control of cameras or camera modules by using electronic viewfinders
- H04N23/631—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N5/00—Details of television systems
- H04N5/76—Television signal recording
- H04N5/765—Interface circuits between an apparatus for recording and another apparatus
- H04N5/77—Interface circuits between an apparatus for recording and another apparatus between a recording apparatus and a television camera
- H04N5/772—Interface circuits between an apparatus for recording and another apparatus between a recording apparatus and a television camera the recording apparatus and the television camera being placed in the same enclosure
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/79—Processing of colour television signals in connection with recording
- H04N9/80—Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback
- H04N9/82—Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback the individual colour picture signal components being recorded simultaneously only
- H04N9/8205—Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback the individual colour picture signal components being recorded simultaneously only involving the multiplexing of an additional signal and the colour video signal
- H04N9/8211—Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback the individual colour picture signal components being recorded simultaneously only involving the multiplexing of an additional signal and the colour video signal the additional signal being a sound signal
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M2250/00—Details of telephonic subscriber devices
- H04M2250/52—Details of telephonic subscriber devices including functional features of a camera
Definitions
- the present application relates to the field of audio technology, and in particular, to a video recording method and electronic device.
- video is more and more widely used in people's daily life.
- ambience can be rendered by adding background music to a video.
- a user needs to use an electronic device to record a video first, and store the recorded video in the electronic device in the form of a video file (eg MP4 file, 3gp file). Then, the user uses the electronic device to perform post-processing on the stored video file, thereby adding background music to the video. Therefore, this method of adding background music to the video is more complicated.
- a video file eg MP4 file, 3gp file
- the embodiments of the present application provide a video recording method and electronic device, so that the electronic device can automatically add background music of an application program in the process of recording a video through a certain application program, and obtain a video file containing the background music, thereby facilitating the user use to improve user experience.
- a first aspect is a video recording method according to an embodiment of the present application, which specifically includes: an electronic device plays audio corresponding to a first media file through a first application; the electronic device displays a video recording interface of the second application; the video recording interface Including an image preview frame, background music setting options and virtual keys, the virtual keys are used to control the start or stop of video recording, and the image preview frame is used to preview the images captured by the camera; in response to the operation of the background music setting options , the electronic device sets the background music as the audio corresponding to the second audio file;
- the electronic device In response to the first operation on the virtual key, the electronic device starts recording video, and processes the second audio file to obtain audio data of the second audio file;
- the electronic device In response to the second operation on the virtual key, the electronic device ends the video recording and generates a video file, the video file includes the audio data of the second audio file and the image data of the image captured by the camera, not Audio data of the first media file is included.
- the electronic device when the electronic device plays the audio corresponding to the first audio file through the first application, when recording the video through the second application, the electronic device can combine the audio file corresponding to the background music set by the user in the second application in combination with the audio file. the audio data, obtain the video file including the audio data of the audio file corresponding to the background music set by the user in the second application, and the audio data of the first audio file is not included in the video file, so that the user can record the video as needed In the process of adding corresponding background music, it is not only convenient for users to use, but also helps to avoid copyright disputes.
- the first media file corresponds to the identification of the first application
- the second audio file corresponds to the identification of the second application
- the electronic device in response to For the first operation of the virtual key, obtains the audio data of the second audio file according to the identification of the second application program, and obtains the audio data of the second audio file according to the audio data of the second audio file and the camera
- the image data of the acquired images are processed for synthesis.
- the electronic device in response to the first operation on the virtual key, uses a microphone to collect sound;
- the electronic device performs synthesis processing according to the audio data of the second audio file, the image data of the image collected by the camera, and the audio data of the sound collected by the microphone.
- the recorded video file includes audio data of the user or the sound in the surrounding environment.
- the electronic device when the shooting mute function is turned on, the electronic device does not use a microphone to collect sound.
- the electronic device parses the second audio file, and performs sound effect processing on the audio data obtained by parsing the second audio file to obtain audio data of the second audio file. Therefore, the audio data of the second audio file included in the recorded video file is processed by sound effects, which helps to improve the audio-visual experience of the user.
- the electronic device plays according to the audio data of the second audio file.
- the present application provides an audio recording method, which is applied to an electronic device, and may include: the electronic device displays a first interactive interface of a live broadcast application, the first interactive interface includes recording setting options; the electronic device An operation acting on the recording setting option is detected; the electronic device displays a second interactive interface in response to the operation, the second interactive interface includes a plurality of audio stream options; the electronic device detects a trigger event, the trigger event is an event generated by determining the selection of recording the audio stream marked with the first type and the audio stream marked with the second type; the electronic device responds to the trigger event, respectively The stream and the audio stream marked with the second type are recorded to obtain first audio recording data and second audio recording data.
- the user can select the type-marked audio stream to be recorded on the interface of the live broadcast application according to his own needs or preferences, thereby improving user experience.
- the electronic device can separately record the audio streams marked with various types, thereby obtaining multiple audio recording files, which can facilitate the user to process different audio streams and improve the user experience.
- the electronic device respectively recording the audio stream marked with the first type and the audio stream marked with the second type, including: the electronic device performing type marking on the first audio stream , obtain at least two types of tags, the first audio stream includes the audio stream played by the application corresponding to the content of the live broadcast application and the audio stream played by the music application; the electronic device detects that the first audio stream includes at least two types of marks, and the first type mark and the second type mark are screened out from the at least two types of marks; the electronic device marks the first type mark and the second type mark Mark the corresponding audio stream for recording.
- the electronic device can mark the first audio stream by type, and then filter the type mark selected by the user from multiple type marks, and then record the audio stream with the type mark selected by the user.
- audio streams of the same type can be divided in more detail, so that the user can select more types, which can improve the user experience.
- the first audio stream may be understood as the currently playing audio stream, which may at least include the audio stream played by the application corresponding to the content broadcasted by the live broadcast application.
- the first audio stream may include an audio stream played by a game application (eg, King of Glory).
- a game application eg, King of Glory
- the host opens the music application while playing music the first audio stream may also include the audio stream played by the music application.
- the electronic device marking the type of the first audio stream includes: the electronic device marking the first audio stream according to an audio parameter of the first audio stream, and the audio parameter At least the following information is included: the type of the audio stream and the length of the audio stream.
- the electronic device can mark the audio streams by type according to the characteristics and uses of different audio streams, so that the types of audio streams can be classified in more detail.
- audio streams for games may be marked as: game voice call audio streams (or called game team voice audio streams), background audio streams, skill release audio streams, and the like.
- the lengths of different audio streams can be marked with different types; when the lengths of the audio streams are the same, different audio stream types can be marked with different types, which this application does not make limited.
- the method further includes: the electronic device compares all the marks of the first type and the second type of marks.
- the first audio stream is mixed to obtain mixed audio, and the mixed audio is played.
- the audio service (AudioService) of the electronic device can divide the audio stream into two transmissions, and one is used to mark the first type of audio. Recording is performed with the audio stream marked by the second type, and another audio stream is sent to the mixing thread (MixerThread) of the electronic device for mixing.
- the electronic device can perform sound mixing processing on the audio stream after filtering out the required audio stream type mark. Recording, so that the recorded audio data is independent audio data instead of mixed audio data.
- the present application also provides an audio recording method, the method includes: the electronic device displays a first interactive interface of a live broadcast application, the first interactive interface includes recording setting options; at least one operation on the recording setting option; the electronic device records the audio stream according to the set audio type mark in response to the at least one operation, and the set audio type mark includes a first type mark and a first type mark. Two types of tags.
- the electronic device can automatically record the audio stream according to the set audio type mark.
- the set audio type mark may be the audio type mark set last time by the user, or may also be the audio type mark configured by the live broadcast application, or the like.
- the user can double-click the recording setting option on the first interactive interface, and then the electronic device can automatically record the corresponding audio stream according to the audio type flag configured by the live broadcast application.
- the user can click the recording setting option on the first interactive interface first, and then display the second interactive interface.
- the user clicks the confirmation option and the electronic device can record the corresponding audio stream according to the audio type mark set by the user last time.
- the electronic device records the audio stream according to the set audio type mark, including: the electronic device marks the first audio stream by type to obtain at least two type marks, and the first audio stream is type marked.
- An audio stream includes an audio stream played by an application corresponding to the content of the live broadcast application host and an audio stream played by a music application; the electronic device detects at least two types of tags included in the first audio stream, and displays the The first type mark and the second type mark are filtered out from at least two types of marks; the electronic device records the audio streams corresponding to the first type mark and the second type mark respectively.
- the electronic device can mark the first audio stream by type, and then filter the set type mark among the plurality of type marks, and then record the audio stream with the set type mark.
- audio streams of the same type can be divided in more detail, so that the user can select more types, which can improve the user experience.
- the present application further provides an audio playback method, the method includes: an electronic device plays a first audio through a first application; the electronic device responds to a first operation of the first application by a user, The application is switched to run in the background; the electronic device runs the second application in the foreground in response to the second operation of the second application by the user, and plays the second audio through the second application; the electronic device determines the first audio and a play strategy of the second audio; the electronic device plays the first audio and the second audio according to the play strategy.
- the electronic device is installed with a first application and a second application; or, the electronic device is installed with at least one of the first application and the second application, and the other application is an online application accessed through a network; or, the first application Both the application and the second application are online applications, and the electronic device accesses both applications through the network.
- the electronic device determining the play strategy of the first audio and the second audio includes: the electronic device classifies the first audio and the second audio, and determines the first audio and the second audio. A category corresponding to the audio and the second audio respectively; the electronic device determines the play strategy of the first audio and the second audio according to the categories corresponding to the first audio and the second audio respectively.
- the audio played by the front-end and back-end applications can be classified respectively, and then the audio playback strategy can be determined according to the classified category, so that the corresponding playback strategy can be given according to the specific category, so that the electronic device can play multiple audios at the same time. Audio confusion can be avoided, which can improve the user experience.
- the electronic device classifying the first audio and the second audio includes: the electronic device obtains the audio attribute of the first audio and the audio attribute of the second audio respectively; The electronic device respectively determines the category corresponding to the audio attribute of the first audio and the audio category corresponding to the audio attribute of the second audio according to the first mapping relationship, where the first mapping relationship is the relationship between the audio attribute and the audio category. Correspondence.
- the audio category can be determined according to the audio attribute of the audio, so that the audio can be specifically classified, so that the playing strategy given later is more suitable.
- the electronic device determining the play strategy of the first audio and the second audio includes: the electronic device determining, according to the second mapping relationship, that the first audio and the second audio are in Under the same or different categories, the corresponding audio playing strategies, the second mapping relationship includes the corresponding relationship between the category of the first audio and the category of the second audio and the audio playing strategy.
- the electronic device can give the audio played by the front-end and background applications the playback strategy corresponding to the audio category according to the pre-saved mapping relationship (correspondence between the audio category and the playback strategy), thereby improving the simultaneous playback of the electronic device.
- the pre-saved mapping relationship correlateence between the audio category and the playback strategy
- the audio categories of the first audio and the second audio include any one of the following categories: voice calls, alarms, voice navigation, media sounds, games, movies, music, Dial Tone, Incoming Ringtone, Action/Event Tone, Notification Tone, Others.
- the play strategy of the first audio and the second audio includes any one of the following strategies: playing the first audio, playing the second audio, playing the first audio and the second audio simultaneously audio.
- the play strategy given by the electronic device in the embodiment of the present application may include but not limited to the above strategies.
- the method further includes: when the first audio is of the first category and the second audio is of the second category, the electronic device determines that the first audio is of the third category, The third category is a subset of the first category.
- the audio category is a specific category (for example, music)
- a more specific classification can be performed for the audio category, so that the scene after the classification is more specific, thereby making the playback strategy more suitable, and improving the User experience.
- the method further includes: displaying first prompt information, where the first prompt information is used to prompt the user whether to play the first audio and the second audio according to the play strategy.
- the present application further provides a sound effect processing method, which is applied to the connection between the first electronic device and the second electronic device, and the method includes:
- the first electronic device displays an interface of a media application, and the interface of the media application includes an identifier of an audio file to be played, a first control, and a second control, the first control is used to control audio playback, and the second control is used to control the audio to be played. playback of the file on the second electronic device;
- the first electronic device parses the audio file to be played in response to the operation of the first control to obtain the first audio data
- the first electronic device performs sound effect processing on the first audio data according to the first sound effect configuration information to obtain second audio data; and performs sound effect processing on the first audio data according to the second sound effect configuration information to obtain third audio data;
- the first electronic device sends the third audio data to the second electronic device, and triggers the second electronic device to play the third audio data;
- the second audio data is played after a first duration;
- the first duration is the time required for the third audio data to be played from the first electronic device to the second electronic device ;
- the first audio configuration information is used to indicate the first sound effect algorithm, the first sound effect mode, the first equalizer setting, the first gain setting and the first sound effect parameter;
- the second audio configuration information is used to indicate the first sound effect algorithm, the first sound effect A sound effect mode, a first equalizer setting, a first gain setting and a second sound effect parameter, the first sound effect parameter is the first sound effect algorithm of the first electronic device under the first sound effect mode, the first equalizer setting and the first gain setting
- the used sound effect parameter, the second sound effect parameter is the sound effect parameter used by the first sound effect algorithm of the second electronic device under the first sound effect mode, the first equalizer setting and the first gain setting.
- the first electronic device can perform sound effect processing on the first audio data obtained by parsing the audio file to be played according to the first sound effect configuration information, to obtain the second audio data
- the audio data is subjected to sound effect processing to obtain third audio data, so that the first electronic device can play the second audio data after a first period of time after sending the third audio data to the second electronic device, thereby helping to reduce the first electronic device.
- the electronic device and the second electronic device play the audio file to be played synchronously, the difference between the playback effect of the first electronic device for the audio file to be played and the playback effect of the second electronic device for the audio file to be played improves the user experience .
- the first electronic device is in a sound effect-on state. Since when the first electronic device is in the sound effect-on state, the first electronic device performs the process of sound effect processing, which helps to simplify the implementation.
- the first electronic device when the second electronic device is in a sound effect on state, the first electronic device sends a sound effect off message or instruction to the second electronic device. This helps to avoid the second electronic device from performing repeated sound effect processing on the third audio data from the first electronic device.
- the first electronic device when the first electronic device is in the sound effect off state, the first electronic device sends the first audio data and the sound effect off message or instruction to the second electronic device, so as to Trigger the second electronic device to turn off the sound effect and play the first audio data; after the first electronic device sends the first audio data to the second electronic device, after the first time period, play the first audio data
- the first duration is the time required for the first audio data to be played from the first electronic device to the second electronic device. This not only helps keep the audio playback effects of the first electronic device and the second electronic device consistent, but also helps prevent the second electronic device from performing sound effect processing on the first audio data from the first electronic device.
- the first sound effect configuration information is the sound effect configuration information currently used by the first electronic device; or the second sound effect configuration information is the sound effect configuration currently used by the second electronic device information.
- the present application also provides a sound effect processing method, which is applied to the connection between a first electronic device and a second electronic device, and specifically includes: the first electronic device displays an interface of a media application, and the interface of the media application includes audio to be played.
- a file identifier, a first control, and a second control where the first control is used to control audio playback, and the second control is used to control the playback of the to-be-played audio file on the second electronic device;
- the first electronic device parses the audio file to be played in response to the operation of the first control to obtain first audio data
- the first electronic device performs sound effect processing on the first audio data according to the first sound effect configuration information to obtain second audio data;
- the first electronic device performs sound effect processing on the first audio data according to the second sound effect configuration information to obtain third audio data;
- the first electronic device sends the third audio data and play time information to the second electronic device, and triggers the second electronic device to play the third audio data according to the play time information;
- the first electronic device plays the second audio data according to the play time information
- the play time information is used to indicate the time to start playing
- the first audio configuration information is used to indicate the first sound effect algorithm, the first sound effect mode, the first equalizer setting, the first gain setting and the first sound effect parameter
- the second audio configuration information is used to indicate the first sound effect algorithm, the first sound effect mode, the first equalizer setting, the first gain setting and the second sound effect parameter, the first sound effect
- the parameter is the sound effect parameter used by the first sound effect algorithm of the first electronic device under the first sound effect mode, the first equalizer setting and the first gain setting
- the second sound effect parameter is The sound effect parameters used by the first sound effect algorithm of the second electronic device under the first sound effect mode, the first equalizer setting and the first gain setting.
- the first electronic device can perform sound effect processing on the first audio data obtained by parsing the audio file to be played according to the first sound effect configuration information, to obtain the second audio data
- the audio data is subjected to sound effect processing to obtain third audio data
- the first electronic device plays the second audio data according to the playback time information
- the second electronic device plays the third audio data according to the same playback time information, thereby helping to reduce the number of third audio data.
- the first sound effect configuration information is the sound effect configuration information currently used by the first electronic device; or the second sound effect configuration information is the sound effect configuration currently used by the second electronic device information.
- the present application provides a volume adjustment method, which is applied to a first device, and may include: the first device plays a first audio; the first device responds to a user's first operation, and adjusts the first audio Switch to the second device to play; the first device responds to the user's second operation and sends volume adjustment information to the second device, so that the second device adjusts the volume to the second volume according to the volume adjustment information level, the volume adjustment information includes a first volume level, the first volume level is the volume level corresponding to the first audio on the first device, and the second volume level is the first audio The corresponding volume level on the second device.
- the first device can switch the audio to the second device, and when the audio volume is adjusted on the first device, it can send volume adjustment information to the second device, so that the second device can adjust the volume according to the volume information for volume adjustment.
- the method before the first device sends the volume adjustment information to the second device in response to the second operation of the user, the method further includes: acquiring, by the first device, the volume adjustment information of the second device. a third volume level; the first device determines a fourth volume level corresponding to the third volume level; wherein the first volume level is a volume level adjusted based on the fourth volume level, and the first volume level is adjusted based on the fourth volume level.
- the second volume level is the volume level adjusted based on the third volume level.
- the first device before adjusting the volume, can perform initial volume conversion on the volume level on the first device according to the volume level of the second device, so that the volume can be adjusted on this basis.
- the method further includes: the first device determines to adjust the volume of the second device according to the absolute volume.
- the present application further provides a volume adjustment method, the method includes: the second device receives volume adjustment information sent by the first device, the volume adjustment information includes a first volume level, and the first volume level is the first volume level.
- the second device determines a second volume level corresponding to the first volume level according to the volume level mapping relationship, and the second volume level is the first volume level
- the volume level corresponding to the audio on the second device; the volume level mapping relationship is the volume level conversion relationship between the first device and the second device under the same volume; Two volume levels for volume adjustment.
- the second device after receiving the volume adjustment information sent by the first device, the second device can determine the volume level corresponding to the volume level included in the volume adjustment information according to the pre-stored volume level mapping relationship, so that the first device can The device and the second device realize the coordinated volume adjustment when adjusting the volume, and can make the volume of the two devices consistent.
- the method before the second device receives the volume adjustment information sent by the first device, the method further includes: the second device sends a third volume level to the first device, the third volume The level is the volume level of the second device before adjusting the volume to the second volume level.
- the volume level can be sent to the first device before adjusting the volume, so that the first device can perform an initial volume conversion on the volume, so that the volume can be adjusted on this basis.
- the method further includes: the second device plays the first audio according to an absolute volume corresponding to the second volume level.
- the volume adjustment information further includes an audio type of the first audio; the method further includes: the second device determines, according to the audio type of the first audio, an audio type of the first audio The volume level mapping relationship corresponding to the audio type.
- the second device when determining the volume level, can first determine the volume level mapping relationship corresponding to the audio type, and then determine the volume level corresponding to the first device. corresponding volume level.
- the present application also provides a sound-vibration synchronous playback method, which is applied to a scenario where a first electronic device is connected to a second electronic device, and specifically includes: the first electronic device receives a first trigger event, and the first trigger event uses For triggering and playing the sound and vibration file, the sound and vibration file includes audio data and vibration data; in response to the first trigger event, the first electronic device parses the sound and vibration file to obtain audio data and vibration data; Two electronic devices transmit audio data and vibration data.
- the first electronic device after receiving the first trigger event, can parse the sound and vibration file in response to the first trigger event, and send the parsed audio data and vibration data to the second electronic device , so that the second electronic device can directly play audio data and vibration data without parsing the audio file. Therefore, the second electronic device may not have the capability of parsing the audio and vibration file.
- the first electronic device's own audio device capability is used to instruct the audio hardware abstraction layer to support the distribution of audio data and vibration data, according to the first synchronous playback mode, based on the audio data and the vibrating data to play; wherein, when playing according to the first synchronous playing mode, the audio data is distributed to the speaker of the first electronic device by the audio hardware abstraction layer of the first electronic device, and the Vibration data is distributed to the motor of the first electronic device by the audio hardware abstraction layer of the first electronic device.
- the first electronic device's own audio device capability is used to indicate that the audio hardware abstraction layer does not support the distribution of vibration data
- the second synchronous playback method based on the audio data and the Vibration data is played; wherein, when playing according to the second synchronous playback mode, the audio data is distributed to the speaker of the first electronic device by the audio hardware abstraction layer of the first electronic device, and the audio data is distributed to the speaker of the first electronic device.
- the vibration data is distributed to the motor of the first electronic device by the vibration hardware abstraction layer of the first electronic device, and the moment when the vibration hardware abstraction layer distributes the vibration data is the same as that of the audio hardware abstraction layer.
- the difference between the times of the audio data is the difference between the first transmission delay and the second transmission delay
- the first transmission delay is the length of time for the audio data to reach the speaker from the audio hardware abstraction layer
- the second transmission delay The length of time for the vibration data to arrive at the motor from the vibration hardware abstraction layer.
- the difference between the moment when the vibration hardware abstraction layer distributes the vibration data and the moment when the audio hardware abstraction layer distributes the audio data is the difference between the first transmission delay and the second transmission delay. Therefore, in the first electronic When the device's own audio device capability is used to indicate that the audio hardware abstraction layer does not support vibration data distribution, the device can implement the synchronous playback of sound and vibration according to the second synchronous playback method.
- connection between the first electronic device and the second electronic device may be implemented based on the following manner:
- the first electronic device and the second electronic device are connected through Wi-Fi or Bluetooth, or the first electronic device and the second electronic device are bound through an application program.
- the present application also provides a method for synchronously playing sound and vibration, which is applied to a scenario where a first electronic device is connected to a second electronic device, specifically including:
- the second electronic device receives the audio data and vibration data sent by the first electronic device; when the second electronic device's own audio device capability is used to instruct the audio hardware abstraction layer to support the distribution of audio data and vibration data, , and play based on the audio data and the vibration data; wherein, when playing according to the first synchronous playback mode, the audio data is distributed to the second electronic device by the audio hardware abstraction layer of the second electronic device. of the speaker of the second electronic device, the vibration data is distributed by the audio hardware abstraction layer of the second electronic device to the motor of the second electronic device.
- the second electronic device when the second electronic device receives the audio data and the vibration data from the first electronic device, it can play the audio data and the vibration data according to the corresponding synchronous playback mode in combination with its own audio device capabilities, so that the The second electronic device may not need to parse the audio file, so as to realize the synchronous playback of the audio data and the vibration data. Therefore, the second electronic device may not have the parsing capability of the audio and vibration file.
- the second electronic device's own audio device capability is used to indicate that the audio hardware abstraction layer does not support the distribution of vibration data, according to the second synchronous playback method, based on the audio data and the vibrating data to play; wherein, when playing according to the second synchronous playback mode, the audio data is distributed to the speaker of the second electronic device by the audio hardware abstraction layer of the second electronic device, and the The vibration data is distributed to the motor of the second electronic device by the vibration hardware abstraction layer of the second electronic device, and the moment when the vibration hardware abstraction layer distributes the vibration data is the same as that of the audio hardware abstraction layer.
- the difference between the times of the audio data is the difference between the first transmission delay and the second transmission delay
- the first transmission delay is the length of time for the audio data to reach the speaker from the audio hardware abstraction layer
- the second transmission delay The length of time for the vibration data to arrive at the motor from the vibration hardware abstraction layer.
- the difference between the moment when the vibration hardware abstraction layer distributes the vibration data and the moment when the audio hardware abstraction layer distributes the audio data is the difference between the first transmission delay and the second transmission delay. Therefore, in the first electronic When the device's own audio device capability is used to indicate that the audio hardware abstraction layer does not support vibration data distribution, the device can implement the synchronous playback of sound and vibration according to the second synchronous playback method.
- connection between the first electronic device and the second electronic device may be implemented based on the following manner:
- the first electronic device and the second electronic device are connected through Wi-Fi or Bluetooth, or the first electronic device and the second electronic device are bound through an application program.
- an electronic device in an eleventh aspect, includes modules/units for performing the above-mentioned first aspect or any possible design method of the first aspect; these modules/units can be implemented by hardware, or can be The corresponding software implementation is performed by hardware.
- a twelfth aspect provides an electronic device, the electronic device comprising modules/units for performing the above-mentioned second aspect, the third aspect, or any one of the possible designs of the second aspect and the third aspect; these modules/units
- the unit may be implemented by hardware, or by executing corresponding software by hardware.
- an electronic device in a thirteenth aspect, includes modules/units for performing the above-mentioned fourth aspect or any possible design method of the fourth aspect; these modules/units may be implemented by hardware, or The corresponding software implementation is performed by hardware.
- an electronic device comprising modules/units for performing the method of the fifth aspect, the sixth aspect, or any one of the possible designs of the fifth aspect and the sixth aspect; these modules/units
- the unit may be implemented by hardware, or by executing corresponding software by hardware.
- an electronic device comprising modules/units for executing the seventh aspect or any possible design method of the seventh aspect; these modules/units may be implemented by hardware, or The corresponding software implementation is performed by hardware.
- an electronic device in a sixteenth aspect, includes modules/units for executing the above-mentioned eighth aspect or any possible design method of the eighth aspect; these modules/units may be implemented by hardware, or The corresponding software implementation is performed by hardware.
- an electronic device comprising modules/units for performing any one of the possible design methods of the ninth aspect or the ninth aspect; these modules/units may be implemented by hardware, or The corresponding software implementation is performed by hardware.
- an electronic device comprising modules/units for performing any one of the possible design methods of the tenth aspect or the tenth aspect; these modules/units may be implemented by hardware, or The corresponding software implementation is performed by hardware.
- an electronic device in a nineteenth aspect, includes a memory, a processor, and a computer program, the computer program is stored in the memory, and when the computer program is executed, causes the electronic device.
- the device implements the first aspect and any possible design technical solutions of the first aspect.
- an electronic device in a twentieth aspect, includes a memory, a processor, and a computer program, the computer program is stored in the memory, and when the computer program is executed, causes the electronic device.
- the device executes the second aspect, the third aspect, and any possible designed technical solutions of the second aspect and the third aspect.
- an electronic device in a twenty-first aspect, includes a memory, a processor, and a computer program, the computer program is stored in the memory, and when the computer program is executed, the computer program causes the The electronic device implements the fourth aspect and the technical solutions of any possible designs of the fourth aspect.
- an electronic device in a twenty-second aspect, includes a memory, a processor, and a computer program, the computer program is stored in the memory, and when the computer program is executed, the computer program causes the The electronic device implements the technical solutions of the fifth aspect, the sixth aspect, and any of the fifth and sixth aspects that may be designed.
- an electronic device comprising a memory, a processor, and a computer program, the computer program being stored in the memory, causing the computer program to cause the computer program to be executed when the computer program is executed.
- the electronic device implements the seventh aspect and any of the possible designs of the seventh aspect.
- an electronic device comprising a memory, a processor, and a computer program, the computer program being stored in the memory, and when the computer program is executed, the computer program causes the The electronic device implements the eighth aspect and any of the possible designs of the eighth aspect.
- an electronic device comprising a memory, a processor, and a computer program, the computer program being stored in the memory, which, when executed by the computer program, causes the The electronic device implements the ninth aspect and any of the possible designs of the ninth aspect.
- an electronic device comprising a memory, a processor, and a computer program, the computer program being stored in the memory, and when the computer program is executed, the computer program causes the The electronic device implements the tenth aspect and any of the possible designs of the tenth aspect.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, and causing the apparatus to execute the computer program when the computer program is executed.
- the first aspect and any possible technical solutions of the first aspect It should be understood that the apparatus includes a system-on-chip, an integrated circuit, a chip, or the like.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, which, when executed by the computer program, causes the apparatus to execute
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, which, when executed by the computer program, causes the apparatus to execute
- the fourth aspect and any possible technical solutions of the fourth aspect It should be understood that the apparatus includes a system-on-chip, an integrated circuit, a chip, or the like.
- an apparatus in a thirtieth aspect, includes a memory, a processor, and a computer program, the computer program is stored in the memory, and when the computer program is executed, causes the apparatus to execute the first
- the apparatus includes a system-on-chip, an integrated circuit, a chip, or the like.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, and causing the apparatus to execute the computer program when the computer program is executed.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory and causing the apparatus to execute when the computer program is executed.
- the eighth aspect and any possible technical solutions of the eighth aspect It should be understood that the apparatus includes a system-on-chip, an integrated circuit, a chip, or the like.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, which, when executed by the computer program, causes the apparatus to execute
- the ninth aspect and any possible technical solutions of the ninth aspect It should be understood that the apparatus includes a system-on-a-chip, an integrated circuit, a chip, or the like.
- an apparatus comprising a memory, a processor, and a computer program, the computer program being stored in the memory, which, when executed by the computer program, causes the apparatus to execute
- the tenth aspect and any possible design technical solutions of the tenth aspect It should be understood that the apparatus includes a system-on-chip, an integrated circuit, a chip, or the like.
- a thirty-fifth aspect provides a computer-readable storage medium, the computer-readable storage medium comprising a computer program, when the computer program is run on an electronic device, the electronic device causes the electronic device to perform any one of the above-mentioned aspects and any of the above.
- the electronic device causes the electronic device to perform any one of the above-mentioned aspects and any of the above.
- any technical solution that may be designed.
- a thirty-sixth aspect provides a computer program product that, when run on a computer, enables the computer to execute the technical solution according to any one of the above aspects and any possible designs of any one of the aspects.
- an embodiment of the present application further provides a volume adjustment system, including the electronic device described in the fifteenth aspect and the electronic device described in the sixteenth aspect.
- an embodiment of the present application further provides a sound-vibration synchronous playback system, including the electronic device described in the seventeenth aspect and the electronic device described in the eighteenth aspect.
- a thirty-ninth aspect provides a graphical user interface (graphical user interface, GUI) on an electronic device, the electronic device has a display screen, a camera, a memory, and one or more processors, the one or more processors are used for Execute one or more computer programs stored in the memory, and the graphical user interface includes a graphical user interface displayed when the electronic device executes the above-mentioned first aspect and any of the possible designs of the first aspect. .
- GUI graphical user interface
- Fig. 1 is a kind of schematic diagram of video recording
- FIG. 2 is a hardware structure diagram of an electronic device according to an embodiment of the application.
- FIG. 3 is a schematic structural diagram of a software system of an electronic device according to an embodiment of the application.
- FIG. 4 is a schematic diagram of a video recording according to an embodiment of the application.
- FIG. 5 is a schematic diagram of an interface according to an embodiment of the application.
- 6A is a schematic diagram of a video recording according to an embodiment of the present application.
- 6B is a schematic diagram of another video recording according to an embodiment of the present application.
- FIG. 7 is a flowchart for realizing a method for recording audio data according to an embodiment of the present application.
- FIG. 8A is a schematic diagram of a software architecture provided by an embodiment of the present application.
- 8B is a schematic diagram of a data flow of an Android operating system provided by an embodiment of the present application.
- 8C is a flowchart of an audio data recording method based on an Android operating system internal module provided by an embodiment of the present application
- FIG. 9 is a schematic diagram of an application scenario provided by an embodiment of the present application.
- FIG. 10 is a flowchart of an audio recording method provided by an embodiment of the present application.
- FIG. 11 is a schematic diagram of a user interface provided by an embodiment of the present application.
- FIG. 13A is a schematic diagram of a software architecture provided by an embodiment of the present application.
- FIG. 13B is a schematic diagram of a data flow of an Android operating system provided by an embodiment of the present application.
- FIG. 13C is a schematic diagram of a software module provided by an embodiment of the present application.
- 15A is a schematic diagram of classifying using audio attributes according to an embodiment of the present application.
- 15B is a schematic diagram of determining a playback strategy by using an audio category according to an embodiment of the present application.
- FIG. 16 is a schematic diagram of a user interface provided by an embodiment of the present application.
- 17A is a schematic diagram of an audio classification model provided by an embodiment of the present application.
- 17B is a schematic diagram of a processing flow for classifying an audio stream by using an audio classification model according to an embodiment of the present application
- FIG. 19 is a schematic diagram of a multi-device connection scenario according to an embodiment of the application.
- 20 is a schematic structural diagram of a software system of an electronic device according to an embodiment of the application.
- 21 is a schematic diagram of an interface of a music application according to an embodiment of the application.
- 22 is a schematic diagram of an electronic device discovery interface according to an example of the application.
- 23A is a schematic diagram of an audio data transmission process according to an embodiment of the present application.
- 23B is a schematic diagram of a transmission process of sound effect configuration information according to an embodiment of the present application.
- 24 is a schematic diagram of a software architecture provided by an embodiment of the present application.
- FIG. 25 is a flowchart of a method for volume adjustment provided by an embodiment of the present application.
- 26A is a schematic diagram of a user interface provided by an embodiment of the present application.
- 26B is a schematic diagram of a user interface provided by an embodiment of the present application.
- 27A is a schematic diagram of a user interface provided by an embodiment of the present application.
- 27B is a schematic diagram of a user interface provided by an embodiment of the present application.
- 29 is a schematic structural diagram of a sound and vibration file according to an embodiment of the application.
- FIG. 30 is a schematic structural diagram of a software system of an electronic device according to an embodiment of the application.
- 31A is a schematic diagram of a sound and vibration synchronous playback according to an embodiment of the application.
- 31B is a schematic diagram of another sound and vibration synchronous playback according to an embodiment of the application.
- FIG. 32 is a schematic diagram of another sound-vibration synchronous playback according to an embodiment of the application.
- 33 is a schematic flowchart of a method for synchronously playing sound and vibration according to an embodiment of the application.
- 35 is a schematic structural diagram of another device according to an embodiment of the application.
- 36 is a schematic structural diagram of another device according to an embodiment of the application.
- FIG. 37 is a schematic structural diagram of another device according to an embodiment of the present application.
- the electronic device in this embodiment of the present application may be a portable terminal, such as a mobile phone, a tablet computer, a portable computer, a wearable electronic device (such as a smart watch, smart glasses, a smart helmet, a smart bracelet), an augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR) devices, etc.
- the portable terminal includes but is not limited to carrying Hongmeng or other operating systems.
- the electronic devices in the embodiments of the present application may not be portable terminals, such as desktop computers, large-screen devices (such as Huawei smart screens, smart TVs, smart displays, and smart projection systems), which are not limited.
- Application is a software program that can realize one or more specific functions.
- multiple applications may be installed in an electronic device.
- camera application SMS application, email application, Douyin application, King of Glory application, WeChat (WeChat), WeLink, etc.
- the application mentioned below may be an application that has been installed when the electronic device is shipped from the factory, or may be an application downloaded from a network or acquired by a user during the use of the electronic device.
- audio data may also be called sound data, which is used to represent sound, and is obtained after processing an audio file (such as an ogg file).
- the audio data is obtained by decoding, decompressing, or performing audio processing on the audio file.
- the audio file includes audio data, and may be an MP3 file, an MP4 file, or a file in other formats, which is not limited. That is, the electronic device can play the sound based on the audio data.
- the electronic device may provide the user with functions such as video recording and photographing through a camera application.
- a user can operate the camera application so that the electronic device can record video in response to the user's operation of the camera application.
- the electronic device stores the recorded video in the form of a video file (for example, an MP4 file, or a 3gp file, etc.).
- the user uses the electronic device to post-process the stored video file, thereby adding background music to the video.
- the electronic device may record video and play music in response to user manipulation of the camera application.
- the video added to the video may be audio that is played in response to user manipulation of the camera application.
- the camera application starts the camera in response to the operation of receiving the user's recording video, and transmits the corresponding video recording parameter configuration (such as video resolution, video frame rate, etc.) to the media record.
- the video capture device ie, the video hardware abstraction layer
- the video shooting device processes the collected images, such as encoding, compressing, etc., to obtain image data, and outputs the image data to the media record until the video recording ends.
- media record processes the image data from the video shooting device to generate video files.
- the video file does not include background music.
- the electronic device processes the obtained video file and the audio file of the background music, and synthesizes the background music into the video.
- the camera application sends the audio file of the background music to the audio track in response to receiving the user's action to record the video.
- the audio flinger calls the audio playback device (that is, the audio hardware abstraction layer (audio HAL)) to play the background music.
- the audio playback device that is, the audio hardware abstraction layer (audio HAL)
- the embodiment of the present application provides a video recording method, so that the electronic device can add corresponding background music in the process of video recording, so that after the video recording ends, a video file containing the background music can be directly obtained .
- At least one refers to one or more.
- “Plural” means two or more.
- the character “/” generally indicates that the associated objects are an “or” relationship.
- “At least one (item) of the following” or its similar expression refers to any combination of these items, including any combination of single item (item) or plural item (item).
- At least one (a) of a, b or c may represent: a, b, c, a and b, a and c, b and c, or a, b and c seven situations. where each of a, b, c can be an element itself, or a set containing one or more elements.
- the electronic device includes a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, key 190, motor 191, indicator 192, camera 193, a display screen 194, and a subscriber identification module (subscriber identification module, SIM) card interface 195 and the like.
- SIM subscriber identification module
- the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an environment Light sensor 180L, bone conduction sensor 180M, etc.
- Processor 110 may include one or more processing units.
- the processor 110 may include an application processor (AP), a modem (modem), a graphics processor (graphics processing unit, GPU), an image signal processor (ISP), a controller, a video encoder Decoder, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc.
- AP application processor
- modem modem
- graphics processor graphics processor
- ISP image signal processor
- controller a video encoder Decoder
- digital signal processor digital signal processor
- DSP digital signal processor
- baseband processor baseband processor
- neural-network processing unit neural-network processing unit
- NPU neural-network processing unit
- different processing units may be independent devices, or two or more different processing units may also be integrated into one device.
- the controller can be the nerve center and command center of the electronic device.
- the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetch
- a memory may also be provided in the processor 110 for storing computer programs and/or data.
- the memory in processor 110 is cache memory.
- the memory may hold computer programs and/or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the computer program and/or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
- the processor 110 may include one or more interfaces.
- the processor 110 includes a universal serial bus (USB) interface 130 and a subscriber identity module (SIM) interface 195 .
- the processor 110 may further include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous Transmitter (universal asynchronous receiver/transmitter, UART) interface, mobile industry processor interface (mobile industry processor interface, MIPI), and/or general-purpose input/output (general-purpose input/output, GPIO) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- PCM pulse code modulation
- UART universal asynchronous Transmitter
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device.
- the electronic device may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
- the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
- the USB interface 130 can be used to connect a charger to charge the electronic device, and can also be used to transmit data between the electronic device and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
- the interface can also be used to connect other electronic devices, such as augmented reality (AR) devices.
- AR augmented reality
- the SIM card interface 195 is used to connect a SIM card.
- the SIM card can be inserted into the SIM card interface 195 or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device.
- the electronic device can support 2 or N SIM card interfaces, where N is a positive integer greater than 2.
- the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
- the SIM card interface 195 can also be compatible with different types of SIM cards.
- the SIM card interface 195 is also compatible with external memory cards.
- the electronic device interacts with the network through the SIM card to realize functions such as call and data communication.
- the electronic device employs an eSIM, ie: an embedded SIM card.
- the eSIM card can be embedded in the electronic device and cannot be separated from the electronic device.
- the charging management module 140 is used to receive charging input from the charger.
- the charger may be a wireless charger or a wired charger.
- the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
- the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device. While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
- the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
- the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, the wireless communication module 160, and the like.
- the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
- the power management module 141 may also be provided in the processor 110 .
- the power management module 141 and the charging management module 140 may also be provided in the same device.
- the wireless communication function of the electronic device may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem, the baseband processor, and the like.
- Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
- Each antenna in an electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
- the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
- the mobile communication module 150 can provide a wireless communication solution including 2G/3G/4G/5G/(6G and other subsequent evolution standards) and other standards applied to the electronic device.
- the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), and the like.
- the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
- the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
- the wireless communication module 160 includes wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), and global navigation satellite systems (GNSS) that can be applied to electronic devices. ), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions.
- the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
- the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
- the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
- a communication connection may be established between different electronic devices through BT or WLAN.
- the antenna 1 of the electronic device is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device can communicate with the network and other devices through wireless communication technology.
- the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), the fifth generation (the fifth generation) , 5G) mobile communication system, future communication system, such as the sixth generation (6th generation, 6G) system, etc., BT, GNSS, WLAN, NFC, FM and/or IR technology, etc.
- GSM global system for mobile communications
- GPRS general packet radio service
- CDMA code division multiple access
- WCDMA broadband Code Division Multiple Access
- TD-SCDMA Time Division Code Division Multiple Access
- LTE Long Term Evolution
- future communication system such as the sixth generation (6th generation, 6G) system, etc., BT,
- the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
- GPS global positioning system
- GLONASS global navigation satellite system
- BDS Beidou satellite navigation system
- BDS Beidou navigation satellite system
- QZSS quasi-zenith satellite system
- SBAS satellite based augmentation systems
- the electronic device implements a display function through a GPU, a display screen 194, an application processor, and the like.
- the display screen 194 is used to display images, videos, and the like.
- Display screen 194 includes a display panel.
- the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode, or an active matrix organic light emitting diode (active-matrix organic light).
- emitting diode, AMOLED organic light-emitting diode
- FLED flexible light-emitting diode
- Miniled MicroLed, Micro-oLed
- quantum dot light-emitting diode quantum dot light emitting diodes, QLED
- the electronic device may include 1 or N display screens 194 , where N is a positive integer greater than 1.
- the electronic device can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor.
- the ISP is used to process the data fed back by the camera 193 .
- the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
- ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
- ISP can also optimize parameters such as exposure and color temperature of the shooting scene.
- the ISP may be provided in the camera 193 .
- Camera 193 is used to capture still images or video.
- the object is projected through the lens to generate an optical image onto the photosensitive element.
- the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
- CMOS complementary metal-oxide-semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
- the ISP outputs the digital image signal to the DSP for processing.
- DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
- the electronic device may include 1 or N cameras 193 , where N is a positive integer greater than 1.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
- the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save audio, video, etc. files in an external memory card.
- the internal memory 121 includes an operating memory (memory) and a built-in memory.
- the running memory can be used to store computer programs and/or data and the like.
- the processor 110 executes various functional applications and data processing of the electronic device by executing the computer program stored in the operating memory.
- running memory may include high-speed random access memory.
- the built-in memory can also be called built-in external memory, etc., and can be used to store computer programs and/or data.
- the built-in memory may store an operating system, application programs, and the like.
- the electronic device usually loads the computer program and/or data in the built-in memory into the running memory, so that the processor 110 runs the corresponding computer program and/or data to realize the corresponding function.
- the internal memory 121 may include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), and the like.
- the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device.
- the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. Such as saving pictures, videos and other files in an external memory card.
- the electronic device may implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor. Such as music playback, recording, etc.
- the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
- the pressure sensor 180A may be provided on the display screen 194 .
- the gyro sensor 180B can be used to determine the motion attitude of the electronic device.
- the angular velocity of the electronic device about three axes ie, the x, y, and z axes
- the gyro sensor 180B can be used for image stabilization.
- the air pressure sensor 180C is used to measure air pressure.
- the electronic device calculates altitude from the air pressure value measured by air pressure sensor 180C to aid in positioning and navigation.
- the magnetic sensor 180D includes a Hall sensor.
- the electronic device can use the magnetic sensor 180D to detect the opening and closing of the flip holster.
- the electronic device when the electronic device is a flip machine, the electronic device can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
- the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device in various directions (generally three axes).
- the magnitude and direction of gravity can be detected when the electronic device is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
- Distance sensor 180F for measuring distance.
- Electronic devices can measure distances by infrared or laser. In some embodiments, when shooting a scene, the electronic device can use the distance sensor 180F to measure the distance to achieve fast focusing.
- Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
- the light emitting diodes may be infrared light emitting diodes.
- Electronic devices emit infrared light outward through light-emitting diodes.
- Electronic devices use photodiodes to detect reflected infrared light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object in the vicinity of the electronic device.
- the electronic device can determine that there is no object in the vicinity of the electronic device.
- the electronic device can use the proximity light sensor 180G to detect that the user holds the electronic device close to the ear to talk, so as to automatically turn off the screen to save power.
- Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
- the ambient light sensor 180L is used to sense ambient light brightness.
- the electronic device can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
- the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
- the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device is in the pocket to prevent accidental touch.
- the fingerprint sensor 180H is used to collect fingerprints. Electronic devices can use the collected fingerprint characteristics to unlock fingerprints, access application locks, take photos with fingerprints, and answer incoming calls with fingerprints.
- the temperature sensor 180J is used to detect the temperature.
- the electronic device utilizes the temperature detected by the temperature sensor 180J to implement a temperature handling strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device may reduce the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
- the electronic device when the temperature is lower than another threshold, the electronic device heats the battery 142 to avoid abnormal shutdown of the electronic device caused by the low temperature.
- the electronic device boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
- Touch sensor 180K also called “touch panel”.
- the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
- the touch sensor 180K is used to detect a touch operation on or near it.
- the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
- Visual output related to touch operations may be provided through display screen 194 .
- the touch sensor 180K may also be disposed on the surface of the electronic device, which is different from the location where the display screen 194 is located.
- the bone conduction sensor 180M can acquire vibration signals.
- the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
- the bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal.
- the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
- the electronic device may receive key input and generate key signal input related to user settings and function control of the electronic device.
- Motor 191 can generate vibrating cues.
- the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
- touch operations acting on different applications can correspond to different vibration feedback effects.
- the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
- Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
- the touch vibration feedback effect can also support customization.
- the indicator 192 can be an indicator light, which can be used to indicate a charging state, a change in power, or a message, a missed call, a notification, and the like.
- the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device.
- the electronic device may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
- the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
- the software system of the electronic device in the embodiments of the present application may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture, or the like.
- the embodiments of the present application use the layered architecture of the Hongmeng operating system as an example to illustrate the software system of the electronic device.
- FIG. 3 is a structural diagram of a software system of an electronic device according to an embodiment of the present application.
- the software system of the electronic device includes an application layer, a framework layer, a hardware abstraction layer (HAL), and the like.
- HAL hardware abstraction layer
- the application layer includes applications, such as camera applications, short video applications, gallery applications, map applications, game applications, music applications, and the like.
- the application program can be used to provide a graphical user interface (graphical user interface, GUI) for the user, to provide the user with an operation interface, and the like.
- GUI graphical user interface
- the application program of the framework layer application layer provides an application programming interface (application programming interface, API) framework.
- API application programming interface
- the API framework may include a camera system framework and an audio system framework.
- the camera system framework includes a camera.
- the audio system framework includes a media recorder (MediaRecord), an audio player (AudioTrack), an audio policy executor (AudioFlinger), an audio policy (AudioPolicy), and the like.
- camera is an application (eg, a camera application) that invokes the interface of the video shooting device.
- the camera system framework also includes a surface view, and the camera can call the video capture device through the surface view.
- MediaRecord is used to generate video files.
- the audio system framework also includes a writer, and MediaRecord can generate video files by calling the writer.
- the audio system framework further includes HwAudioPolicyMix (audio policy setting module) for customizing different audio policies for different applications.
- HwAudioPolicyMix audio policy setting module
- an application can pass corresponding parameters to HwAudioPolicyMix, such as application ID (uid), etc., so that Hw AudioPolicyMix can generate a corresponding audio policy for the application and pass it to AudioPolicy.
- the hardware abstraction layer includes audio playback devices (such as Audio HAL), video capture devices (such as video hardware abstraction layer), and so on. Audio playback devices are used to call sound hardware playback devices such as speakers to play audio. The video capture device is used to call the camera to capture images.
- the hardware abstraction layer may also include a virtual audio playback device (remote_submix). remote_submix is used to receive the audio data of the audio file sent by AudioFlinger that conforms to the audio policy generated by HwAudioPolicyMix for the application, and pass the audio data of the audio file to MediaRecord through AudioFlinger, so that MediaRecord can meet the audio data generated for the application according to the audio data.
- the audio data of the audio file of the strategy and the image data collected by the video shooting device are combined into a corresponding video file, so that the combined video file can include background music.
- the software system of the electronic device shown in FIG. 3 is only a schematic illustration, and does not constitute a limitation to the software system of the electronic device.
- the software system of the electronic device may further include a kernel layer.
- the modules included in the framework layer or the hardware abstraction layer are not limited.
- the software system of the electronic device shown in FIG. 3 may also be an Android operating system.
- the camera application In response to the user's operation to record a video with background music, the camera application starts the camera, passes the corresponding video recording parameter configuration (such as video resolution, video frame rate, etc.) to MediaRecord, and passes the audio file of the background music to AudioTrack.
- the video capture device is called by the camera for image capture.
- the camera transmits the image data of the collected image to MediaRecord
- AudioTrack processes the audio file of the background music to obtain the audio data of the background music and transmits it to AudioFlinger.
- AudioFlinger distributes the audio data to the virtual audio playback device and the audio playback device respectively.
- the audio data is passed to MediaRecord by the virtual audio playback device through AudioFlinger. Therefore, MediaRecord can perform corresponding processing on the image data and audio data according to the video recording parameter configuration, until the video recording ends, and obtain a video file with background music.
- the audio playback device can distribute the audio data from AudioFlinger to speakers or headphones for playback.
- the camera application may also acquire and play a video file with background music after the video recording ends, or in response to a user's operation.
- the video file recording method shown in FIG. 4 adds background music to the video during the video recording process, so that the user does not need to perform subsequent processing on the video file, which is convenient for the user to use.
- AudioFlinger can not only receive audio data from the background music of the camera app, but also receive audio data from another app
- the audio data of the program it is easy to cause the audio data transmitted by AudioFlinger to the virtual audio playback device not only the audio data of the background music of the camera application, but also the audio data of another application, which not only affects the video recording effect, but also easily causes version disputes. .
- the embodiment of the present application introduces HwAudioPolicyMix into the software system of the electronic device, so that the electronic device can filter the audio in a media file (such as a video file or an audio file) under the condition of supporting multiple application programs to play.
- a media file such as a video file or an audio file
- From the audio data of the application program that records the video in order to achieve the purpose of adding corresponding background music according to the user's needs during the video recording process, and it is not easy to cause copyright disputes.
- this method of adding background music to the video will also help to make the background music sound better when the video is recorded by the electronic device.
- the sound effect is the same as the sound effect of the background music played when the electronic device records the video.
- the electronic device displays an interface 500 .
- the interface 500 is a video recording interface of the camera application, including an image preview frame 501 , a background music setting option 502 and a virtual key 503 .
- the image preview frame 501 is used for previewing the images collected by the camera.
- the virtual key 503 is used to control the start or stop of video recording. It can be understood that the video recording interface of the camera application may also include other controls, such as virtual keys for controlling switching between front and rear cameras.
- a background music setting bar 5021 is displayed. Background music settings bar 5021 includes a number of music options such as None, Music 1, Music 2, Music 3 and more.
- the recorded video does not include background music. If Music 1 is selected, Music 1 is included in the recorded video. When the user selects more, the corresponding music can be selected locally or on the network as the background music of the recorded video.
- the electronic device takes the user selecting music 2 as an example.
- the electronic device starts recording video.
- the electronic device ends video recording, and generates a video file, where the video file includes background music and images actually captured by the camera.
- the electronic device may also play the music file indicated by the music 2.
- the electronic device when multiple application programs in the electronic device play audio, in the case that the user selects music 2, in response to the user clicking the virtual button 503, the electronic device according to the application identifier (uid) of the camera application ), audio data of the audio corresponding to the application identifier of the camera application is selected from the multiple application programs that play audio.
- the electronic device ends video recording, and generates a video file according to the audio data of the audio corresponding to the application identifier of the camera application (that is, the audio data of the audio file identified by Music 2) and the image data collected by the camera.
- an application in the electronic device plays audio
- the camera application may not play the background music used to record the video. This can prevent multiple applications from playing background music at the same time.
- a method for video recording by an electronic device may be as shown in FIG. 6A , which specifically includes: in response to a user's operation of recording a video with background music, the camera application configures the audio policy of the camera application.
- the parameters are passed to HwAudioPolicyMix, the camera application passes the audio file of the background music to AudioTrack, the camera application passes the video recording parameter configuration (such as video resolution, video frame rate, etc.) to MediaRecord, and starts the camera.
- the audio policy configuration parameters of the camera application may include an application identifier (eg, uid) of the camera application, and the like.
- HwAudioPolicyMix generates the audio policy applied by the camera according to the configuration parameters of the audio policy applied by the camera, and passes the audio policy applied by the camera to AudioPolicy.
- AudioPolicy sends the policy applied by the camera to AudioFlinger.
- AudioTrack processes the audio files of the background music, obtains the audio data of the background music, and passes it to AudioFlinger.
- AudioFlinger receives the audio policy of the camera application from AudioPolicy, then filters out the music data of the background music used for recording the video according to the audio policy of the camera application, and transmits the music data of the background music used for recording the video to the virtual audio player. equipment.
- the virtual audio playback device sends the music data of the background music used for recording the video to MediaRecord.
- the virtual audio playback device can also send the music data of the background music used for recording the video to AudioFlinger, and then AudioFlinger sends the music data of the background music used for recording the video to MediaRecord.
- the video capture device can be called for image capture. Then, the camera passes the image data of the captured image to MediaRecord. Therefore, MediaRecord can perform corresponding synthesis on the received audio data and image data according to the video recording parameter configuration. When the video recording is over, MediaRecord can generate a video file with background music according to the synthesis result of the audio data and the image data. and save.
- the The audio strategy filters out the audio data played by the camera application (that is, background music) from the audio played by multiple applications, thereby helping to achieve the purpose of adding corresponding background music according to user needs during the video recording process, and It is not easy to record the audio data of the audio played by other applications into the video, resulting in copyright disputes.
- the audio policy of the camera application may refer to filtering out audio data corresponding to the application identifier of the camera application.
- the audio data of the background music is transmitted to the virtual audio playback device by AudioFlinger, and generally, the sound effect processing is performed on the audio data of the background music before the AudioFlinger outputs the audio data. Therefore, in this embodiment of the present application, if When the video is recorded by the electronic device, the playing background music has undergone sound effect processing.
- This method of adding background music to the video also helps to make the sound effect of the background music during playback and the recording of the electronic device after the video recording of the electronic device ends. The sound effects of the background music played during the video are consistent.
- the microphone of the electronic device when the shooting mute function is enabled, does not collect external sounds (such as user sounds or sounds in the surrounding environment).
- the electronic device may generate a video file according to the audio data of the sound collected by the microphone, the audio data of the background music, and the image data collected by the camera.
- the camera application in response to the user's operation of recording a video with background music, the camera application also activates the microphone, and the microphone calls the audio collection device to collect the audio data of the sound, and then the audio collection device will collect the audio data of the sound. Sent to MediaRecord.
- MediaRecord synthesizes the audio data of the sound collected by the audio collection device, the audio data of the background music, and the image data collected by the camera, and when the video recording ends, according to the audio data of the sound collected by the microphone, the audio data of the background music and the image data collected by the camera are synthesized.
- the synthetic result of the image data collected by the camera generates a video file and saves it.
- the electronic device may also play the video file according to the video file, so as to facilitate the user to preview.
- the end of video recording may be triggered by the user through an operation, or may be automatically ended by the electronic device after starting the video recording for a preset duration, which is not limited.
- the video recording method according to the embodiment of the present application is described above by taking a camera application as an example, and the embodiment of the present application is not limited to an application using the video recording method shown in FIG. 6A or FIG. 6B , for example, FIG. 6A or FIG. 6B
- the shown video recording method can also be applied to short video applications, etc., which is not limited.
- the video recording method of the embodiment of the present application is applied to generate a video file in a scene of a live broadcast or a video call.
- the above-mentioned embodiments have introduced the process of generating video files based on audio data and image data.
- the audio data may include the voice of the host, the sound of the game, background music, etc., Then, how to record the audio data so that the user can select the audio data to be recorded according to their own needs is also a problem to be solved.
- the following will take the live broadcast scene as an example to introduce the audio data recording process in detail.
- the recording of audio data usually includes the following two methods:
- Method 1 The system sound is released through the speaker, and then the microphone records the sound released from the speaker.
- the system sound (which can also be understood as: the sound of the game) is usually played out through the speaker, and then the microphone will record the external system sound, and the microphone can directly record the voice of the host.
- the audio data recorded by the microphone includes the system sound and the voice of the host, that is, a piece of audio data includes multiple kinds of audio data.
- Method 2 The system sound is recorded by means of internal recording.
- the internal recording refers to the fact that there is no need for the speaker to be played out, and then the sound is picked up from the microphone.
- live broadcast application the application used for live broadcast is recorded as "live broadcast application”
- game application the application where the live broadcast content is located
- background music in the live broadcast scene (such as the music played by the host himself) is used
- music application the application used for live broadcast is recorded as “live broadcast application”.
- the method may include the following steps: a live application creates a class (AudioPlaybackCaptureConfiguration) to apply for recording audio streams of types A and B, and then Create an audio recording (AudioRecord) to record audio streams of type A and type B. Then AudioPlaybackCaptureConfiguration can send the application for recording audio stream types A and B to the audio policy (AudioPolicy/AudioPolicyMix).
- the audio policy (AudioPolicy/AudioPolicyMix) receives the application, it notifies the audio service (AudioService) to change the audio output policy (that is, after When outputting audio streams, one audio stream is output to speakers, earphones, etc., and the other audio stream (A, B type mixed audio stream) is output to the virtual device).
- the audio service (AudioService) receives the audio streams output by the game application and the music application through multiple audio players (AudioTrack).
- the audio service (AudioService) can send the audio stream to the mixing thread (MixerThread), and the audio stream is mixed by the MixerThread.
- the audio system can duplicate the audio stream and split it into two transmissions.
- one audio stream (audio data after mixing audio streams of types A, B, and C) is sent to speakers, earphones, and the like.
- the other audio stream is: the audio system can copy and mix the audio streams of type A and B, and then send the audio streams after mixing A and B to the virtual device (remote_submix), and then pass the audio recording class ( AudioRecord) to record at least one type of audio stream, and finally send the audio stream after the recording to the live application of the application layer.
- an application can output different audio streams through multiple different AudioTracks. In the figure, only three AudioTracks are used to illustrate, for example, two AudioTracks, or four AudioTracks, etc. This is not limited.
- the recording data received by the live broadcast application is data after mixing multiple audio stream types, and the audio stream types that the live broadcast application can obtain are limited.
- the mixing thread MixerThread
- the mixed data of types A and B is output to the virtual device, and then sent to the live broadcast application.
- the audio data is one piece of data after mixing, not two pieces of audio data.
- an embodiment of the present application also provides an audio recording method, by marking multiple types of audio streams in a live broadcast scenario, and filtering out at least one type of audio streams required by a live broadcast application from the marked audio streams Then send the filtered audio streams to the live broadcast application, so that the live broadcast application side can record multiple different types of audio data instead of multiple types of mixed data, which can facilitate the audio stream. deal with.
- the audio recording method can be applied to the electronic device shown in FIG. 2 .
- the block diagram of the software structure of the electronic device can be referred to as shown in FIG. 8A .
- the software structure of the electronic device from top to bottom is the application layer, the application framework layer, the Android runtime (Android runtime), the system library, the kernel layer, and the hardware abstraction layer (HAL). ) and the hardware layer.
- the application layer can include a series of application packages. As shown in Figure 8A, browsers, Youku, Tencent Video, Maps, iQiyi, game applications (such as Honor of Kings), live broadcast applications (such as Douyin), and music applications (NetEase Cloud Music) can be installed in the application layer. ) and other applications.
- the application framework layer can include an audio service (AudioService), an audio recording class (AudioRecord), an audio policy (AudioPolicy/AudioPolicyMix), an audio policy executor (AudioFlinger), an audio playback (AudioTrack), and a mixing thread (MixerThread).
- the application framework layer can also include display strategy service (DSS), power management service (power manager service, PMS), display management service (display manager service, DMS), activity manager, window manager , content providers, view systems, resource managers, notification managers, etc.
- the audio recording class (AudioRecord) is responsible for collecting the recording data.
- the audio policy (AudioPolicy/AudioPolicyMix) is responsible for the policy selection and volume adjustment policy of audio device switching.
- Audio strategy executor (AudioFlinger) is responsible for the management of input and output stream devices and the processing and transmission of audio stream data.
- Audio playback (AudioTrack) is responsible for outputting audio data.
- the mixing thread (MixerThread) is responsible for mixing the audio data and outputting the mixed audio data to the audio device.
- the Android runtime includes core libraries and a virtual machine.
- Android runtime is the runtime environment of the Android operating system, responsible for the scheduling and management of the Android operating system.
- the core library includes two parts: one part is the function functions that the java language needs to call, and the other part is the core library of the Android operating system.
- the application layer and the application framework layer run in virtual machines.
- the virtual machine executes the java files of the application layer and the application framework layer as binary files.
- the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
- a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
- surface manager surface manager
- media library Media Libraries
- 3D graphics processing library eg: OpenGL ES
- 2D graphics engine eg: SGL
- the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
- the media library supports playback and recording of audio and video in multiple formats, and supports opening of still images in multiple formats.
- the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
- the graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
- 2D graphics engine is a drawing engine for 2D drawing.
- the kernel layer is the layer between the hardware and software of an electronic device.
- the kernel layer at least includes display drivers, sensor drivers, camera drivers, audio drivers, etc., which are used to drive the hardware in the hardware layer.
- the hardware abstraction layer HAL is an interface layer between the operating system kernel layer and the hardware circuit, and its purpose is to abstract the hardware. It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system, making it hardware-independent and portable on a variety of platforms. From the perspective of software and hardware testing, the testing of software and hardware can be completed based on the hardware abstraction layer, which makes it possible to perform parallel testing of software and hardware.
- the hardware abstraction layer HAL may include: an audio primary channel (primary HAL) and a virtual device (remote_submix).
- the primary audio channel corresponds to speakers, headphones, etc.
- the virtual device (remote_submix) is used to record system sounds.
- the hardware layer may include various types of sensors (such as touch sensors, etc.), display screens, cameras, and the like.
- FIG. 8B a schematic diagram of a data flow of an Android operating system provided by an embodiment of the present application.
- an audio stream marked with at least one type required by a live application application at the application layer after receiving the application, the audio system at the framework layer marks the played audio stream, and then uses the From the at least two types of tags obtained by marking, screen out the type tags required by the live application, and then send the filtered audio streams of at least one type tag to the virtual device (remote_submix) in the hardware abstraction layer HAL, respectively, Then, the audio stream marked with at least one type is recorded through the audio recording class (AudioRecord) of the framework layer, and finally the audio stream after the recording is sent to the live application of the application layer.
- the audio recording class AudioRecord
- FIG. 8C it is a flowchart of an audio data recording method based on an internal module of an Android operating system.
- a live broadcast application creates a class (AudioPlaybackCaptureConfiguration), and at the same time, the live broadcast application calls an added interface (addSoundFlags) to apply for a required type flag.
- the live application creates an AudioRecorder class for recording.
- AudioPlaybackCaptureConfiguration can send the application for the required audio stream type tag to the audio policy (AudioPolicy/AudioPolicymix), and after the audio policy (AudioPolicy/AudioPolicyMix) receives the application for the audio stream type tag, it notifies the audio service (AudioService) to change the audio output policy (Change the audio output strategy to only output to speakers, headphones, etc., change the audio stream marked with the audio stream type applied by the live application to the virtual device before mixing, and mix different types of audio streams to output to the speaker , headphones, etc.).
- the audio service AudioService
- the audio service receives audio streams with different types of tags output by game applications and music applications through multiple audio players (AudioTrack), and then filters the corresponding audio stream type tags in the audio stream type tags based on the application of the live application. Then, the audio service (AudioService) can copy the audio stream and divide it into two transmissions.
- One of the audio stream data is sent to the mixing thread (MixerThread) to mix various types of audio streams, and then send them to speakers, headphones, etc.
- the other channel sends at least one type-marked audio stream required by the live application to the virtual device (remote_submix), and then uses the audio recording class (AudioRecord) to record at least one type of marked audio stream, and finally records the recording.
- the subsequent audio stream is sent to the live application at the application layer. That is to say, the solution in this embodiment of the present application can filter out the audio streams marked with types A and B before sending the audio streams marked with three types of A, B, and C to the MixerThread (MixerThread) for mixing. , and then sent to the virtual device (remote_submix), so that the audio data received after the live application is two copies of audio data, including audio data marked by type A and audio data marked by type B, rather than the prior art. A piece of audio data.
- the scenario may include: electronic equipment and a live broadcast service platform.
- the electronic devices include host-side electronic devices and viewer-side electronic devices, and the live broadcast service platform may include at least one server.
- the electronic device on the host side is used to collect real-time original live video, and upload the collected original live video to the server in the live service platform according to the set video transmission protocol.
- the original live broadcast video collected by the host-side electronic device includes the game video currently displayed on the display screen, and also includes the host video including the host collected by the camera device.
- an application program for live broadcasting an application program related to music, an application program related to games, and the like may be installed on the electronic device on the host side.
- the host can also open music-related applications to play music to adjust the atmosphere while the game is live broadcast.
- the application scenarios of the embodiments of the present application may include music applications or may not include music applications, which are not limited in this application.
- the server in the live broadcast service platform is used to receive the original live video of the electronic device on the host side, and transcode the original live video to generate a variety of target live videos of different bit rates and formats to be played on the electronic device of the audience. .
- the electronic device on the viewer side is used to receive and play the target live video.
- the audience can send a barrage through the audience-side electronic device, enter comment information in the comment area, and so on.
- the viewer-side electronic device can upload the traditional comment information sent by the user to the server, and then distribute it to other viewer-side electronic devices through the server.
- audio data and “audio stream” in the embodiments of the present application may sometimes be mixed, and it should be understood that their meanings are the same.
- FIG. 10 a flowchart of an audio recording method provided by an embodiment of the present application, referring to FIG. 10 , the method may include the following steps:
- S1001 The electronic device detects a first trigger event.
- the electronic device here may be the host-side electronic device in the application scenario shown in FIG. 9 .
- the first trigger event may be a user (host) selection operation event on the audio stream type mark (hereinafter referred to as the first type mark and the second type mark) on the interface of the first application, or the first application according to Sets the rule's selection event for the audio stream type tag.
- the "first application” in the embodiments of the present application may be understood as a “live broadcast application”
- the "second application” may be understood as a “game application”
- the "third application” may be understood as a “music application”.
- the electronic device on the host side can be based on the host's operation, for example, log in to the live broadcast client through the host's user account, and create a live broadcast room, and then, the electronic device on the host side obtains the original live broadcast video, and upload the original live video to the server in the live service platform, and then the server in the live service platform transcodes the original live video to generate the target live video for playback on the electronic device on the viewer side.
- step S1001 will be described in detail below in conjunction with two possible implementation manners of the first trigger event.
- Mode 1 The user selects the first type mark and the second type mark on the interface of the first application.
- an application in the electronic device may provide a user (host) with a display interface, and the interface may display the audio stream and the type mark corresponding to the audio stream. Then the host can make selections on the interface according to his own preferences, for example, he can choose to record the audio stream marked with type A, and not record the audio stream marked with type B, and so on.
- the interface 1100 may include an “audio recording” button 1101 .
- the user interface 1110 may be displayed on the electronic device.
- the user interface 1110 may include various audio stream type marks, for example, may include: game audio stream 1111 , music audio stream 1112 , and host audio stream 1113 .
- a confirmation button (or option) 1114 may also be included on the user interface 1110 .
- the user interface 1120 may be displayed on the electronic device.
- the user interface 1120 may include a variety of audio stream type marks, for example, may include: game voice call audio stream 1121, skill release audio stream 1122, game background music audio stream 1123, game character lines audio stream 1124, game kill Broadcast audio stream 1125, music audio stream 1126, and host audio stream 1127.
- a confirmation button (or option) 1128 may also be included on the user interface 1110 .
- the above-mentioned audio stream type marking is only a schematic description, and the marking form of the audio stream type can also be in other forms. Marks, etc., and can also be divided in other ways, which are not limited.
- the game background music audio stream 1123 can be understood as the background music of the game (eg, Honor of Kings) itself, and the music audio stream 1126 can be understood as the audio stream of the music played by the host in the background.
- the music played by the host may be the music played on the electronic device on the host side, or the music played by the host on other electronic devices, etc., which is not limited in this application.
- the user interface 1120 only specifically divides the game audio stream 1111 in the user interface 1110 into a game voice call audio stream 1121, a skill release audio stream 1122, and a game background music audio stream. 1123. Audio stream 1124 of game character lines, and audio stream 1125 of game kill play.
- the host can record the audio stream according to his own preferences or needs, so that the audio stream can be processed later, which can improve the user experience.
- Mode 2 The first application selects the first type mark and the second type mark according to the set rule.
- the first type mark and the second type mark may be set audio type marks, and the audio type mark may be the audio type mark set last time by the user, or may also be the configured audio type mark.
- the user may click the confirmation button (or option) 1128 on the user interface, at this time, the electronic device uses the audio type mark set by the user last time as the setting. specified audio type flag.
- the audio system of the electronic device may configure the set rule for the first application, and then after the first application is started, the first application may select the required audio stream type mark according to the rules configured by the system.
- the rules configured by the audio system for the first application may be fixed rules or dynamically changed rules, which are not limited in this application.
- the rules configured by the audio system for the first application may be configured according to scenarios.
- the rules of audio system configuration can be referred to as shown in Table 1 below.
- the rules for the configuration of the audio system and the corresponding tables involved in the embodiments of this application are only a schematic description, and the identifiers of the scenarios in this application may also be scenarios such as scenario 1, scenario 2, etc., and the audio system
- the form of the configured rules is not limited to the above table.
- the audio system of the electronic device may configure the rules according to the duration of the live broadcast of the host.
- the duration of the live broadcast of the host is T
- the rules of audio system configuration can be referred to as shown in Table 2 below.
- T1 is 20 minutes and T2 is 40 minutes.
- the configuration rule selected by the first application can be recorded simultaneously with three types of audio streams marked A, B, and C;
- the configuration rule selected by the first application can be to record audio streams marked with type A and type B, and not record the audio stream marked with type C;
- the configuration rule selected by the first application may be to record the audio stream marked by type A, and not record the audio stream marked by type B and C.
- T is only an illustration, and the present application is not limited to the above-mentioned value.
- the rules for configuring the audio system of the electronic device as the first application are not limited to the above examples.
- the audio system of the electronic device can also configure the rules according to the time period of the live broadcast of the anchor.
- the number to configure rules, etc., is not limited in this application.
- the type marks of the audio stream such as the first type mark and the second type mark.
- two or more types of marks may be selected Type tags for example.
- S1002 The electronic device detects the type flag of the first audio stream in response to the first trigger event.
- the audio streams played in the current scene are collectively referred to as "first audio streams", and the audio stream corresponding to the first type mark and the audio stream corresponding to the second type mark in step S1001
- the recorded audio stream or the audio stream selected by the application are collectively referred to as "first audio streams", and the audio stream corresponding to the first type mark and the audio stream corresponding to the second type mark in step S1001
- the electronic device After detecting the target trigger event, the electronic device can respond to the target trigger event, and then detect the type mark of the audio stream played in the current scene.
- the electronic device detects the type mark of the currently played audio stream the following two methods may be adopted:
- Mode 1 The electronic device calls the audio system, the audio system marks the first audio stream, and then the electronic device detects the type mark of the currently played audio stream according to the marking result of the audio system.
- the first audio stream includes an audio stream in a game application and an audio stream in a music application.
- the audio system marks the first audio stream, for example, as type A, B, or C, and then streams the marked audio to the AudioServer module.
- the audio system may mark the audio stream through audio parameters in multiple modules (eg, audio attributes (AudioAttrbutes), media session (Mediasession), and media provider (MediaProvider) modules).
- audio attributes AudioAttrbutes
- Mediasession media session
- MediaProvider media provider
- the type of the audio stream, the length of the audio stream, etc. can be acquired, and then the tags are marked according to the acquired audio parameters.
- the marking rules may be as shown in Table 3 below.
- the marked content may be stored in the audio system, for example, may be stored in an audio attribute (AudioAttrbutes) module.
- Manner 2 The electronic device calls the application, and the application marks the played first audio stream, and then the electronic device detects the type mark of the currently played audio stream according to the marking result of the application.
- the first audio stream includes an audio stream in a game application and an audio stream in a music application.
- the game application and the music application can respectively mark the audio streams played by their respective applications, for example, mark them as types A, B, and C, and then mark the marked audio streams.
- Audio is streamed to the AudioServer module.
- S1003 The electronic device selects the first type marker and the second type marker from at least two types of markers of the first audio stream.
- the electronic device may determine the type mark of the first audio stream, and then select the audio stream required in S1001 from the type mark of the first audio stream type tag. For example, in S1001, the required audio stream type is marked as the audio stream marked with type A and B, and in S1002, it is determined that the type of the first audio stream includes type A, B, and C type marks, that is, the first audio stream includes The required audio stream type in S1001 marks the corresponding audio stream.
- S1004 The electronic device records the audio streams corresponding to the first type mark and the second type mark, respectively, to obtain the first audio recording data and the second audio recording data.
- the user/application selects to record audio streams corresponding to two audio stream type marks, in S1001 the user/application selects two audio stream type marks, and then S1003 the electronic device selects two audio stream type marks, and respectively The required two audio stream types are marked with corresponding audio streams for recording, and two copies of the recording data are obtained. In this way, multiple copies of the recorded data of different types of audio streams can be obtained, instead of one copy of the recorded data of the audio mixing data in the prior art.
- FIG. 12 a flowchart of an audio playback method provided by an embodiment of the present application, referring to FIG. 12 , the method may include the following steps:
- S1201 The electronic device detects a second trigger event.
- the electronic device here may be the viewer-side electronic device in the application scenario shown in FIG. 9 .
- the viewer-side electronic device can log in to the live client through the viewer's user account based on the viewer's operation, find the live room in the live client, and then join the live room to watch the target live video.
- the second trigger event may be a selection operation event of the user (viewer) marking the audio stream type on the interface of the first application, or a selection event of the first application marking the audio stream type.
- Mode 1 The user (viewer) selects the audio stream type mark.
- an application program in the electronic device may provide a user (viewer) with a display interface, and the interface may display the audio stream included in the current live broadcast scene and the type corresponding to the audio stream mark. Then the user can make selections on the interface according to their own preferences. For example, they can choose to play the audio stream marked with type A, not play the audio stream marked with type B, or choose to turn down the volume of the audio stream marked with type B. Wait.
- FIG. 11 it is assumed that a viewer joins a certain game live broadcast room, and at this time, an interface 1100 is displayed on the electronic device on the viewer side, for example.
- An "Audio Record” button 1101 may be included in interface 1100 .
- the user interface 1120 may be displayed on the electronic device.
- the user interface 1120 may include the audio stream type of the host in the live broadcast scene, for example, it may include: game voice call audio stream 1121, skill release audio stream 1122, game background music audio stream 1123, game character lines audio stream 1124, Game kill broadcast audio stream 1125 , music (Media) audio stream 1126 , host audio stream 1127 .
- interface schematic diagrams of the live broadcast interface displayed on the host-side electronic device and the live broadcast interface displayed on the viewer-side electronic device are only a schematic illustration, and the application does not limit the icons and names displayed on the interfaces.
- the interface may also include a "confirm to open” button, a “confirm to close” button, and the like.
- a "confirm to open” button when the user chooses to play the game voice call audio stream 1121 and the skill release audio stream 1122, he can click the "Confirm to open” button, and when the user chooses not to play the game background music audio stream 1123, he can click the "Confirm to close” button.
- Mode 2 The first application selects the audio stream according to the set rule.
- the electronic device on the viewer side can configure the set rules for the first application, and then when the viewer opens the first application and enters the live room, the first application can select the desired audio stream type and mark the corresponding audio stream according to the rules configured by the system.
- the rules may be configured according to the viewer's viewing duration of the live broadcast, and the first application further selects the audio stream according to the viewing duration.
- the configuration rule selected by the first application can be to play the audio streams marked with three types of A, B, and C at the same time; when the live viewing duration T is greater than T1 And when it is less than T2, the configuration rule selected by the first application may be to play the audio streams marked by types A and B, and not play the audio streams marked by type C; when the duration T of watching the live broadcast is greater than T2, the first application selected The configuration rule can be to play the audio stream marked with type A, and not play the audio stream marked with type B and C.
- the above rules are only an example.
- the rules may also be configured in other ways, for example, the rules may be configured according to the number of times viewers enter the live broadcast room, which is not limited in the present application.
- S1202 The electronic device plays the audio stream corresponding to the audio stream type mark in response to the second trigger event.
- the electronic device can play the audio stream corresponding to the audio stream type mark, so that for the user, it is convenient for the user to select the audio stream they want to hear according to their own needs, or can be configured according to the audio system.
- the rules provide users with some possible needs, such as the loud sound of some audios, which may cause trouble to users when playing for a long time, so as to improve the user experience of users when watching live broadcasts.
- the user can set the type of the audio stream to be played according to their own preferences or needs, which can improve the user experience.
- multiple applications may play audio at the same time.
- the audio streams of multiple applications are output together, that is, the user Audio from multiple applications will be heard and may be noisy and cluttered. Therefore, how to avoid the problem of noisy and chaotic sound when multiple sound-emitting applications are opened at the same time remains to be solved.
- audio-related applications may be referred to as voice-producing applications.
- the following uses two applications, one in the foreground and one in the background, as an example to introduce an audio playback method.
- the application running in the foreground refers to an application currently running on the electronic device and displayed on the display screen.
- An application running in the background refers to an application currently running on the electronic device but not displayed on the display screen.
- Running in the foreground means that the application is running and the display interface of the application is displayed on the display screen.
- Running in the background means that the application is running, but the display interface of the application is not displayed on the screen.
- the display screen of the mobile phone is displaying the display interface of the map application (such as AutoNavi Map), then at this time, the map application is running in the foreground. If the mobile phone receives an incoming call in the process of displaying the display interface of the map application, the display screen displays the incoming call interface (including the interface of the caller number, answering, hanging up and other controls), but does not display the display interface of the map application, then at this time, the map The app switches to the background while the phone app runs in the foreground.
- the map application such as AutoNavi Map
- the audio playback method introduced below is described by taking as an example that it is applied in the architecture shown in the electronic device shown in FIG. 2 .
- FIG. 13A is a software structural block diagram of an electronic device to which an audio playback method according to an embodiment of the present application is applied.
- applications such as browsers, Youku, Tencent Video, Maps, iQiyi, Douyin, and NetEase Cloud Music can be installed in the application layer.
- the application framework layer may include a media player (MediaPlayer), an audio policy executor (AudioFlinger), and a sound mixing module.
- the media player (MediaPlayer) is responsible for outputting the audio data of the applications running in the foreground and background. It should be understood that the media player (MediaPlayer) is only an example, and the audio playback interface may also be AudioTrack, etc., which is not limited in this application.
- Audio policy executor responsible for the management of input and output stream devices and the processing and transmission of audio stream data.
- the mixing module is responsible for mixing the audio data and outputting the mixed audio data to the audio device.
- the hardware abstraction layer HAL may include: an audio hardware abstraction layer (Audio HAL).
- Audio HAL is responsible for the interaction with audio hardware devices, which can be directly called by AudioFlinger, the audio policy executor of the framework layer.
- FIG. 13B a schematic diagram of a data flow of an Android operating system provided by an embodiment of the present application.
- an application running in the foreground and background may call a media player (MediaPlayer) of the framework layer, and then output the audio stream played by the foreground and background applications, and send the The output audio stream is sent to AudioFlinger, and then AudioFlinger sends the audio stream to the mixing module, which processes the audio stream and gives the corresponding mixing strategy.
- the mixing module of the framework layer calls the AudioHAL of the HAL layer of the hardware abstraction layer, and the AudioHAL sends the output audio stream to the device of the hardware layer for playback.
- FIG. 13C a schematic diagram of a software module provided by an embodiment of the present application is shown.
- the front-end and back-end applications can send their respective audio streams to the mixing module, and the audio source classifier in the mixing module classifies and identifies the audio streams of the front-end and back-end applications, and then sends them to the strategy library of the mixing module.
- the strategy library provides the corresponding mixing strategy according to the classification and recognition results of the audio stream.
- the sound mixing module in the schematic diagram shown in FIG. 13B is specifically subdivided into: a sound source classifier and a strategy library.
- the audio playback method of the embodiment of the present application can be applied to a single device or to a multi-device distributed collaboration scenario, for example, the audio (for example, navigation and music) on the mobile phone can be projected to the car machine, It is up to the car to decide how to play the audio.
- the audio for example, navigation and music
- FIG. 14 a flowchart of an audio playback method provided by an embodiment of the present application, referring to FIG. 14 , the method may include the following steps:
- S1401 The electronic device receives a first trigger event and a second trigger event.
- the trigger event may be an operation event in which the user clicks the icon of the application, or a click operation event in which the user plays music on the application, or an operation event in which the user opens the application and plays music by voice .
- the first trigger event may be an operation event of switching an application running in the foreground to running in the background
- the second trigger event may be an operation event of starting the application and displaying the application in the foreground
- S1402 In response to the first trigger event and the second trigger event, the electronic device acquires the audio playback policy of the first audio stream and the second audio stream.
- first audio stream and the second audio stream in the embodiments of the present application originate from different applications.
- the audio stream played by the foreground application may be recorded as a "first audio stream”, and the audio stream played by the background application may be recorded as a "second audio stream”.
- the process of how the audio playback strategy is determined is described in detail below.
- the process may specifically include two steps: classification of audio streams and determination of playback strategies.
- an audio source classifier (also referred to as an audio classification system or a classification module) in the electronic device can acquire the first audio attribute of the first audio stream from the application (foreground application and background application), and according to the first audio attribute of the first audio stream An audio attribute classifies the first audio stream to obtain a first category corresponding to the first audio stream.
- the second audio attribute of the second audio stream may be acquired, and the second audio stream may be classified according to the second audio attribute to obtain a second category corresponding to the second audio stream.
- execution order of classifying the first audio stream and the second audio stream may be sequential or simultaneous, which is not limited in this application.
- the audio attribute of the first audio stream may be denoted as "first audio attribute”
- the audio attribute of the second audio stream may be denoted as “second audio attribute”
- the first audio stream corresponding to The category of the audio stream is denoted as "first category”
- the category corresponding to the second audio stream is denoted as "second category”.
- the audio attributes (AudioAttributes) of the audio stream may include two attributes: a usage (USAGE) attribute and a content type (CONTENT_TYPE) attribute. It should be understood that the USAGE attribute and the CONTENT_TYPE attribute are audio attributes that divide the audio stream from different perspectives.
- the audio properties of the audio stream are configured by the application, and different audio streams may correspond to the same or different audio properties. Different audio streams from the same application may have different audio properties configured.
- the audio attributes of each audio stream can be acquired, and then the audio source classifier in the electronic device can classify the audio streams according to the audio attributes of the audio streams , so as to determine the category corresponding to the audio stream.
- the audio source classifier may classify the audio attributes (including the USAGE attribute/CONTENT_TYPE attribute) of the audio stream according to the mapping table, and determine the category to which the audio attribute belongs as the category corresponding to the audio stream.
- the category to which the audio attribute of the audio stream belongs (that is, the above-mentioned mapping table) can be referred to as shown in Table 4 below.
- Table 4 can be stored in the electronic device in advance.
- the storage form is not limited to the form of the above-mentioned table, which is not limited in this application.
- each audio stream may include a USAGE attribute and a CONTENT_TYPE attribute, and the priority of the USAGE attribute and the CONTENT_TYPE attribute may be the same or different, which is not limited in this application.
- the priority between the USAGE attribute and the CONTENT_TYPE attribute is that the USAGE attribute has a higher priority than the CONTENT_TYPE attribute. Then, after obtaining the audio stream, the audio source classifier can first determine whether the USAGE attribute has a corresponding category. If the USAGE attribute has a corresponding category, the audio stream is assigned to the corresponding category; if the USAGE attribute does not have a corresponding category, it is judged whether the CONTENT_TYPE attribute has a corresponding category, and if the CONTENT_TYPE attribute has a corresponding category, the audio Streams are assigned to corresponding categories.
- the audio stream obtained by the audio source classifier includes audio stream 1 and audio stream 2.
- the USAGE attribute and the CONTENT_TYPE attribute included in the audio stream 1 are: USAGE_VOICE_COMMUNICATION and CONTENT_TYPE_MUSIC respectively.
- the electronic device can determine whether the USAGE attribute, that is, USAGE_VOICE_COMMUNICATION, has a corresponding category.
- USAGE_VOICE_COMMUNICATION can be divided into voice call categories. That is to say, if the USAGE attribute has a corresponding category, the category of the audio stream 1 can be determined as the voice call category.
- the following begins to introduce the process of determining the playback strategy of the audio stream.
- the electronic device may determine a specific playback strategy for the audio streams according to the categories to which the two audio streams belong.
- the foreground audio category and the background audio category can be input into the strategy library, and then a specific audio playback strategy can be obtained according to the strategy library.
- the electronic device will identify the type of the front and back audio streams. For example, the type of the background audio stream is music (if it is heavy metal music), and the type of the front audio stream is media, then it is necessary to determine when the type of the audio stream is music. and media, how the audio stream should be played to improve the user experience.
- opening an application involved in the embodiments of the present application may refer to starting an application and displaying the application in the foreground, or switching an application running in the foreground to running in the background.
- the electronic device may store the correspondence between the audio category and the audio playing strategy (ie, the above-mentioned strategy table).
- the audio playing strategy ie, the above-mentioned strategy table.
- the audio playback strategies in Table 5 below are strategies set for some scenarios with a relatively high probability of occurrence, or in other words, scenarios in which users use frequently.
- the "-" involved in the above table 5 indicates that the probability of occurrence of the scene is relatively low, and the default strategy is used, that is, the foreground audio stream is played; "foreground” means that only the foreground audio stream is output, and the background audio stream is discarded; "Indicates that only the background audio stream is output, and the foreground audio stream is discarded; "Mixed” indicates that the front and background audio streams are mixed and output, that is, played at the same time; "Preemptive” means that the background audio stream is stopped and the foreground audio stream is played.
- “dropping” means that the audio stream is playing, not paused.
- a prompt sound comes when listening to music, and the music in the background can continue to be played at this moment, but the user can only hear the sound of the prompt sound.
- “Stop” refers to pausing the playback of the audio stream.
- a prompt sound comes when listening to music. At this moment, the music in the background can be paused, and when the prompt sound ends, the music in the background can continue to play.
- prompt information may be displayed on the display screen of the electronic device to prompt the user whether to choose to follow the strategy.
- Library recommended strategy to play audio can be displayed after the strategy library provides the play strategy.
- the foreground application is Huawei Music.
- the song currently played by the foreground application is "Summer Wind”
- the screen of the electronic device displays interface 1600
- the background application is NetEase Cloud Music.
- the playback strategy given by the electronic device is to play the music of the foreground application and pause the background music.
- the electronic device can play the foreground music, and after a preset time period, the user interface 1610 can be displayed on the display screen of the electronic device.
- the user interface 1610 may include a prompt box 1611 , for example, the content of the prompt box may include prompt information “Do you want to play music as recommended?” 1612 , a selection button “Yes” 1613 , and a selection button “No” 1614 . The user can choose whether to play the foreground music by clicking the select button.
- the electronic device can continue to play the music in the foreground, and pause the music in the background. If the user clicks the selection button "No” 1614, the electronic device can stop the music in the foreground, that is, the music is paused after the foreground, and then the user can re-select the music playing strategy according to his own preferences. Of course, if the user clicks the selection button "No" 1614, the electronic device can play the music in the foreground and the background at the same time, that is, mixing and playing.
- the user interface 1620 may be displayed on the display screen.
- the user interface 1620 may include an audio playback strategy table 1621 , such as playing foreground music 1622 , playing background music 1623 , mixing playback 1624 , pausing playback 1625 , and others 1626 .
- the user can select a play strategy in the above selection box, for example, the user has selected to play the foreground music 1622 .
- the foreground music at this time can be paused, and then after the user selects, it is determined whether to continue playing according to the user's selection.
- the foreground music at this time can also be played all the time without pausing. Not limited.
- 1626 may include the following strategies: reducing the volume of background music, increasing the volume of foreground music, recommending soothing type music, recommending performance music, and so on.
- the electronic device can set the display time for the prompt box 1611 displayed on the user interface 1610, for example, it can be set to display for 1 minute, and when the time reaches 1 minute, if the user does not select a playback strategy, it can automatically disappear.
- the above-mentioned prompt information 1612 can also remind the user in the form of voice broadcast, and then the user can select a play strategy by voice, which is not limited in this application.
- the content and form of the prompt information 1612 is only an example, which may be changed according to the actual scene. For example, if the mobile phone is in silent mode, music is playing on the mobile phone at this time, and when the front desk calls, the voice assistant of the mobile phone can issue a prompt message "Do you want to answer the call?", which is convenient for the user to answer the incoming call in time.
- music may include pop music, rock music, folk music, etc.
- different styles of music may have different playback strategies. Therefore, in the following embodiments of the present application, the description will be continued for special scenarios such as listening to a book/storytelling (eg, media sound category) for the audio stream of the background application and the audio stream of the foreground application.
- a book/storytelling eg, media sound category
- the audio source classifier After the audio stream is classified by the audio source classifier, if it is determined that the category of the first audio stream is the first preset category and the category of the second audio stream is the second preset category, it can further determine the specific style of the music (or say the specific type of music), continue to classify the second audio stream, and then determine the playback strategy according to the type of the second audio stream.
- a media sound category such as listening to a book/storytelling, may be recorded as a "first set category", and a music category as a "second set category”.
- the audio stream may be classified by an audio classification model (eg, the YAMNet audio classification model).
- an audio classification model eg, the YAMNet audio classification model
- FIG. 17A is a schematic diagram of an audio classification model provided by an embodiment of the present application.
- the YAMNet audio classification model adopts the Depthwise-Separable convolution architecture, which has the characteristics of small scale and fast speed. The size of the entire model is about 14.5M, the number of network weights is about 1.9M, and the amount of operation is 69.2M multiplication operations.
- FIG. 17B it is a schematic diagram of a processing flow of classifying an audio stream by using an audio classification model according to an embodiment of the present application.
- the audio stream of the background application can be collected first, and then the collected audio stream can be resampled to obtain 16KHz mono audio, and then the 16KHz mono audio can be divided into frames, and the fast Fourier transform can be performed ( fast fourier transform, FFT) to obtain the spectrum, and then use the 64-order Mel filter bank to process the spectrum to obtain the Mel logarithmic spectrum, and finally segment the Mel logarithmic spectrum according to 960ms to obtain a 96*64 feature vector.
- FFT fast fourier transform
- FIG. 17A and FIG. 17B may refer to the prior art, and this application will not describe it too much here.
- the electronic device may not use the audio classification model to classify the audio stream.
- the electronic device may acquire the category of the music style classified by the application, and use the category after the application has classified the music style as the final category.
- corresponding audio playing strategies may be set in the electronic device for music categories, for example, different music styles (types) may recommend different audio playing strategies. For example, see Table 7.
- the background music and the audio stream of the foreground application are played at the same time, if the style of the background music will not make the played audio noisy and chaotic, the background music can be used as the background of the foreground audio stream music to enhance the user experience.
- S1403 The electronic device plays the first audio stream and the second audio stream according to the determined play policy of the audio stream.
- the electronic device can play the audio stream according to the playback strategy. For example, if the playback strategy is: stop the background music, the electronic device can play the foreground music and pause the background music at this time; if the playback strategy is: mix and play, then the electronic device can play the front and background music at the same time.
- the electronic device when the electronic device plays multiple audio streams at the same time, it can play the multiple audio streams according to the playback strategy of the audio streams determined by the strategy library according to the category of the audio streams, so as to avoid the occurrence of noisy and chaotic audio. , to improve the user experience.
- the embodiments of the present application further provide an audio playback method, as shown in FIG. 18 , the method may include the following steps:
- S1801 The electronic device plays the first audio through the first application.
- S1802 The electronic device switches the first application to run in the background in response to the user's first operation on the first application.
- S1804 The electronic device determines a play strategy of the first audio and the second audio.
- S1805 The electronic device plays the first audio and the second audio according to the playback policy.
- the audio playback method when the audio playback method is applied in a multi-device connection scenario, for example, the mobile phone is connected to the speaker and the smart screen respectively, the mobile phone can project audio to the speaker and the smart screen, so that the mobile phone, the speaker and the smart screen can play the same audio file at the same time.
- the audio playback effect of the same audio file on different electronic devices will be different, resulting in poor user experience.
- the present application also provides a sound effect processing method applied in a multi-device connection scenario, which can determine the sound effect configuration information used by different electronic devices in combination with the sound effect configuration information of the electronic devices. Therefore, based on the above-determined sound effect configuration information, corresponding sound effect processing can be performed and played on the corresponding electronic device, thereby reducing the difference in the audio playing effect of different electronic devices, so that the user sounds basically the same.
- the sound effect configuration information may include sound effect algorithm information, sound effect state information, sound effect mode information, audio parameters, equalizer setting information, gain setting information, and the like.
- the sound effect algorithm information is used to indicate a sound effect algorithm, such as a Dolby (Dolby) algorithm, a digital theater sound system (digital theater system, DTS) algorithm, and the like.
- the sound effect state information is used to indicate the sound effect state, and the sound effect state may include on and off.
- the sound effect mode information is used to indicate a sound effect mode, such as a music mode, a movie mode, a game mode, and the like.
- the sound effect parameters refer to the parameters used by the sound effect algorithm in the corresponding sound effect mode, equalizer setting and gain setting.
- the sound effect parameters may include a product name (PRODUCT), a sound effect module name (NAME), and the like.
- PRODUCT product name
- NAME sound effect module name
- some or all of the sound effect parameters used in the sound effect algorithm may be customized by the sound effect algorithm manufacturer.
- the product name may be customized by the sound effect algorithm manufacturer, and the sound effect module name may be defined in the standard.
- the equalizer setting information is used to set the equalizer, which may include Profile1, Profile2, and so on.
- the gain setting information is used to set the gain, for example, +3db, +2db.
- the sound effect configuration information corresponding to different devices may be different or the same. For example, as shown in Table 8.
- the electronic device may include a master electronic device (hereinafter referred to as a master device for ease of description, and may also be referred to as a master device) and a slave electronic device (hereinafter referred to as a slave device for ease of description, and may also be referred to as a slave device). called the slave device).
- a master device can be connected with one or more slave devices.
- the master device and the slave device may be connected wirelessly or wired, which is not limited.
- a master device and a slave device can transmit data, messages, information, parameters, files (eg, audio files, video files, picture files, document files) or control commands to each other through a Wi-Fi connection, and/or a Bluetooth connection. at least one, etc.
- the master device is the audio sender and the slave device is the audio receiver.
- the master device can send audio files or audio data to some of the N slave devices, or N slave devices.
- the specific master device sends data to which slave devices connected to itself are related to the data type, the device capability of the slave device, or the settings of the user.
- the main device is connected to a large-screen device, a speaker and a socket, and the socket does not have an audio playback function, and the user only selects the speaker and does not select the large-screen device.
- the host device can respond to the user's operation of playing the above-mentioned audio file, and only send the audio file or the audio data of the audio file to the speaker, so that the speaker can play.
- an application scenario of multi-device connection includes one master device and at least one slave device.
- FIG. 19 it is an application scenario of a multi-device connection according to an embodiment of the present application, including a master device 01, a slave device 02, a slave device 03, a slave device 04, a slave device 05, a slave device 06 and a slave device Equipment 07 etc.
- the application scenario of multi-device connection shown in FIG. 19 is only an example, and the embodiment of the present application does not limit the number of master devices and the number of slave devices in the application scenario of multi-device connection.
- the master device 01 can be interconnected with multiple slave devices based on the communication network, and then the master device 01 can control the slave device 02, the slave device 03, the slave device 04, the slave device 05, the slave device 06 and the slave device 07.
- At least one electronic device plays audio.
- the communication network may be a local area network, such as a Wi-Fi hotspot network, a wireless fidelity-peer to peer (Wi-Fi P2P) network, a Bluetooth network, a zigbee network, or an NFC network, etc.
- a wireless connection may also be established between the plurality of electronic devices based on a mobile network, for example, the mobile network includes a mobile network established based on 2G, 3G, 4G, 5G and subsequent standard protocols.
- the plurality of electronic devices may also establish a connection with at least one server through a mobile network, and each device transmits data, and/or messages, and/or information, and/or, through the server. signaling, and/or instructions.
- the plurality of electronic devices may also be connected through data lines.
- main device 01 can control other electronic devices to play the same audio, and the main device 01 can also control other electronic devices to play different audios, which is not limited in this application.
- the software system of the electronic device to which the sound effect processing method is applied is exemplarily described.
- FIG. 20 is a software system diagram of an electronic device according to an embodiment of the present application.
- the application layer includes applications, such as media applications (such as camera applications, music applications, video applications, audio applications), proxy applications, virtual device applications (device virtual, DV), and the like.
- the proxy application is used to realize the information exchange between devices, such as sound effect configuration information, audio data, etc. It should be noted that the proxy application may be pre-configured before the electronic device leaves the factory.
- the application layer may also include an audio control center for implementing sound effect control and control of audio devices.
- the audio device here may be an electronic device with audio playback capability connected to the electronic device, such as a speaker, a large-screen device, a mobile phone, etc., or an audio playback device of the electronic device itself, such as a speaker.
- the application layer includes a device discovery module (eg, Wi-Fi self-discovery module) and a device connection module (eg, Hiplay).
- the framework layer provides the application programming interface API framework for the applications of the application layer.
- the API framework may include an audio native framework and an audio extension framework.
- the audio native framework can be the built-in audio framework of the Harmony OS.
- the audio native framework includes an audio manager (AudioManager), an audio service (AudioService), an audio policy executor (AudioFlinger), and an audio player (AudioTrack) Wait.
- the audio extension framework refers to the extension framework of the audio function, which may include a sound effect modifier (AudioEffect, or AudioEffectimpl), an audio policy extension (AudioPolicyimpl), and an audio policy executor extension (AudioFlingerimpl).
- the hardware abstraction layer is located between the framework layer and the kernel layer, which can include audio hardware abstraction layer (Audio HAL), virtual audio playback device (also called virtual audio device, such as DV Audio HAL), Wi-Fi module or other communication modules etc.
- the virtual audio playback device is an abstraction of external audio devices (such as speakers and large-screen devices), and is used to implement communication with corresponding external audio devices.
- the software system of the electronic device shown in FIG. 20 is only a schematic illustration, and does not constitute a limitation on the software system of the electronic device. It should be noted that, when the audio native framework in the software system of the electronic device shown in FIG. 20 is the audio framework of the Android operating system, the software system of the electronic device shown in FIG. 20 may also be the Android operating system. .
- Example 1 In a multi-device connection scenario, the master device is responsible for parsing audio files, obtaining audio data, and performing corresponding sound effect processing on the audio data for different devices; the slave device does not need to parse audio files and process sound effects.
- the mobile phone Take the mobile phone as the main device and the speaker as the slave device as an example.
- the mobile phone displays an interface 2100 of a music application.
- the interface 2100 includes the identifier of the audio file to be played (eg, music name, music icon, etc.), a virtual control 2101 and a virtual control 2102 .
- Virtual controls 2101 are used to control audio playback or pause.
- the virtual control 2102 is used for the user to select whether to play audio on the speaker. When the virtual control 2102 is selected, audio playback is performed on the speaker. When the virtual control 2102 is not selected, audio playback is not performed on the speaker.
- the mobile phone detects that the user clicks on the virtual control 2101 .
- the mobile phone parses the audio file to be played to obtain the first audio data. Then, based on the first sound effect configuration information, the mobile phone performs sound effect processing on the first audio data to obtain second audio data, and based on the second sound effect configuration information, performs sound effect processing on the first audio data to obtain third audio data. Finally, the mobile phone plays the second audio data, and sends the third audio data to the speaker, so that the speaker can play the third audio data. Therefore, when the mobile phone and the speaker play the above-mentioned audio file to be played, the user can hear substantially the same sound effects.
- the second audio data is played after a first period of time.
- the first duration is the time required for the third audio data to be sent from the mobile phone to the speaker for playback.
- the first duration is the sum of the first sub duration and the second sub duration.
- the first sub-duration is the time required for the third audio data to be transmitted from the mobile phone to the speaker
- the second sub-duration is the time required for the speaker to play after the third audio data reaches the speaker. Therefore, it is helpful to realize that the mobile phone and the speaker simultaneously play the audio file to be played.
- the first sub-duration may be calculated by the mobile phone according to the distance between itself and the speaker, and the second sub-duration may be indicated by the speaker to the mobile phone.
- the speaker may send information indicating the second sub-duration to the mobile phone during the process of establishing the connection with the mobile phone or after establishing the connection with the mobile phone.
- the mobile phone can also send playback time information to the speaker, and the playback time information is used to indicate the time to start playing, so that the mobile phone and the speaker can simultaneously perform corresponding playback according to the playback time information, so as to achieve Simultaneous playback of mobile phones and speakers.
- the mobile phone detects that the user clicks on the virtual control 2101 .
- the mobile phone parses the audio file to be played to obtain the first audio data.
- the mobile phone performs sound effect processing on the first audio data to obtain second audio data; the mobile phone performs sound effect processing on the first audio data according to the second sound effect configuration information to obtain third audio data, and uses The third audio data and playing time information are sent to the speaker.
- the mobile phone plays the second audio data according to the playback time information; after the speaker receives the third audio data and the playback time information, it plays the third audio data according to the playback time information, so that the mobile phone and the speaker can play a certain audio file at the same time.
- the mobile phone and the speaker play the above-mentioned audio file to be played, the sound effect that the user sounds is substantially the same.
- the speaker does not perform sound effect processing on the second audio data.
- the sound effect state of the speaker can be OFF, that is, the sound effect state of the speaker is turned off.
- the mobile phone also sends a message or an instruction for turning off the sound effect to the speaker, and the message or instruction triggers the speaker to turn off the sound effect, so that the sound effect state is turned off.
- the mobile phone may not send a message or instruction for turning off the sound effect to the speaker.
- the sound effect state of the speaker may be obtained by the mobile phone from the speaker when the mobile phone establishes a connection with the speaker. For example, when the mobile phone initiates a connection establishment request to the speaker, the speaker can send the sound effect status to the mobile phone through the connection establishment response. For another example, when the speaker initiates a connection establishment request to the mobile phone, the speaker can send the sound effect status to the mobile phone through the connection establishment request.
- the sound effect state of the speaker may also be acquired from the speaker by the mobile phone in response to an operation of clicking the virtual control 2101 . For example, in response to the operation of clicking the virtual control 2101, the mobile phone obtains the sound effect configuration information currently used by the speaker.
- the mobile phone when the sound effect state of the mobile phone is off, the mobile phone does not perform sound effect processing on the first audio data. That is, the mobile phone sends the first audio data to the speaker, triggering the speaker to play the first audio data, and after the mobile phone sends the first audio data to the speaker, the first audio data is played after a first period of time.
- the mobile phone sends a message or instruction for turning off the sound effect to the speaker, and the message or instruction triggers the speaker to turn off the sound effect.
- the mobile phone when the sound effect state of the mobile phone is off and the sound effect state of the speaker is on, the mobile phone turns on the sound effect, and sends a message or instruction for turning off the sound effect to the speaker.
- the first sound effect configuration information includes first sound effect algorithm information, first sound effect mode information, first sound effect parameters, first equalizer setting information, and first gain setting information.
- the second sound effect configuration information includes first sound effect algorithm information, first sound effect mode information, second sound effect parameters, first equalizer setting information, and first gain setting information.
- the first sound effect algorithm information is used to indicate the first sound effect algorithm
- the first sound effect mode information is used to indicate the first sound effect mode
- the first equalizer setting information is used to indicate the first equalizer setting
- the first gain setting information is used to indicate the first sound effect mode.
- a gain setting is used to indicate the first sound effect mode.
- the first sound effect parameter is the sound effect parameter used by the first sound effect algorithm in the mobile phone under the first sound effect mode, the first equalizer setting and the first gain setting.
- the second sound effect parameter is the sound effect parameter used by the first sound effect algorithm in the speaker under the first sound effect mode, the first equalizer setting and the first gain setting.
- the first sound effect mode is the sound effect mode currently used by the mobile phone
- the first sound effect algorithm is the sound effect algorithm currently used by the mobile phone
- the first equalizer is set to the equalizer setting currently used by the mobile phone
- the first gain is set to the current used by the mobile phone. Gain setting.
- the first sound effect mode is the sound effect mode currently used by the speaker
- the first sound effect algorithm is the sound effect algorithm currently used by the speaker
- the first equalizer is set to the equalizer setting currently used by the speaker
- the first gain is set to the gain currently used by the speaker. set up.
- the sound effect configuration information currently used by the speaker may be obtained by the mobile phone from the speaker when the mobile phone establishes a connection with the speaker or after the mobile phone establishes a connection with the speaker. Or, in response to the operation of clicking the virtual control 2101, the mobile phone obtains the sound effect configuration information currently used by the speaker.
- the embodiment of the present application does not limit the manner of acquiring the sound effect configuration information currently used by the speaker.
- the sound effect configuration information of the mobile phone and the sound effect configuration information of the speaker are shown in Table 9.
- the first sound effect configuration information is the sound effect configuration information currently used by the mobile phone, and in the sound effect configuration information currently used by the mobile phone, the sound effect algorithm is Dolby, the sound effect mode is music, the sound effect parameter is parameter 1, the equalizer is set to Profile1, and the gain is set to + 3db. Then set the sound effect mode of the speaker to music, the sound effect parameter to parameter 3, the equalizer to Profile1, and the gain to +3db.
- the sound effect configuration information supported by the speaker may be pre-stored in the mobile phone.
- the sound effect configuration information supported by the speaker can be stored in the mobile phone in the form of a list.
- the mobile phone may search for the second sound effect configuration information from the sound effect configuration information list based on the speaker-based identification and the sound effect configuration information currently used by the mobile phone.
- the second sound effect configuration information is the sound effect configuration information corresponding to the speaker identification, the sound effect algorithm currently used by the mobile phone, the sound effect mode, the equalizer setting and the gain setting.
- the sound effect configuration information supported by the speaker may be sent by the speaker to the mobile phone during the process of establishing the connection between the speaker and the mobile phone or after the connection between the speaker and the mobile phone is established.
- the speaker can be sent to the mobile phone during the process of establishing the first connection with the mobile phone or after the first connection with the mobile phone is established.
- the speaker when the sound effect configuration information supported by the speaker changes, if the speaker and the mobile phone are in a connected state, or the speaker and the mobile phone are in a connected state, the speaker can send the changed sound effect configuration information to the mobile phone again. For example, when the speaker updates the software system version, the audio configuration information it supports changes.
- the mobile phone displays an interface 2200 of a smart home application, and the interface 2200 includes a device addition option 2201.
- the mobile phone displays an interface 2210.
- the interface 2210 It is used to prompt the user that the mobile phone is currently in a state of automatically scanning and discovering nearby electronic devices.
- the device information of the electronic device found by scanning is displayed on the interface 2210 .
- the device information of the electronic device may include a device name, a device model, and/or a device icon, and the like. For example, taking the mobile phone scanning to find speakers and large-screen devices as an example, as shown in C of FIG.
- the mobile phone In response to the user clicking on the device name of the speaker, the mobile phone sends a connection establishment request to the speaker.
- the speaker receives the connection establishment request, and sends a connection establishment response to the mobile phone, wherein the connection establishment response may include sound effect configuration information supported by the speaker and/or sound effect configuration information currently used by the speaker.
- connection establishment response may further include device hardware attribute information.
- the device hardware attribute information is used to identify the hardware device capabilities of the speaker, such as audio sampling rate, frame rate, and the like. In order to facilitate the mobile phone to identify the hardware device capability of the speaker.
- the music application sends the first audio file to AudioTrack 2301 in response to the operation of playing the first audio file.
- the first audio file is parsed by AudioTrack 2301 to obtain the first audio data of the first audio file. And pass the first audio data to AudioFlinger 2302, and pass AudioFlinger 2302 to AudioFlingerimpl 2303.
- the AudioFlingerimpl 2303 obtains the first sound effect configuration information and the second sound effect configuration information, and sends the first audio data, the first sound effect configuration information and the second sound effect configuration information to the AudioEffect 2304.
- AudioEffect 2304 according to the first sound effect configuration information, the first audio data is subjected to sound effect processing to obtain the second audio data; and according to the second sound effect configuration information, the first audio data is subjected to sound effect processing to obtain the third audio data; AudioEffect 2304 Send the second audio data to Audio HAL 2305, and call the speaker of the mobile phone to play through Audio HAL 2305; AudioEffect 2304 sends the third audio data to DV Audio HAL 2306, and the DV Audio HAL 2306 sends the third audio data to the communication Module 2307. And the communication module 2307 sends the third audio data to the communication module 2311 . Then, it is sent to the proxy application 2312 by the communication module 2311 .
- the proxy application 2312 then transmits the third audio data to the Audio HAL 2315 through the AudioTrack 2313 and the AudioFlinger 2314, and calls the speaker of the speaker through the Audio HAL 2315 to play.
- first sound effect configuration information and the second sound effect configuration information reference may be made to the above-mentioned related introduction, which will not be repeated here.
- the device discovery module 2321 performs a device discovery process in response to the first trigger event.
- the first trigger event is used to trigger the device discovery process.
- the device discovery module 2321 After the device discovery module 2321 discovers the speaker, it transmits the device information of the speaker, such as device identification, device model and/or device icon, to the device connection module 2322.
- the device connection module 2322 sends a connection establishment request to the proxy application 2324 through the DV 2323 in response to the second trigger event.
- the proxy application 2324 sends the connection establishment request to the communication module 2307.
- the connection establishment request is then sent by the communication module 2307 to the proxy application 2312 via the communication module 2311.
- the proxy application 2312 After receiving the connection establishment request, the proxy application 2312 obtains the sound effect configuration information currently used by the speaker, the sound effect configuration information supported by the speaker, etc. from the AudioEffect 2332 through AudioService 2331 and AudioFlinger 2314. Then the proxy application 2312 sends a connection establishment response to the communication module 2307 through the communication module 2311, and the connection establishment response includes the sound effect configuration information currently used by the speaker and the sound effect configuration information supported by the speaker. The communication module 2307 returns a connection establishment response to the proxy application 2324.
- the proxy application 2324 sends the sound configuration information of the speaker to the DV 2323, and the DV 2323 registers the DV Audio HAL 2306 in the hardware abstraction layer, and sends the sound configuration information of the speaker to the AudioManager 2326 through the audio control center 2325.
- AudioManager 2326 sends audio configuration information of speakers to AudioPolicyimpl 2328 through AudioService 2327.
- AudioPolicyimpl 2328 sends the sound effect configuration information of the speaker to AudioFlingerimpl 2303, so that when AudioFlingerimpl 2303 receives audio data, it can perform corresponding sound effect processing on the audio data according to the sound effect information currently used by itself and the sound effect configuration information of the speaker.
- the proxy application 2312 obtains the second sub-duration, and the second sub-duration is the time required for the third audio data to be played on the speaker after the third audio data reaches the speaker.
- the second sub-duration is the sum of duration 1, duration 2 and duration 3
- duration 1 is the time required for the third audio data to reach the proxy application 2312 from the communication module 2311
- duration 2 is the third audio data from the proxy application 2312 to the Audio HAL
- the time required for 2315 that is, the length 2 is the time for the third application data to arrive at Audio HAL 2315 from proxy application 2312 via AudioTrack 2313 and AudioFlinger 2314.
- the duration 3 is the time required for the third audio data to travel from the Audio HAL 2315 to the audio playback device (such as a speaker) of the speaker.
- the duration 3 is obtained by the proxy application 2312 from the Audio HAL 2315.
- Example 2 In a multi-device connection scenario, the master device sends the audio file to be played, or the identifier or address of the audio file to be played, to the slave device.
- the audio file to be played is parsed by the slave device itself, and then the sound effect is processed, and the sound effect configuration information used by the slave device for sound effect processing may be sent to the slave device after the master device makes a decision.
- the mobile phone Take the mobile phone as the main device and the speaker as the slave device as an example.
- the mobile phone displays an interface 2100 of a music application, and the interface 2100 includes an identifier of an audio file to be played, a virtual control 2101 and a virtual control 2102 .
- the virtual control 2102 When the virtual control 2102 is selected, the mobile phone receives the operation of the user clicking the virtual control 2101 .
- the mobile phone parses the audio file to be played to obtain the first audio data. Then, based on the first sound effect configuration information, the mobile phone performs sound effect processing on the first audio data to obtain second audio data.
- the mobile phone plays the second audio data, and sends the second sound effect configuration information and the audio file to be played to the speaker, so that the speaker can analyze the audio file to be played, obtain fourth audio data, and based on the second sound effect configuration information Perform sound effect processing on the fourth audio data to obtain third audio data, and play the third audio data.
- the second audio data is played after a second period of time.
- the second duration is the sum of the third sub duration and the fourth sub duration.
- the third sub-time is the time required for the second sound effect configuration information and the audio file to be played to be transferred from the mobile phone to the speaker.
- the fourth sub-time is the time required for the speaker to play the third audio data after the second sound effect configuration information and the audio file to be played arrive at the speaker.
- the above is the audio configuration information used by the master device to determine the audio configuration information used for audio playback on the master device and the audio configuration information used for audio playback on the slave device. , thereby reducing the difference in the audio playback effect of the master device and the slave device.
- the audio configuration information used for audio playback on the master device and the audio used for audio playback on the slave device can also be determined according to the audio configuration information used by the slave device configuration information.
- take Table 2 as an example.
- the mobile phone is the master device
- the speaker is the slave device.
- the sound effect algorithm is Dolby
- the sound effect mode is movie
- the sound effect parameter is parameter 2
- the equalizer is set to Profile2
- the gain is set to +2db
- set the audio configuration information used by the mobile phone to the sound effect algorithm as Dolby
- the sound effect mode is movie
- the sound effect parameter is parameter 4
- the equalizer is set to Profile2
- the gain is set to +2db.
- the audio configuration information used for audio playback on the master device and the audio configuration information used for audio playback on the slave device are determined, which may be the master device.
- One of the devices is arbitrarily selected, or it can be selected by the master device according to a certain policy.
- the audio configuration information used for audio playback on the master device and the audio configuration information used for audio playback on the slave device are determined.
- the device priority can be pre-configured in the main device, for example, the priority of the speaker is higher than that of the mobile phone, the priority of the mobile phone is higher than that of the tablet, the priority of the tablet is higher than that of the large-screen device, etc.
- volume level of the slave device may be different from that of the master device.
- the electronic device 1 can transmit the audio on its own device to the electronic device 2, the electronic device 3 and other devices for playback.
- the mobile phone can be connected to the speaker through a communication network, and then the audio on the phone can be transmitted to the speaker for playback. Since the power amplifier, volume level, volume curve, etc. of the mobile phone and the speaker are quite different, when the volume is adjusted on the mobile phone, the volume of the same audio played on the mobile phone and the speaker is different, which makes the user experience poor.
- an embodiment of the present application also provides a volume adjustment method.
- an absolute volume conversion table After adjusting the volume on the electronic device 1, the electronic device 1 can report the volume level 1 corresponding to the volume on its own device. To the electronic device 2, then the electronic device 2 can determine the volume level 2 corresponding to the volume level 1 according to the absolute volume conversion table, and play audio on the electronic device 2 according to the volume level 2, so that the electronic device 1 and the electronic device 2 are playing. When audio, achieve volume consistency.
- the principle of volume adjustment by one device is similar to the principle of one device controlling the volume of another device. It is assumed that the first device wants to control the second device to perform volume adjustment, so that the first device and the second device can achieve a consistent volume level when playing the same audio.
- the first device may be a mobile phone, a tablet computer, etc.
- the second device may be a speaker, a watch, a large-screen device (for example, a smart screen), etc., which is not limited in this application.
- the application layer can include Youku, iQiyi, navigation, distributed device virtualization kit (device virtualization kit, Dvkit) (or also called “proxy service”), volume control center, settings , broadcast control cards and other applications.
- Dvkit distributed device virtualization kit
- proxy service distributed device virtualization kit
- the application in the application layer may be an application at the device system level, or may be a third-party application (application, APP).
- the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
- the application framework layer includes some predefined functions.
- the application framework layer may include a display policy service, a power manager service (PMS), a display manager service (DMS), an audio service (AudioService), and an audio policy executor (AudioFlinger).
- PMS power manager service
- DMS display manager service
- AudioService audio service
- AudioFlinger audio policy executor
- the application framework layer may also include an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, and the like.
- the audio service (AudioService) is used to receive the volume adjustment instruction.
- the audio strategy executor (AudioFlinger) is the executor of the audio strategy, responsible for the management of the input and output stream devices and the processing and transmission of the audio stream data.
- the Bluetooth Audio Distribution Profile (A2dp) HAL is a virtualization path for Bluetooth devices.
- the Distributed Mobile Sensing Hardware Abstraction Layer is a virtualization channel of virtual audio devices (for example, Wi-Fi speakers).
- Audio Hardware Abstraction Layer (Audio HAL): responsible for interaction with audio hardware devices, it is directly called by AudioFlinger, the audio policy executor of the framework layer.
- the electronic device 1 can receive the volume adjustment information, and send the volume adjustment information to the audio service (AudioService) module of the framework layer, and the AudioService module adjusts the volume The information is passed to the distributed absolute volume module, and then the distributed absolute volume module reports the volume level on the electronic device 1 to the electronic device 2 .
- the electronic device 2 can determine the volume level B corresponding to the volume level A according to the volume conversion table, and then the electronic device 2 performs audio playback according to the volume corresponding to the volume level B.
- the following embodiments are described by taking the architecture applied to the electronic device shown in FIG. 2 and the application scenario shown in FIG. 19 as examples. It should be understood that the “master device” in the schematic diagram shown in FIG. 19 can be understood as the “source end device” in the following embodiments, and the “slave device” can be understood as the “sink end device”.
- the electronic device may store the correspondence between the volume level and the absolute volume. For example, see Table 10.
- volume level Absolute volume (db) audio stream type 1 1 media stream 2 2 media stream 3 3 media stream ... ... media stream 100 100 media stream 1 1 Ringtone Stream ... ... Ringtone Stream 100 100 Ringtone Stream
- the electronic device may also store a conversion relationship between the volume level of the electronic device at the control end and the volume level of the electronic device at the controlled end.
- the control-end electronic device can also be recorded as "source-end device", that is, the electronic device that initiates the connection
- the controlled-end electronic device can also be recorded as "sink-end device”, that is, the connected electronic device.
- source-end device that is, the electronic device that initiates the connection
- sink-end electronic device can also be recorded as "sink-end device” that is, the connected electronic device.
- the conversion relationship between the absolute volume of the source device and the sink device can be referred to as shown in Table 11.
- volume level (source) Volume level (sink) 1 10 2 15 3 twenty two 4 30 5 35 6 40 ... ... 15 100
- the master device 01 can establish a connection with other electronic devices.
- the master device 01 adjusts the volume, for example, it can send the volume level corresponding to the volume adjustment to the slave device 02, for example The volume level is 3, and then the slave device 02 determines that the volume level corresponding to the slave device 02 is 22 when the volume level of the master device 01 is 3 according to the conversion relationship between the saved volume levels, and then the slave device 02 according to the volume level is 22 Play audio at the corresponding volume.
- volume adjustment method according to the embodiment of the present application will be described in detail below by taking the first device and the second device as examples.
- FIG. 25 a flowchart of a volume adjustment method provided by an embodiment of the present application is shown in FIG. 25 .
- the method may include the following steps:
- S2501 The first device transmits audio data to the second device.
- the first device can play the audio data, that is, the first device can transmit the audio data after playing the audio data.
- the first device may also establish a connection with the second device first, and then transmit the audio data to the second device.
- the first device may play the first audio, and then in response to the user's first operation, switch the first audio to be played on the second device.
- the first audio is audio data played by an application on the first device, and the first operation may be a user's click operation on a button (for example, an "audio switch” button) on the display interface.
- a button for example, an "audio switch” button
- the process of establishing a connection between the first device and the second device is introduced.
- the mobile phone displays a main interface 2600 .
- the main interface 2600 may include multiple application programs, such as email, clock, gallery, and the like.
- the user can call up the control bar through gesture operation on the main interface 2600, and then select the target device in the control bar.
- the gesture operation may be a user's sliding operation upward from the lower left corner on the main interface 2600 of the mobile phone.
- the user interface 2610 can be displayed on the main interface.
- the user interface 2610 may include a control bar 2611, and the control bar 2611 may include at least one list of connectable devices, such as “Smart Screen” 2612 and “MateBook X” 2613.
- the user can click on the "smart screen” 2612 in the list of connectable devices, and the mobile phone can respond to the user's click operation on the "smart screen” 2612 and send an instruction to request a connection to the "smart screen”.
- the electronic devices in the list of connectable devices displayed in the user interface 2610 may be other electronic devices under the same local area network as the first device (mobile phone); or the electronic devices displayed in the user interface 2610
- the electronic device in the list of connectable devices may be an electronic device logged in with the same user account as the first device (mobile phone).
- the gesture operation may also be other operations, such as a sliding operation from the lower right corner upwards, etc.
- the gesture operation may also be upwards from the lower left corner/upward from the lower right corner, and has A sliding operation with a certain pressure, for example, the mobile phone displays the control bar 2611 only when the mobile phone detects a sliding operation from the upper left corner downward, and the pressure sensor set on the display screen detects that the pressure value generated by the sliding operation is greater than the threshold value.
- the gesture operation may also be a sliding operation from the lower left corner up/up from the lower right corner, etc., and the sliding operation stays at the end position without interval or long-presses for a preset duration.
- the mobile phone detects a sliding operation from the upper left corner down, and when the mobile phone detects that the sliding operation has slid to the end position, the mobile phone will only display the control bar 2611 if it stays at the end position or long-presses for a preset period of time (such as 2 seconds). .
- the gesture operation may also be other operations, such as an operation of drawing a circle, drawing a polygon on the display screen, etc.; or, the gesture operation may also be an operation such as "shaking";
- the space gesture is not limited in this embodiment of the present application.
- the above-mentioned gesture operation can also be replaced by a voice command.
- the "smart screen” 2612 can receive the connection request instruction sent by the mobile phone (for example, HUAWEI Mate 30).
- the mobile phone for example, HUAWEI Mate 30
- an interface 261 can be displayed on the “Smart Screen”, and the interface 261 can include a prompt box 262.
- the content of the prompt box 262 can be “HUAWEI Mate 30 requests a connection, do you agree? ", "Allow” button 263, "Deny” button 264.
- the proxy service on the smart screen 2612 can collect parameters such as power amplifier, volume level, volume curve, etc. of the smart screen after receiving the instruction requesting connection. After the user clicks the "Allow" button 263 on the interface 261 of the smart screen, the proxy service on the smart screen 2612 can send parameters such as the power amplifier, volume level, and volume curve of the smart screen to the mobile phone.
- a user interface 2620 may be displayed on the display screen of the mobile phone.
- the user interface 2620 may include an “audio switch” button 2621 and at least one connected device list 2622 , such as a “smart screen” 2612 .
- the user can click the "audio switch” button 2613 in the interface 2620, and the mobile phone can respond to the click operation, and the user interface 2630 can be displayed on the display screen.
- the user interface 2630 may include at least one device list 2631 capable of audio switching. The user can select the "smart screen" 2612 in the device list 2631 that can perform audio switching, so as to switch the audio on the mobile phone to the "smart screen” 2612 for playback.
- the mobile phone can write the audio data from the application program where it is located and write the Pulse Code Modulation (PCM) data to the audio system, and then the audio system selects the smart screen 2612 and sends the audio data through the local area network (or Wi- Fi direct connection) to the smart screen 2612. After the proxy service of the smart screen 2612 receives the audio data, it plays it through the player.
- PCM Pulse Code Modulation
- the above description is based on the mobile phone transmitting audio data to one device as an example. If the mobile phone wants to transmit audio data to two devices (for example, device 1 and device 2), one audio data can be copied. For two audio data, such as audio data 1 and audio data 2, then transmit audio data 1 to device 1 and audio data 2 to device 2. It should be understood that audio data 1 and audio data 2 are the same audio data. Or you can also split a two-channel audio data on the mobile phone into two channels, in which the audio data of one channel is transmitted to the device 1, and the audio data of the other channel is transmitted to the device 2, so as to realize the audio data. transmission.
- the first device determines a first volume level.
- the first device can switch the audio data to the second device for playback, and then the first device can obtain the current volume level of the second device, and determine the first volume level of the first device corresponding to the current volume level of the second device . Specifically, the first device acquires the current volume level of the second device, and converts the current volume level of the second device into a volume level corresponding to the first device according to the volume level conversion table. Exemplarily, assuming that the current volume level of the second device is 100, according to the correspondence in Table 2 above, it can be known that the corresponding volume level of the first device is 15.
- the current volume level of the second device may be understood as the volume level of the audio played by the second device last time before the connection is established this time.
- S2503 The first device receives a trigger event.
- the trigger event is an operation event for the user to adjust the volume on the first device.
- the user may perform volume adjustment operations through physical buttons, playback control cards, settings, and the like on the first device (eg, a mobile phone).
- the trigger event may be an event generated by a user operation acting on the mobile phone, for example, the user operation may be recorded as a "second operation".
- S2504 The first device sends a volume adjustment instruction to the second device in response to the trigger event.
- the volume adjustment instruction may include a second volume level of the first device, and the second volume level may be understood as a volume level corresponding to the volume currently adjusted by the user on the first device.
- the volume adjustment instruction may further include the audio stream type of the audio data transmitted by the first device to the second device, for example, the audio stream type is media stream or ringtone stream. It should be noted that, the audio stream type of the audio data may also be transmitted by the first device to the second device during the connection process between the first device and the second device.
- the first device can receive the volume adjustment information, and then the first device can send the volume level corresponding to the volume adjustment (for example, the second volume level) to the first device.
- Second equipment Exemplarily, for example, the volume level of the first device determined in S2502 is 15, which corresponds to the maximum volume level of the first device.
- the volume can only be decreased. That is, when the user adjusts the volume, for example, the volume level is 13, the volume level 13 can be sent to the second device, so that the second device can determine the volume level required for audio playback.
- the second device determines, according to the volume level mapping table, a third volume level corresponding to the second volume level sent by the first device.
- volume conversion table may also be recorded as a "volume level mapping table", which may be mixed in this application sometimes, and it should be understood that the meanings are the same.
- the second device after the second device receives the volume adjustment instruction sent by the first device, it can find the absolute volume conversion table corresponding to the audio stream type according to the audio stream type, and then convert the absolute volume according to the absolute volume saved in the second device. table to determine a third volume level corresponding to the second volume level included in the volume adjustment instruction.
- the second volume level is 13
- the volume level of the sink terminal can be obtained according to the mapping relationship in Table 2, for example, the third volume level can be 80.
- the above table is only a schematic description.
- the volume level of the source end is 13
- the volume level of the sink end may also be 85, etc., which is not limited in this application.
- the updated audio stream type can be sent to the second device. It should be understood that when the updated audio stream type is sent to the second device, it may be sent to the second device before the volume adjustment information occurs, which is not limited in this application.
- Scenario 1 The audio data on the phone is transmitted to the speaker.
- the volume adjustment methods may include: physical button adjustment, adjustment on the playback control card, and adjustment through settings (for example, volume adjustment can be performed through "Sound and Vibration" in the phone settings).
- the user interface 2700 may include the broadcast control card 2701 of the audio currently being played by the speaker connected to the mobile phone.
- the volume touch key 2702 may be included on the control card, and the user may adjust the volume through the volume touch key 2702 .
- the playback control card may also include the audio currently being played by the speaker, such as "Back to Summer" 2703, and buttons for switching audio, including a button 2704 for switching audio forward, a button 2705 for switching audio backward, and so on.
- the user can slide the volume touch key 2702 left and right on the mobile phone to adjust the volume.
- the mobile phone can transmit the volume level (eg A1) corresponding to the current volume touch key 2702 to the speaker.
- the speaker receives the volume level A1 sent by the mobile phone, it can determine the volume level B1 that matches the volume level A1 according to the absolute volume conversion table saved by itself, and then set the volume corresponding to the volume level B1 on the speaker to complete the matching. Speaker volume adjustment.
- the volume touch keys 2702 displayed on the mobile phone are touch keys corresponding to the volume level range of the mobile phone.
- the volume level of the mobile phone ranges from 0 to 15, and the volume level of the speaker ranges from 0 to 70.
- FIG. 27A suppose the current volume level of the volume touch button in FIG. 27A is 5, that is, the volume level of the speaker corresponding to the volume level on the mobile phone is 5. At this time, the volume level 5 is sent to the speaker.
- the speaker can determine that when the volume level on the mobile phone is 5, the volume level on the speaker is 35.
- Scenario 2 The audio data on the mobile phone is transmitted to the smart screen.
- the volume can be adjusted through the physical buttons or the playback control card.
- the smart screen can receive the volume adjustment information, and then determine the volume level according to the absolute volume conversion table, and record the volume in the smart screen.
- a volume bar is displayed on the display screen of the screen.
- the interface 2710 shown in FIG. 27B may include a volume bar 2711 in the interface 2710 .
- the user can see the current volume of the smart screen through the number displayed on the volume bar.
- the volume level currently displayed on the volume bar is 50.
- the second device plays the audio data according to the volume corresponding to the third volume level.
- the audio data projected by the first device can be played according to the absolute volume corresponding to the determined volume level.
- the absolute volume conversion table is a table for converting between the volume levels of two devices configured in advance based on the absolute volume baseline, it can keep the sound output volume of the sound projection device consistent between the two devices during volume adjustment, and realize the coordinated adjustment of the volume of multiple devices. .
- FIG. 28 it is a flowchart of another volume adjustment method provided by this embodiment of the present application. Taking the sink device as an example, the implementation process of the method shown in FIG. 28 is introduced. Specifically, the following steps may be included:
- the proxy service (Dvkit) of the source device notifies its own audio service (AudioService) to process the sink device according to the absolute volume, and sends the volume level of the sink device to the audio service (AudioService).
- the user triggers the volume adjustment information through the broadcast control card, settings or physical buttons on the source device.
- the AudioService receives the volume adjustment information, it can send the volume adjustment information to the distributed absolute volume module.
- the distributed absolute volume module notifies AudioFlinger of its own device not to do volume gain to its own device.
- the distributed absolute volume module reports the volume level corresponding to the volume adjustment information to the proxy service (Dvkit).
- the proxy service (Dvkit) of the source device feeds back the volume level to the proxy service of the sink device.
- the proxy service of the sink device can determine the corresponding volume level according to the absolute volume conversion table saved by itself, then set the volume, and notify the player to play audio according to the set volume.
- the mobile phone is connected to the virtual reality VR glasses, so that the user can use the VR glasses to watch the video in the mobile phone.
- the mobile phone and the gamepad are connected, so that the user can use the gamepad to play mobile games.
- vibration scenes such as keystrokes, gunshots or drum beats, which can be simulated by vibration and sound playback to enhance the user's realistic experience.
- vibrations are generated by linear motors in electronic equipment.
- the controllability of the vibration of the linear motor allows electronic devices to simulate vibrations in different scenarios, such as gunshots, or vibrations generated by keystrokes.
- the present application also provides a sound and vibration synchronous playback method, in which the master device parses the sound and vibration file, and sends the audio data and the vibration data to the corresponding slave device, so that the slave device does not need to parse the sound and vibration file, and can receive
- the sound and vibration are played according to the synchronous playback mode corresponding to the capability of the own audio device, so as to realize the synchronous playback of sound and vibration.
- the audio device capability is used to indicate whether the audio device supports the distribution of audio data and vibration data.
- the audio device capability can be specifically understood as whether the power amplifier (such as a smart PA) in the electronic device supports the distribution of vibration data to the motor, or whether the audio hardware abstraction layer (such as Audio HAL) supports the distribution of vibration data to the motor. Vibrators (i.e. vibrate playback devices such as motors).
- the power amplifier supports the distribution of audio data and vibration data, which can be understood as: the power amplifier supports the distribution of audio data to audio playback devices (such as speakers), and the distribution of vibration data to Vibrators (such as motors).
- the vibration data is used to characterize the vibration, which is obtained after processing the vibration file.
- the vibration file includes vibration data.
- the vibration file and the audio file may be different files, that is, the vibration file includes vibration data, the audio file includes audio data, and the audio file does not include vibration data.
- the audio file may include audio data and vibration data, ie adding the vibration data to the audio file.
- audio data and vibration data can be obtained by processing the audio file by the electronic device.
- vibration data can be carried by adding a channel to an audio file.
- the channel for carrying vibration data may be referred to as a vibration channel, and the channel for carrying audio data is referred to as an audio channel.
- an audio file includes audio data and vibration data, where the audio data is carried on the audio channel and the vibration data is carried on the vibration channel.
- one audio file may include audio data carried by one or more audio channels.
- FIG. 29 is merely an exemplary illustration of an audio file and does not constitute an illustration of an audio file including vibration data.
- an audio file that does not include vibration data and only includes audio data is referred to as an audio file
- an audio file that includes both vibration data and audio data is referred to as a tone-vibration file.
- the embodiments of the present application use the layered architecture of the Hongmeng operating system as an example to illustrate the software system of the electronic device.
- the application layer includes applications such as camera, gallery, map, game application, music, and so on.
- the application can be used to obtain a file, such as a sound and vibration file (such as a haptic ogg file), a vibration file (haptic file), or an audio file (ogg file), and the like.
- a sound and vibration file such as a haptic ogg file
- haptic file haptic file
- ogg file an audio file
- the framework layer may include a media player (MediaPlayer), an audio player (AudioTrack), a mixer (AudioMixer), a media extractor (media extractor), a vibration service (vibrate service), and the like.
- MediaPlayer media player
- AudioTrack audio player
- mixer AudioMixer
- media extractor media extractor
- vibration service vibration service
- MediaPlayer can be used to play audio and video.
- the media extractor is used to decode and decompress audio files.
- AudioTrack can be used to play audio in a specific format, such as audio files that support wav format.
- AudioMixer can mix together audio data from different AudioTracks.
- the vibrate service is used to provide an interface to control vibration.
- the framework layer further includes an audio effect modifier (AudioEffect, which may also be referred to as an audio effect processor). AudioEffect is used to add corresponding sound effects, such as pop, classical, jazz, vocal, etc. Of course, the framework layer may not include AudioEffect.
- AudioEffect is used to add corresponding sound effects, such as pop, classical, jazz, vocal, etc.
- the framework layer may not include AudioEffect.
- the hardware abstraction layer includes an audio hardware abstraction layer (Audio HAL), a vibration hardware abstraction layer (vibrator HAL), a Wi-Fi module or other communication modules, etc.
- Audio HAL is used to call a power amplifier (such as a smart PA) to adjust the power amplifier, and output it to an audio playback device (such as a speaker) to play sound.
- vibrator HAL is used to call motors or vibration sensors to generate vibration.
- the following takes the software system shown in FIG. 30 as an example.
- the method for realizing the synchronous playback of sound and vibration is introduced.
- the power amplifier supports audio data and vibration data distribution, that is, the power amplifier supports the distribution of audio data to audio playback devices (such as speakers) and the distribution of vibration data to vibrators (such as motors), in this case, for an electronic device, a sound and vibration file can be obtained by adding vibration data to an audio file, so as to realize the synchronous playback of sound and vibration.
- the embodiment of the present application can implement sound-vibration synchronization based on the following manner, as shown in FIG. 31A .
- An application program in the application layer responds to a certain trigger event (such as a user operation, or other trigger events, etc.), and sends the sound and vibration file to the MediaPlayer.
- MediaPlayer sends the tone and vibration file to media extractor.
- the audio and vibration files are parsed (such as decoding, decompressing, etc.) by the media extractor.
- the media extractor will send the data obtained by parsing the audio and vibration files (ie vibration data and audio data) to AudioTrack.
- AudioTrack outputs the data obtained by parsing the audio file to AudioMixer.
- AudioMixer identifies whether vibration data is included in the data from AudioTrack. If vibration data is included, the audio device capabilities are obtained from the vibrate service. In the case where the audio device capability is used to indicate that the power amplifier supports the distribution of audio data and vibration data, AudioMixer outputs the audio data and vibration data as output data to the Audio HAL.
- the Audio HAL outputs the vibration data and audio data to the power amplifier, and then the power amplifier distributes the vibration data to the vibrator for playback, and distributes the audio data to the audio player (such as a speaker) for playback.
- AudioMixer returns audio data and vibration data to AudioTrack
- AudioTrack outputs audio data and vibration data as output data to Audio HAL.
- AudioMixer returns vibration data to AudioTrack and sends audio data to AudioEffect. Audio data is processed by AudioEffect to obtain audio data after adding corresponding sound effects. Then, AudioEffect returns the audio data after adding the corresponding sound effect to AudioTrack.
- AudioTrack receives the audio data after adding the corresponding sound effect, and sends the audio data after adding the corresponding sound effect and the vibration data from AudioMixer as output data to Audio HAL.
- AudioMixer sends vibration data and audio data to AudioEffect. Audio data is processed by AudioEffect to obtain audio data after adding corresponding sound effects. AudioEffect does not process vibration data. Then, AudiEffect sends the vibration data and the audio data after adding the corresponding sound effects to Audio HAL. Since the vibration data and audio data are output to the Audio HAL at the same time, the synchronous playback of the sound and vibration is realized.
- the synchronous playback of sound and vibration can be achieved by calculating the transmission delay difference between the Audio HAL and the vibrator HAL.
- the transmission delay of Audio HAL refers to the time that audio data is transmitted from Audio HAL to audio playback device (such as speakers)
- the transmission delay of vibrator HAL refers to the transmission of vibration data from vibrator HAL to vibrator (such as motor) delay.
- the embodiment of the present application may implement sound-vibration synchronization based on the following manner, as shown in FIG. 31B .
- An application in the application layer responds to a trigger event (such as a user operation, or other trigger events, etc.), and sends the audio file to the MediaPlayer.
- MediaPlayer sends audio files to media extractor.
- the media extractor parses the audio file (such as decoding, decompressing, etc.).
- the media exactor will send the data obtained by parsing the audio file to AudioTrack.
- AudioTrack outputs the data obtained by parsing the audio file to AudioMixer. After AudioMixer performs mixing processing, the corresponding audio data is obtained, and the audio data is output to Audio HAL.
- the Audio HAL outputs the audio data to the power amplifier, and the power amplifier distributes the power-amplified audio data to the audio playback device for sound playback.
- AudioMixer can also send audio data to AudioEffect, and AudioEffect processes the audio data to obtain the audio data after adding the corresponding sound effect, and then AudioEffect outputs the audio data after adding the corresponding sound effect to Audio HAL.
- an application in the application layer sends a vibration file to the vibrator service in response to a trigger event (such as a user operation, or other trigger events, etc.).
- the vibrator service parses the vibration file to obtain the vibration data, and calculates the transmission delay difference between the Audio HAL and the vibrator HAL according to the transmission delay of the Audio HAL and the transmission delay of the vibrator HAL. Then, the vibrator service outputs the vibration data to the vibrator HAL based on the transmission delay difference between the Audio HAL and the vibrator HAL.
- the vibrator HAL distributes the vibration data to the vibrator (such as a motor) to vibrate accordingly. Since the vibrator service is based on the transmission delay difference between the audio HAL and the vibrator HAL, it outputs the vibration data to the vibrator HAL, instead of distributing the vibration data to the vibrator after receiving the vibration data, so that the audio playback device and the vibrator get the data time. Roughly the same, so as to achieve synchronous playback of sound and vibration.
- the software system of the master device includes an application layer 3201A, a framework layer 3202A, and a HAL 3203A.
- the application layer 3201A includes application 1 .
- the framework layer 3202A includes MediaPlayer 32021A, media extractor 32022A, AudioTrack 32023A, AudioMixer 32024A, and AudioEffect 32025A.
- HAL 3203A includes DV Audio HAL 32031A, communication module 32032A.
- the software system of the slave device includes the application layer 3201B, the framework layer 3220B and the HAL 3203B.
- the application layer 3201B includes a proxy application.
- the framework layer 3202B includes AudioTrack 32023B, AudioMixer 32024B, AudioEffect 32025B, and vibrate service 32026B.
- HAL 3203B includes Audio HAL 32031B, communication module 32032B and vibrator HAL 32033B.
- DV Audio HAL 32031A can be understood as a virtual Audio HAL, which is used to send vibration data and audio data to the slave device, which is a new module.
- a proxy app for receiving vibration data and audio data from the master device is also a new module.
- the software system may include DV Audio HAL, or may not include it, which is optional.
- the software system may or may not include an agent application, which is optional.
- AudioEffect 32025A is optional for master device; AudioEffect 32025B is optional for slave device.
- Application 1 receives a specific trigger event.
- a specific trigger event is used to trigger the playback of a tone file.
- the specific trigger event may include: the user's operation of playing video or audio, or receiving a sound and vibration file during the process of video playing or game running.
- Application 1 sends a haptic ogg file to MediaPlayer 32021A.
- the haptic ogg file is sent by MediaPlayer 32021A to media extractor 32022A.
- the media extractor 32022A parses the haptic ogg file (such as decoding, decompressing, etc.).
- media extractor 32022A will send the data obtained by parsing the haptic ogg file to AudioTrack 32023A.
- AudioTrack 32023A sends the data obtained by parsing the haptic ogg file to AudioMixer 32024A.
- the data obtained by the media extractor 32022A parsed by the haptic ogg file includes vibration data and audio data.
- AudioMixer 32024 identifies the actual playback device for vibration data and audio data. When the actual playback device of vibration data and audio data is a slave device, AudioMixer 32024 sends vibration data and audio data to DV Audio HAL 32031A as output data (output data).
- the vibration data and audio data are sent to the communication module 32032A by the DV Audio HAL 32031A. Then, the communication module 32032A sends the vibration data and audio data to the communication module 32032B. The vibration data and audio data are sent to the agent application by the communication module 32032B. After receiving the vibration data and audio data from the communication module 32032B, the proxy application outputs the vibration data and audio data to AudioTrack 32023B. The vibration data and audio data are output by AudioTrack 32023B to AudioMixer 32024B. AudioMixer 32024B recognizes that data from AudioTrack 32023B includes vibration data, and obtains audio device capabilities from vibrate service 32026B.
- AudioMixer 32024B sends the vibration data and audio data as output data to Audio HAL 32031B in the case where the audio device capability is used to indicate that the power amplifier supports the distribution of audio data and vibration data.
- the Audio HAL 32031B outputs the vibration data and audio data to the power amplifier, and then the power amplifier distributes the vibration data to the vibrator for playback, and distributes the audio data to the audio player (such as a speaker) for playback, thereby realizing sound and vibration synchronization.
- the AudioMixer 32024B sends the audio data to the audio HAL 32031B, and the AudioMixer 32024B sends the audio data After sending it to Audio HAL 32031B, after the first time period, send the vibration data to vibrator HAL 32033B.
- the first duration includes the transmission delay difference between the Audio HAL 32031B and the vibrator HAL 32033B.
- the Audio HAL 32031B outputs the audio data to the power amplifier, and the power amplifier distributes the power-amplified audio data to the audio playback device for sound playback. Vibrator HAL32033B distributes vibration data to vibrators (such as motors) for corresponding vibration.
- the audio HAL and vibrator HAL obtain data at roughly the same time, thereby realizing the synchronous playback of sound and vibration.
- the transmission delay of Audio HAL 32031B is N1, that is, the time required for audio data to be transmitted from Audio HAL 32031B to the audio playback device is N1, and the transmission delay of vibrator HAL 32033B is N2, that is, the vibration data is transmitted from vibrator HAL 32033B to The time required by the audio playback device is N2. If N1 is greater than N2, the AudioMixer 32024B will output the audio data after passing through N1-N2, and then output the vibration data, so that the time when the audio data reaches the audio player and the time when the vibration data reaches the vibrator. The time is roughly the same, so that the sound and vibration can be played simultaneously.
- AudioMixer 32024A can also send the audio data to AudioEffect 32025A before sending the audio data to Audio HAL 32031A, and AudioEffect 32025A processes the audio data, and obtains after adding corresponding sound effects. , and then output the audio data after adding the corresponding sound effects to the DV Audio HAL 32031A.
- the AudioMixer 32024A can also send the vibration data to the AudioEffect 32025A.
- AudioEffect 32025A does not process the vibration data, and after processing the audio data, the vibration data and the audio data after adding the corresponding sound effects are sent to the DV Audio HAL32031A as output data.
- AudioMixer 32024A returns the vibration data to AudioTrack 32023A
- AudioEffect 32025A also returns the audio data after adding corresponding sound effects to AudioTrack 32023A.
- the AudioTrack 32023A receives the vibration data and the audio data after adding the corresponding sound effect, it sends the vibration data and the audio data after adding the corresponding sound effect as output data to the DV Audio HAL 32031A.
- the DV Audio HAL 32031A sends the vibration data and the audio data after adding the corresponding sound effects as output data to the communication module 32032A.
- AudioMixer 32024B can also send audio data to AudioEffect 32025B before sending audio data to Audio HAL 32031B.
- the audio data is processed by the AudioEffect 32025B to obtain the audio data after adding the corresponding sound effects. Then AudioEffect 32025B outputs the audio data after adding corresponding sound effects to Audio HAL 32032B.
- the present application provides a method for synchronously playing sound and vibration, which is applied to multi-device connection.
- the audio device capability is used to indicate whether the audio hardware abstraction layer supports the distribution of vibration data and audio data. 33, including the following steps.
- the first electronic device receives a specific trigger event.
- a specific trigger event is used to trigger the playback of the tone file.
- the first electronic device parses the sound and vibration file to obtain vibration data and audio data.
- the first electronic device identifies that the actual playback device of the vibration data and the audio data includes the second electronic device.
- the first electronic device may determine the actual playback device of the vibration data and the audio data in combination with information such as the device capability identified by the device identifier in the device association list.
- the device association list includes at least one device identifier, and each device identifier is used to identify an electronic device connected to or associated with the first electronic device, that is, a slave device connected to the first electronic device.
- the first electronic device sends vibration data and audio data to the second electronic device.
- the second electronic device receives the vibration data and the audio data from the first electronic device, if the audio device capability indicates that the audio hardware abstraction layer in the second electronic device supports the distribution of the audio data and the vibration data, according to the first synchronous playback mode , play based on audio data and vibration data. Wherein, when playing based on the first synchronous playing mode, both the audio data and the vibration data are distributed to the corresponding playing device in the second electronic device by the audio hardware abstraction layer.
- both the audio data and the vibration data are distributed by the audio hardware abstraction layer to the corresponding playback device in the second electronic device, which can be implemented in the following manner:
- Mode 1 Both audio data and vibration data are distributed by the audio hardware abstraction layer to the power amplifier in the second electronic device, and then the power amplifier distributes the audio data and vibration data to the corresponding playback device in the second electronic device.
- Mode 2 The audio data is distributed by the audio hardware abstraction layer to the power amplifier in the second electronic device, and then the power amplifier distributes the audio data to the audio playback device (eg, speaker).
- the vibration data is distributed by the audio hardware abstraction layer to a vibrator (ie, a vibration playback device, such as a motor) in the second electronic device.
- the second electronic device receives the vibration data and the audio data of the first electronic device, and if the audio device capability indicates that the audio hardware abstraction layer in the second electronic device does not support distribution of the vibration data, according to the second electronic device Synchronous playback, based on audio data and vibration data.
- the audio data is distributed to the audio playback device in the second electronic device by the audio hardware abstraction layer in the second electronic device, and the vibration data is generated by the vibration in the second electronic device.
- the hardware abstraction layer is distributed to the vibrator in the second electronic device.
- the difference between the time when the vibration hardware abstraction layer distributes the vibration data and the time when the audio hardware abstraction layer distributes the audio data is the difference between the first transmission delay and the second transmission delay, and the first transmission delay is the arrival of the audio data from the audio hardware abstraction layer.
- the duration of the audio playback device, and the second transmission delay is the duration of the vibration data reaching the vibrator from the vibration hardware abstraction layer. So as to realize the synchronous playback of sound and vibration.
- the actual playback device for identifying the vibration data and the audio data by the first electronic device may further include the first electronic device.
- the first electronic device and the second electronic device can play sound and vibration at the same time.
- the method shown in FIG. 31A or FIG. 31B may be referred to for the method for realizing the synchronous playback of sound and vibration by the first electronic device, and details are not described herein again.
- the actual playback device for the first electronic device to identify the vibration data and the audio data may also include other slave devices, such as a third electronic device, so that multiple slave devices can realize synchronous playback of sound and vibration.
- the master device since the parsing of the audio file is performed by the master device, the master device can directly send the audio data and vibration data to the slave device, so the slave device may not have an audio file (for example, including vibration data)
- the slave device may not have an audio file (for example, including vibration data)
- the parsing ability of the audio file of the data after connecting with the main device, it can also realize the synchronous playback of sound and vibration across the devices. Therefore, the sound-vibration synchronous playback method provided by the embodiment of the present application does not limit the audio file parsing capability of the slave device.
- the method for synchronously playing sound and vibration shown in FIG. 33 can be applied to a distributed audio scene.
- the audio and video vibration synchronization can be realized on the slave device, which can enhance the user's visual, auditory and tactile feelings, thus providing users with an immersive experience.
- extending the parsing capability of the audio and vibration files (that is, audio files including vibration data) on the main device to diversified scenarios such as video calls, small videos, and online teaching can bring users a better interactive experience.
- the methods provided by the embodiments of the present application are introduced from the perspective of an electronic device as an execution subject.
- the electronic device may include a hardware structure and/or software modules, and implement the above functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. Whether one of the above functions is performed in the form of a hardware structure, a software module, or a hardware structure plus a software module depends on the specific application and design constraints of the technical solution.
- the embodiments of the present application further provide an apparatus, as shown in FIG. 34 , including one or more processors 3401 and one or more memories 3402 .
- One or more computer programs are stored in the memory 3402, and when the one or more computer programs are executed by the processor 3401, make the apparatus execute the video recording method provided by the embodiment of the present application.
- the apparatus may further include a camera 3403 , a speaker 3404 , and a microphone 3405 .
- the apparatus may further include a display screen 3406 for displaying a graphical user interface, such as an interface of a media application.
- connection medium between the processor 3401 , the memory 3402 , the camera 3403 , the speaker 3404 , the microphone 3405 , and the display screen 3406 is not limited in the embodiments of the present application.
- the processor 3401, the memory 3402, the camera 3403, the speaker 3404, the microphone 3405, and the display screen 3406 may be connected through a bus, and the bus may be divided into an address bus, a data bus, and a control bus.
- the apparatus may be an electronic device with an audio function.
- the device 3500 includes: a display screen 3501; one or more processors 3502; one or more memories 3503; one or more sensors 3504 (not shown in the figure), a plurality of applications 3505 ( Not shown); and one or more computer programs 3506 (not shown), each of which may be connected by one or more communication buses 3507.
- the display screen 3501 is used to display the display interface of the application in the electronic device, or to display prompt information.
- One or more computer programs are stored in the memory 3503, and the one or more computer programs include instructions; the processor 3502 calls the instructions stored in the memory 3503, so that the device 3500 can use the audio recording method, audio playback method of the above-mentioned embodiment. method and volume adjustment method.
- the embodiments of the present application further provide an apparatus, as shown in FIG. 36 , including one or more processors 3601 and one or more memories 3602 .
- One or more computer programs are stored in the memory 3602, and when the one or more computer programs are executed by the processor 3601, the device can execute the sound effect processing method provided by the embodiment of the present application.
- the apparatus may further include a transceiver 3603 for communicating with other devices through a transmission medium, so that the apparatus may communicate with other devices.
- the transceiver 3603 may be a communication interface, a circuit, a bus, a module, etc., and the other device may be a terminal or a server, or the like.
- the transceiver 3603 may be used to transmit audio data and the like.
- the apparatus may further include a display screen 3604 for displaying a graphical user interface, such as an interface of a media application.
- the embodiments of the present application further provide an apparatus, as shown in FIG. 37 , including one or more processors 3701 , one or more memories 3702 , a transceiver 3703 , a motor 3704 , and a speaker 3705 .
- One or more computer programs are stored in the memory 3702, and when the one or more computer programs are executed by the processor 3701, the device executes the sound-vibration synchronous playback method provided by the embodiment of the present application.
- the transceiver 3703 is used to communicate with other devices through a transmission medium, so that the apparatus can communicate with other devices.
- the transceiver 3703 may be a communication interface, a circuit, a bus, a module, or the like, and the other device may be a terminal, a server, or the like.
- the transceiver 3703 may be used to transmit audio data, vibration data, and the like.
- connection medium between the above-mentioned processor, memory, transceiver, and display screen is not limited in the embodiments of the present application.
- the processor, the memory, the transceiver, and the display screen may be connected through a bus, and the bus may be divided into an address bus, a data bus, a control bus, and the like.
- the above-mentioned device provided in the embodiment of the present application may further include a display, a touch sensor, etc., which is not limited thereto.
- the above-mentioned apparatus may be an electronic device, or the apparatus may include a chip system, a chip, or an integrated circuit, or the like.
- the display screen includes a display panel.
- the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
- LCD liquid crystal display
- OLED organic light-emitting diode
- active-matrix organic light-emitting diode active-matrix organic light.
- emitting diode AMOLED
- flexible light-emitting diode flex light-emitting diode, FLED
- Miniled MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
- the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, which can implement or
- a general purpose processor may be a microprocessor or any conventional processor or the like.
- the steps of the methods disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
- the memory may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), etc., or may also be a volatile memory (volatile memory), for example Random-access memory (RAM).
- Memory is, but is not limited to, any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
- the memory in this embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and/or data.
- the terms “when” or “after” can be interpreted to mean “if” or “after” or “in response to determining" or “in response to detecting ...”.
- the phrases “in determining" or “if detecting (the stated condition or event)” can be interpreted to mean “if determining" or “in response to determining" or “on detecting (the stated condition or event)” or “in response to the detection of (the stated condition or event)”.
- the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
- software it can be implemented in whole or in part in the form of a computer program product.
- the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated.
- the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
- the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center is by wire (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.).
- the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
- the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), and the like.
- magnetic media eg, floppy disks, hard disks, magnetic tapes
- optical media eg, DVD
- semiconductor media eg, Solid State Disk (SSD)
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Computer Networks & Wireless Communication (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Circuit For Audible Band Transducer (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
一种视频录制方法及电子设备,涉及终端技术领域。该方法包括:电子设备通过第一应用播放第一媒体文件对应的音频,显示第二应用的视频录制界面;响应于对背景音乐设置选项的操作,电子设备设置背景音乐为第二音频文件对应的音频;响应于对虚拟按键的第一操作,电子设备开始录制视频,并对第二音频文件进行处理,得到第二音频文件的音频数据;响应于对虚拟按键的第二操作,电子设备结束视频录制,生成视频文件,视频文件包括第二音频文件的音频数据和摄像头采集的图像的图像数据,不包括第一媒体文件的音频数据。这种技术方案使得用户可以根据需要在视频录制的过程中增加相应的背景音乐,不但便于用户使用,而且还有助于避免引起版权纠纷。
Description
相关申请的交叉引用
本申请要求在2020年12月25日提交中国专利局、申请号为202011565521.3、申请名称为“一种音效处理方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2020年12月28日提交中国专利局、申请号为202011581873.8、申请名称为“一种音频播放方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2020年12月30日提交中国专利局、申请号为202011601905.6、申请名称为“一种视频录制方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2020年12月30日提交中国专利局、申请号为202011604343.0、申请名称为“一种音振同步播放方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2020年12月31日提交中国专利局、申请号为202011626278.1、申请名称为“一种音量调整方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2020年12月31日提交中国专利局、申请号为202011628665.9、申请名称为“一种音频录制方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中;本申请要求在2021年04月16日提交中国专利局、申请号为202110411509.5、申请名称为“一种视频录制方法及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及音频技术领域,尤其涉及一种视频录制方法及电子设备。
视频作为一种更直观和形象的信息载体,在人们的日常生活中得到越来越广泛的应用。通常,可以通过在视频中增加背景音乐,来渲染氛围。然而,现有技术中,用户需要先使用电子设备录制视频,并将录制的视频以视频文件(例如MP4文件、3gp文件)的形式存储到电子设备中。然后,用户再使用电子设备对存储的视频文件进行后期处理,从而将背景音乐添加到视频中。因此,这种在视频中增加背景音乐的方式较为复杂。
发明内容
本申请实施例提供了一种视频录制方法及电子设备,使得电子设备可以通过某一应用程序录制视频的过程中,自动添加该应用程序的背景音乐,得到包含背景音乐的视频文件,从而便于用户使用,提高用户体验。
第一方面,为本申请实施例的一种视频录制方法,具体包括:电子设备通过第一应用播放第一媒体文件对应的音频;电子设备显示第二应用的视频录制界面;所述视频录制界面包括图像预览框、背景音乐设置选项和虚拟按键,所述虚拟按键用于控制启动或停止视频录制,所述图像预览框用于预览摄像头采集的图像;响应于对所述背景音乐设置选项的操作,所述电子设备设置背景音乐为第二音频文件对应的音频;
响应于对所述虚拟按键的第一操作,所述电子设备开始录制视频,并对所述第二音频文件进行处理,得到所述第二音频文件的音频数据;
响应于对所述虚拟按键的第二操作,所述电子设备结束视频录制,生成视频文件,所述视频文件包括所述第二音频文件的音频数据和所述摄像头采集的图像的图像数据,不包括所述第一媒体文件的音频数据。
本申请实施例中,由于电子设备在通过第一应用播放第一音频文件对应的音频的情况下,可以通过第二应用录制视频时,结合用户在第二应用中设置的背景音乐对应的音频文件的音频数据,得到包括用户在第二应用中设置的背景音乐对应的音频文件的音频数据的视频文件,且视频文件中不包括第一音频文件的音频数据,从而使得用户可以根据需要在视频录制的过程中增加相应的背景音乐,不但便于用户使用,而且还有助于避免引起版权纠纷。
在一种可能的设计中,所述第一媒体文件与所述第一应用程序的标识对应,所述第二音频文件与所述第二应用程序的标识对应,在这种情况下,响应于对所述虚拟按键的第一操作,所述电子设备根据所述第二应用程序的标识,获取所述第二音频文件的音频数据,并根据所述第二音频文件的音频数据和所述摄像头采集的图像的图像数据进行合成处理。
在一种可能的设计中,响应于对所述虚拟按键的第一操作,所述电子设备使用麦克风采集声音;
所述电子设备根据所述第二音频文件的音频数据、所述摄像头采集的图像的图像数据和所述麦克风采集的声音的音频数据,进行合成处理。从而使得录制的视频文件中包括用户或周围环境中的声音的音频数据。
在一种可能的设计中,所述拍摄静音功能处于开启状态时,所述电子设备不使用麦克风采集声音。
在一种可能的设计中,所述电子设备对所述第二音频文件进行解析,并对解析第二音频文件得到的音频数据进行音效处理,得到第二音频文件的音频数据。从而使得录制得到视频文件中包括的第二音频文件的音频数据是经过音效处理后的,有助于提高用户的视听体验。
在一种可能的设计中,所述电子设备根据所述第二音频文件的音频数据进行播放。
第二方面,本申请提供一种音频录制方法,该方法应用于电子设备,可包括:电子设备显示一个直播应用的第一交互界面,所述第一交互界面包括录制设置选项;所述电子设备检测到作用于所述录制设置选项上的一个操作;所述电子设备响应于所述操作,显示第二交互界面,所述第二交互界面包括多个音频流选项;所述电子设备检测到触发事件,所述触发事件为确定选择录制第一类型标记的音频流和第二类型标记的音频流产生的事件;所述电子设备响应于所述触发事件,分别对所述第一类型标记的音频流和所述第二类型标记的音频流进行录制,得到第一音频录制数据和第二音频录制数据。
通过上述技术方案,用户可以根据自身的需求或者喜好等在直播应用的界面上选择想要录制的类型标记的音频流,从而提升用户体验。并且电子设备可以分别对多种类型标记的音频流进行录制,进而得到多个音频录制文件,这样可方便用户对不同的音频流进行处理,提升用户体验。
在一种可能的设计中,所述电子设备分别对所述第一类型标记的音频流和所述第二类型标记的音频流进行录制,包括:所述电子设备对第一音频流进行类型标记,得到至少两 种类型标记,所述第一音频流包括所述直播应用直播的内容对应的应用所播放的音频流和音乐应用所播放的音频流;所述电子设备检测第一音频流所包括的至少两种类型标记,并在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记;所述电子设备对所述第一类型标记和所述第二类型标记分别对应的音频流进行录制。
通过上述技术方案,电子设备可对第一音频流进行类型标记,然后在多个类型标记中筛选用户所选择的类型标记,进而对用户所选择的类型标记的音频流进行录制。通过类型标记的方法可以对同一类型的音频流进行更为细致的划分,使得用户可选择的类型更多,能够提升用户体验。
应理解,第一音频流可以理解为当前播放的音频流,至少可以包括直播应用所直播的内容对应的应用播放的音频流。比如直播应用直播游戏,则第一音频流可以包括游戏应用(比如,王者荣耀)播放的音频流。当然,如果主播打开音乐应用同时在播放音乐时,第一音频流还可以包括音乐应用播放的音频流。
在一种可能的设计中,所述电子设备对第一音频流进行类型标记,包括:所述电子设备根据第一音频流的音频参数对所述第一音频流进行类型标记,所述音频参数至少包括如下信息:音频流的类型、音频流的长度。
通过上述技术方案,电子设备可以根据不同音频流的特点、用途等对音频流进行类型标记,使得音频流的类型划分的更为细致。示例性的,对于游戏的音频流可以标记为:游戏语音通话音频流(或者称为游戏小队语音音频流)、背景音音频流、技能释放音频流等。
需要说明的是,在音频流类型相同时,不同的音频流的长度可以为不同的类型标记;在音频流的长度相同时,不同的音频流类型可以为不同的类型标记,本申请对此不作限定。
在一种可能的设计中,所述电子设备在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记之后,所述方法还包括:所述电子设备对所述第一音频流进行混音处理,得到混音音频,并播放所述混音音频。
需要说明的是,在本申请中电子设备的音频服务(AudioService)在获取到第一音频流的至少两种类型标记之后,可对音频流分为两路传输,一路用于对第一类型标记和第二类型标记的音频流进行录制,另一路音频流发送给电子设备的混音线程(MixerThread)进行混音。
通过上述技术方案,电子设备可以在筛选出需要的音频流类型标记之后,再对音频流进行混音处理,也就是说,在混音处理之前,电子设备可以对用户选择的音频流类型标记进行录制,这样录制到的音频数据即为独立的音频数据,而不是混音的音频数据。
第三方面,本申请还提供一种音频录制方法,该方法包括:电子设备显示一个直播应用的第一交互界面,所述第一交互界面包括录制设置选项;所述电子设备检测到作用于所述录制设置选项上的至少一个操作;所述电子设备响应于所述至少一个操作,按照设定的音频类型标记对音频流进行录制,所述设定的音频类型标记包括第一类型标记和第二类型标记。
通过上述技术方案,电子设备可以按照设定的音频类型标记对音频流自动进行录制。其中,设定的音频类型标记可以为用户上一次设置的音频类型标记,或者也可以为直播应用配置的音频类型标记等。
示例性的,比如用户可以双击第一交互界面上的录制设置选项,然后电子设备可按照直播应用配置的音频类型标记对相应的音频流自动进行录制。或者用户可以先单击第一交 互界面上的录制设置选项,然后显示第二交互界面,此时用户再点击确认选项,电子设备可按照用户上次设置的音频类型标记对相应的音频流进行录制。
在一种可能的设计中,所述电子设备按照设定的音频类型标记对音频流进行录制,包括:所述电子设备对第一音频流进行类型标记,得到至少两种类型标记,所述第一音频流包括所述直播应用主播的内容对应的应用所播放的音频流和音乐应用所播放的音频流;所述电子设备检测第一音频流所包括的至少两种类型标记,并在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记;所述电子设备对所述第一类型标记和所述第二类型标记分别对应的音频流进行录制。
通过上述技术方案,电子设备可对第一音频流进行类型标记,然后在多个类型标记中筛选设定的类型标记,进而对设定类型标记的音频流进行录制。通过类型标记的方法可以对同一类型的音频流进行更为细致的划分,使得用户可选择的类型更多,能够提升用户体验。
第四方面,本申请还提供一种音频播放方法,该方法包括:电子设备通过第一应用播放第一音频;电子设备响应于用户对所述第一应用的第一操作,将所述第一应用切换到后台运行;电子设备响应于用户对第二应用的第二操作,将所述第二应用运行在前台,并通过所述第二应用播放第二音频;电子设备确定所述第一音频和所述第二音频的播放策略;电子设备根据所述播放策略对所述第一音频和所述第二音频进行播放。应理解:该电子设备安装有第一应用和第二应用;或者,该电子设备安装有第一应用和第二应用中的至少一个,另一个应用是通过网络访问的在线应用;或者,第一应用和第二应用都是在线应用,该电子设备通过网络访问这两个应用。
通过上述技术方案,当前后台运行的应用均为发声类应用时,可以针对前后台播放的音频给出相应的音频播放策略,使得电子设备能够按照音频播放策略来播放音频,避免多个发声类应用同时打开时出现声音嘈杂混乱的情况,提升用户体验。
在一种可能的实施方式中,电子设备确定所述第一音频和所述第二音频的播放策略,包括:电子设备对所述第一音频和所述第二音频进行分类,确定所述第一音频和所述第二音频分别对应的类别;电子设备根据所述第一音频和所述第二音频分别对应的类别,确定所述第一音频和所述第二音频的播放策略。
通过上述技术方案,可以对前后台应用播放的音频分别进行分类,进而根据分类后的类别确定音频的播放策略,这样能够根据具体的类别给出相应的播放策略,使得电子设备在同时播放多个音频时避免出现声音混乱的情况,能够提升用户的使用体验。
在一种可能的实施方式中,电子设备对所述第一音频和所述第二音频进行分类,包括:电子设备分别获取所述第一音频的音频属性和所述第二音频的音频属性;电子设备根据第一映射关系分别确定与所述第一音频的音频属性对应的类别和所述第二音频的音频属性对应的音频类别,所述第一映射关系为音频属性与音频类别之间的对应关系。
通过上述技术方案,可以根据音频的音频属性确定音频类别,从而能够对音频进行具体的分类,使得后续给出的播放策略更合适。
在一种可能的实施方式中,电子设备确定所述第一音频和所述第二音频的播放策略,包括:电子设备依据第二映射关系,确定所述第一音频和所述第二音频在相同或不同的类别下,相对应的音频播放策略,所述第二映射关系包括所述第一音频的类别和所述第二音频的类别与音频播放策略之间的对应关系。
通过上述技术方案,电子设备可以根据预先保存的映射关系(音频类别与播放策略之间的对应关系)对前后台应用播放的音频给出与音频类别相对应的播放策略,从而提升电子设备同时播放多个音频时的用户体验。
在一种可能的实施方式中,所述第一音频和所述第二音频的音频类别包括如下类别中的任意一种:语音通话、闹铃、语音导航、媒体音、游戏、电影、音乐、拨号音、来电响铃、操作/事件音、通知提示音、其它。
需要说明的是,本申请实施例中按照音频属性划分的类别更加具体,这样能够根据具体的场景给出合适的播放策略,从而提升用户体验。
在一种可能的实施方式中,所述第一音频和所述第二音频的播放策略包括如下策略中的任意一种:播放第一音频、播放第二音频、同时播放第一音频和第二音频。
需要说明的是,本申请实施例中电子设备给出的播放策略可以包括但不限于上述几种策略。
在一种可能的实施方式中,所述方法还包括:当所述第一音频为第一类别,所述第二音频为第二类别时,电子设备确定所述第一音频为第三类别,所述第三类别为所述第一类别的子集。
通过上述技术方案,如果音频的类别为特定类别(比如,音乐)时,可以针对该音频的类别进行更为具体的分类,使得分类之后的场景更为具体,进而使得播放策略更为合适,提升用户使用体验。
在一种可能的实施方式中,所述方法还包括:显示第一提示信息,所述第一提示信息用于提示用户是否要按照播放策略播放第一音频和第二音频。通过上述技术方案,可以使得用户根据自身的喜好或者需求等选择播放策略,从而提升用户体验。
第五方面,本申请还提供一种音效处理方法,应用于第一电子设备与第二电子设备连接,该方法包括:
第一电子设备显示媒体应用的界面,媒体应用的界面包括待播放的音频文件的标识、第一控件和第二控件,第一控件用于控制音频播放,第二控件用于控制待播放的音频文件在第二电子设备上的播放;
当第二控件被选中时,第一电子设备响应于对第一控件的操作,对待播放的音频文件进行解析,得到第一音频数据;
第一电子设备根据第一音效配置信息对第一音频数据进行音效处理,得到第二音频数据;以及根据第二音效配置信息对第一音频数据进行音效处理,得到第三音频数据;
然后,第一电子设备将第三音频数据发送给第二电子设备,并触发第二电子设备播放第三音频数据;
第一电子设备将第三音频数据发送给第二电子设备后经过第一时长,播放第二音频数据;第一时长为第三音频数据从第一电子设备到第二电子设备播放所需的时间;
其中,第一音频配置信息用于指示第一音效算法、第一音效模式、第一均衡器设置、第一增益设置和第一音效参数;第二音频配置信息用于指示第一音效算法、第一音效模式、第一均衡器设置、第一增益设置和第二音效参数,第一音效参数为第一电子设备在第一音效模式、第一均衡器设置和第一增益设置下第一音效算法所使用的音效参数,第二音效参数为第二电子设备在第一音效模式、第一均衡器设置和第一增益设置下第一音效算法所使用的音效参数。
本申请实施例中,由于第一电子设备可以根据第一音效配置信息对解析待播放的音频文件得到的第一音频数据进行音效处理,得到第二音频数据,根据第二音效配置信息对第一音频数据进行音效处理,得到第三音频数据,使得第一电子设备可以在将第三音频数据发送给第二电子设备后,经过第一时长再播放第二音频数据,从而有助于降低第一电子设备和第二电子设备针对待播放的音频文件同步播放时,第一电子设备针对待播放的音频文件的播放效果和第二电子设备针对待播放的音频文件的播放效果的差异,提高用户体验。
在一种可能的设计中,所述第一电子设备处于音效开启状态。由于当第一电子设备处于音效开启状态时,第一电子设备执行音效处理的过程,从而有助于简化实现方式。
在一种可能的设计中,当所述第二电子设备处于音效开启状态时,所述第一电子设备向所述第二电子设备发送音效关闭消息或指令。从而有助于避免第二电子设备对来自第一电子设备的第三音频数据进行重复音效处理。
在一种可能的设计中,当所述第一电子设备处于音效关闭状态时,所述第一电子设备将所述第一音频数据和音效关闭消息或指令发送给所述第二电子设备,以触发所述第二电子设备关闭音效,并播放所述第一音频数据;所述第一电子设备将所述第一音频数据发送给所述第二电子设备后,经过所述第一时长,播放所述第一音频数据,所述第一时长为所述第一音频数据从所述第一电子设备到所述第二电子设备播放所需的时间。不但有助于保持第一电子设备和第二电子设备的音频播放效果的一致,还有助于避免第二电子设备对来自第一电子设备的第一音频数据进行音效处理。
在一种可能的设计中,所述第一音效配置信息为所述第一电子设备当前使用的音效配置信息;或者,所述第二音效配置信息为所述第二电子设备当前使用的音效配置信息。
第六方面,本申请还提供一种音效处理方法,应用于第一电子设备与第二电子设备连接,具体包括:第一电子设备显示媒体应用的界面,该媒体应用的界面包括待播放的音频文件的标识、第一控件和第二控件,所述第一控件用于控制音频播放,所述第二控件用于控制所述待播放的音频文件在所述第二电子设备上的播放;
所述第二控件被选中时,所述第一电子设备响应于对所述第一控件的操作,对所述待播放的音频文件进行解析,得到第一音频数据;
所述第一电子设备根据第一音效配置信息对所述第一音频数据进行音效处理,得到第二音频数据;
所述第一电子设备根据第二音效配置信息对所述第一音频数据进行音效处理,得到第三音频数据;
所述第一电子设备将所述第三音频数据和播放时间信息发送给所述第二电子设备,并触发所述第二电子设备根据所述播放时间信息播放所述第三音频数据;
所述第一电子设备根据所述播放时间信息播放所述第二音频数据;
其中,所述播放时间信息用于指示开始播放的时间,所述第一音频配置信息用于指示第一音效算法、第一音效模式、第一均衡器设置、第一增益设置和第一音效参数;所述第二音频配置信息用于指示所述第一音效算法、所述第一音效模式、所述第一均衡器设置、所述第一增益设置和第二音效参数,所述第一音效参数为所述第一电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数,所述第二音效参数为所述第二电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数。
本申请实施例中,由于第一电子设备可以根据第一音效配置信息对解析待播放的音频文件得到的第一音频数据进行音效处理,得到第二音频数据,根据第二音效配置信息对第一音频数据进行音效处理,得到第三音频数据,且第一电子设备根据播放时间信息,播放第二音频数据,第二电子设备根据同一播放时间信息,播放第三音频数据,从而有助于降低第一电子设备和第二电子设备针对待播放的音频文件同步播放时,第一电子设备针对待播放的音频文件的播放效果和第二电子设备针对待播放的音频文件的播放效果的差异,提高用户体验。
在一种可能的设计中,所述第一音效配置信息为所述第一电子设备当前使用的音效配置信息;或者,所述第二音效配置信息为所述第二电子设备当前使用的音效配置信息。
第七方面,本申请提供一种音量调整方法,该方法应用于第一设备,可包括:第一设备播放第一音频;所述第一设备响应用户的第一操作,将所述第一音频切换到第二设备播放;所述第一设备响应用户的第二操作,向所述第二设备发送音量调节信息,以使所述第二设备根据所述音量调节信息将音量调整为第二音量等级,所述音量调节信息包括第一音量等级,所述第一音量等级为所述第一音频在所述第一设备上对应的音量等级,所述第二音量等级为所述第一音频在所述第二设备上对应的音量等级。
通过上述技术方案,第一设备可以将音频切换到第二设备上,并且在第一设备上对音频进行音量调节时,可以向第二设备发送音量调节信息,以使第二设备能够根据音量调节信息进行音量调整。
在一种可能的设计中,所述第一设备响应用户的第二操作,向所述第二设备发送音量调节信息之前,所述方法还包括:所述第一设备获取所述第二设备的第三音量等级;所述第一设备确定与所述第三音量等级对应的第四音量等级;其中,所述第一音量等级为基于所述第四音量等级调整之后的音量等级,所述第二音量等级为基于所述第三音量等级调整之后的音量等级。
通过上述技术方案,第一设备在调节音量之前,可以根据第二设备的音量等级对第一设备上的音量等级进行初始音量转换,以便后续在此基础上进行音量调节。
在一种可能的设计中,所述方法还包括:所述第一设备确定对所述第二设备的音量按照绝对音量进行调节。通过上述技术方案,第一设备在对第二设备上播放的音频进行音量调整时,可以按照绝对音量进行处理。
第八方面,本申请还提供一种音量调整方法,该方法包括:第二设备接收第一设备发送的音量调节信息,所述音量调节信息包括第一音量等级,所述第一音量等级为第一音频在所述第一设备上对应的音量等级;所述第二设备根据音量等级映射关系确定与所述第一音量等级对应的第二音量等级,所述第二音量等级为所述第一音频在所述第二设备上对应的音量等级;所述音量等级映射关系为在同一音量下所述第一设备和所述第二设备的音量等级转换关系;所述第二设备按照所述第二音量等级进行音量调整。
通过上述技术方案,第二设备在接收到第一设备发送的音量调节信息之后,可以根据预先保存的音量等级映射关系确定与音量调节信息中包括的音量等级相对应的音量等级,从而使得第一设备和第二设备在调节音量时实现音量的协同调节,并且能够使得两个设备的音量一致。
在一种可能的设计中,第二设备接收第一设备发送的音量调节信息之前,所述方法还包括:所述第二设备向所述第一设备发送第三音量等级,所述第三音量等级为所述第二设 备在将音量调整为所述第二音量等级之前的音量等级。
通过上述技术方案,可以在调节音量之前向第一设备发送音量等级,以使第一设备对音量进行初始音量转换,以便后续在此基础上进行音量调节。
在一种可能的设计中,所述方法还包括:所述第二设备按照所述第二音量等级对应的绝对音量播放所述第一音频。
在一种可能的设计中,所述音量调节信息还包括第一音频的音频类型;所述方法还包括:所述第二设备根据所述第一音频的音频类型确定与所述第一音频的音频类型相对应的音量等级映射关系。
通过上述技术方案,不同的音频类型可对应一个音量等级映射关系,因此,第二设备在确定音量等级时可以先确定与音频类型对应的音量等级映射关系,进而确定与第一设备上的音量等级相对应的音量等级。
第九方面,本申请还提供一种音振同步播放方法,应用于第一电子设备与第二电子设备连接的场景,具体包括:第一电子设备接收到第一触发事件,第一触发事件用于触发播放音振文件,音振文件包括音频数据和振动数据;响应于第一触发事件,第一电子设备对音振文件进行解析,得到音频数据和振动数据;然后,第一电子设备向第二电子设备发送音频数据和振动数据。
本申请实施例中,由于第一电子设备接收到第一触发事件后,可以响应于第一触发事件,对音振文件进行解析,并将解析得到的音频数据和振动数据发送给第二电子设备,从而使得第二电子设备可以无需对音频文件解析,直接根据音频数据和振动数据进行播放,因此,第二电子设备可以不具备音振文件解析能力。
在一种可能的设计中,第一电子设备当自身的音频设备能力用于指示音频硬件抽象层支持音频数据和振动数据的分发时,根据第一同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第一同步播放方式进行播放时,所述音频数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的扬声器的,所述振动数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的马达的。从而便于实现声音和振动的同步播放。
在一种可能的设计中,所述第一电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据的分发时,根据第二同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第二同步播放方式进行播放时,所述音频数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的扬声器的,所述振动数据是由所述第一电子设备的振动硬件抽象层分发到所述第一电子设备的马达的,所述振动硬件抽象层分发所述振数据的时刻与所述音频硬件抽象层分发所述音频数据的时刻之差为第一传输时延与第二传输时延之差,所述第一传输时延为所述音频数据从音频硬件抽象层到达所述扬声器的时长,第二传输时延为所述振动数据从振动硬件抽象层到达所述马达的时长。
通过上述技术方案,有助于振动硬件抽象层分发振动数据的时刻与音频硬件抽象层分发音频数据的时刻之差为第一传输时延的第二传输时延之差,因此,在第一电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据分发时,根据第二同步播放方式可以实现声音和振动的同步播放。
在一种可能的设计中,可以基于下列方式实现所述第一电子设备与所述第二电子设备的连接:
所述第一电子设备与所述第二电子设备通过Wi-Fi、或蓝牙连接,或者,所述第一电子设备与所述第二电子设备通过应用程序绑定。
第十方面,本申请还提供一种音振同步播放方法,应用于第一电子设备与第二电子设备连接的场景,具体包括:
第二电子设备接收第一电子设备发送的音频数据和振动数据;第二电子设备当自身的音频设备能力用于指示音频硬件抽象层支持音频数据和振动数据的分发时,根据第一同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第一同步播放方式进行播放时,所述音频数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的扬声器的,所述振动数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的马达的。
本申请实施例中,由于第二电子设备接收到来自第一电子设备的音频数据和振动数据时,可以结合自身的音频设备能力,根据相应的同步播放方式,播放音频数据和振动数据,从而使得第二电子设备可以无需对音频文件解析,实现音频数据和振动数据的同步播放,因此,第二电子设备可以不具有音振文件的解析能力。
在一种可能的设计中,所述第二电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据的分发时,根据第二同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第二同步播放方式进行播放时,所述音频数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的扬声器的,所述振动数据是由所述第二电子设备的振动硬件抽象层分发到所述第二电子设备的马达的,所述振动硬件抽象层分发所述振数据的时刻与所述音频硬件抽象层分发所述音频数据的时刻之差为第一传输时延与第二传输时延之差,所述第一传输时延为所述音频数据从音频硬件抽象层到达所述扬声器的时长,第二传输时延为所述振动数据从振动硬件抽象层到达所述马达的时长。
通过上述技术方案,有助于振动硬件抽象层分发振动数据的时刻与音频硬件抽象层分发音频数据的时刻之差为第一传输时延的第二传输时延之差,因此,在第一电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据分发时,根据第二同步播放方式可以实现声音和振动的同步播放。
在一种可能的设计中,可以基于下列方式实现所述第一电子设备与所述第二电子设备的连接:
所述第一电子设备与所述第二电子设备通过Wi-Fi、或蓝牙连接,或者,所述第一电子设备与所述第二电子设备通过应用程序绑定。
第十一方面,提供一种电子设备,所述电子设备包括执行上述第一方面或者第一方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十二方面,提供一种电子设备,所述电子设备包括执行上述第二方面、第三方面或者第二方面、第三方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十三方面,提供一种电子设备,所述电子设备包括执行上述第四方面或者第四方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十四方面,提供一种电子设备,所述电子设备包括执行上述第五方面、第六方面或 者第五方面、第六方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十五方面,提供一种电子设备,所述电子设备包括执行上述第七方面或者第七方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十六方面,提供一种电子设备,所述电子设备包括执行上述第八方面或者第八方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十七方面,提供一种电子设备,所述电子设备包括执行上述第九方面或者第九方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十八方面,提供一种电子设备,所述电子设备包括执行上述第十方面或者第十方面的任意一种可能的设计的方法的模块/单元;这些模块/单元可以通过硬件实现,也可以通过硬件执行相应的软件实现。
第十九方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第一方面及其第一方面任一项可能设计的技术方案。
第二十方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第二方面、第三方面及其第二方面、第三方面任一项可能设计的技术方案。
第二十一方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第四方面及其第四方面任一项可能设计的技术方案。
第二十二方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第五方面、第六方面及其第五方面、第六方面任一项可能设计的技术方案。
第二十三方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第七方面及其第七方面任一项可能设计的技术方案。
第二十四方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第八方面及其第八方面任一项可能设计的技术方案。
第二十五方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第九方面及其第九方面任一项可能设计的技术方案。
第二十六方面,提供一种电子设备,所述电子设备包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述电子设备执行第十方面及其第十方面任一项可能设计的技术方案。
第二十七方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第 一方面及其第一方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第二十八方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第二方面、第二方面及其第二方面、第三方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第二十九方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第四方面及其第四方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第五方面、第六方面及其第五方面、第六方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十一方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第七方面及其第七方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十二方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第八方面及其第八方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十三方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第九方面及其第九方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十四方面,提供一种装置,所述装置包括存储器、和处理器,以及计算机程序,所述计算机程序存储在存储器中,当所述计算机程序被所述执行时,使得所述装置执行第十方面及其第十方面任一项可能设计的技术方案。应理解:所述装置包括芯片系统、集成电路、或芯片等。
第三十五方面,提供一种计算机可读存储介质,所述计算机可读存储介质包括计算机程序,当计算机程序在电子设备上运行时,使得所述电子设备执行如上述任一方面及其任一方面任一项可能设计的技术方案。
第三十六方面,提供一种计算机程序产品,当其在计算机上运行时,使得所述计算机执行如上述任一方面及其任一方面任一项可能设计的技术方案。
第三十七方面,本申请实施例还提供一种音量调整系统,包括第十五方面所述的电子设备和第十六方面所述的电子设备。
第三十八方面,本申请实施例还提供一种音振同步播放系统,包括第十七方面所述的电子设备和第十八方面所述的电子设备。
第三十九方面,提供一种电子设备上的图形用户界面(graphical user interface,GUI), 电子设备具有显示屏、摄像头、存储器以及一个或多个处理器,所述一个或多个处理器用于执行存储在所述存储器中的一个或多个计算机程序,所述图形用户界面包括所述电子设备执行上述第一方面及其第一方面任一项可能设计的技术方案时,显示的图形用户界面。
上述第十一方面至第三十九方面中的各个方面以及各个方面可能达到的技术效果请参照上述针对第一方面至第十方面中的各种可能方案可以达到的技术效果说明,这里不再重复赘述。
图1为一种视频录制的示意图;
图2为本申请实施例的一种电子设备的硬件结构图;
图3为本申请实施例的一种电子设备的软件系统的结构示意图;
图4为本申请实施例的一种视频录制的示意图;
图5为本申请实施例的一种界面的示意图;
图6A为本申请实施例的一种视频录制的示意图;
图6B为本申请实施例的另一视频录制的示意图;
图7为本申请实施例提供的一种音频数据的录制方法实现流程图;
图8A为本申请实施例提供的一种软件架构示意图;
图8B为本申请实施例提供的一种安卓操作系统数据流向示意图;
图8C为本申请实施例提供的一种基于安卓操作系统内部模块的音频数据录制方法流程图;
图9为本申请实施例提供的一种应用场景示意图;
图10为本申请实施例提供的一种音频录制方法流程图;
图11为本申请实施例提供的一种用户界面示意图;
图12为本申请实施例提供的一种音频播放方法流程图;
图13A为本申请实施例提供的一种软件架构示意图;
图13B为本申请实施例提供的一种安卓操作系统数据流向示意图;
图13C为本申请实施例提供的一种软件模块示意图;
图14为本申请实施例提供的一种音频播放方法流程图;
图15A为本申请实施例提供的一种利用音频属性进行分类的示意图;
图15B为本申请实施例提供的一种利用音频类别确定播放策略的示意图;
图16为本申请实施例提供的一种用户界面示意图;
图17A为本申请实施例提供的一种音频分类模型的示意图;
图17B为本申请实施例提供的一种利用音频分类模型对音频流进行分类的处理流程示意图;
图18为本申请实施例提供的一种音频播放方法流程图;
图19为本申请实施例的一种多设备连接的场景示意图;
图20为本申请实施例的一种电子设备的软件系统的结构示意图;
图21为本申请实施例的一种音乐应用的界面的示意图;
图22为本申请示例的一种电子设备发现界面的示意图;
图23A为本申请实施例的一种音频数据传输流程示意图;
图23B为本申请实施例的一种音效配置信息的传输流程示意图;
图24为本申请实施例提供的一种软件架构示意图;
图25为本申请实施例提供的一种音量调整方法流程图;
图26A为本申请实施例提供的一种用户界面示意图;
图26B为本申请实施例提供的一种用户界面示意图;
图27A为本申请实施例提供的一种用户界面示意图;
图27B为本申请实施例提供的一种用户界面示意图;
图28为本申请实施例提供的另一种音量调整方法流程图;
图29为本申请实施例的一种音振文件的结构示意图;
图30为本申请实施例的一种电子设备的软件系统的结构示意图;
图31A为本申请实施例的一种音振同步播放的示意图;
图31B为本申请实施例的另一音振同步播放的示意图;
图32为本申请实施例的另一音振同步播放的示意图;
图33为本申请实施例的一种音振同步播放的方法流程示意图;
图34为本申请实施例的一种装置的结构示意图;
图35为本申请实施例的另一种装置的结构示意图;
图36为本申请实施例的另一种装置的结构示意图;
图37为本申请实施例的又一种装置的结构示意图。
首先,对本申请实施例中涉及的部分名词进行解释,以便于本领域技术人员理解。
1、电子设备:本申请实施例的电子设备可以为便携式终端,例如手机、平板电脑、便携式计算机、可穿戴式电子设备(如智能手表、智能眼镜、智能头盔、智能手环)、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备等。示例性的,便携式终端包括但不限于搭载
鸿蒙
或其他操作系统。此外,本申请实施例的电子设备还可以不是便携式终端,例如台式计算机、大屏设备(如华为智慧屏,智能电视,智能显示器,智能投影系统)等,对此不作限定。
2、应用程序:简称应用,为能够实现某项或多项特定功能的软件程序。通常,电子设备中可以安装多个应用。比如,相机应用、短信应用、邮箱应用、抖音应用、王者荣耀应用、微信(WeChat)、WeLink等。下文中提到的应用,可以是电子设备出厂时已安装的应用,也可以是用户在使用电子设备的过程中从网络下载或其他电子设备获取的应用。
3、音频数据:在本申请实施例中,音频数据(audio data)又可以称之为声音数据,用于表征声音,为对音频文件(如ogg文件)处理后得到的。示例的,对音频文件进行解码、解压缩或音效等处理得到音频数据。音频文件包括音频数据,可以为MP3文件、MP4文件或其它格式的文件,对此不作限定。即电子设备基于音频数据可以实现声音的播放。
目前,电子设备是通过应用程序为用户提供相应的功能的。例如,电子设备可以通过相机应用可以为用户提供视频录制和拍照功能等。通常,用户可以对相机应用操作,使得电子设备可以响应于用户对相机应用的操作,录制视频。并在视频录制结束后,电子设备将录制的视频以视频文件(例如MP4文件、或3gp文件等)的形式存储。然后,用户再使 用电子设备对存储的视频文件进行后期处理,从而将背景音乐增加到视频中。在一些实施例中,电子设备响应于用户对相机应用的操作,可以录制视频和播放音乐。在这种情况下,在视频中增加的视频可以为响应于用户对相机应用的操作,播放的音频。
例如,如图1所示,相机应用响应于接收到用户的录制视频的操作,启动camera,以及将相应的视频录制参数配置(如视频分辨率、视频帧率等)传递给media record。由camera调用视频拍摄设备(即视频硬件抽象层)进行视频图像采集。然后视频拍摄设备对采集的图像进行处理,例如编码、压缩等,得到图像数据,并将图像数据输出给media record,直至视频录制结束。由media record根据视频录制参数配置,对来自视频拍摄设备的图像数据进行处理,生成视频文件。但是,该视频文件中不包括背景音乐。最后,电子设备对上述得到的视频文件和背景音乐的音频文件进行处理,将背景音乐合成到视频中。在一些实施例中,相机应用响应于接收到用户的录制视频的操作,将背景音乐的音频文件发送给audio track。由audio track将音频文件输出给audio flinger。audio flinger调用音频播放设备(即音频硬件抽象层(audio HAL)),播放背景音乐。
然而,由于图1所示的视频录制方法中,需要后期处理才能得到包含背景音乐的视频文件,导致得到包括背景音乐的视频文件较为复杂。
有鉴于此,本申请实施例提供了一种视频录制方法,使得电子设备可以在视频录制的过程中添加相应的背景音乐,从而可以在视频录制结束后,可以直接得到包含有背景音乐的视频文件。有助于简化实现方式,便于用户使用,从而有助于提高用户体验。
应理解,本申请实施例中“至少一个”是指一个或者多个。“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系。例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的三种情况。其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一(项)个”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a、b和c七种情况。其中a、b、c中的每一个本身可以是元素,也可以是包含一个或多个元素的集合。
在本申请中,“示例的”、“在一些实施例中”、“在另一些实施例中”等用于表示作例子、例证或说明。本申请中被描述为“示例”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用示例的一词旨在以具体方式呈现概念。
需要指出的是,本申请实施例中涉及的“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。
示例的,如图2所示,为本申请实施例的一种电子设备的硬件结构示意图。具体的,如图2所示,电子设备包括处理器110、外部存储器接口120、内部存储器121、通用串行总线(universal serial bus,USB)接口130、充电管理模块140、电源管理模块141、电池142、天线1、天线2、移动通信模块150、无线通信模块160、音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D、传感器模块180、按键190、马达191、指示器192、摄像头193、显示屏194、以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
处理器110可以包括一个或多个处理单元。例如:处理器110可以包括应用处理器(application processor,AP)、调制解调器(modem)、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、视频编解码器、数字信号处理器(digital signal processor,DSP)、基带处理器、和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,或者,两个或更多个不同的处理单元也可以集成在一个器件中。其中,控制器可以是电子设备的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储计算机程序和/或数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的计算机程序和/或数据。如果处理器110需要再次使用该计算机程序和/或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。例如,处理器110包括通用串行总线(universal serial bus,USB)接口130、用户标识模块(subscriber identity module,SIM)接口195。再例如,处理器110还可以包括集成电路(inter-integrated circuit,I2C)接口、集成电路内置音频(inter-integrated circuit sound,I2S)接口、脉冲编码调制(pulse code modulation,PCM)接口、通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口、移动产业处理器接口(mobile industry processor interface,MIPI)、和/或通用输入输出(general-purpose input/output,GPIO)接口等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备的结构限定。在本申请另一些实施例中,电子设备也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口、Micro USB接口、USB Type C接口等。USB接口130可以用于连接充电器为电子设备充电,也可以用于电子设备与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如增强现实(augmented reality,AR)设备等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备的接触和分离。电子设备可以支持2个或N个SIM卡接口,N为大于2的正整数。SIM卡接口195可以支持Nano SIM卡、Micro SIM卡、SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备中,不能和电子设备分离。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142、充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110、内部存储器121、外部存储器、显示屏194、摄像头193和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量、电池循环次数、电池健康状态(漏电、阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备上的包括2G/3G/4G/5G/(6G等后续演进标准)等制式的无线通信的解决方案。移动通信模块150可以包括至少一个滤波器、开关、功率放大器、低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
无线通信模块160包括可以提供应用在电子设备上的包括无线局域网(wireless local area networks,WLAN)(如Wi-Fi网络)、蓝牙(Bluetooth,BT)、全球导航卫星系统(global navigation satellite system,GNSS)、调频(frequency modulation,FM)、近距离无线通信技术(near field communication,NFC)、红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。示例性的,在本申请实施例中,不同的电子设备之间可通过BT或WLAN建立通信连接。
在一些实施例中,电子设备的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM)、通用分组无线服务(general packet radio service,GPRS)、码分多址接入(code division multiple access,CDMA)、宽带码分多址(wideband code division multiple access,WCDMA)、时分码分多址(time-division code division multiple access,TD-SCDMA)、长期演进(long term evolution,LTE)、第五代(the fifth generation,5G)移动通信系统,未来通信系统,如第六代(6th generation,6G)系统等,BT、GNSS、WLAN、NFC、FM和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS)、全球导航卫星系统(global navigation satellite system,GLONASS)、北斗卫星导航系统(beidou navigation satellite system,BDS)、准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备通过GPU、显示屏194以及应用处理器等实现显示功能。显示屏194用于显示图像、视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、Miniled、MicroLed、Micro-oLed、量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光、色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备可以包括1个或N个摄像头193,N为大于1的正整数。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音频、视频等文件保存在外部存储卡中。
内部存储器121包括运行内存(memory)和内置存储器。其中,运行内存可以用于存储计算机程序和/或数据等。处理器110通过运行存储在运行内存的计算机程序,从而执行电子设备的各种功能应用以及数据处理。例如,运行内存可以包括高速随机存取存储器。而内置存储器又可以称之为内置外存等,可以用于存储计算机程序和/或数据。例如,内置存储器可以存储操作系统、应用程序等。电子设备通常将内置存储器中的计算机程序和/或数据加载到运行内存后,使得处理器110运行相应的计算机程序和/或数据,实现相应的功能。此外,内部存储器121可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、通用闪存存储器(universal flash storage,UFS)等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将图片,视频等文件保存在外部存储卡中。
电子设备可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D、以及应用处理器等实现音频功能。例如音乐播放、录音等。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。陀螺仪传感器180B可以用于确定电子设备的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备围绕三个轴(即,x,y和z轴)的角速度。
陀螺仪传感器180B可以用于拍摄防抖。气压传感器180C用于测量气压。在一些实施 例中,电子设备通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。磁传感器180D包括霍尔传感器。电子设备可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备是翻盖机时,电子设备可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。加速度传感器180E可检测电子设备在各个方向上(一般为三轴)加速度的大小。当电子设备静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备可以利用距离传感器180F测距以实现快速对焦。接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备通过发光二极管向外发射红外光。电子设备使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备附近有物体。当检测到不充分的反射光时,电子设备可以确定电子设备附近没有物体。电子设备可以利用接近光传感器180G检测用户手持电子设备贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备是否在口袋里,以防误触。指纹传感器180H用于采集指纹。电子设备可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备对电池142加热,以避免低温导致电子设备异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。
按键190包括开机键、音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备可以接收按键输入,产生与电子设备的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照、音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒、接收信息、闹钟、游戏等)也可以对应不同的 振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态、电量变化,也可以用于指示消息、未接来电、通知等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备的具体限定。在本申请另一些实施例中,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
本申请实施例中的电子设备的软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构或云架构等。本申请实施例以分层架构的鸿蒙操作系统为例,示例性说明电子设备的软件系统。
示例的,图3为本申请实施例的一种电子设备的软件系统的结构图。如图所示,电子设备的软件系统包括应用层、框架层和硬件抽象层(hardware abstraction layer,HAL)等。
其中,应用层包括应用程序,例如相机应用、短视频应用、图库应用、地图应用、游戏应用、音乐应用等。其中,应用程序可以用于为用户提供图形用户界面(graphical user interface,GUI),为用户提供操作接口等。
框架层应用程序层的应用程序提供应用编程接口(application programming interface,API)框架。
示例的,API框架可以包括相机系统框架和音频系统框架。相机系统框架包括相机(camera)。音频系统框架包括媒体记录器(MediaRecord)、音频播放器(AudioTrack)、音频策略执行器(AudioFlinger)、音频策略(AudioPolicy)等。
其中,camera为应用程序(例如相机应用)调用视频拍摄设备的接口。例如,相机系统框架还包括surface view,camera可以通过surface view调用视频拍摄设备。
MediaRecord用于生成视频文件。例如,音频系统框架还包括writer,MediaRecord可以通过调用writer生成视频文件。
在一些实施例中,音频系统框架还包括HwAudioPolicyMix(音频策略设置模块),用于针对不同的应用程序定制不同音频策略。例如,应用程序可以通过向HwAudioPolicyMix传递相应的参数,例如应用程序标识(uid)等,使得Hw AudioPolicyMix针对该应用程序生成相应的音频策略,并传递给AudioPolicy。
硬件抽象层包括音频播放设备(如Audio HAL)、视频拍摄设备(如视频硬件抽象层)等。音频播放设备用于调用扬声器等声音硬件播放设备播放音频。视频拍摄设备用于调用摄像头采集图像。在一些实施例中,硬件抽象层还可以包括虚拟音频播放设备(remote_submix)。remote_submix用于接收AudioFlinger发送的符合由HwAudioPolicyMix针对应用程序生成的音频策略的音频文件的音频数据,并将该音频文件的音频数据通过AudioFlinger传递给MediaRecord,从而由MediaRecord可以根据符合针对应用程序生成的音频策略的音频文件的音频数据和视频拍摄设备采集的图像数据合成相应的视频文件,从而使得合成的视频文件中可以包括背景音乐。
可以理解的是,图3所示的电子设备的软件系统只是示意性说明,并不构成对电子设备的软件系统限定。在本申请的另一些实施例中,电子设备的软件系统还可以包括内核层。或者,不限定框架层或硬件抽象层等包括的模块。此外,在一些实施例中,图3所示的电子设备的软件系统也可以为安卓操作系统。
以支持录制具有背景音乐的视频的相机应用为例。响应于用户录制具有背景音乐的视频的操作,相机应用启动camera、将相应的视频录制参数配置(如视频分辨率、视频帧率等)传递给MediaRecord,以及将背景音乐的音频文件传递给AudioTrack。由camera调用视频拍摄设备进行图像采集。然后,camera将采集的图像的图像数据传递给MediaRecord,AudioTrack对背景音乐的音频文件进行处理,得到背景音乐的音频数据,传递给AudioFlinger。并由AudioFlinger将音频数据分别分发给虚拟音频播放设备和音频播放设备。由虚拟音频播放设备通过AudioFlinger将音频数据传递给MediaRecord。从而MediaRecord可以根据视频录制参数配置,对图像数据和音频数据进行相应的处理,直至视频录制结束,得到具有背景音乐的视频文件。而音频播放设备可以将来自AudioFlinger的音频数据分发给扬声器或耳机等,进行播放。
在另一些示例中,相机应用还可以在视频录制结束后、或者响应于用户的操作,获取具有背景音乐的视频文件,进行播放。
图4所示的这种视频文件的录制方式,在视频录制过程中将背景音乐增加到视频中,使得用户无需对视频文件进行后续处理,便于用户使用。但是,在电子设备支持一边使用相机应用录制视频、一边使用另一应用程序播放视频或音乐的情况下,AudioFlinger不仅可以接收到来自相机应用的背景音乐的音频数据,也可以接收到来自另一应用程序的音频数据,这样容易导致AudioFlinger传递给虚拟音频播放设备的音频数据不但包括相机应用的背景音乐的音频数据、也包括另一应用程序的音频数据,不但影响视频录制效果,而且容易引起版本纠纷。
为了解决这一问题,本申请实施例在电子设备的软件系统中引入了HwAudioPolicyMix,从而使得电子设备在支持多个应用程序播放媒体文件(例如视频文件或音频文件)中音频的情况下,能够筛选出来自录制视频的应用程序的音频数据,以达到在视频录制过程中根据用户需要增加相应的背景音乐的目的,而且不容易引起版权纠纷。此外,进一步的,如果在电子设备录制视频时,播放的背景音乐经过了音效处理,这种在视频中增加背景音乐的方式,还有助于使得电子设备视频录制结束后,播放时背景音乐的音效、与电子设备录制视频时播放的背景音乐的音效是一致的。
如图5所示,电子设备显示界面500。界面500为相机应用的视频录制界面,包括图像预览框501、背景音乐设置选项502和虚拟按键503。其中,图像预览框501用于预览摄像头采集的图像。虚拟按键503用于控制启动或停止视频录制。可以理解的是,相机应用的视频录制界面上还可以包括其它控件,例如用于控制前后摄像头切换的虚拟按键等。响应于用户点击背景音乐设置选项502的操作,显示背景音乐设置栏5021。背景音乐设置栏5021包括多个音乐选项,例如无、音乐1、音乐2、音乐3和更多。如果音乐选项“无”被用户选中,则录制的视频不包括背景音乐。如果音乐1被选中,则录制的视频中包括音乐1。当用户选择更多时,可以从本地或网络上选择相应的音乐作为录制的视频的背景音乐。
以用户选中音乐2为例。响应于用户点击虚拟按键503,电子设备开始录制视频。响应于用户点击虚拟按键503,电子设备结束录制视频,生成视频文件,该视频文件包括背景音乐和摄像头实际采集的图像。在一些实施例中,在用户选中音乐2的情况下,响应于用户点击虚拟按键503,电子设备还可以基于音乐2所指示的音乐文件进行播放。
在本申请的另一些实施例中,当电子设备中的多个应用程序播放音频时,在用户选中 音乐2的情况下,响应于用户点击虚拟按键503,电子设备根据相机应用的应用标识(uid),从播放音频的多个应用程序中选择相机应用的应用标识对应的音频的音频数据。响应于用户点击虚拟按键503,电子设备结束录制视频,根据相机应用的应用标识对应的音频的音频数据(即音乐2标识的音频文件的音频数据)和摄像头采集的图像数据,生成视频文件。
进一步的,在一些实施例中,当电子设备中某个应用程序播放音频时,如果用户使用相机应用录制具有背景音乐的视频,则相机应用可以不播放录制视频所使用的背景音乐。从而可以避免多个应用同时播放背景音乐。
示例的,基于图3所示的软件系统,电子设备进行视频录制的方法可以如图6A所示,具体包括:响应于用户录制具有背景音乐的视频的操作,相机应用将相机应用的音频策略配置参数传递给HwAudioPolicyMix,相机应用将背景音乐的音频文件传递给AudioTrack,相机应用将视频录制参数配置(如视频分辨率、视频帧率等)传递给MediaRecord,并启动camera。其中,相机应用的音频策略配置参数可以包括相机应用的应用标识(如uid)等。HwAudioPolicyMix根据相机应用的音频策略配置参数,生成相机应用的音频策略,并将相机应用的音频策略传递给AudioPolicy。AudioPolicy将相机应用的策略发送给AudioFlinger。AudioTrack对背景音乐的音频文件进行处理,得到背景音乐的音频数据,传递给AudioFlinger。AudioFlinger接收到来自AudioPolicy的相机应用的音频策略,则根据相机应用的音频策略,筛选出录制视频所使用的背景音乐的音乐数据,并将录制视频所使用的背景音乐的音乐数据传递给虚拟音频播放设备。由虚拟音频播放设备将录制视频所使用的背景音乐的音乐数据发送给MediaRecord。作为一种可选的实现方式,虚拟音频播放设备还可以将录制视频所使用的背景音乐的音乐数据发送给AudioFlinger,再由AudioFlinger将录制视频所使用的背景音乐的音乐数据发送给MediaRecord。此外,camera在启动后,可以调用视频拍摄设备进行图像采集。然后,camera将采集的图像的图像数据传递给MediaRecord。因此,MediaRecord可以根据视频录制参数配置,对接收到的音频数据和图像数据进行相应的合成,当视频录制结束后,MediaRecord可以根据音频数据和图像数据的合成结果,生成具有背景音乐的视频文件,并保存。
本申请实施例中,由于在电子设备的软件系统中增加了HwAudioPolicyMix,从而在电子设备中多个应用程序(包括具有录制背景音乐的视频功能的相机应用)播放音频的情况下,基于相机应用的音频策略,从多个应用程序播放的音频中筛选出相机应用播放的音频(即背景音乐)的音频数据,从而有助于达到在视频录制过程中根据用户需要增加相应的背景音乐的目的,而且不容易将其它应用程序播放的音频的音频数据录制到视频中,导致引起版权纠纷。示例的,相机应用的音频策略可以指的是筛选出与相机应用的应用程序标识对应的音频的音频数据。
此外,由于背景音乐的音频数据是由AudioFlinger传递给虚拟音频播放设备,而通常,对背景音乐的音频数据进行音效处理是在AudioFlinger输出音频数据之前执行的,因此,在本申请实施例中,如果在电子设备录制视频时,播放的背景音乐经过了音效处理,这种在视频中增加背景音乐的方式,还有助于使得电子设备视频录制结束后,播放时背景音乐的音效、与电子设备录制视频时播放的背景音乐的音效是一致的。
需要说明的是,在本申请实施例中,当拍摄静音功能开启时,电子设备的麦克风不采集外界声音(如用户声音、或周围环境中的声音)。在一些实施例中,当拍摄静音功能关闭时,电子设备可以根据麦克风采集的声音的音频数据、背景音乐的音频数据和摄像头采 集的图像数据,生成视频文件。例如,如图6B所示,响应于用户录制具有背景音乐的视频的操作,相机应用还启动麦克风,由麦克风调用音频采集设备采集声音的音频数据,然后,音频采集设备将采集的声音的音频数据发送给MediaRecord。由MediaRecord对音频采集设备采集的声音的音频数据、背景音乐的音频数据和摄像头采集的图像数据进行合成,并当视频录制结束时,根据对麦克风采集的声音的音频数据、背景音乐的音频数据和摄像头采集的图像数据的合成结果,生成视频文件,并保存。
进一步的,在一些实施例中,电子设备在生成视频文件后,还可以根据该视频文件进行播放,以便于用户预览。
需要说明的是,在本申请实施例中,视频录制结束可以是用户通过操作触发的,也可以是电子设备在启动视频录制达到预设时长后,自动结束的,对此不作限定。
应理解,上述是以相机应用为例对本申请实施例视频录制方法进行介绍的,本申请实施例不限定使用图6A或图6B所示的视频录制方法的应用程序,例如,图6A或图6B所示的视频录制方法还可以应用于短视频应用等,对此不作限定。
此外,本申请实施例的视频录制方法应用于直播或视频通话的场景中生成视频文件。
还需要说明的是,上述各实施例可以单独使用,也可以相互结合使用,以实现不同的技术效果,对此不作限定。
上述实施例介绍了基于音频数据和图像数据生成的视频文件的过程,当上述视频录制方法应用于直播场景,比如游戏直播场景时,该音频数据可能包括主播声音、游戏的声音、背景音乐等,那么如何对音频数据进行录制,使得用户可以根据自身的需求选择需要录制的音频数据也是有待解决的问题。以下将以直播场景为例,对音频数据的录制过程进行详细介绍。
目前,在直播场景下,以直播游戏为例,对于音频数据的录制通常包括如下两种方式:
方式1:系统音通过扬声器外放,然后麦克风对扬声器外放的声音进行录制。
主播在直播游戏时,系统音(也可以理解为:游戏的声音)通常是通过扬声器外放,然后麦克风对外放的系统音进行录制,麦克风可以直接录制主播的声音。在这个过程中,麦克风录制到的音频数据包括系统音以及主播的声音,即一份音频数据中包括多种音频数据。
方式2:系统音通过内录的方式进行录制。
应理解,内录指的是不需要扬声器外放,再从麦克风拾音。
为了描述方便,以下将直播所使用的应用记为“直播应用”,将直播的内容所在的应用记为“游戏应用”,将直播场景下的背景音乐(比如主播自己放的音乐)所使用的应用记为“音乐应用”。
如图7所示,为一种音频数据的录制方法实现流程图,参阅图7,该方法可包括如下步骤:直播应用创建类(AudioPlaybackCaptureConfiguration),以申请录制类型为A和B的音频流,然后创建音频录制(AudioRecord)用于对类型为A和类型为B的音频流进行录制。然后AudioPlaybackCaptureConfiguration可将录制音频流类型A、B的申请发送给音频策略(AudioPolicy/AudioPolicyMix),音频策略(AudioPolicy/AudioPolicyMix)接收到该申请之后,通知音频服务(AudioService)更改音频输出策略(即在经过输出音频流时,一路音频流输出到扬声器、耳机等,另一路音频流(A、B类型混音的音频流)输出到虚拟设备)。音频服务(AudioService)接收游戏应用、音乐应用通过多个音频播放器 (AudioTrack)输出的音频流。接着,音频服务(AudioService)可将音频流发送给混音线程(MixerThread),由MixerThread对音频流进行混音。音频系统可对音频流进行复制并分为两路传输。其中,一路音频流(将A、B、C类型的音频流进行混音之后的音频数据)发送给扬声器、耳机等。另一路音频流为:音频系统可将A、B类型的音频流进行复制并混音,然后将A、B混音之后的音频流送到虚拟设备(remote_submix),接着再分别通过音频录制类(AudioRecord)对至少一种类型的音频流进行录音,最后将录音之后的音频流发送给应用层的直播应用。应理解,一个应用可通过多个不同的AudioTrack来输出不同的音频流,图中仅是以三个AudioTrack来示意,例如也可以为两个AudioTrack,或者还可以为四个AudioTrack等,本申请对此不作限定。
在上述这两种方式中,直播应用接收到录音数据都是多种音频流类型混音之后的数据,并且直播应用能够获取的音频流类型有限。另外,方式2中是在混音线程(MixerThread)对A、B、C三种类型的音频流进行混音之后,才将A、B类型的混音数据输出到虚拟设备,这样发送给直播应用的音频数据就是混音之后的一份数据,而不是两份音频数据。
有鉴于此,本申请实施例还提供一种音频录制方法,通过对直播场景下多种类型的音频流进行标记,并在带有标记的音频流中筛选出直播应用所需的至少一种类型的音频流,然后将筛选出的音频流分别发送给直播应用,这样直播应用侧能够录制到多个不同类型的音频数据,而不是录制到多个类型的混音数据,能够方便对音频流进行处理。
需要说明的是,该音频录制方法可应用于图2所示的电子设备。其中,电子设备的软件结构框图可参阅图8A所示。以Android系统为例,该电子设备的软件结构从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)、系统库、内核层、硬件抽象层(hardware abstraction layer,HAL)以及硬件层。
应用程序层可以包括一系列应用程序包。如图8A所示,应用程序层内可以安装浏览器,优酷,腾讯视频,地图,爱奇艺,游戏应用(比如,王者荣耀),直播应用(比如,抖音),音乐应用(网易云音乐)等应用程序。
应用程序框架层可以包括音频服务(AudioService)、音频录制类(AudioRecord)、音频策略(AudioPolicy/AudioPolicyMix)、音频策略执行器(AudioFlinger)、音频播放(AudioTrack)、混音线程(MixerThread)。当然,应用程序框架层中还可以包括显示策略服务(display strategy service,DSS)、电源管理服务(power manager service,PMS)、显示管理服务(display manager service,DMS)、活动管理器、窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。
其中,音频录制类(AudioRecord)负责对录音数据进行采集。
音频策略(AudioPolicy/AudioPolicyMix)负责音频设备切换的策略抉择、音量调节策略等。
音频策略执行器(AudioFlinger)负责输入输出流设备的管理及音频流数据的处理传输。
音频播放(AudioTrack)负责对音频数据进行输出。
混音线程(MixerThread)负责对音频数据进行混音,并将混音后的音频数据输出到音频设备。
Android runtime包括核心库和虚拟机。Android runtime是Android操作系统的运行时环境,负责Android操作系统的调度和管理。
其中,核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是Android 操作系统的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种格式的音频、视频的回放和录制,以及支持打开多种格式的静态图像等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。2D图形引擎是2D绘图的绘图引擎。
内核层是电子设备的硬件和软件之间的层。内核层至少包含显示驱动,传感器驱动、摄像头驱动,音频驱动等,用于驱动硬件层中的硬件。
硬件抽象层HAL为位于操作系统内核层与硬件电路之间的接口层,其目的在于将硬件抽象化。它隐藏了特定平台的硬件接口细节,为操作系统提供虚拟硬件平台,使其具有硬件无关性,可在多种平台上进行移植。从软硬件测试的角度来看,软硬件的测试工作都可分别基于硬件抽象层来完成,使得软硬件测试工作的并行进行成为可能。
硬件抽象层HAL可包括:音频主通路(primary HAL)、虚拟设备(remote_submix)。
其中,音频主通路(primary HAL)对应扬声器、耳机等,虚拟设备(remote_submix)用于录制系统音。
硬件层可以包括各类传感器(例如触摸传感器等)、显示屏、摄像头等。
如图8B所示,为本申请实施例提供的一种安卓操作系统数据流向示意图。示例性的,在本申请实施例中,应用层的直播应用申请所需要的至少一种类型标记的音频流,框架层的音频系统接收到该申请之后,对播放的音频流进行标记,然后在标记得到的至少两种类型标记中筛选出类型标记为直播应用所需要的类型标记,然后将筛选出的至少一种类型标记的音频流分别送到硬件抽象层HAL中的虚拟设备(remote_submix),接着再分别通过框架层的音频录制类(AudioRecord)对至少一种类型标记的音频流进行录音,最后将录音之后的音频流发送给应用层的直播应用。
与图8B类似的,如图8C所示,为基于安卓操作系统内部模块的音频数据录制方法流程图。示例性的,直播应用创建类(AudioPlaybackCaptureConfiguration),同时直播应用调用新增的接口(addSoundFlags)申请所需要的类型标记。同时直播应用创建音频录制(AudioRecorder)类进行录音。AudioPlaybackCaptureConfiguration可将所需要的音频流类型标记的申请发送给音频策略(AudioPolicy/AudioPolicymix),音频策略(AudioPolicy/AudioPolicyMix)接收到该音频流类型标记的申请之后,通知音频服务(AudioService)更改音频输出策略(将音频输出策略为仅输出到扬声器、耳机等,更改为在混音之前将直播应用申请的音频流类型标记的音频流输出到虚拟设备,并将不同类型的音频流进行混音输出到扬声器、耳机等)。音频服务(AudioService)接收游戏应用、音乐应用通过多个音频播放(AudioTrack)输出的不同类型标记的音频流,然后基于直播应用的申请在音频流类 型标记中筛选对应的音频流类型标记。接着,音频服务(AudioService)可将音频流进行复制并分为两路传输。其中一路音频流数据发送给到混音线程(MixerThread)对各种类型的音频流进行混音,之后送到扬声器、耳机等。另一路将直播应用所需要的至少一种类型标记的音频流分别送到虚拟设备(remote_submix),接着再分别通过音频录制类(AudioRecord)对至少一种类型标记的音频流进行录音,最后将录音之后的音频流发送给应用层的直播应用。也就是说,本申请实施例中的方案可在将A、B、C三种类型标记的音频流在发送给混音线程(MixerThread)混音之前,将A、B类型标记的音频流筛选出来,然后送到虚拟设备(remote_submix),这样直播应用之后接收到的音频数据即为两份音频数据,包括类型标记为A的音频数据以及类型标记为B的音频数据,而不是现有技术中的一份音频数据。
其中,各个模块的具体功能可参见图8B的相关描述,此处不再重复赘述。
以下实施例以应用在图2所示的电子设备所示的架构中为例进行描述。
如图9所示,为本申请实施例提供的一种应用场景示意图。参阅图9所示,该场景中可包括:电子设备和直播服务平台。其中,电子设备包括主播侧电子设备和观众侧电子设备,直播服务平台中可包括至少一个服务器。
其中,主播侧电子设备,用于采集实时的原始直播视频,并根据设定的视频传输协议将采集的原始直播视频上传到直播服务平台中的服务器。示例性的,在游戏直播场景中,主播侧电子设备采集的原始直播视频包括当前在显示屏中显示的游戏视频,还包括通过摄像装置采集的包含主播的主播视频。
在本申请实施例中,在主播侧电子设备上,可以安装有用于直播的应用程序、与音乐相关的应用程序以及与游戏相关的应用程序等。在游戏直播场景下,主播在进行游戏直播的同时也可以打开与音乐相关的应用程序来播放音乐,以调节气氛等。
需要说明的是,在本申请实施例的应用场景中可以包括音乐应用,也可以不包括音乐应用,本申请对此不作限定。
直播服务平台中的服务器,用于将接收主播侧电子设备原始直播视频,并对原始直播视频进行转码处理,生成多种不同码率和格式的目标直播视频,以在观众侧电子设备上播放。
观众侧电子设备,用于接收并播放目标直播视频。在该应用场景中,观众可以通过观众侧电子设备发送弹幕、在评论区输入评论信息等。而观众侧电子设备可以将用户发送的传统评论信息上传给服务器,再通过服务器分发给其他观众侧电子设备。
以下结合附图对本申请实施例的音频录制方法进行详细介绍。
应理解,本申请实施例中的“音频数据”和“音频流”有时候可能会混用,应理解其含义相同。
如图10所示,为本申请实施例提供的一种音频录制方法流程图,参阅图10所示,该方法可包括如下步骤:
S1001:电子设备检测到第一触发事件。
应理解,这里的电子设备可以为图9所示的应用场景中的主播侧电子设备。
其中,第一触发事件可以为用户(主播)在第一应用的界面上对音频流类型标记(以下记为:第一类型标记和第二类型标记)的选择操作事件,或者为第一应用按照设定规则对音频流类型标记的选择事件。
应理解,本申请实施例中仅是以两个类型标记为例进行的介绍,在实际应用中,也可以为一个类型标记或者三个类型标记等,本申请对此不作限定。
为了描述方便,本申请实施例中的“第一应用”可以理解为“直播应用”,“第二应用”可以理解为“游戏应用”,“第三应用”可以理解为“音乐应用”。
作为一种可能的实现方式,在该步骤S1001执行之前,主播侧电子设备可基于主播的操作,比如通过主播的用户账号登录直播客户端,并创建直播间,然后,主播侧电子设备获取原始直播视频,并将原始直播视频上传给直播服务平台中的服务器,之后直播服务平台中的服务器对原始直播视频进行转码处理,生成目标直播视频,以在观众侧电子设备上播放。
以下结合第一触发事件的两种可能的实现方式对该步骤S1001进行详细介绍。
方式1:用户在第一应用的界面上对第一类型标记和第二类型标记的选择操作。
在一些实施例中,电子设备中的应用程序,比如第一应用可以为用户(主播)提供显示界面,该界面上可以显示音频流以及音频流对应的类型标记。然后主播可根据自己的喜好等在该界面上进行选择,例如可以选择录制类型标记为A的音频流,不录制类型标记为B的音频流等。
示例性的,以游戏直播为例,假设游戏直播间如图11所示的界面1100,在界面1100中可包括“音频录制”按钮1101。当主播在界面1100中点击“音频录制”按钮1101之后,电子设备上可显示用户界面1110。其中,该用户界面1110中可包括多种音频流类型标记,例如可包括:游戏音频流1111、音乐音频流1112、主播音频流1113。当然,用户界面1110上还可以包括确认按钮(或者选项)1114。
另一示例,当主播在界面1100中点击“音频录制”按钮1101之后,电子设备上可显示用户界面1120。其中,该用户界面1120中可包括多种音频流类型标记,例如可包括:游戏语音通话音频流1121、技能释放音频流1122、游戏背景音乐音频流1123、游戏角色台词音频流1124、游戏击杀播报音频流1125、音乐音频流1126、主播音频流1127。当然,用户界面1110上还可以包括确认按钮(或者选项)1128。
当然,上述音频流类型标记仅是一种示意性说明,音频流类型的标记形式也可以为其它形式,比如用户界面1100上也可以不显示“音频录制”按钮1101,直接显示多种音频流类型标记等,并且,还可以按照其他的方式进行划分,对此不作限定。
其中,游戏背景音乐音频流1123可以理解为游戏(比如,王者荣耀)本身自带的背景音乐,音乐音频流1126可以理解为主播在后台播放的音乐的音频流。当然,可以理解的是,主播播放的音乐可以为主播侧电子设备上播放的音乐,也可以为主播在其它电子设备上播放的音乐等,本申请对此不作限定。
需要说明的是,用户界面1120相比于用户界面1110而言,仅是将用户界面1110中的游戏音频流1111具体划分为游戏语音通话音频流1121、技能释放音频流1122、游戏背景音乐音频流1123、游戏角色台词音频流1124、游戏击杀播放音频流1125。
通过这种方式,主播可以根据自身的喜好或者需求等来录制音频流,以便后续对音频流进行处理,能够提升用户体验。
方式2:第一应用按照设定规则对第一类型标记和第二类型标记进行选择。
也就是说,第一类型标记和第二类型标记可以为设定的音频类型标记,该音频类型标记可以为用户上次设置的音频类型标记,或者还可以为配置的音频类型标记。示例性的, 以图11为例,用户可以在点击“音频录制”按钮1101之后,在用户界面上点击确认按钮(或者选项)1128,此时电子设备将用户上次设置的音频类型标记作为设定的音频类型标记。
在另一些实施例中,电子设备的音频系统可以为第一应用配置设定的规则,然后当第一应用开启之后,第一应用可按照系统配置的规则选择所需的音频流类型标记。
需要说明的是,本申请实施例中音频系统为第一应用配置的规则可以为固定的规则,也可以为动态变化的规则,本申请对此不作限定。
作为一种可能的实现方式,音频系统为第一应用配置的规则可以按照场景来配置。示例性的,音频系统配置的规则可参阅如下表1所示。
表1音频系统配置的规则
可以理解的是,本申请实施例中所涉及到的音频系统配置的规则以及相应的表格仅是一种示意性说明,本申请中场景的标识也可以为场景1、场景2等,并且音频系统配置的规则的形式并不限于上述表格。
从上述表1可知,比如当直播场景中包括A、B、C三种类型标记的音频流时,可以选择录制类型标记为A和B的音频流,不录制类型标记为C的音频流;或者,可以选择录制类型标记为A和C的音频流,不录制类型标记为B的音频流。当直播场景中包括A、B两种类型标记的音频流时,可以选择录制类型标记为A的音频流,不录制类型标记为B的音频流。当然,当直播场景中包括A、B、C三种类型标记的音频流时,也可以选择录制类型标记为B、C的音频流等,本申请对此不作限定。
作为另一种可能的实现方式,电子设备的音频系统可以按照主播的直播的时长来配置规则。示例性的,假设主播直播的时长为T,以当直播场景中包括A、B、C三种类型标记的音频流为例,音频系统配置的规则可参阅如下表2所示。
表2音频系统配置的规则
时长 | 配置的规则 |
T<T1 | A、B、C |
T1<T<T2 | A、B |
T>T2 | A |
比如T1为20分钟,T2为40分钟,从上述表2可知,当主播直播的时长小于20分钟,第一应用选择的配置规则可以为同时录制A、B、C三种类型标记的音频流;当主播直播的时长大于20分钟且小于40分钟时,第一应用选择的配置规则可以为录制A、B两种类型标记的音频流,不录制C类型标记的音频流;当主播直播的时长大于40分钟时,第一应用选择的配置规则可以为录制A类型标记的音频流,不录制B、C类型标记的音频流。
应理解,上述T的取值仅是一种示意,本申请中并不限于上述取值。
需要说明的是,电子设备的音频系统配为第一应用配置的规则并不限于上述举例,例如电子设备的音频系统还可以按照主播直播的时间段来配置规则,当然,还可以根据音频流的数量来配置规则等,本申请对此不作限定。
在本申请实施例中,通过上述两种方式,可以选择出确定录制的音频流类型标记,比 如第一类型标记和第二类型标记,当然,本申请中以选择出两种或两种以上的类型标记为例。
S1002:电子设备响应第一触发事件,检测第一音频流的类型标记。
为了描述方便,将当前场景中所播放的音频流统称为“第一音频流”,步骤S1001中的第一类型标记对应的音频流和第二类型标记对应的音频流为主播所选择的想要录制的音频流或者应用选择的音频流。
当电子设备检测到目标触发事件之后,可响应目标触发事件,然后检测当前场景中所播放的音频流的类型标记。在本申请实施例中,电子设备在检测当前所播放的音频流的类型标记时,可采用如下两种方式:
方式1:电子设备调用音频系统,由音频系统对第一音频流进行标记,然后电子设备根据音频系统的标记结果检测当前所播放的音频流的类型标记。
示例性的,比如第一音频流包括游戏应用中的音频流、音乐应用的音频流。以图8C为例,当第一音频流通过AudioTrack播放出来后,由音频系统对第一音频流进行标记,例如标记为A、B、C类型,然后将带有标记的音频流传给AudioServer模块。
在一种可能的实现方式中,音频系统可以通过多个模块(例如,音频属性(AudioAttrbutes),媒体会话(Mediasession),媒体提供者(MediaProvider)模块)中的音频参数对音频流进行标记。比如,可以获取到音频流的类型、音频流的长度等,然后根据获取到的音频参数进行标记。示例性的,标记规则可以如下表3所示。
表3音频流的标记规则
USAGE(类型) | LENGTH(长度) | SINGER(歌手) | 标记 |
GAME | SHORT | / | 游戏短音(技能释放等) |
GAME | LONG | / | 游戏长音(背景音乐等) |
MEDIA | LONG | 周杰伦 | 男歌手音乐 |
VOICE_COMMICATION | LONG | / | 游戏小队语音 |
应理解,上述表格仅是一种示意性说明。在本申请中,当音频系统标记完之后,可将标记之后的内容保存在音频系统中,例如可保存在音频属性(AudioAttrbutes)模块中。
方式2:电子设备调用应用,由应用对播放的第一音频流进行标记,然后电子设备根据应用的标记结果检测当前所播放的音频流的类型标记。
示例性的,比如第一音频流包括游戏应用中的音频流、音乐应用的音频流。以图8C为例,当第一音频流通过AudioTrack播放之前,游戏应用和音乐应用可分别对各自应用所播放的音频流进行标记,例如标记为A、B、C类型,然后将带有标记的音频流传给AudioServer模块。
S1003:电子设备在第一音频流的至少两种类型标记中筛选第一类型标记和第二类型标记。
本申请实施例中,当音频系统或者应用对音频流进行标记之后,电子设备可确定出第一音频流的类型标记,然后在第一音频流的类型标记中选择在S1001中所需要的音频流类型标记。比如,在S1001中所需要的音频流类型标记为A、B类型标记的音频流,在S1002中确定出第一音频流的类型包括A、B、C类型标记,即在第一音频流中包括S1001中所需要的音频流类型标记对应的音频流。
S1004:电子设备分别对第一类型标记和第二类型标记对应的音频流进行录制,得到 第一音频录制数据和第二音频录制数据。
示例性的,用户/应用选择录制两种音频流类型标记对应的音频流,在S1001中用户/应用选择两种音频流类型标记,然后S1003电子设备选择出两种音频流类型标记,并分别对所需的两种音频流类型标记对应的音频流进行录制,得到两份录制数据。这样可以得到多份不同类型的音频流的录制数据,而不是现有技术中的一份混音数据的录制数据。
上述过程是针对主播侧电子设备来进行的说明,以下结合观众侧电子设备进行介绍。
如图12所示,为本申请实施例提供的一种音频播放方法流程图,参阅图12所示,该方法可包括如下步骤:
S1201:电子设备检测到第二触发事件。
这里的电子设备可以为图9所示的应用场景中的观众侧电子设备。观众侧电子设备可基于观众的操作,比如通过观众的用户账号登录该直播客户端,并在该直播客户端中查找到该直播间,然后加入该直播间观看目标直播视频。
其中,第二触发事件可以为用户(观众)在第一应用的界面上对音频流类型标记的选择操作事件,或者为第一应用对音频流类型标记的选择事件。
以下结合第二触发事件的两种可能的实现方式对S1201进行介绍。
方式1:用户(观众)选择音频流类型标记。
在一些实施例中,电子设备中的应用程序,比如第一应用可以为用户(观众)提供一个显示界面,该界面上可以显示当前所在的直播场景中所包括的音频流以及音频流对应的类型标记。然后用户可根据自己的喜好等在该界面上进行选择,例如可以选择播放类型标记为A的音频流,不播放类型标记为B的音频流或者选择将类型标记为B的音频流的音量调低等。
示例性的,以图11为例,假设观众加入某个游戏直播间,此时观众侧的电子设备上例如显示界面1100。在界面1100中可包括“音频录制”按钮1101。当观众在界面1100中点击“音频录制”按钮1101之后,电子设备上可以显示用户界面1120。其中,该用户界面1120中可包括主播在直播场景下的音频流类型,例如可包括:游戏语音通话音频流1121、技能释放音频流1122、游戏背景音乐音频流1123、游戏角色台词音频流1124、游戏击杀播报音频流1125、音乐(Media)音频流1126、主播音频流1127。
应理解,主播侧电子设备上显示的直播界面和观众侧电子设备上显示的直播界面的界面示意图仅是一种示意说明,本申请对于界面上显示的图标及名称等不作限定。
当然,如果是用户选择想要播放的音频流,在界面上还可以包括“确认开启”按钮、“确认关闭”按钮等。比如,当用户选择播放游戏语音通话音频流1121、技能释放音频流1122之后,可点击“确认开启”按钮,当用户选择不播放游戏背景音乐音频流1123之后,可点击“确认关闭”按钮。
方式2:第一应用按照设定规则对音频流进行选择。
观众侧的电子设备可以为第一应用配置设定的规则,然后当观众开启第一应用,进入直播间之后,第一应用可按照系统配置的规则选择所需的音频流类型标记对应的音频流。示例性的,可以按照观众观看直播的时长来配置规则,第一应用进而根据观看时长为来选择音频流。假设观看直播的时长为T,当观看直播的时长T小于T1时,第一应用选择的配置规则可以为同时播放A、B、C三种类型标记的音频流;当观看直播的时长T大于T1且小于T2时,第一应用选择的配置规则可以为播放A、B两种类型标记的音频流,不播 放C类型标记的音频流;当观看直播的时长T大于T2时,第一应用选择的配置规则可以为播放A类型标记的音频流,不播放B、C类型标记的音频流。
当然,上述规则仅是一种举例,本申请实施例中还可以按照其它的方式来配置规则,例如还可以根据观众进入直播间的次数来配置规则等,本申请对此不作限定。
S1202:电子设备响应第二触发事件,播放与音频流类型标记对应的音频流。
在本申请实施例中,电子设备可播放与音频流类型标记对应的音频流,这样针对用户而言,能够便于用户根据自己的需求选择想要听到的音频流,或者可以根据音频系统配置的规则为用户提供一些可能的需求,比如某些音频的声音比较大,长时间播放可能会对用户造成困扰等,从而提升用户在观看直播时的用户体验。
通过这种方式,用户(观众)可以根据自身的喜好或者需求等来设置播放的音频流类型,能够提升用户体验。
通过上述实施例可知,在视频录制或者音频录制过程中可能会有多个应用程序同时播放音频,目前在多个应用程序同时播放音频时,会将多个应用程序的音频流一起输出,即用户会听到多个应用程序的音频,此时可能会出现声音嘈杂混乱的问题。因此,如何避免在多个发声类应用同时打开时出现声音嘈杂混乱的问题也是有待解决的。
应理解,电子设备上可以安装各种类型的应用,比如音乐类应用,听书类应用、视频类应用等。其中,一些应用与音频相关,可以将这些与音频相关的应用称为发声类应用。
以下以两个应用程序,并且一个应用在前台,一个应用在后台为例介绍一种音频播放方法。其中,前台运行的应用指电子设备当前正在运行的,且正在显示屏上显示的应用。后台运行的应用指电子设备当前正在运行的、但不在显示屏上显示的应用。前台运行指应用正在运行,且该应用的显示界面在显示屏上显示。后台运行指应用正在运行,但是该应用的显示界面不在显示屏上显示。
以手机为例,对上述概念进行解释。手机的显示屏正显示地图应用(比如高德地图)的显示界面,那么此时,地图应用在前台运行。若手机在显示地图应用的显示界面过程中,接收到来电,显示屏显示来电界面(包括来电号码,接听,挂断等控件的界面),而不显示地图应用的显示界面,那么此时,地图应用切换到后台运行,而电话应用在前台运行。
以下介绍的音频播放方法以应用在图2所示的电子设备所示的架构中为例进行描述。
图13A是本申请实施例的一种音频播放方法所应用的电子设备的软件结构框图。以Android系统为例,如图13A所示,应用程序层内可以安装浏览器,优酷,腾讯视频,地图,爱奇艺,抖音,网易云音乐等应用程序。应用程序框架层可以包括媒体播放器(MediaPlayer)、音频策略执行器(AudioFlinger)、混音模块。
其中,媒体播放器(MediaPlayer),负责对前后台运行的应用的音频数据进行输出。应理解,媒体播放器(MediaPlayer)仅是一种示例,音频播放的接口还可以为AudioTrack等,本申请对此不作限定。
音频策略执行器(AudioFlinger),负责输入输出流设备的管理及音频流数据的处理传输。
混音模块,负责对音频数据进行混音,并将混音后的音频数据输出到音频设备。
硬件抽象层HAL可包括:音频硬件抽象层(Audio HAL)。其中,Audio HAL负责与音频硬件设备的交互,可以由框架层的音频策略执行器AudioFlinger直接调用。
应理解,下述实施例中对于系统库、内核层等各个功能模块的介绍可参阅图8A所示 实施例中的介绍,后面不再重复赘述。
如图13B所示,为本申请实施例提供的一种安卓操作系统数据流向示意图。示例性的,在本申请实施例中,前后台运行的应用(以下简称:前后台应用)可以调用框架层的媒体播放器(MediaPlayer),然后对前后台应用播放的音频流进行输出,并将输出的音频流送到AudioFlinger,然后AudioFlinger将音频流送到混音模块,由混音模块对音频流进行处理,并给出相应的混音策略。最后框架层的混音模块调用硬件抽象层HAL层的AudioHAL,由AudioHAL将输出的音频流送到硬件层的设备进行播放。
如图13C所示,为本申请实施例提供的一种软件模块示意图。具体来说,前后台应用可将各自的音频流送到混音模块,由混音模块中的音源分类器对前后台应用的音频流进行分类识别,然后送到混音模块的策略库。策略库根据音频流的分类识别结果给出相应的混音策略。需要说明的是,图13C所示的示意图中将图13B所示示意图中的混音模块具体细分为:音源分类器和策略库。
需要说明的是,本申请实施例的音频播放方法可以适用于单设备,也可以适用于多设备分布式协同场景,例如可以将手机上的音频(比如,导航和音乐)投音到车机上,可以由车机决定如何播放音频。
如图14所示,为本申请实施例提供的一种音频播放方法流程图,参阅图14所示,该方法可包括如下步骤:
S1401:电子设备接收到第一触发事件和第二触发事件。
其中,触发事件可以为用户点击应用程序的图标的操作事件,或者也可以为用户在应用程序上播放音乐的点击操作事件,或者还可以为用户通过语音的方式打开应用程序并播放音乐的操作事件。
示例性的,第一触发事件可以为将正在前台运行的应用切换到后台运行的操作事件,第二触发事件可以为启动应用,并在前台显示该应用的操作事件。
S1402:电子设备响应第一触发事件和第二触发事件,获取第一音频流和第二音频流的音频播放策略。
需要说明的是,本申请实施例中的第一音频流和第二音频流来源于不同的应用。
为了描述方便,本申请实施例中可将前台应用所播放的音频流记为“第一音频流”,将后台应用所播放的音频流记为“第二音频流”。
以下详细介绍音频播放策略如何确定的过程。该过程具体可包括两个步骤:音频流的分类和播放策略的确定。
首先介绍如何对音频流进行分类。
本申请实施例中,电子设备中的音源分类器(也可以称为音频分类系统或分类模块)可从应用程序(前台应用和后台应用)获取第一音频流的第一音频属性,并根据第一音频属性对第一音频流进行归类,得到第一音频流对应的第一类别。同样的,可获取第二音频流的第二音频属性,并根据第二音频属性对第二音频流进行归类,得到第二音频流对应的第二类别。
应理解,对于第一音频流和第二音频流进行分类的执行顺序可以有先后顺序,也可以同时进行,本申请对此不作限定。
为了描述方便,本申请实施例中可将第一音频流的音频属性记为“第一音频属性”,将第二音频流的音频属性记为“第二音频属性”,将第一音频流对应的类别记为“第一类别”, 将第二音频流对应的类别记为“第二类别”。
在一些实施例中,音频流的音频属性(AudioAttributes)可包括:用法(USAGE)属性和内容类型(CONTENT_TYPE)属性两种属性。应理解,USAGE属性和CONTENT_TYPE属性是从不同的角度对音频流划分的音频属性。
需要说明的是,音频流的音频属性是由应用程序来配置的,不同的音频流,可能对应相同或不同的音频属性。来自同一个应用程序的不同的音频流,可能配置不同的音频属性。
本申请实施例中,当获取到第一音频流和第二音频流之后,可获取每一个音频流的音频属性,然后电子设备中的音源分类器可根据音频流的音频属性对音频流进行分类,从而确定出音频流所对应的类别。示例性的,参阅图15A所示,音源分类器可根据映射表对音频流的音频属性(包括USAGE属性/CONTENT_TYPE属性)进行分类,并将音频属性所属的类别确定为音频流对应的类别。
作为一种可能的实现方式,音频流的音频属性所归属的类别(即上述所说的映射表)可参阅如下表4所示。
表4
可以理解的是,上述表4可预先保存在电子设备中,当然,保存形式并不限于上述表格的形式,本申请对此不作限定。
需要说明的是,每一个音频流中可包括USAGE属性和CONTENT_TYPE属性,USAGE 属性和CONTENT_TYPE属性的优先级可以相同,也可以不同,本申请对此不作限定。
在一些实施例中,USAGE属性和CONTENT_TYPE属性之间的优先级为:USAGE属性的优先级高于CONTENT_TYPE属性的优先级。那么,音源分类器在获取到音频流之后,可以先判断USAGE属性是否有对应的类别。若USAGE属性有对应的类别,则将该音频流归属到对应的类别下;若USAGE属性没有对应的类别,则判断CONTENT_TYPE属性是否有对应的类别,若CONTENT_TYPE属性有对应的类别,则将该音频流归属到对应的类别下。
举例来说,假设音源分类器获取到的音频流包括音频流1和音频流2。以音频流1为例,比如音频流1中包括的USAGE属性和CONTENT_TYPE属性分别为:USAGE_VOICE_COMMUNICATION、CONTENT_TYPE_MUSIC。此时电子设备可确定USAGE属性即USAGE_VOICE_COMMUNICATION是否有对应类别。根据表4可知,USAGE_VOICE_COMMUNICATION可划分为语音通话类别。也就是说,USAGE属性有对应的类别,则可将音频流1的类别确定为语音通话类别。
以下开始介绍如何音频流的播放策略的确定过程。
在一些实施例中,电子设备在S1403中确定出第一音频流和第二音频流所属的类别之后,可根据两个音频流所属的类别,确定音频流的具体播放策略。示例性的,参阅图15B所示,可将前台音频类别和后台音频类别输入到策略库中,然后根据策略库得到具体的音频播放策略。
举例来说,假设后台应用为酷狗音乐、前台应用为喜马拉雅听书为例。当酷狗音乐播放音乐的时候,用户打开喜马拉雅听书应用,酷狗音乐会失去音频焦点进入后台继续播放。此时,电子设备会识别出前后台音频流的类型,例如,后台音频流的类型为音乐(假如是重金属类音乐),前台音频流的类型为媒体,则此时需要确定当音频流类型为音乐和媒体时,应该如何播放音频流,以提升用户体验。
应理解,本申请实施例涉及的“打开”应用,可以是指启动应用,并在前台显示该应用,或者,将正在前台运行的应用切换到后台运行。
在一些实施例中,电子设备中可保存音频类别与音频播放策略之间的对应关系(即上述所说的策略表)。作为一种可能的实现方式,可参阅下述表5所示。
需要说明的是,以下表5中的音频播放策略为针对一些发生概率比较大的场景,或者说用户使用频率比较高的场景所设置的策略。
表5
需要说明的是,上述表5中所涉及到的“-”表示场景出现概率比较低,使用默认策略,即播放前台音频流;“前台”表示只输出前台音频流,丢弃后台音频流;“后台”表示只输出后台音频流,丢弃前台音频流;“混合”表示前后台音频流混音输出,即同时播放;“抢占式”表示停止后台音频流,播放前台音频流。
应理解,“丢弃”指的是音频流在播放,并没有暂停。例如,在听音乐的时候来了一个提示音,在该时刻后台的音乐可继续播放,但用户仅能听到提示音的声音。“停止”指的是暂停音频流的播放,例如在听音乐的时候来了一个提示音,在该时刻后台的音乐可暂停播放,当提示音结束之后,后台的音乐可继续播放。
从上述表5(策略表)中可以得出以下结论:
结论1:如果前台音源类型是短音,如操作/事件音、通知提示音等,则播放策略偏向“前台”,主要考虑是短音持续时间短,输出完成后可以继续播放后台。
结论2:当语音导航作后台、音乐/视频/游戏类作前台时,播放策略偏向后台导航发声。主要考虑是导航音属于非连续中短音和其应用优先级,可以在同时发生的时候输出导航声,导航不发声期间输出前台声。
结论3:当前后台都是游戏/视频/音乐类时,播放策略偏向“抢占”,直接停止后台的应用发声,只保留前台发声。
结论4:语音通话的优先级最高,播放策略偏向抢占所有后台发声。若后台音频流的类型是导航,则通话期间只输出通话发声,通话结束可继续输出导航发声。
考虑到不同用户的喜好可能不同,本申请另一些实施例中,当策略库按照表5给出相应的播放策略之后,可以在电子设备的显示屏上显示提示信息,以提示用户是否选择按照策略库推荐的策略来播放音频。需要说明的是,当策略库给出播放策略之后,可在预设时 长(比如,30s)后显示提示信息。
示例性的,参阅图16所示,假设前台应用为华为音乐。比如当前前台应用播放的歌曲为“夏天的风”,电子设备的显示屏上显示界面1600,后台应用为网易云音乐,此时电子设备给出的播放策略为播放前台应用的音乐暂停后台音乐。此时电子设备可播放前台音乐,然后在预设时长后,电子设备的显示屏上可显示用户界面1610。其中,用户界面1610中可包括提示框1611,例如该提示框的内容可以包括提示信息“是否要按照推荐播放音乐?”1612、选择按钮“是”1613、选择按钮“否”1614。用户可通过点击选择按钮来选择是否播放前台音乐。
假设用户点击了选择按钮“是”1613,则电子设备可继续播放前台音乐,后台音乐暂停播放。若用户点击了选择按钮“否”1614,则电子设备可停止前台音乐,即前台后音乐都暂停播放,然后用户可根据自身的喜好等重新选择音乐的播放策略。当然,若用户点击了选择按钮“否”1614,则电子设备可同时播放前台后音乐,即混音播放。
作为一种可能的实施方式,当用户点击选择按钮“否”1614之后,可以在显示屏上显示用户界面1620。其中,用户界面1620中可包括音频播放的策略表1621,比如可包括播放前台音乐1622、播放后台音乐1623、混音播放1624、暂停播放1625,其它1626。然后用户可在上述选择框中选择播放策略,比如用户选择了播放前台音乐1622。在用户界面1620中,此时的前台音乐可暂停播放,然后当用户选择之后,根据用户的选择再确定是否继续播放,当然,此时的前台音乐也可以一直播放,不暂停,本申请对此不作限定。
需要说明的是,其它1626可以包括如下策略:降低后台音乐音量、增大前台音乐音量、推荐舒缓类型的音乐、推荐演奏乐等等。
可以理解的是,电子设备可以对用户界面1610上显示的提示框1611设置显示时间,例如可设置为显示1分钟,当1分钟时间达到时,若用户没有选择播放策略,则可自动消失。
应理解,上述提示信息1612也可以通过语音播报的形式来提醒用户,然后用户可通过语音的方式来选择播放策略,本申请对此不作限定。并且,提示信息1612的内容及形式仅是一种示例,其可以根据实际场景发生变化。比如,手机的模式为静音模式,此时手机上正在播放音乐,当前台来电时,手机的语音助手可发出提示信息“是否要接听来电?”,这样可方便用户及时的接听来电。
以下以一些具体场景为例对上述过程进行介绍。示例性的,参阅如下表6所示。
表6
上述表格仅是一种示例,在实际场景中,也有可能是其它的播放策略,本申请对此不作限定。示例性的,比如在儿童故事场景,可以给出适合儿童的欢快音乐或者在部分游戏的音效场景,可以停止后台音乐或者匹配契合的音乐或者在视频播放场景,可以停止后台音乐等等。
考虑到音乐的风格比较多,比如音乐可包括流行音乐、摇滚音乐、民谣音乐等,在多 个音频流同时播放时,不同风格的音乐可能会有不同的播放策略。因此,本申请实施例以下针对后台应用的音频流为音乐类型,前台应用的音频流为听书/讲故事(比如,媒体音类别)等这种特殊场景来继续说明。
当音源分类器对音频流进行分类之后,若确定第一音频流的类别为第一设定类别,且第二音频流的类别为第二设定类别,则可进一步判断音乐的具体风格(或者说音乐的具体类型),继续对第二音频流进行分类,然后根据第二音频流的类型确定播放策略。
为了描述方便,本申请实施例中可将媒体音类别,比如听书/讲故事等类型记为“第一设定类别”,将音乐类别记为“第二设定类别”。
在一些实施例中,可以通过音频分类模型(比如,YAMNet音频分类模型)对音频流进行分类。示例性的,参阅图17A所示,为本申请实施例提供的一种音频分类模型的示意图。应理解,YAMNet音频分类模型采用Depthwise-Separable卷积架构,其具有规模小、速度快的特点,整个模型大小约14.5M,网络权重数约1.9M个,运算量为69.2M次乘法运算。
参阅图17B所示,为本申请实施例提供的一种利用音频分类模型对音频流进行分类的处理流程示意图。具体来说,可首先采集后台应用的音频流,然后对采集到的音频流进行重采样,得到16KHz单声道音频,接着对16KHz单声道音频进行分帧,并做快速傅里叶变换(fast fourier transform,FFT)得到频谱,然后利用64阶梅尔滤波器组对频谱进行处理,得到梅尔对数频谱,最后对梅尔对数频谱按照960ms进行分段得到96*64的特征向量。然后将特征向量输入到YAMNet音频分类模型,由YAMNet音频分类模型对音频流进行分类,计算每一种风格类别的概率,最终输出概率最高的风格类别。
需要说明的是,图17A和图17B中的YAMNet音频分类模型可参考现有技术,本申请在此不做过多说明。
在另一些实施例中,电子设备也可以不利用音频分类模型进行音频流的分类。示例性的,电子设备可以获取应用对音乐风格进行分类的类别,将应用对音乐风格进行分类后的类别作为最终的类别。
作为一种可能的实现方式,电子设备中针对音乐类别可设置有相应的音频播放策略,比如,不同的音乐风格(类型)可以推荐不同的音频播放策略。示例性的,可参阅表7所示。
表7
音乐风格 | 播放策略 |
流行 | 抢占式 |
摇滚 | 抢占式 |
民谣 | 抢占式 |
电子 | 抢占式 |
舞曲 | 抢占式 |
说唱 | 抢占式 |
英伦 | 抢占式 |
金属 | 抢占式 |
朋克 | 抢占式 |
蓝调 | 混合 |
雷鬼 | 抢占式 |
世界音乐 | 抢占式 |
轻音乐 | 混合 |
爵士 | 混合 |
乡村 | 抢占式 |
R&B/Soul | 混合 |
古典 | 混合 |
民族 | 抢占式 |
拉丁 | 抢占式 |
新世纪 | 抢占式 |
古风 | 抢占式 |
后摇 | 混合 |
Bossa Nova | 抢占式 |
从上述表7可以得出:若后台音乐类型为蓝调、R&B/Soul、古典、轻音乐、后摇等舒缓类音乐,即适合作为听书背景的风格,则播放策略可以是“混合”,即混音播放,其余类别的策略则保持不变。
也就是说,在本申请实施例中,如果后台音乐与前台应用的音频流在同时播放时,若后台音乐的风格不会使得播放的音频嘈杂混乱,则可以将后台音乐作为前台音频流的背景音乐,以提升用户体验。
S1403:电子设备根据确定的音频流的播放策略对第一音频流和第二音频流进行播放。
当策略库根据前后台应用的音频流类别确定出音频流播放策略之后,电子设备可根据播放策略播放音频流。例如,播放策略为:停止后台音乐,则此时电子设备可播放前台音乐,暂停后台音乐;若播放策略为:混音播放,则此时电子设备可同时播放前后台音乐。
通过本申请实施例的方案,电子设备在同时播放多个音频流时,可以按照策略库根据音频流的类别确定的音频流的播放策略播放多个音频流,以避免出现音频嘈杂混乱的情况出现,提升用户体验。
基于上述实施例,本申请实施例还提供一种音频播放方法,如图18所示,该方法可包括如下步骤:
S1801:电子设备通过第一应用播放第一音频。
S1802:电子设备响应于用户对第一应用的第一操作,将第一应用切换到后台运行。
S1803:电子设备响应于用户对第二应用的第二操作,将第二应用运行在前台,并通过第二应用播放第二音频。
S1804:电子设备确定第一音频和第二音频的播放策略。
S1805:电子设备根据播放策略对第一音频和第二音频进行播放。
对于上述步骤的具体实现可参阅前述实施例中的详细介绍,此处不再赘述。
进一步的,当音频播放方法应用在多设备连接场景,例如,手机分别与音箱、智慧屏连接,则手机可以向音箱和智慧屏投音,从而使得手机、音箱和智慧屏可以同时播放同一音频文件。在该场景下,由于不同的电子设备的音效处理能力、或音效处理方式等存在差异,从而会导致同一音频文件在不同电子设备上的音频播放效果存在差异,使得用户体验 较差。
基于该技术问题,本申请还提供一种应用于多设备连接场景下的音效处理方法,可以结合电子设备的音效配置信息,确定不同电子设备使用的音效配置信息。从而可以基于上述确定的音效配置信息,进行相应的音效处理,并在对应的电子设备上播放,从而降低不同电子设备的音频播放效果差异,使得用户听起来基本上相同。
例如,音效配置信息可以包括音效算法信息、音效状态信息、音效模式信息、音频参数、均衡器设置信息、增益设置信息等。其中,音效算法信息用于指示音效算法,例如杜比(Dolby)算法、数字影院音效系统(digital theater system,DTS)算法等。音效状态信息用于指示音效状态,音效状态可以包括开、和关。音效模式信息用于指示音效模式,例如音乐模式、电影模式、游戏模式等。音效参数指的是音效算法在对应音效模式、均衡器设置和增益设置下所使用的参数。如,音效参数可以包括产品名(PRODUCT)、音效模块名(NAME)等。示例的,音效算法中所使用的音效参数的部分或全部可以是音效算法厂商自定义的等,例如,产品名可以是音效算法厂商自定义,音效模块名是标准中定义的。均衡器设置信息用于设置均衡器,可以包括Profile1、Profile2等。增益设置信息用于设置增益,例如,+3db、+2db。
其中,不同的设备对应的音效配置信息可以是不同的,也可以是相同的。例如,如表8所示。
表8
设备标识 | 音效算法 | 音效状态 | 音效模式 | 音效参数 | 均衡器设置 | 增益设置 | …… |
ID1 | Dolby | 开 | 音乐 | 参数1 | Profile1 | +3db | …… |
ID2 | DTS | 关 | 电影 | 参数2 | Profile2 | +2db | …… |
ID3 | Dolby | 开 | 音乐 | 参数1 | Profile1 | +3db | …… |
需要说明的是,不同的电子设备使用的音效算法的厂商可能不同,因此对于同一音效算法、音效模式、均衡器设置和增益设置的情况下,所使用的音频参数可能是不同的。但是,在同一音效算法、音效模式、均衡器设置和增益设置下,不同电子设备的音频播放效果大致相同。
其中,在多设备连接场景中,电子设备可包括主电子设备(以下为便于描述简称为主设备,又可以称之为master设备)和从电子设备(以下为便于描述简称为从设备,又可以称之为slave设备)。具体的,一个主设备可以与一个或多个从设备连接。主设备和从设备可以通过无线方式连接,也可以通过有线方式连接,对此不作限定。例如,主设备和从设备可以通过Wi-Fi连接、和/或蓝牙连接互相传输数据,消息,信息,参数,文件(如,音频文件,视频文件,图片文件,文档文件)或控制指令中的至少一种等。主设备为音频投递方,从设备为音频接收方。当主设备与N个从设备连接时,例如N的取值为大于或等于2的正整数,主设备可以将音频文件或音频数据发送给N个从设备中的部分从设备、或者N个从设备,具体的主设备将数据发送给与自身连接的哪些从设备,与数据类型、从设备的设备能力或用户的设置等相关。例如,主设备与大屏设备、音箱和插座连接,插座不具备音频播放功能,而用户只选择了音箱,未选择大屏设备,在这种情况下,如果主设备接收到用户播放某一音频文件的操作,主设备可以响应于用户播放上述音频文件的操作,只向音箱发送该音频文件或该音频文件的音频数据,以使得音箱进行播放。
本申请实施例适用于多设备连接的应用场景。通常,多设备连接的应用场景中包括一个主设备和至少一个从设备。示例的,如图19所示,为本申请实施例的一种多设备连接的应用场景,包括主设备01、从设备02、从设备03、从设备04、从设备05、从设备06和从设备07等。需要说明的是,图19所示的多设备连接的应用场景仅为一个举例说明,本申请实施例对多设备连接的应用场景中主设备的个数、从设备的个数等不作限定。
在该场景下,主设备01可基于通信网络与多个从设备互联,然后主设备01可以控制从设备02、从设备03、从设备04、从设备05、从设备06和从设备07中的至少一个电子设备播放音频。示例性的,该通信网络可以是局域网,比如可以是Wi-Fi热点网络、无线保真点对点(wireless fidelity-peer to peer,Wi-Fi P2P)网络、蓝牙网络、zigbee网络或NFC网络等。作为一种可能的实现方式,该多个电子设备之间还可以是基于移动网络建立无线连接,例如该移动网络包括基于2G,3G,4G,5G以及后续的标准协议建立的移动网络。作为一种可能的实现方式,该多个电子设备还可以通过移动网络与至少一个服务器建立连接,各个设备之间通过服务器传输数据,和/或,消息,和/或,信息,和/或,信令,和/或,指令。作为一种可能的实现方式,该多个电子设备还可以通过数据线进行连接。
需要说明的是,主设备01可以控制其它的电子设备播放同一音频,主设备01也可以控制其它的电子设备播放不同的音频,本申请对此不作限定。
以分层架构的鸿蒙操作系统为例,示例性说明该音效处理方法所应用的电子设备的软件系统。
示例的,图20为本申请实施例的一种电子设备的软件系统图。如图20所示,应用层包括应用程序,例如媒体应用(如相机应用,音乐应用,视频应用,音频应用)、代理应用、虚拟设备应用(device virtual,DV)等。代理应用用于实现设备间的信息交互,例如音效配置信息、音频数据等。需要说明的是,代理应用可以电子设备在出厂之前预配置好的。此外,应用层还可以包括音频控制中心,用于实现音效控制、以及对音频设备的控制。这里的音频设备可以为与电子设备连接的具有音频播放能力的电子设备,例如音箱、大屏设备、手机等,也可以为电子设备自身的音频播放设备,例如扬声器等。或者,应用层包括设备发现模块(例如,Wi-Fi自发现模块)和设备连接模块(例如,Hiplay)。
框架层为应用程序层的应用程序提供应用编程接口API框架。示例的,API框架可以包括音频原生框架和音频扩展框架。其中,音频原生框架可以为鸿蒙操作系统的自带的音频框架,例如,音频原生框架包括音频管理器(AudioManager)、音频服务(AudioService)、音频策略执行器(AudioFlinger)、音频播放器(AudioTrack)等。音频扩展框架指的是音频功能的扩展框架,可以包括音效调节器(AudioEffect、或者AudioEffectimpl)、音频策略扩展(AudioPolicyimpl)、音频策略执行器扩展(AudioFlingerimpl)。
硬件抽象层位于框架层和内核层之间,可以包括音频硬件抽象层(Audio HAL)、虚拟音频播放设备(又可以称之为虚拟音频设备,例如DV Audio HAL)、Wi-Fi模块或其它通信模块等。虚拟音频播放设备为外接音频设备(如音箱、大屏设备)的抽象,用于实现与对应外接音频设备等的通信。
可以理解的是,图20所示的电子设备的软件系统只是示意性说明,并不构成对电子设备的软件系统限定。需要说明的是,当图20所示的电子设备的软件系统中音频原生框架为安卓操作系统的自带的音频框架的情况下,图20所示的电子设备的软件系统也可以为安卓操作系统。
下面结合具体示例,对本申请实施例音效处理方法进行详细说明。
示例一:在多设备连接场景下,主设备负责解析音频文件,得到音频数据,并针对不同设备,对音频数据进行相应的音效处理;从设备无需解析音频文件,以及音效处理。
以手机为主设备、音箱为从设备为例。如图21所示,手机显示音乐应用的界面2100,界面2100包括待播放的音频文件的标识(如音乐名称、音乐图标等)、虚拟控件2101和虚拟控件2102。虚拟控件2101用于控制音频播放或暂停。虚拟控件2102用于用户选择是否在音箱进行音频播放。当虚拟控件2102被选中时,在音箱进行音频播放。当虚拟控件2102未被选中时,不在音箱进行音频播放。在虚拟控件2102被选中的情况下,手机检测到用户点击虚拟控件2101的操作。响应于用户点击虚拟控件2101的操作,手机对待播放的音频文件进行解析,得到第一音频数据。然后,手机基于第一音效配置信息,对第一音频数据进行音效处理,得到第二音频数据,以及基于第二音效配置信息,对第一音频数据进行音效处理,得到第三音频数据。最后,手机播放该第二音频数据,以及将第三音频数据发送给音箱,使得音箱可以播放该第三音频数据。从而使得手机和音箱播放上述待播放的音频文件时使得用户听起来的音效大体相同。进一步的,在一些实施例中,手机将第三音频数据发送给音箱后,经过第一时长,播放第二音频数据。第一时长为第三音频数据从手机发送到音箱播放所需的时间。例如,第一时长为第一子时长和第二子时长之和。第一子时长为第三音频数据从手机传输到音箱所需要的时间,第二子时长为第三音频数据到达音箱后,到音箱播放所需的时间。从而有助于实现手机和音箱同时播放待播放的音频文件。
示例的,第一子时长可以是手机根据自身与音箱之间的距离计算得到的,第二子时长可以是音箱指示给手机的。例如,音箱可以在与手机建立连接的过程中、或者与手机建立连接后,向手机发送指示第二子时长的信息。
在本申请的另一些实施例中,手机还可以向音箱发送播放时间信息,播放时间信息用于指示开始播放的时间,从而使得手机和音箱可以同时根据播放时间信息,进行相应的播放,以实现手机和音箱的同步播放。例如,以图21为例,在虚拟控件2102被选中的情况下,手机检测到用户点击虚拟控件2101的操作。响应于用户点击虚拟控件2101的操作,手机对待播放的音频文件进行解析,得到第一音频数据。然后,手机基于第一音效配置信息,对第一音频数据进行音效处理,得到第二音频数据;手机根据第二音效配置信息,对第一音频数据进行音效处理,得到第三音频数据,并将第三音频数据和播放时间信息发送给音箱。然后,手机根据播放时间信息,播放第二音频数据;音箱接收到第三音频数据和播放时间信息后,根据播放时间信息,播放第三音频数据,从而实现手机和音箱的同时播放某一音频文件时,手机和音箱播放上述待播放的音频文件时使得用户听起来的音效大体相同。
另外,需要说明的是,在音箱接收到手机发送的第二音频数据后,音箱不再对该第二音频数据进行音效处理。在这种情况下,音箱的音效状态可以为关,即音箱处于音效关闭状态。在一些实施例中,手机还向音箱发送用于关闭音效的消息或指令,该消息或指令触发音箱关闭音效,使得音效状态为关闭。以避免音箱重复对音频数据进行音效处理。示例的,当音箱的音效状态为关闭时,手机可以不向音箱发送用于关闭音效的消息或指令。其中,音箱的音效状态可以是手机与音箱建立连接时,手机从音箱获取的。例如,手机向音箱发起连接建立请求的情况下,音箱可以通过连接建立响应将音效状态发送给手机。再例如,在音箱向手机发起连接建立请求的情况下,音箱可以通过连接建立请求将音效状态发 送给手机。或者,音箱的音效状态也可以是手机响应于点击虚拟控件2101的操作,从音箱获取的。例如,手机响应于点击虚拟控件2101的操作,获取音箱当前使用的音效配置信息。
在另一些实施例中,当手机的音效状态为关闭时,则手机对第一音频数据不进行音效处理。即,手机将第一音频数据发送给音箱,触发音箱播放第一音频数据,手机在将第一音频数据发送给音箱后,经过第一时长,播放第一音频数据。在这种情况下,如果音箱的音效状态为开,则手机向音箱发送用于关闭音效的消息或指令,该消息或指令触发音箱关闭音效。或者,在手机的音效状态为关闭,音箱的音效状态为开启的情况下,手机开启音效,向音箱发送用于关闭音效的消息或指令。
其中,第一音效配置信息包括第一音效算法信息、第一音效模式信息、第一音效参数、第一均衡器设置信息、第一增益设置信息。第二音效配置信息包括第一音效算法信息、第一音效模式信息、第二音效参数、第一均衡器设置信息和第一增益设置信息。第一音效算法信息用于指示第一音效算法,第一音效模式信息用于指示第一音效模式,第一均衡器设置信息用于指示第一均衡器设置,第一增益设置信息用于指示第一增益设置。第一音效参数为手机中第一音效算法在第一音效模式、第一均衡器设置和第一增益设置下所使用的音效参数。第二音效参数为音箱中第一音效算法在第一音效模式、第一均衡器设置和第一增益设置下使用的音效参数。
示例的,第一音效模式为手机当前使用的音效模式,第一音效算法为手机当前使用的音效算法,第一均衡器设置为手机当前使用的均衡器设置,第一增益设置为手机当前使用的增益设置。或者,第一音效模式为音箱当前使用的音效模式,第一音效算法为音箱当前使用的音效算法,第一均衡器设置为音箱当前使用的均衡器设置,第一增益设置为音箱当前使用的增益设置。在这种情况下,音箱当前使用的音效配置信息可以是手机与音箱建立连接时或手机与音箱建立连接之后,手机从音箱获取的。或者,手机响应于点击虚拟控件2101的操作,获取音箱当前使用的音效配置信息。本申请实施例对获取音箱当前使用的音效配置信息的方式不作限定。
例如,手机的音效配置信息、音箱的音效配置信息如表9所示。
表9
设备标识 | 音效算法 | 音效状态 | 音效模式 | 音效参数 | 均衡器设置 | 增益设置 |
ID1(手机) | Dolby | 开 | 音乐 | 参数1 | Profile1 | +3db |
ID1(手机) | Dolby | 开 | 电影 | 参数4 | Profile2 | +2db |
ID2(音箱) | Dolby | 关 | 电影 | 参数2 | Profile2 | +2db |
ID2(音箱) | Dolby | 关 | 音乐 | 参数3 | Profile1 | +3db |
在第一音效配置信息为手机当前使用的音效配置信息,而手机当前使用的音效配置信息中音效算法为Dolby、音效模式为音乐、音效参数为参数1、均衡器设置为Profile1,增益设置为+3db。则将音箱的音效模式设置为音乐,音效参数设置为参数3,均衡器设置为Profile1,增益设置为+3db。
在一些实施例中,音箱支持的音效配置信息可以预先存储在手机中。例如,音箱支持的音效配置信息可以以列表的形式存储在手机中。手机可以根据基于音箱的标识和手机当前使用的音效配置信息,从音效配置信息列表中,查找第二音效配置信息。第二音效配置信息为与音箱标识、手机当前使用的音效算法、音效模式、均衡器设置和增益设置对应的 音效配置信息。
示例的,音箱支持的音效配置信息可以是在音箱和手机连接建立的过程中或在音箱和手机连接建立之后,由音箱发送给手机的。例如,音箱可以在于手机首次连接建立的过程或者首次与手机连接建立之后,发送给手机。当音箱后续再与手机建立连接,如果音箱支持的音效配置信息未发生变化,则无需在向手机发送自身所支持的音效配置信息。在一些实施例中,当音箱支持的音效配置信息发生变化时,如果音箱与手机处于连接状态,或者音箱与手机处于正在连接状态,则音箱可以再次向手机发送变化后自身支持的音效配置信息。例如,音箱更新软件系统版本,导致自身支持的音效配置信息变化。
例如,如图22的A所示,手机显示智能家居应用的界面2200,界面2200包括设备添加选项2201,响应于用户点击添加选项2201,手机显示界面2210,如图22的B所示,界面2210用于提示用户手机当前处于自动扫描发现附近电子设备的状态。当手机发现电子设备后,在界面2210上显示扫描发现的电子设备的设备信息。示例的,电子设备的设备信息可以包括设备名称、设备型号、和/或设备图标等。例如,以手机扫描发现音箱和大屏设备为例,如图22的C所示,手机在界面2210上显示音箱的图标和设备名称,以及大屏设备的设备图标和设备名称。响应于用户点击音箱的设备名称,手机向音箱发送连接建立请求。音箱接收到连接建立请求,向手机发送连接建立响应,其中,连接建立响应中可以包括音箱支持的音效配置信息、和/或音箱当前使用的音效配置信息。
进一步的,在一些实施例中,连接建立响应中还可以包括设备硬件属性信息。例如,设备硬件属性信息用于标识音箱的硬件设备能力,例如,音频采样率、帧率等。以便于手机识别音箱的硬件设备能力。
示例的,以待播放的音频文件为第一音频文件为例。如图23A所示,音乐应用响应于播放第一音频文件的操作,向AudioTrack 2301发送第一音频文件。由AudioTrack 2301对第一音频文件进行解析,得到第一音频文件的第一音频数据。并将第一音频数据传递给AudioFlinger 2302,并由AudioFlinger 2302传递给AudioFlingerimpl 2303。由AudioFlingerimpl 2303获取第一音效配置信息和第二音效配置信息,并将第一音频数据、第一音效配置信息和第二音效配置信息发送给AudioEffect 2304。由AudioEffect 2304根据第一音效配置信息,对第一音频数据进行音效处理,得到第二音频数据;以及根据第二音效配置信息,对第一音频数据进行音效处理,得到第三音频数据;AudioEffect 2304将第二音频数据发送给Audio HAL 2305,并通过Audio HAL 2305调用手机的扬声器进行播放;AudioEffect 2304将第三音频数据发送给DV Audio HAL 2306,由DV Audio HAL 2306将第三音频数据发送给通信模块2307。并由通信模块2307将第三音频数据发送给通信模块2311。然后,由通信模块2311发送给代理应用2312。再由代理应用2312将第三音频数据通过AudioTrack 2313、经AudioFlinger 2314传递给Audio HAL 2315,通过Audio HAL 2315调用音箱的扬声器进行播放。关于第一音效配置信息和第二音效配置信息可以参见上述相关介绍在此不再赘述。
在一些实施例中,如图23B所示,设备发现模块2321响应于第一触发事件,执行设备发现过程。第一触发事件用于触发设备发现流程。设备发现模块2321发现音箱后,将音箱的设备信息,例如设备标识、设备型号和/或设备图标等,传递给设备连接模块2322。设备连接模块2322响应于第二触发事件,通过DV 2323将连接建立请求发送给代理应用2324。并由代理应用2324将连接建立请求发送给通信模块2307。然后由通信模块2307将 连接建立请求经由通信模块2311发送给代理应用2312。代理应用2312在接收到连接建立请求后,通过AudioService 2331、AudioFlinger 2314从AudioEffect 2332获取音箱当前使用的音效配置信息、音箱支持的音效配置信息等。然后代理应用2312通过通信模块2311向通信模块2307发送连接建立响应,连接建立响应包括音箱当前使用的音效配置信息、音箱支持的音效配置信息。通信模块2307将连接建立响应返回给代理应用2324。代理应用2324将音箱的音效配置信息发送给DV 2323,由DV 2323在硬件抽象层注册DV Audio HAL 2306,以及将音箱的音效配置信息通过音频控制中心2325发送给AudioManager 2326。AudioManager 2326通过AudioService 2327将音箱的音效配置信息发送给AudioPolicyimpl 2328。由AudioPolicyimpl 2328将音箱的音效配置信息发送给AudioFlingerimpl 2303,从而使得AudioFlingerimpl 2303接收到音频数据时,可以根据自身当前使用的音效信息和音箱的音效配置信息,对音频数据进行相应的音效处理。进一步的,在一些实施例中,代理应用2312获取第二子时长,第二子时长为第三音频数据到达音箱后,到音箱播放所需的时间。第二子时长为时长1、时长2和时长3之和,时长1为第三音频数据从通信模块2311到达代理应用2312所需的时间,时长2为第三音频数据从代理应用2312到达Audio HAL 2315所需的时间,即时长2为第三应用数据从代理应用2312经过AudioTrack 2313、AudioFlinger 2314到达Audio HAL 2315的时间。时长3为第三音频数据从Audio HAL 2315到音箱的音频播放设备(如扬声器)所需的时间。其中时长3是代理应用2312从Audio HAL 2315获取的。
以上仅为一种举例说明,并不构成对本申请实施例的限定。
示例二、在多设备连接场景下,主设备将待播放的音频文件、或者待播放的音频文件的标识或地址发送给从设备。由从设备自身对待播放的音频文件进行解析,然后进行音效处理,而从设备进行音效处理所使用的音效配置信息可以是由主设备进行决策后发送给从设备的。
以手机为主设备、音箱为从设备为例。如图21所示,手机显示音乐应用的界面2100,界面2100包括待播放的音频文件的标识、虚拟控件2101和虚拟控件2102。在虚拟控件2102被选中的情况下,手机接收到用户点击虚拟控件2101的操作。响应于用户点击虚拟控件2101的操作,手机对待播放的音频文件进行解析,得到第一音频数据。然后,手机基于第一音效配置信息,对第一音频数据进行音效处理,得到第二音频数据。然后,手机播放第二音频数据,以及将第二音效配置信息和待播放的音频文件发送给音箱,使得音箱可以对待播放的音频文件进行解析,得到第四音频数据,并基于第二音效配置信息对第四音频数据进行音效处理,得到第三音频数据,并播放第三音频数据。进一步,在一些实施例中,手机将第二音效配置信息和待播放的音频文件发送给音箱后,经过第二时长,播放第二音频数据。第二时长为第三子时长和第四子时长之和。第三子时长为第二音效配置信息和待播放的音频文件从手机传输到音箱所需要的时间。第四子时长为第二音效配置信息和待播放的音频文件到达音箱后,到音箱播放第三音频数据所需要的时间。
关于第一音效配置信息和第二音效配置信息可以参见示例一中的相关介绍,在此不再赘述。
可以理解的是,上述是以主设备使用的音频配置信息,确定用于在主设备上进行音频播放所使用的音频配置信息、以及用于在从设备上进行音频播放所使用的音频配置信息的,从而降低主设备和从设备的音频播放效果的差异的。
当然,本申请实施例中,还可以根据从设备使用的音频配置信息,确定用于在主设备上进行音频播放所使用的音频配置信息、以及用于在从设备上进行音频播放所使用的音频配置信息的。例如,以表2为例。手机为主设备,音箱为从设备。在音箱当前使用的音频配置信息中音效算法为Dolby、音效模式为电影、音效参数为参数2、均衡器设置为Profile2,增益设置为+2db时,将手机使用的音频配置信息设置为音效算法为Dolby、音效模式为电影、音效参数为参数4、均衡器设置为Profile2,增益设置为+2db。
对于主设备与两个或多个从设备连接的场景。具体根据哪个从设备的使用的音频配置信息,确定用于在主设备上进行音频播放所使用的音频配置信息、以及用于在从设备上进行音频播放所使用的音频配置信息的,可以是主设备任意选择的一个,也可以是主设备根据某一策略选择的。例如,根据设备优先级最高的从设备使用的音频配置信息,确定用于在主设备上进行音频播放所使用的音频配置信息、以及用于在从设备上进行音频播放所使用的音频配置信息。设备优先级可以是预先配置在主设备中的,例如音箱的优先级高于手机的优先级,手机的优先级高于平板的优先级,平板的优先级高于大屏设备的优先级等。
进一步的,由于不同设备的厂商不同,其参数、功效、音量级数、产品性能及自身音量曲线均不一致,因此,不同的电子设备在同一音量等级下,发出的音量大小可能不同。基于上述实施例,如果在主设备上调节音量,从设备的音量大小可能与主设备的音量大小不同。
比如,电子设备1可以将自身设备上的音频传输到电子设备2、电子设备3等多个设备上进行播放。以电子设备1为手机、电子设备2为音箱为例,手机可以通过通信网络连接音箱,然后可将手机上的音频传输到音箱上进行播放。由于手机和音箱的功放、音量等级、音量曲线等有较大的区别,因此,当在手机上进行音量调节时,手机和音箱上播放的同一音频的音量大小不同,使得用户体验不佳。
基于该技术问题,本申请实施例还提供一种音量调整方法,通过配置绝对音量转换表,当在电子设备1上调节音量之后,电子设备1可将自身设备上的音量对应的音量等级1上报给电子设备2,然后电子设备2可根据绝对音量转换表确定与音量等级1对应的音量等级2,并按照音量等级2在电子设备2上播放音频,从而使得电子设备1和电子设备2在播放音频时,实现音量的一致性。
以两个设备为例,比如第一设备和第二设备为例来说明一个设备控制另一设备进行音量调节,从而使得两个设备在播放同一音频时音量大小一致的过程,对于一个设备控制多个设备进行音量调节的原理和一个设备控制另一个设备进行音量调节的原理类似。假设第一设备要控制第二设备进行音量调节,使得第一设备和第二设备在播放同一音频时,能够达到一致的音量水平。其中,第一设备可以为手机、平板电脑等,第二设备可以是音箱、手表、大屏设备(比如,智慧屏)等,本申请对此不作限定。
应理解,第一设备和第二设备的硬件结构可以参阅前述图2所示的电子设备的介绍,此处不再重复赘述。
以分层架构的Android系统为例,示例性说明电子设备的软件结构。如图24所示,应用程序层内可以包括优酷,爱奇艺,导航,分布式设备虚拟化套件(device virtualization kit,Dvkit)(或者也可以称为“代理服务”),音量控制中心,设置,播控卡片等应用程序。可以理解的是,应用程序层内的应用程序可以为设备系统级的应用程序,也可以为第三方应用程序(application,APP)。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图24所示,应用程序框架层可以包括显示策略服务、电源管理服务(power manager service,PMS)、显示管理服务(display manager service,DMS)、音频服务(AudioService)、音频策略执行器(AudioFlinger)。当然,应用程序框架层中还可以包括活动管理器、窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。
其中,音频服务(AudioService)用于接收音量调整指令。
音频策略执行器(AudioFlinger)为音频策略的执行者,负责输入输出流设备的管理及音频流数据的处理传输。
蓝牙音频传输模型协定(Advanced Audio Distribution Profile,A2dp)HAL为蓝牙设备的虚拟化通路。
分布式设备虚拟化通路(Distributed Mobile Sensing Hardware Abstraction Layer,Dmsp HAL)为虚拟音频设备(比如,Wi-Fi音箱)的虚拟化通路。
音频硬件抽象层(Audio HAL):负责与音频硬件设备的交互,由框架层的音频策略执行器AudioFlinger直接调用。
在本申请实施例中,当用户在电子设备1上调节音量之后,电子设备1可以接收到该音量调节信息,将音量调节信息发送给框架层的音频服务(AudioService)模块,AudioService模块将音量调节信息传递给分布式绝对音量模块,然后分布式绝对音量模块将电子设备1上的音量等级上报给电子设备2。相应的,电子设备2接收到电子设备1上报的音量等级A之后,可根据音量转换表确定与音量等级A对应的音量等级B,然后电子设备2按照音量等级B对应的音量进行音频播放。
以下实施例以应用在图2所示的电子设备的架构、图19所示的应用场景为例进行描述。应理解,图19所示的示意图中的“主设备”可以理解为下述所述实施例中的“source端设备”,“从设备”可以理解为“sink端设备”。
在本申请实施例中,电子设备中可保存有音量等级与绝对音量之间的对应关系。示例性的,参阅表10所示。
表10
音量等级 | 绝对音量(db) | 音频流类型 |
1 | 1 | 媒体流 |
2 | 2 | 媒体流 |
3 | 3 | 媒体流 |
… | … | 媒体流 |
100 | 100 | 媒体流 |
1 | 1 | 铃声流 |
… | … | 铃声流 |
100 | 100 | 铃声流 |
根据表10可以得出,针对每一种音频流类型,音量等级与绝对音量之间都存在对应关系。需要说明的是,在同一音量等级下,不同的音频流类型所对应的绝对音量的大小可能相同,也可能不同,本申请对此不作限定。
进一步的,基于上述表10,电子设备中还可以保存有控制端电子设备的音量等级与被控制端电子设备的音量等级之间的转换关系。需要说明的是,控制端电子设备也可以记为“source端设备”,即发起连接的电子设备,被控制端电子设备也可以记为“sink端设备”,即被连接的电子设备。示例性的,以媒体流为例,source端设备和sink端设备的绝对音量之间的转换关系可参阅表11所示。
表11
音量等级(source) | 音量等级(sink) |
1 | 10 |
2 | 15 |
3 | 22 |
4 | 30 |
5 | 35 |
6 | 40 |
… | … |
15 | 100 |
从表11可知,当source端电子设备的音量等级为1时,sink端电子设备的音量等级为10。
示例性的,比如在图19所示的应用场景中,主设备01可以与其它的电子设备建立连接,当主设备01进行音量调节时,比如可向从设备02发送音量调节对应的音量等级,例如音量等级为3,然后从设备02根据保存的音量等级之间的转换关系,确定在主设备01的音量等级为3时从设备02对应的音量等级为22,然后从设备02按照音量等级为22对应的音量播放音频。
以下以第一设备和第二设备为例,对本申请实施例的音量调整方法进行详细介绍。
如图25所示,为本申请实施例提供的一种音量调整方法流程图,参阅图25所示,该方法可包括如下步骤:
S2501:第一设备将音频数据传输到第二设备。
可选的,在第一设备将音频数据传输到第二设备之前,第一设备可播放音频数据,也就是说,第一设备可以在播放音频数据之后再进行音频数据的传输。当然,第一设备也可以先与第二设备建立连接,然后再将音频数据传输到第二设备。示例性的,第一设备可播放第一音频,然后响应用户的第一操作,将第一音频切换到第二设备上播放。
应理解,第一音频为第一设备上某一个应用播放的音频数据,第一操作可以为用户对显示界面上按钮(比如,“音频切换”按钮)的点击操作等。
首先,以第一设备为手机,第二设备为智慧屏为例,对第一设备与第二设备建立连接的过程进行介绍。
参阅图26A所示,手机显示主界面2600。其中,主界面2600中可包括多个应用程序,比如电子邮件、时钟、图库等。用户可以在主界面2600上通过手势操作调出控制栏,进而在控制栏中选择目标设备。示例性的,手势操作可以是用户在手机的主界面2600上从左下角向上的滑动操作。当手机检测到该手势操作时,可在主界面上显示用户界面2610。其中,用户界面2610中可包括控制栏2611,该控制栏2611中包括至少一个可连接设备列表,比如可包括“智慧屏”2612、“MateBook X”2613。用户可在可连接设备列表中点击“智 慧屏”2612,手机可响应用户对“智慧屏”2612的点击操作,向“智慧屏”发送请求连接的指令。
需要说明的是,在本申请实施例中,用户界面2610中显示的可连接设备列表中的电子设备可以为与第一设备(手机)处于同一局域网下的其它电子设备;或者用户界面2610中显示的可连接设备列表中的电子设备可以为与第一设备(手机)登陆了同一个用户帐号的电子设备。
在另一些实施例中,手势操作还可以是其它操作,比如,从右下角向上等的滑动操作,在其他实施例中,手势操作还可以是从左下角向上/从右下角向上、且以具有一定的压力的滑动操作,比如,手机检测到从左上角向下的滑动操作,且显示屏上设置的压力传感器检测到该滑动操作产生的压力值大于阈值时,手机才显示控制栏2611。
在其他实施例中,手势操作还可以是从左下角向上/从右下角向上等的滑动操作,且该滑动操作在终点位置无间隔的停留或长按预设时长。比如,手机检测到从左上角向下的滑动操作,且手机检测到该滑动操作滑动到终点位置时,在该终点位置停留或长按预设时长(比如2秒),手机才显示控制栏2611。
在其他实施例中,手势操作还可以是其它操作,比如,在显示屏上画圈、画多边形等的操作;或者,手势操作还可以是“摇一摇”等操作;或者任一种设置的隔空手势,本申请实施例不作限定。
作为一种可能的实现方式,还可以用语音指令代替上述的手势操作。
相应的,“智慧屏”2612可接收手机(比如,HUAWEI Mate 30)发送的请求连接的指令。示例性的,参阅图26B所示,“智慧屏”上可显示界面261,该界面261上可包括提示框262,例如,该提示框262的内容可以为“HUAWEI Mate 30请求连接,是否同意?”、“允许”按钮263、“拒绝”按钮264。
具体而言,智慧屏2612上的代理服务可在接收到请求连接的指令之后,收集智慧屏的功放、音量等级、音量曲线等参数。当用户在智慧屏的界面261上点击“允许”按钮263之后,智慧屏2612上的代理服务可将智慧屏的功放、音量等级、音量曲线等参数发送给手机。继续以图26A为例,手机的显示屏上可显示用户界面2620。其中,用户界面2620中可包括“音频切换”按钮2621、至少一个已连接的设备列表2622,比如“智慧屏”2612。
比如用户要将手机中的某个音频传输到智慧屏2612,则用户可以在界面2620中点击“音频切换”按钮2613,此时手机可响应该点击操作,在显示屏上可显示用户界面2630。其中,用户界面2630中可包括至少一个可进行音频切换的设备列表2631。用户可在可进行音频切换的设备列表2631中选择“智慧屏”2612,从而将手机上的音频切换到“智慧屏”2612上进行播放。
具体来说,手机可将音频数据从所在的应用程序将脉冲编码调制(Pulse Code Modulation,PCM)数据写入到音频系统,然后由音频系统选择智慧屏2612,将音频数据通过局域网(或者Wi-Fi直连)传给智慧屏2612。智慧屏2612的代理服务接收到音频数据之后,通过播放器播放出来。
需要说明的是,上述是以手机将音频数据传输到一个设备为例进行的介绍,如果手机要将音频数据传输到两个设备(比如,设备1和设备2),则可以将一个音频数据拷贝为两个音频数据,比如音频数据1和音频数据2,然后将音频数据1传输到设备1,将音频数据2传输到设备2。应理解,音频数据1和音频数据2为相同的音频数据。或者还可以将 手机上的一个双声道的音频数据拆分为两个声道,其中一个声道的音频数据传输给设备1,另一个声道的音频数据传输给设备2,从而实现音频数据的传输。
S2502:第一设备确定第一音量等级。
通过S2501第一设备可将音频数据切换到第二设备播放,然后第一设备可获取第二设备当前的音量等级,并确定与第二设备当前的音量等级对应的第一设备的第一音量等级。具体的,第一设备获取第二设备当前的音量等级,并根据音量等级转换表将第二设备当前的音量等级转换为第一设备对应的音量等级。示例性的,假设第二设备当前的音量等级为100,则根据上述表2中的对应关系可知,对应的第一设备的音量等级为15。
需要说明的是,第二设备当前的音量等级可以理解为在本次建立连接之前,第二设备上一次播放音频的音量等级。
S2503:第一设备接收到触发事件。
其中,所述触发事件为用户在第一设备上进行音量调节的操作事件。示例性的,用户可以通过第一设备(比如,手机)上的物理按键、播控卡片、设置等进行音量调节的操作。
需要说明的是,该触发事件可以为作用在手机上的用户操作产生的事件,例如该用户操作可以记为“第二操作”。
应理解,当第一设备的音频数据切换到第二设备播放之后,用户在第一设备上调节音量时调节的是第二设备的音量,而不是第一设备的本地音量。
S2504:第一设备响应触发事件,向第二设备发送音量调节指令。
其中,该音量调节指令中可包括第一设备的第二音量等级,该第二音量等级可以理解为用户当前在第一设备上所调节的音量对应的音量等级。
可选的,该音量调节指令中还可以包括第一设备向第二设备传输的音频数据的音频流类型,比如音频流类型为媒体流或者铃声流等。需要说明的是,音频数据的音频流类型也可以在第一设备与第二设备的连接过程中由第一设备传递给第二设备。
当用户通过物理按键、播控卡片、设置等进行音量调节之后,第一设备可接收到音量调节信息,然后第一设备可将音量调节对应的音量等级(比如,第二音量等级)发送给第二设备。示例性的,比如在S2502中确定的第一设备的音量等级为15,对应的是第一设备的最大音量等级,此时在调节音量时,只能减小音量。也就是说,当用户调节音量,比如调节到音量等级为13时,可将音量等级13发送给第二设备,以便第二设备确定音频播放所需的音量等级。
S2505:第二设备根据音量等级映射表,确定与第一设备发送的第二音量等级对应的第三音量等级。
可以理解的是,绝对音量转换表也可以记为“音量等级映射表”,本申请中有时候可能会混用,应理解其含义一致。
本申请实施例中,当第二设备接收到第一设备发送的音量调节指令之后,可根据音频流类型找到与音频流类型对应的绝对音量转换表,然后根据第二设备中保存的绝对音量转换表,确定与音量调节指令中包括的第二音量等级对应的第三音量等级。示例性的,假设第二音量等级为13,即source端的音量等级为13,则根据表2中的映射关系可得到sink端的音量等级,例如第三音量等级可以为80。当然,上述表格仅是一种示意性说明,当source端的音量等级为13时,sink端的音量等级也可以为85等,本申请对此不作限定。
需要说明的是,在本申请实施例中,当第一设备将音频数据投音到第二设备之后,如 果音频流类型发生变化,比如用户在手机上将媒体流的音频数据更改为铃声流的音频数据之后,可以将更新后的音频流类型发送给第二设备。应理解,将更新后的音频流类型发送给第二设备时可以在音量调节信息发生之前发送给第二设备,本申请对此不作限定。
以下以具体场景为例,对上述过程进行介绍。
场景1:手机上的音频数据传输到音箱。
在该场景下,进行音量调节的方式可包括:物理按键调节、在播控卡片上调节、通过设置进行调节(例如,可通过手机设置中的“声音与振动”进行音量调节)。
示例性的,如图27A所示,以播控卡片为例,假设手机上显示用户界面2700,该用户界面2700上可包括手机连接的音箱在当前所播放的音频的播控卡片2701,在播控卡片上可包括音量触摸按键2702,用户可通过该音量触摸按键2702进行音量调节。当然,播控卡片上还可包括音箱当前所播放的音频,比如“回到夏天”2703、切换音频的按钮,包括向前切换音频的按钮2704、向后切换音频的按钮2705等。
比如,用户可在手机上对音量触摸按键2702进行左右滑动以实现音量调节。在此过程中,当用户滑动音量触摸按键2702时,手机可将当前音量触摸按键2702对应的音量等级(比如A1)传递给音箱。相应的,音箱接收到手机发送的音量等级A1之后,可根据自身保存的绝对音量转换表确定与音量等级A1相匹配的音量等级B1,然后在音箱上设置音量等级B1对应的音量,从而完成对音箱的音量调节。
应理解,手机上显示的音量触摸按键2702为手机的音量等级范围对应的触摸按键。手机的音量等级范围为0~15,音箱的音量等级范围为0~70。以图27A为例,假设图27A中音量触摸按键当前的音量等级为5,即音箱的音量等级在手机上所对应的音量等级为5,此时将该音量等级5发送给音箱。音箱可根据绝对音量转换表确定出当手机上的音量等级为5时,在音箱上的音量等级为35。
场景2:手机上的音频数据传输到智慧屏。
当手机上的音频投音到智慧屏时,可以通过物理按键或者播控卡片进行音量调节。以物理按键调节为例,如图27B所示,当用户在手机上通过物理按键触发音量调节信息之后,智慧屏可接收到该音量调节信息,然后根据绝对音量转换表确定音量等级,并在智慧屏的显示屏上显示音量条,例如图27B所示的界面2710,在界面2710中可包括音量条2711。用户可通过音量条上显示的数字看到当前智慧屏的音量,比如音量条上当前显示的音量等级为50。
S2506:第二设备按照第三音量等级对应的音量播放音频数据。
当第二设备根据绝对音量转换表确定出相应的音量等级之后,可根据确定出的音量等级对应的绝对音量播放第一设备投音的音频数据。由于绝对音量转换表是预先基于绝对音量基线配置的两个设备音量等级之间进行转换的表,能够使得两个设备在音量调节时投音设备的发声音量保持一致,实现多设备音量的协同调节。
如图28所示,为本申请实施例提供的另一种音量调节方法流程图。以Sink端设备为一个设备为例,对图28所示方法的实现过程进行介绍。具体可包括如下步骤:
1、首先对Source端和Sink端建立连接,并进行初始音量转换,即将Sink端当前的音量等级转换为Source端的音量等级,以便在Source端上调节音量。
2、Source端设备的代理服务(Dvkit)通知自身的音频服务(AudioService)对Sink端设备按照绝对音量处理,并向音频服务(AudioService)下发Sink端设备的音量等级。
3、用户在Source端设备上通过播控卡片、设置或物理按键等触发音量调节信息,音频服务(AudioService)接收到该音量调节信息之后,可将该音量调节信息发送给分布式绝对音量模块。
4、分布式绝对音量模块通知自身设备的AudioFlinger不对自身设备做音量增益。
5、分布式绝对音量模块将音量调节信息对应的音量等级上报给代理服务(Dvkit)。
6、Source端设备的代理服务(Dvkit)将音量等级反馈给Sink端设备的代理服务。
7、相应的,Sink端设备的代理服务接收到该音量等级之后,可根据自身保存的绝对音量转换表确定相对应的音量等级,然后设置音量,并通知播放器按照设置的音量进行音频播放。
需要说明的是,图28中粗线表示的是数据流,其它的线表示的是控制流。
基于上述实施例的介绍可知,在多设备连接场景下,可以降低不同电子设备针对同一音频文件的音频播放效果的差异,即实现音频播放效果的一致性。并且可以实现多设备播放音频的音量一致性。也就是说,可以实现声音的同步播放。
然而,随着分布式技术的发展,多设备连接的场景越来越多。例如,手机和虚拟现实VR眼镜连接,使得用户可以使用VR眼镜观看手机中的视频。再比如,手机和游戏手柄连接,使得用户可以使用游戏手柄玩手机游戏。在游戏或视频中可能会存在一些按键、枪击或鼓点等振动场景,可以通过振动配合声音的播放进行模拟,以增强用户的真实感体验。
由于人的触觉一般比听觉、视觉更加敏感,如果振动和声音的播放存在误差,则容易导致用户体验较差,因此,如何跨设备实现声音和振动的同步播放,对于增强用户的真实感体验具有重要的实用价值。
应理解,振动是由电子设备中的线性马达产生。线性马达的振动的可控性,使得电子设备可以模拟不同场景下的振动,例如枪击、或按键时产生的振动。
基于此,本申请还提供一种音振同步播放方法,由主设备对音振文件解析,将音频数据和振动数据发送给相应的从设备,从而使得从设备无需解析音振文件,可以在接收到来自主设备的音频数据和振动数据的情况下,根据与自身的音频设备能力对应的同步播放方式,进行声音和振动的播放,从而实现音振同步播放。其中,在本申请实施例音频设备能力用于指示音频设备是否支持音频数据和振动数据的分发。示例的,音频设备能力具体可以理解为电子设备中的功率放大器(如smart PA)是否支持将振动数据分发给马达,也可以理解为音频硬件抽象层(例如Audio HAL)是否支持将振动数据分发给振动器(即振动播放设备,如马达)。以功率放大器支持音频数据和振动数据的分发为例,功率放大器支持音频数据和振动数据的分发,可以理解为:功率放大器支持将音频数据分发给音频播放设备(如扬声器),将振动数据分发给振动器(如马达)。
在本申请实施例中,振动数据(haptic data)用于表征振动,为对振动文件处理后得到的。示例的,振动文件包括振动数据。在本申请实施例中,振动文件与音频文件可以为不同的文件,即振动文件包括振动数据,音频文件包括音频数据,且音频文件不包括振动数据。或者,音频文件可以包括音频数据和振动数据,即将振动数据增加到音频文件中。在这种情况下,电子设备对音频文件进行处理可以得到音频数据和振动数据。例如,本申请实施例可以通过在音频文件中增加一个声道来携带振动数据。其中用于携带振动数据的声道可以称之为振动声道,用于携带音频数据的声道称之为音频声道。例如,如图29所示,音频文件包括音频数据和振动数据,其中音频数据携带在音频声道上,振动数据携带在振 动声道上。需要说明的是,本申请实施例中,一个音频文件可以包括一个或多个音频声道携带的音频数据。图29仅为一个音频文件的示例性说明,并不构成对包括振动数据的音频文件的举例说明。
以下为便于描述,将不包括振动数据、只包括音频数据的音频文件称之为音频文件,将包括振动数据和音频数据的音频文件称之为音振文件。
本申请实施例以分层架构的鸿蒙操作系统为例,示例性说明电子设备的软件系统。如图30所示,应用层包括应用程序,例如相机、图库、地图、游戏应用、音乐等。其中,应用程序可以用于获取文件,例如音振文件(如haptic ogg file)、振动文件(haptic file)或者音频文件(ogg file)等。
框架层可以包括媒体播放器(MediaPlayer)、音频播放器(AudioTrack)、混音器(AudioMixer)、媒体提取器(media extractor)和振动服务(vibrate service)等。
其中,MediaPlayer可以用于播放音视频。media extractor用于对音频文件进行解码、解压缩等处理。AudioTrack可以用于播放特定格式的音频,例如支持wav格式的音频文件等。AudioMixer可以将来自不同AudioTrack的音频数据混合在一起。vibrate service用于提供控制振动的接口。
在一些实施例中,框架层还包括音效调节器(AudioEffect,又可以称之为音效处理器)。AudioEffect用于增加相应的音效,例如流行、古典、爵士、人声等。当然,框架层也可以不包括AudioEffect。
硬件抽象层包括音频硬件抽象层(Audio HAL)、振动硬件抽象层(vibrator HAL)、Wi-Fi模块或其它通信模块等。Audio HAL用于调用功率放大器(如smart PA)进行功放调节,并输出给音频播放设备(如扬声器)播放声音。vibrator HAL用于调用马达或振动传感器等产生振动。
下面以图30所示的软件系统为例。对针对一个电子设备来说,实现音振同步播放的方法进行介绍。
例如,当功率放大器支持音频数据和振动数据分发时,即功率放大器支持将音频数据分发给音频播放设备(如扬声器),将振动数据分发给振动器(如马达),在这种情况下,对于一个电子设备来说,可以通过将振动数据增加到音频文件得到音振文件,从而实现音振同步播放。以图30所示的软件系统为例,本申请实施例可以基于下列方式实现音振同步,如图31A所示。应用层中的某一应用程序响应于某一触发事件(如用户操作、或其他触发事件等),将音振文件发送给MediaPlayer。然后,MediaPlayer将音振文件发送给media extractor。由media extractor对音振文件进行解析(例如解码、解压缩等处理)。media extractor将对音振文件解析得到的数据(即振动数据和音频数据)发送给AudioTrack。由AudioTrack将对音频文件解析得到的数据输出给AudioMixer。AudioMixer识别来自AudioTrack的数据中是否包括振动数据。若包括振动数据,则从vibrate service获取音频设备能力。在音频设备能力用于指示功率放大器支持音频数据和振动数据的分发的情况下,AudioMixer将音频数据和振动数据作为输出数据(output data),输出给Audio HAL。由Audio HAL将振动数据和音频数据输出给功率放大器,然后由功率放大器将振动数据分发给振动器进行播放,将音频数据分发给音频播放器(如扬声器)进行播放。作为一种可能的实现方式,AudioMixer将音频数据和振动数据返回给AudioTrack,由AudioTrack将音频数据和振动数据作为输出数据,输出给Audio HAL。作为一种可能的实现方式,AudioMixer将振动数据返回给 AudioTrack,将音频数据发送给AudioEffect。由AudioEffect对音频数据进行处理,得到增加相应的音效后的音频数据。然后,AudioEffect将增加相应的音效后的音频数据返回给AudioTrack。AudioTrack接收到增加相应的音效后的音频数据,则将增加相应的音效后的音频数据和来自AudioMixer的振动数据作为输出数据,发送给Audio HAL。或者,AudioMixer将振动数据和音频数据发送给AudioEffect。由AudioEffect对音频数据进行处理,得到增加相应的音效后的音频数据,AudioEffect不对振动数据进行处理。然后,AudiEffect将振动数据和增加相应的音效后的音频数据发送给Audio HAL。由于振动数据和音频数据是同时输出给Audio HAL的,从而实现了音振的同步播放。
然而,在一些实施例中,如果功率放大器不支持音频数据和振动数据分发,即功率放大器仅支持将音频数据分发给音频播放设备(如扬声器),在这种情况下,对于一个电子设备来说,可以通过计算Audio HAL和vibrator HAL的传输时延差,来实现音振的同步播放。其中,Audio HAL的传输时延指的是音频数据从Audio HAL传输到音频播放设备(如扬声器)的时间,vibrator HAL的传输时延指的是振动数据从vibrator HAL传输到振动器(如马达)的时延。以图30所示的软件系统为例,本申请实施例可以基于下列方式实现音振同步,如图31B所示。应用层中的某一应用程序响应于某一触发事件(如用户操作、或其他触发事件等),将音频文件发送给MediaPlayer。MediaPlayer将音频文件发送给media extractor。media extracrtor对音频文件进行解析(例如解码、解压缩等处理)。media exactor将对音频文件解析得到的数据发送给AudioTrack。由AudioTrack将对音频文件解析得到的数据输出给AudioMixer。AudioMixer进行混音处理后,得到相应的音频数据,并将音频数据输出给Audio HAL。由Audio HAL将音频数据输出给功率放大器,并由功率放大器将经过功率放大处理的音频数据分发给音频播放设备进行声音的播放。作为一种可能的实现方式,AudioMixer还可以将音频数据发送给AudioEffect,由AudioEffect对音频数据进行处理,得到增加相应的音效后的音频数据,然后AudioEffect再将增加相应音效后的音频数据输出给Audio HAL。此外,应用层中的某一应用程序响应于某一触发事件(如用户操作、或其他触发事件等),将振动文件发送给vibrator service。vibrator service对振动文件进行解析,得到振动数据,以及根据Audio HAL的传输时延和vibrator HAL的传输时延,计算Audio HAL和vibrator HAL的传输时延差。然后,vibrator service基于Audio HAL和vibrator HAL的传输时延差,将振动数据输出给vibrator HAL。由vibrator HAL将振动数据分发给振动器(如马达)进行相应的振动。由于vibrator service基于audio HAL和vibrator HAL的传输时延差,将振动数据输出给vibrator HAL,而不是收到振动数据就将振动数据分发给振动器,从而使得音频播放设备和振动器得到数据的时间大致相同,从而实现音振的同步播放。
然而,在多设备连接的场景下,考虑到从设备的设备能力参差不齐,为了实现跨设备音振同步,可以通过在软件系统的硬件抽象层中增加DV Audio HAL、在应用层增加代理应用,实现主设备向从设备发送振动数据和音频数据。以主设备与一个从设备连接为例。结合图32所示主设备和从设备的软件系统结构图,对本申请实施例的音振同步播放方法进行详细说明。
如图32所示,主设备的软件系统包括应用层3201A、框架层3202A和HAL 3203A。其中,应用层3201A包括应用程序1。框架层3202A包括MediaPlayer 32021A、media extractor 32022A、AudioTrack 32023A、AudioMixer 32024A和AudioEffect 32025A。HAL 3203A包括DV Audio HAL 32031A、通信模块32032A。从设备的软件系统包括应用层3201B、框架层3220B和HAL 3203B。其中,应用层3201B包括代理应用。框架层3202B包括AudioTrack 32023B、AudioMixer 32024B、AudioEffect 32025B和vibrate service 32026B。HAL 3203B包括Audio HAL 32031B、通信模块32032B和vibrator HAL 32033B。需要说明的是,DV Audio HAL 32031A可以理解为一个虚拟Audio HAL,用于向从设备发送振动数据和音频数据,为一个新增模块。代理应用用于接收来自主设备的振动数据和音频数据,也是一个新增模块。可以理解的是,对于从设备来说,软件系统中可以包括DV Audio HAL,也可以不包括,是可选的。对于主设备来说,软件系统中可以包括代理应用,也可以不包括,是可选的。此外,对于主设备来说,AudioEffect 32025A是可选的;对于从设备来说,AudioEffect 32025B是可选的。
在一些实施例中,应用程序1接收到特定触发事件。特定触发事件用于触发音振文件播放。例如,特定触发事件可以包括:用户播放视频或音频的操作、或者在视频播放或游戏运行的过程中,接收到音振文件等。响应于特定触发事件,应用程序1将haptic ogg file(音振文件)发送给MediaPlayer 32021A。由MediaPlayer 32021A将haptic ogg file发送给media extractor 32022A。media extractor 32022A对haptic ogg file进行解析(例如解码、解压缩等处理)。然后,media extractor 32022A将对haptic ogg file解析得到的数据发送给AudioTrack 32023A。由AudioTrack 32023A将对haptic ogg file解析得到的数据发送给AudioMixer 32024A。其中,media extractor 32022A对haptic ogg file解析得到的数据包括振动数据和音频数据。AudioMixer 32024识别振动数据和音频数据的实际播放设备。在振动数据和音频数据的实际播放设备为从设备时,AudioMixer 32024将振动数据和音频数据作为输出数据(output data)发送给DV Audio HAL 32031A。由DV Audio HAL 32031A将振动数据和音频数据发送给通信模块32032A。然后,通信模块32032A将振动数据和音频数据发送通信模块32032B。由通信模块32032B将振动数据和音频数据发送给代理应用。代理应用接收到来自通信模块32032B的振动数据和音频数据后,将振动数据和音频数据输出给AudioTrack 32023B。由AudioTrack 32023B将振动数据和音频数据输出给AudioMixer 32024B。AudioMixer 32024B识别来自AudioTrack 32023B的数据中包括振动数据,从vibrate service 32026B获取音频设备能力。在音频设备能力用于指示功率放大器支持音频数据和振动数据的分发的情况下,AudioMixer 32024B将振动数据和音频数据作为输出数据(output data)发送给Audio HAL 32031B。由Audio HAL 32031B将振动数据和音频数据输出给功率放大器,然后由功率放大器将振动数据分发给振动器进行播放,将音频数据分发给音频播放器(如扬声器)进行播放,从而实现音振同步。
在另一些实施例中,如果功率放大器不支持振动数据分发,即功率放大器仅支持将音频数据分发给音频播放设备(如扬声器),AudioMixer 32024B将音频数据发送给audio HAL 32031B,AudioMixer32024B将音频数据发送给Audio HAL 32031B之后,经过第一时长,再将振动数据发送给vibrator HAL 32033B。第一时长包括Audio HAL 32031B和vibrator HAL 32033B的传输时延差。由Audio HAL 32031B将音频数据输出给功率放大器,并由功率放大器将经过功率放大处理的音频数据分发给音频播放设备进行声音的播放。由vibrator HAL32033B将振动数据分发给振动器(如马达)进行相应的振动。从而使得Audio HAL和vibrator HAL得到数据的时间大致相同,从而实现音振的同步播放。
例如,Audio HAL 32031B的传输时延为N1,即音频数据从Audio HAL 32031B传输 到音频播放设备所需要的时间为N1,vibrator HAL 32033B的传输时延为N2,即振动数据从vibrator HAL 32033B传输到音频播放设备所需要的时间为N2,如果N1大于N2,则AudioMixer 32024B将输出音频数据后经过N1-N2,再输出振动数据,从而使得音频数据到达音频播放器的时间、振动数据到达振动器的时间大致相同,从而实现音振同步播放。
在一些实施例中,对于主设备来说,AudioMixer 32024A还可以在将音频数据发送给Audio HAL 32031A之前,将音频数据发送给AudioEffect 32025A,由AudioEffect 32025A对音频数据进行处理,得到增加相应的音效后的音频数据,然后将增加相应音效后的音频数据输出给DV Audio HAL 32031A。示例的,为了将振动数据和增加相应音效后的音频数据同时发送给DV Audio HAL 32031A,在一些实施例中,AudioMixer32024A还可以将振动数据发送给AudioEffect 32025A。但是,AudioEffect 32025A不对振动数据进行处理,并在对音频数据进行处理后,将振动数据和增加相应音效后的音频数据作为输出数据,发送给DV Audio HAL32031A。作为一种可能的实现方式,AudioMixer 32024A将振动数据返回给AudioTrack 32023A,AudioEffect 32025A将增加相应音效后的音频数据也返回给AudioTrack 32023A。AudioTrack 32023A在接收到振动数据和增加相应音效后的音频数据后,将振动数据和增加相应音效后的音频数据作为输出数据,发送给DV Audio HAL 32031A。在这种情况下,由DV Audio HAL 32031A将振动数据和增加相应音效后的音频数据作为输出数据,发送给通信模块32032A。
在另一些实施例中,对于从设备来说,AudioMixer 32024B也可以在将音频数据发送给Audio HAL 32031B之前,将音频数据发送给AudioEffect 32025B。由AudioEffect 32025B对音频数据进行处理,得到增加相应的音效后的音频数据。然后AudioEffect 32025B将增加相应音效后的音频数据输出给Audio HAL 32032B。
需要说明的是,上述实施例仅是以多设备连接的场景中一个从设备为例进行说明的,本申请实施例还可以应用于主设备与多个从设备连接的情况。
基于上述实施例,本申请提供了一种音振同步播放的方法,应用于多设备连接,以音频设备能力用于指示音频硬件抽象层是否支持振动数据和音频数据的分发为例,具体如图33所示,包括以下步骤。
3301、第一电子设备接收到特定触发事件。特定触发事件用于触发播放音振文件。
3302、响应于特定触发事件,第一电子设备对音振文件进行解析,得到振动数据和音频数据。
3303、第一电子设备识别振动数据和音频数据的实际播放设备包括第二电子设备。
示例的,第一电子设备可以结合设备关联列表中设备标识所标识的设备能力等信息,确定振动数据和音频数据的实际播放设备。设备关联列表中包括至少一个设备标识,每个设备标识用于标识一个与第一电子设备连接或关联的电子设备,即与第一电子设备连接的从设备。
3304、第一电子设备向第二电子设备发送振动数据和音频数据。
3305、第二电子设备接收到来自第一电子设备的振动数据和音频数据,如果音频设备能力指示第二电子设备中的音频硬件抽象层支持音频数据和振动数据的分发,根据第一同步播放方式,基于音频数据和振动数据进行播放。其中,基于第一同步播放方式进行播放时,音频数据和振动数据均是由音频硬件抽象层分发到第二电子设备中相应的播放设备上的。
示例的,音频数据和振动数据均是由音频硬件抽象层分发到第二电子设备中相应的播放设备上,可以通过下述方式实现:
方式1、音频数据和振动数据均由音频硬件抽象层分发到第二电子设备中的功率放大器,再由功率放大器将音频数据和振动数据分发到第二电子设备中相应的播放设备上。
方式2、音频数据由音频硬件抽象层分发到第二电子设备中的功率放大器,再由功率放大器将音频数据分发到音频播放设备(如扬声器)上。振动数据由音频硬件抽象层分发到第二电子设备中的振动器(即振动播放设备,如马达)上。
在另一些实施例中,第二电子设备接收到第一电子设备的振动数据和音频数据,如果音频设备能力指示第二电子设备中的音频硬件抽象层不支持振动数据的分发,则根据第二同步播放方式,基于音频数据和振动数据进行播放。其中,基于第二同步播放方式进行播放时,音频数据是由第二电子设备中的音频硬件抽象层分发到第二电子设备中音频播放设备上的,振动数据是由第二电子设备中的振动硬件抽象层分发到第二电子设备中振动器上的。振动硬件抽象层分发振数据的时刻与音频硬件抽象层分发音频数据的时刻之差为第一传输时延与第二传输时延之差,第一传输时延为音频数据从音频硬件抽象层到达音频播放设备的时长,第二传输时延为振动数据从振动硬件抽象层到达振动器的时长。从而实现音振同步播放。
应理解,本申请实施例中,在步骤3303中,第一电子设备识别振动数据和音频数据的实际播放设备还可以包括第一电子设备。在这种情况下,第一电子设备和第二电子设备可以同时进行音振播放。其中,对于第一电子设备实现音振同步播放的方法可以参见图31A或图31B所示的方法,在此不再赘述。或者,在步骤3303中,第一电子设备识别振动数据和音频数据的实际播放设备还可以包括其它从设备,例如第三电子设备等,从而使得多个从设备可以实现音振同步播放。
本申请实施例中,由于音频文件的解析是由主设备进行解析的,使得主设备可以直接将音频数据和振动数据发送给从设备,因而对于从设备来说可以不具有音频文件(例如包括振动数据的音频文件)的解析能力,在与主设备连接后,也能够实现跨设备音振同步播放。因此,本申请实施例提供的音振同步播放方法不限制从设备的音频文件解析能力。
此外,图33所示的音振同步播放的方法可以应用于分布式音频场景中。例如,结合音画同步能力(即音频和视频画面同步播放的能力),可以在从设备上实现音画振同步,可以增强用户在视觉、听觉和触觉上的感受,从而为用户提供沉浸式体验。或者,将主设备上的音振文件(即包括振动数据的音频文件)解析能力拓展到视频通话、小视频、线上教学等多元化场景中,可以给用户带来更好的互动体验。
上述本申请提供的实施例中,从电子设备作为执行主体的角度对本申请实施例提供的方法进行了介绍。为了实现上述本申请实施例提供的方法中的各功能,电子设备可以包括硬件结构和/或软件模块,以硬件结构、软件模块、或硬件结构加软件模块的形式来实现上述各功能。上述各功能中的某个功能以硬件结构、软件模块、还是硬件结构加软件模块的方式来执行,取决于技术方案的特定应用和设计约束条件。
在一些实施例中,本申请实施例还提供了一种装置,如图34所示,包括一个或多个处理器3401、一个或多个存储器3402。存储器3402中存储有一个或多个计算机程序,当该一个或多个计算机程序被处理器3401执行时,使得装置执行本申请实施例提供的视频 录制方法。
进一步的,在一些实施例中,该装置还可以包括摄像头3403、扬声器3404、麦克风3405。
在另一些实施例中,该装置还可以包括显示屏3406,用于显示图形用户界面,例如媒体应用的界面。
本申请实施例中不限定上述处理器3401、存储器3402、摄像头3403、扬声器3404、麦克风3405和显示屏3406之间的连接介质。例如,本申请实施例中处理器3401、存储器3402、摄像头3403、扬声器3404、麦克风3405和显示屏3406之间可以通过总线连接,所述总线可以分为地址总线、数据总线、控制总线等。
在另一些实施例中,如图35所示,本申请另外一些实施例公开了一种装置,该装置可以是具有音频功能的电子设备。参阅图35所示,所述装置3500包括:显示屏3501;一个或多个处理器3502;一个或多个存储器3503;一个或多个传感器3504(图中未示出)、多个应用3505(图中未示出);以及一个或多个计算机程序3506(图中未示出),上述各器件可以通过一个或多个通信总线3507连接。
其中,显示屏3501用于显示电子设备中的应用的显示界面,或者显示提示信息。存储器3503中存储有一个或多个计算机程序,所述一个或多个计算机程序包括指令;处理器3502调用存储器3503中存储的所述指令,使得装置3500可以上述实施例的音频录制方法、音频播放方法以及音量调整方法。
在又一些实施例中,本申请实施例还提供了一种装置,如图36所示,包括一个或多个处理器3601、一个或多个存储器3602。存储器3602中存储有一个或多个计算机程序,当该一个或多个计算机程序被处理器3601执行时,使得装置执行本申请实施例提供的音效处理方法。进一步的,在一些实施例中,该装置还可以包括收发器3603,用于通过传输介质和其它设备进行通信,从而用于该装置可以和其它设备进行通信。示例性地,收发器3603可以是通信接口、电路、总线、模块等,该其它设备可以是终端或服务器等。示例性地,收发器3603可以用于发送音频数据等。
在另一些实施例中,该装置还可以包括显示屏3604,用于显示图形用户界面,例如媒体应用的界面。
在又一些实施例中,本申请实施例还提供了一种装置,如图37所示,包括一个或多个处理器3701、一个或多个存储器3702、收发器3703、马达3704、扬声器3705。存储器3702中存储有一个或多个计算机程序,当该一个或多个计算机程序被处理器3701执行时,使得装置执行本申请实施例提供的音振同步播放方法。
收发器3703,用于通过传输介质和其它设备进行通信,从而用于该装置可以和其它设备进行通信。示例性地,收发器3703可以是通信接口、电路、总线、模块等,该其它设备可以是终端或服务器等。示例性地,收发器3703可以用于发送音频数据和振动数据等。
本申请实施例中不限定上述处理器、存储器、收发器和显示屏之间的连接介质。例如,本申请实施例中处理器、存储器、收发器和显示屏之间可以通过总线连接,所述总线可以分为地址总线、数据总线、控制总线等。
此外,本申请实施例所提供的上述装置还可以包括显示器、触摸传感器等,对此不作限定。
需要说明的是,本申请实施例所提供的上述装置可以为电子设备,或者,该装置包括 芯片系统、芯片或者集成电路等。
在本申请实施例中,显示屏包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。
在本申请实施例中,处理器可以是通用处理器、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
在本申请实施例中,存储器可以是非易失性存储器,比如硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)等,还可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM)。存储器是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。
以上实施例中所用,根据上下文,术语“当…时”或“当…后”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。在不冲突的情况下,以上各实施例的方案都可以组合使用。
需要指出的是,本专利申请文件的一部分包含受著作权保护的内容。除了对专利局的专利文件或记录的专利文档内容制作副本以外,著作权人保留著作权。
Claims (42)
- 一种视频录制方法,其特征在于,所述方法包括:电子设备通过第一应用播放第一媒体文件对应的音频;电子设备显示第二应用的视频录制界面;所述视频录制界面包括图像预览框、背景音乐设置选项和虚拟按键,所述虚拟按键用于控制启动或停止视频录制,所述图像预览框用于预览摄像头采集的图像;响应于对所述背景音乐设置选项的操作,所述电子设备设置背景音乐为第二音频文件对应的音频;响应于对所述虚拟按键的第一操作,所述电子设备开始录制视频,并对所述第二音频文件进行处理,得到所述第二音频文件的音频数据;响应于对所述虚拟按键的第二操作,所述电子设备结束视频录制,生成视频文件,所述视频文件包括所述第二音频文件的音频数据和所述摄像头采集的图像的图像数据,不包括所述第一媒体文件的音频数据。
- 如权利要求1所述的方法,其特征在于,所述第一媒体文件与所述第一应用程序的标识对应,所述第二音频文件与所述第二应用程序的标识对应,所述方法还包括:响应于对所述虚拟按键的第一操作,所述电子设备根据所述第二应用程序的标识,获取所述第二音频文件的音频数据,并根据所述第二音频文件的音频数据和所述摄像头采集的图像的图像数据进行合成处理。
- 如权利要求2所述的方法,其特征在于,所述方法还包括:响应于对所述虚拟按键的第一操作,所述电子设备使用麦克风采集声音;所述电子设备根据所述第二音频文件的音频数据和所述摄像头采集的图像的图像数据进行合成处理,包括:所述电子设备根据所述第二音频文件的音频数据、所述摄像头采集的图像的图像数据和所述麦克风采集的声音的音频数据,进行合成处理。
- 如权利要求1或2所述的方法,其特征在于,所述拍摄静音功能处于开启状态时,所述电子设备不使用麦克风采集声音。
- 如权利要求1至4任一所述的方法,其特征在于,所述电子设备对所述第二音频文件进行处理,得到所述第二音频文件的音频数据,包括:所述电子设备对所述第二音频文件进行解析,并对解析第二音频文件得到的音频数据进行音效处理,得到第二音频文件的音频数据。
- 如权利要求1至5任一所述的方法,其特征在于,所述方法还包括:所述电子设备根据所述第二音频文件的音频数据进行播放。
- 一种音频录制方法,其特征在于,包括:电子设备显示一个直播应用的第一交互界面,所述第一交互界面包括录制设置选项;所述电子设备检测到作用于所述录制设置选项上的一个操作;所述电子设备响应于所述操作,显示第二交互界面,所述第二交互界面包括多个音频流选项;所述电子设备检测到触发事件,所述触发事件为确定选择录制第一类型标记的音频流和第二类型标记的音频流产生的事件;所述电子设备响应于所述触发事件,分别对所述第一类型标记的音频流和所述第二类型标记的音频流进行录制,得到第一音频录制数据和第二音频录制数据。
- 如权利要求7所述的方法,其特征在于,所述电子设备分别对所述第一类型标记的音频流和所述第二类型标记的音频流进行录制,包括:所述电子设备对第一音频流进行类型标记,得到至少两种类型标记,所述第一音频流包括所述直播应用直播的内容对应的应用所播放的音频流和音乐应用所播放的音频流;所述电子设备检测第一音频流所包括的至少两种类型标记,并在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记;所述电子设备对所述第一类型标记和所述第二类型标记分别对应的音频流进行录制。
- 如权利要求8所述的方法,其特征在于,所述电子设备对第一音频流进行类型标记,包括:所述电子设备根据第一音频流的音频参数对所述第一音频流进行类型标记,所述音频参数至少包括如下信息:音频流的类型、音频流的长度。
- 如权利要求8所述的方法,其特征在于,所述电子设备在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记之后,所述方法还包括:所述电子设备对所述第一音频流进行混音处理,得到混音音频,并播放所述混音音频。
- 一种音频录制方法,其特征在于,包括:电子设备显示一个直播应用的第一交互界面,所述第一交互界面包括录制设置选项;所述电子设备检测到作用于所述录制设置选项上的至少一个操作;所述电子设备响应于所述至少一个操作,按照设定的音频类型标记对音频流进行录制,所述设定的音频类型标记包括第一类型标记和第二类型标记。
- 如权利要求11所述的方法,其特征在于,所述电子设备按照设定的音频类型标记对音频流进行录制,包括:所述电子设备对第一音频流进行类型标记,得到至少两种类型标记,所述第一音频流包括所述直播应用直播的内容对应的应用所播放的音频流和音乐应用所播放的音频流;所述电子设备检测第一音频流所包括的至少两种类型标记,并在所述至少两种类型标记中筛选出所述第一类型标记和所述第二类型标记;所述电子设备对所述第一类型标记和所述第二类型标记分别对应的音频流进行录制。
- 一种音频播放方法,其特征在于,包括:电子设备通过第一应用播放第一音频;所述电子设备响应于用户对所述第一应用的第一操作,将所述第一应用切换到后台运行;所述电子设备响应于用户对第二应用的第二操作,将所述第二应用运行在前台,并通过所述第二应用播放第二音频;所述电子设备确定所述第一音频和所述第二音频的播放策略;所述电子设备根据所述播放策略对所述第一音频和所述第二音频进行播放。
- 如权利要求13所述的方法,其特征在于,所述电子设备确定所述第一音频和所述第二音频的播放策略,包括:所述电子设备对所述第一音频和所述第二音频进行分类,确定所述第一音频和所述第二音频分别对应的类别;所述电子设备根据所述第一音频和所述第二音频分别对应的类别,确定所述第一音频和所述第二音频的播放策略。
- 如权利要求14所述的方法,其特征在于,所述电子设备对所述第一音频和所述第二音频进行分类,包括:所述电子设备分别获取所述第一音频的音频属性和所述第二音频的音频属性;所述电子设备根据第一映射关系分别确定与所述第一音频的音频属性对应的类别和所述第二音频的音频属性对应的音频类别,所述第一映射关系为音频属性与音频类别之间的对应关系。
- 如权利要求13至15任一项所述的方法,其特征在于,所述电子设备确定所述第一音频和所述第二音频的播放策略,包括:所述电子设备依据第二映射关系,确定所述第一音频和所述第二音频在相同或不同的类别下,相对应的音频播放策略,所述第二映射关系包括所述第一音频的类别和所述第二音频的类别与音频播放策略之间的对应关系。
- 如权利要求14-16任一项所述的方法,其特征在于,所述第一音频和所述第二音频的音频类别包括如下类别中的任意一种:语音通话、闹铃、语音导航、媒体音、游戏、电影、音乐、拨号音、来电响铃、操作/事件音、通知提示音、其它。
- 如权利要求13-17任一项所述的方法,其特征在于,所述第一音频和所述第二音频的播放策略包括如下策略中的任意一种:播放第一音频、播放第二音频、同时播放第一音频和第二音频。
- 如权利要求13-18任一项所述的方法,其特征在于,所述方法还包括:所述电子设备显示第一提示信息,所述第一提示信息用于提示用户是否要按照播放策略播放第一音频和第二音频。
- 一种音效处理方法,其特征在于,第一电子设备与第二电子设备连接,所述方法包括:所述第一电子设备显示媒体应用的界面,所述媒体应用的界面包括待播放的音频文件的标识、第一控件和第二控件,所述第一控件用于控制音频播放,所述第二控件用于控制所述待播放的音频文件在所述第二电子设备上的播放;所述第二控件被选中时,所述第一电子设备响应于对所述第一控件的操作,对所述待播放的音频文件进行解析,得到第一音频数据;所述第一电子设备根据第一音效配置信息对所述第一音频数据进行音效处理,得到第二音频数据;所述第一电子设备根据第二音效配置信息对所述第一音频数据进行音效处理,得到第三音频数据;所述第一电子设备将所述第三音频数据发送给所述第二电子设备,并触发所述第二电子设备播放所述第三音频数据;所述第一电子设备将所述第三音频数据发送给所述第二电子设备后经过第一时长,播放所述第二音频数据;所述第一时长为所述第三音频数据从所述第一电子设备到所述第二电子设备播放所需的时间;其中,所述第一音频配置信息用于指示第一音效算法、第一音效模式、第一均衡器设置、第一增益设置和第一音效参数;所述第二音频配置信息用于指示所述第一音效算法、 所述第一音效模式、所述第一均衡器设置、所述第一增益设置和第二音效参数,所述第一音效参数为所述第一电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数,所述第二音效参数为所述第二电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数。
- 如权利要求20所述的方法,其特征在于,所述第一电子设备处于音效开启状态。
- 如权利要求21所述的方法,其特征在于,所述方法还包括:当所述第二电子设备处于音效开启状态时,所述第一电子设备向所述第二电子设备发送音效关闭消息。
- 如权利要求20至22任一所述的方法,其特征在于,所述方法还包括:当所述第一电子设备处于音效关闭状态时,所述第一电子设备将所述第一音频数据和音效关闭消息发送给所述第二电子设备,以触发所述第二电子设备关闭音效,并播放所述第一音频数据;所述第一电子设备将所述第一音频数据发送给所述第二电子设备后,经过所述第一时长,播放所述第一音频数据,所述第一时长为所述第一音频数据从所述第一电子设备到所述第二电子设备播放所需的时间。
- 如权利要求20至23任一所述的方法,其特征在于,所述第一音效配置信息为所述第一电子设备当前使用的音效配置信息;或者,所述第二音效配置信息为所述第二电子设备当前使用的音效配置信息。
- 一种音效处理方法,其特征在于,第一电子设备与第二电子设备连接,所述方法包括:所述第一电子设备显示媒体应用的界面,所述媒体应用的界面包括待播放的音频文件的标识、第一控件和第二控件,所述第一控件用于控制音频播放,所述第二控件用于控制所述待播放的音频文件在所述第二电子设备上的播放;所述第二控件被选中时,所述第一电子设备响应于对所述第一控件的操作,对所述待播放的音频文件进行解析,得到第一音频数据;所述第一电子设备根据第一音效配置信息对所述第一音频数据进行音效处理,得到第二音频数据;所述第一电子设备根据第二音效配置信息对所述第一音频数据进行音效处理,得到第三音频数据;所述第一电子设备将所述第三音频数据和播放时间信息发送给所述第二电子设备,并触发所述第二电子设备根据所述播放时间信息播放所述第三音频数据;所述第一电子设备根据所述播放时间信息播放所述第二音频数据;其中,所述播放时间信息用于指示开始播放的时间,所述第一音频配置信息用于指示第一音效算法、第一音效模式、第一均衡器设置、第一增益设置和第一音效参数;所述第二音频配置信息用于指示所述第一音效算法、所述第一音效模式、所述第一均衡器设置、所述第一增益设置和第二音效参数,所述第一音效参数为所述第一电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数,所述第二音效参数为所述第二电子设备在所述第一音效模式、所述第一均衡器设置和所述第一增益设置下所述第一音效算法所使用的音效参数。
- 如权利要求25所述的方法,其特征在于,所述第一音效配置信息为所述第一电子设备当前使用的音效配置信息;或者,所述第二音效配置信息为所述第二电子设备当前使用的音效配置信息。
- 一种音量调整方法,其特征在于,包括:第一设备播放第一音频;所述第一设备响应用户的第一操作,将所述第一音频切换到第二设备播放;所述第一设备响应用户的第二操作,向所述第二设备发送音量调节信息,以使所述第二设备根据所述音量调节信息将音量调整为第二音量等级,所述音量调节信息包括第一音量等级,所述第一音量等级为所述第一音频在所述第一设备上对应的音量等级,所述第二音量等级为所述第一音频在所述第二设备上对应的音量等级。
- 如权利要求27所述的方法,其特征在于,所述第一设备响应用户的第二操作,向所述第二设备发送音量调节信息之前,所述方法还包括:所述第一设备获取所述第二设备的第三音量等级;所述第一设备确定与所述第三音量等级对应的第四音量等级;其中,所述第一音量等级为基于所述第四音量等级调整之后的音量等级,所述第二音量等级为基于所述第三音量等级调整之后的音量等级。
- 如权利要求28所述的方法,其特征在于,所述方法还包括:所述第一设备确定对所述第二设备的音量按照绝对音量进行调节。
- 一种音量调整方法,其特征在于,包括:第二设备接收第一设备发送的音量调节信息,所述音量调节信息包括第一音量等级,所述第一音量等级为第一音频在所述第一设备上对应的音量等级;所述第二设备根据音量等级映射关系确定与所述第一音量等级对应的第二音量等级,所述第二音量等级为所述第一音频在所述第二设备上对应的音量等级;所述音量等级映射关系为在同一音量下所述第一设备和所述第二设备的音量等级转换关系;所述第二设备按照所述第二音量等级进行音量调整。
- 如权利要求30所述的方法,其特征在于,第二设备接收第一设备发送的音量调节信息之前,所述方法还包括:所述第二设备向所述第一设备发送第三音量等级,所述第三音量等级为所述第二设备在将音量调整为所述第二音量等级之前的音量等级。
- 如权利要求30或31所述的方法,其特征在于,所述方法还包括:所述第二设备按照所述第二音量等级对应的绝对音量播放所述第一音频。
- 如权利要求30-32任一项所述的方法,其特征在于,所述音量调节信息还包括第一音频的音频类型;所述方法还包括:所述第二设备根据所述第一音频的音频类型确定与所述第一音频的音频类型相对应的音量等级映射关系。
- 一种音振同步播放方法,其特征在于,第一电子设备与第二电子设备连接,所述方法包括:所述第一电子设备接收到第一触发事件,所述第一触发事件用于触发播放音振文件,所述音振文件包括音频数据和振动数据;响应于所述第一触发事件,所述第一电子设备对所述音振文件进行解析,得到音频数据和振动数据;所述第一电子设备向第二电子设备发送所述音频数据和所述振动数据。
- 如权利要求34所述的方法,其特征在于,所述方法还包括:所述第一电子设备当自身的音频设备能力用于指示音频硬件抽象层支持音频数据和振动数据的分发时,根据第一同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第一同步播放方式进行播放时,所述音频数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的扬声器的,所述振动数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的马达的。
- 如权利要求34所述的方法,其特征在于,所述方法还包括:所述第一电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据的分发时,根据第二同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第二同步播放方式进行播放时,所述音频数据是由所述第一电子设备的音频硬件抽象层分发到所述第一电子设备的扬声器的,所述振动数据是由所述第一电子设备的振动硬件抽象层分发到所述第一电子设备的马达的,所述振动硬件抽象层分发所述振数据的时刻与所述音频硬件抽象层分发所述音频数据的时刻之差为第一传输时延与第二传输时延之差,所述第一传输时延为所述音频数据从音频硬件抽象层到达所述扬声器的时长,第二传输时延为所述振动数据从振动硬件抽象层到达所述马达的时长。
- 如权利要求34至36任一所述的方法,其特征在于,所述第一电子设备与第二电子设备连接,包括:所述第一电子设备与所述第二电子设备通过Wi-Fi、或蓝牙连接,或者,所述第一电子设备与所述第二电子设备通过应用程序绑定。
- 一种音振同步播放方法,其特征在于,第一电子设备与第二电子设备连接,所述方法包括:所述第二电子设备接收所述第一电子设备发送的音频数据和振动数据;所述第二电子设备当自身的音频设备能力用于指示音频硬件抽象层支持音频数据和振动数据的分发时,根据第一同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第一同步播放方式进行播放时,所述音频数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的扬声器的,所述振动数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的马达的。
- 如权利要求38所述的方法,其特征在于,所述方法还包括:所述第二电子设备当自身的音频设备能力用于指示音频硬件抽象层不支持振动数据的分发时,根据第二同步播放方式,基于所述音频数据和所述振动数据进行播放;其中,根据所述第二同步播放方式进行播放时,所述音频数据是由所述第二电子设备的音频硬件抽象层分发到所述第二电子设备的扬声器的,所述振动数据是由所述第二电子设备的振动硬件抽象层分发到所述第二电子设备的马达的,所述振动硬件抽象层分发所述振数据的时刻与所述音频硬件抽象层分发所述音频数据的时刻之差为第一传输时延与第二传输时延之差,所述第一传输时延为所述音频数据从音频硬件抽象层到达所述扬声器的时长,第二传输时延为所述振动数据从振动硬件抽象层到达所述马达的时长。
- 如权利要求38或39所述的方法,其特征在于,所述第一电子设备与第二电子设备 连接,包括:所述第一电子设备与所述第二电子设备通过Wi-Fi、或蓝牙连接,或者,所述第一电子设备与所述第二电子设备通过应用程序绑定。
- 一种电子设备,其特征在于,包括:处理器;存储器;以及计算机程序,所述计算机程序存储在所述存储器中,当所述计算机程序被所述处理器执行时,使得所述电子设备执行如权利要求1-6或7-10或11-12或13-19或20-24或25-26或27-29或30-33或34-37或38-40中任意一项所述的方法。
- 一种计算机可读存储介质,其特征在于,包括计算机程序,当所述计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1-6或7-10或11-12或13-19或20-24或25-26或27-29或30-33或34-37或38-40中任意一项所述的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US18/259,230 US20240056676A1 (en) | 2020-12-25 | 2021-12-23 | Video Recording Method and Electronic Device |
EP21909522.1A EP4246985A4 (en) | 2020-12-25 | 2021-12-23 | VIDEO RECORDING METHOD AND ELECTRONIC DEVICE |
Applications Claiming Priority (14)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011565521.3 | 2020-12-25 | ||
CN202011565521 | 2020-12-25 | ||
CN202011581873.8 | 2020-12-28 | ||
CN202011581873 | 2020-12-28 | ||
CN202011604343.0 | 2020-12-30 | ||
CN202011601905.6 | 2020-12-30 | ||
CN202011604343 | 2020-12-30 | ||
CN202011601905 | 2020-12-30 | ||
CN202011628665 | 2020-12-31 | ||
CN202011626278 | 2020-12-31 | ||
CN202011626278.1 | 2020-12-31 | ||
CN202011628665.9 | 2020-12-31 | ||
CN202110411509.5 | 2021-04-16 | ||
CN202110411509.5A CN114697742A (zh) | 2020-12-25 | 2021-04-16 | 一种视频录制方法及电子设备 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022135527A1 true WO2022135527A1 (zh) | 2022-06-30 |
Family
ID=82135821
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/140845 WO2022135527A1 (zh) | 2020-12-25 | 2021-12-23 | 一种视频录制方法及电子设备 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20240056676A1 (zh) |
EP (1) | EP4246985A4 (zh) |
CN (1) | CN114697742A (zh) |
WO (1) | WO2022135527A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116489270A (zh) * | 2023-03-28 | 2023-07-25 | 荣耀终端有限公司 | 一种音频播放方法和电子设备 |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117992008A (zh) * | 2022-11-02 | 2024-05-07 | 华为技术有限公司 | 一种音频播放方法及电子设备 |
CN118741218A (zh) * | 2023-03-28 | 2024-10-01 | 华为技术有限公司 | 视频录制、播放的方法及电子设备 |
CN117014539B (zh) * | 2023-09-25 | 2023-12-05 | 荣耀终端有限公司 | 音量调节方法及电子设备 |
CN117389507B (zh) * | 2023-12-12 | 2024-05-10 | 荣耀终端有限公司 | 音频数据处理方法、电子设备及存储介质 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103208298A (zh) * | 2012-01-11 | 2013-07-17 | 三星电子(中国)研发中心 | 一种摄像方法及系统 |
CN105681676A (zh) * | 2016-03-25 | 2016-06-15 | 上海斐讯数据通信技术有限公司 | 一种拍摄图像的方法及拍摄装置 |
CN105959773A (zh) * | 2016-04-29 | 2016-09-21 | 魔方天空科技(北京)有限公司 | 多媒体文件的处理方法和装置 |
CN107959873A (zh) * | 2017-11-02 | 2018-04-24 | 深圳天珑无线科技有限公司 | 在视频中植入背景音乐的方法、装置、终端及存储介质 |
CN110958386A (zh) * | 2019-11-12 | 2020-04-03 | 北京达佳互联信息技术有限公司 | 视频合成方法、装置、电子设备及计算机可读存储介质 |
US20200351450A1 (en) * | 2019-04-30 | 2020-11-05 | Kakao Corp. | Method and apparatus for providing special effects to video |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103973955B (zh) * | 2013-01-28 | 2017-08-25 | 联想(北京)有限公司 | 一种信息处理方法及电子设备 |
CN104883516B (zh) * | 2015-06-05 | 2018-08-14 | 福建凯米网络科技有限公司 | 一种制作实时演唱视频的方法及系统 |
CN107135366A (zh) * | 2016-02-29 | 2017-09-05 | 赛尔莱博股份有限公司 | 插入有音源的图像生成方法及装置 |
CN106131472A (zh) * | 2016-07-26 | 2016-11-16 | 维沃移动通信有限公司 | 一种录像方法及移动终端 |
CN106131475A (zh) * | 2016-07-28 | 2016-11-16 | 努比亚技术有限公司 | 一种视频处理方法、装置及终端 |
CN109068081A (zh) * | 2018-08-10 | 2018-12-21 | 北京微播视界科技有限公司 | 视频生成方法、装置、电子设备及存储介质 |
CN110956969B (zh) * | 2019-11-28 | 2022-06-10 | 北京达佳互联信息技术有限公司 | 直播音频处理方法、装置、电子设备和存储介质 |
-
2021
- 2021-04-16 CN CN202110411509.5A patent/CN114697742A/zh active Pending
- 2021-12-23 WO PCT/CN2021/140845 patent/WO2022135527A1/zh active Application Filing
- 2021-12-23 EP EP21909522.1A patent/EP4246985A4/en active Pending
- 2021-12-23 US US18/259,230 patent/US20240056676A1/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103208298A (zh) * | 2012-01-11 | 2013-07-17 | 三星电子(中国)研发中心 | 一种摄像方法及系统 |
CN105681676A (zh) * | 2016-03-25 | 2016-06-15 | 上海斐讯数据通信技术有限公司 | 一种拍摄图像的方法及拍摄装置 |
CN105959773A (zh) * | 2016-04-29 | 2016-09-21 | 魔方天空科技(北京)有限公司 | 多媒体文件的处理方法和装置 |
CN107959873A (zh) * | 2017-11-02 | 2018-04-24 | 深圳天珑无线科技有限公司 | 在视频中植入背景音乐的方法、装置、终端及存储介质 |
US20200351450A1 (en) * | 2019-04-30 | 2020-11-05 | Kakao Corp. | Method and apparatus for providing special effects to video |
CN110958386A (zh) * | 2019-11-12 | 2020-04-03 | 北京达佳互联信息技术有限公司 | 视频合成方法、装置、电子设备及计算机可读存储介质 |
Non-Patent Citations (1)
Title |
---|
See also references of EP4246985A4 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116489270A (zh) * | 2023-03-28 | 2023-07-25 | 荣耀终端有限公司 | 一种音频播放方法和电子设备 |
Also Published As
Publication number | Publication date |
---|---|
CN114697742A (zh) | 2022-07-01 |
EP4246985A1 (en) | 2023-09-20 |
US20240056676A1 (en) | 2024-02-15 |
EP4246985A4 (en) | 2024-04-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11818420B2 (en) | Cross-device content projection method and electronic device | |
WO2020244495A1 (zh) | 一种投屏显示方法及电子设备 | |
WO2020238871A1 (zh) | 一种投屏方法、系统及相关装置 | |
WO2022135527A1 (zh) | 一种视频录制方法及电子设备 | |
WO2021078284A1 (zh) | 一种内容接续方法及电子设备 | |
US20220163932A1 (en) | Device control page display method, related apparatus, and system | |
WO2021164445A1 (zh) | 一种通知处理方法、电子设备和系统 | |
WO2023029967A1 (zh) | 一种播放音频的方法及电子设备 | |
WO2020014880A1 (zh) | 一种多屏互动方法及设备 | |
WO2021233079A1 (zh) | 一种跨设备的内容投射方法及电子设备 | |
WO2020132818A1 (zh) | 无线短距离音频共享方法及电子设备 | |
WO2022121775A1 (zh) | 一种投屏方法及设备 | |
JP7416519B2 (ja) | マルチ端末マルチメディアデータ通信方法及びシステム | |
WO2021249318A1 (zh) | 一种投屏方法和终端 | |
WO2020224447A1 (zh) | 一种在联系人中添加智能家居设备的方法及系统 | |
JP2017528009A (ja) | マルチメディアファイルを再生するための方法及び装置 | |
WO2022028537A1 (zh) | 一种设备识别方法及相关装置 | |
WO2022017393A1 (zh) | 显示交互系统、显示方法及设备 | |
WO2022037463A1 (zh) | 一种功能切换入口的确定方法与电子设备 | |
WO2022135157A1 (zh) | 页面显示的方法、装置、电子设备以及可读存储介质 | |
WO2023125847A1 (zh) | 一种音频处理方法、系统及相关装置 | |
CN114827581A (zh) | 同步时延测量方法、内容同步方法、终端设备及存储介质 | |
CN113794796A (zh) | 一种投屏方法及电子设备 | |
CN114079691A (zh) | 一种设备识别方法及相关装置 | |
WO2022111529A1 (zh) | 一种应用程序的调试方法及电子设备 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21909522 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2021909522 Country of ref document: EP Effective date: 20230613 |
|
WWE | Wipo information: entry into national phase |
Ref document number: 18259230 Country of ref document: US |
|
NENP | Non-entry into the national phase |
Ref country code: DE |