





技术领域technical field
本发明涉及一种车辆控制技术领域,其涉及一种音效处理方法及其系统、电子设备和存储介质。The invention relates to the technical field of vehicle control, which relates to a sound effect processing method and system thereof, electronic equipment and a storage medium.
背景技术Background technique
目前在车辆上的电子设备对音频文件做音效处理有两种方法:一种是在手机端利用播放器进行音效处理,无法实现系统内置音效,即无法实现音效在车辆控制系统内全局生效,导致各个平台音效不统一,无法共享;另一种是在车载终端进行处理,在车载终端对音频文件的音效处理算法都是固化在音频播放硬件中,例如DSP(Digital SignalProcessing,数字信号处理)模块,无法更新音效处理算法,不能很好地满足用户对音效的需求,降低了用户体验。At present, there are two ways for the electronic equipment on the vehicle to process the sound effect of the audio file: one is to use the player on the mobile phone to process the sound effect, which cannot realize the built-in sound effect of the system, that is, it cannot realize the sound effect globally in the vehicle control system, resulting in The sound effects of each platform are not uniform and cannot be shared; the other is to process on the vehicle terminal, and the sound effect processing algorithms for audio files on the vehicle terminal are solidified in the audio playback hardware, such as DSP (Digital Signal Processing, digital signal processing) module, The sound effect processing algorithm cannot be updated, and the user's demand for sound effect cannot be well met, which reduces the user experience.
发明内容Contents of the invention
本发明要解决的技术问题是为了克服现有技术中手机端处理音效导致各个平台音效不统一,无法共享以及车载终端处理音效无法更新音效处理算法的缺陷,提供一种音效处理方法及其系统、电子设备和存储介质。The technical problem to be solved by the present invention is to overcome the defects in the prior art that the sound effects of each platform are not uniform and cannot be shared due to the processing of sound effects on the mobile phone terminal, and the sound effect processing algorithm cannot be updated by the vehicle-mounted terminal, and provide a sound effect processing method and its system, Electronic devices and storage media.
本发明是通过下述技术方案来解决上述技术问题:The present invention solves the above technical problems through the following technical solutions:
本发明第一方面提供一种音效处理方法,应用于电子设备,所述电子设备的操作系统存储有多种音效算法,所述音效处理方法包括:The first aspect of the present invention provides a sound effect processing method, which is applied to an electronic device. The operating system of the electronic device stores a variety of sound effect algorithms, and the sound effect processing method includes:
响应于音频播放请求,确定待播放的初始音频数据和所述初始音频数据的请求音效类型;In response to the audio playback request, determine the initial audio data to be played and the requested sound effect type of the initial audio data;
从所述多种音效算法中确定与所述请求音效类型相匹配的目标音效算法;determining a target sound effect algorithm matching the requested sound effect type from the multiple sound effect algorithms;
采用所述目标音效算法对所述初始音频数据进行音效处理,得到待播放音频数据;performing sound effect processing on the initial audio data by using the target sound effect algorithm to obtain audio data to be played;
将所述待播放音频数据发送至音频播放模块进行播放。Send the audio data to be played to the audio playing module for playing.
本发明第二方面提供一种音效处理系统,应用于电子设备,所述电子设备的操作系统存储有多种音效算法,所述音效处理系统包括:The second aspect of the present invention provides a sound effect processing system, which is applied to electronic equipment. The operating system of the electronic device stores various sound effect algorithms, and the sound effect processing system includes:
一个或多个处理器以及存储器;one or more processors and memory;
所述一个或多个处理器与存储器通信连接;the one or more processors are communicatively coupled to a memory;
所述存储器被配置成存储指令,当所述存储指令被所述一个或多个所述处理器执行时,使所述一个或多个所述处理器执行步骤,所述步骤包括:The memory is configured to store instructions that, when executed by the one or more of the processors, cause the one or more of the processors to perform steps comprising:
响应于音频播放请求,确定待播放的初始音频数据和所述初始音频数据的请求音效类型;In response to the audio playback request, determine the initial audio data to be played and the requested sound effect type of the initial audio data;
从所述多种音效算法中确定与所述请求音效类型相匹配的目标音效算法;determining a target sound effect algorithm matching the requested sound effect type from the multiple sound effect algorithms;
采用所述目标音效算法对所述初始音频数据进行音效处理,得到待播放音频数据;performing sound effect processing on the initial audio data by using the target sound effect algorithm to obtain audio data to be played;
将所述待播放音频数据发送至音频播放模块进行播放。Send the audio data to be played to the audio playing module for playing.
本发明第三方面提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行计算机程序时实现前述的音效处理方法。The third aspect of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and operable on the processor, and the processor implements the aforementioned sound effect processing method when executing the computer program.
本发明第四方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现前述的音效处理方法。A fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the aforementioned sound effect processing method is implemented.
本发明的积极进步效果在于:通过确定待播放的初始音频数据及其请求音效类型,从操作系统存储的多种音效算法中确定与请求音效类型相匹配的目标音效算法,采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据进行播放,支持应用层的各个平台从操作系统调用音效算法,实现系统内置音效,即实现音效在车辆控制系统内全局生效,实现各个平台音效统一。The positive and progressive effect of the present invention is: by determining the initial audio data to be played and its requested sound effect type, the target sound effect algorithm matching the requested sound effect type is determined from various sound effect algorithms stored in the operating system, and the target sound effect algorithm is used for the initial The audio data is processed for sound effect, and the audio data to be played is obtained for playback, and each platform of the application layer is supported to call the sound effect algorithm from the operating system to realize the built-in sound effect of the system, that is, to realize the global effect of the sound effect in the vehicle control system, and to realize the unified sound effect of each platform.
附图说明Description of drawings
图1为本发明的实施例1的音效处理方法的流程图。FIG. 1 is a flow chart of a sound effect processing method according to Embodiment 1 of the present invention.
图2为本发明的实施例1的音效处理方法的一具体实施方式的流程图。FIG. 2 is a flow chart of a specific implementation of the sound effect processing method in Embodiment 1 of the present invention.
图3为本发明的实施例1的音效处理方法的另一具体实施方式的流程图。FIG. 3 is a flow chart of another specific implementation manner of the sound effect processing method in Embodiment 1 of the present invention.
图4为本发明的实施例1的音效处理方法的另一具体实施方式的流程图。FIG. 4 is a flowchart of another specific implementation manner of the sound effect processing method in Embodiment 1 of the present invention.
图5为本发明的实施例1的音效处理方法的另一具体实施方式的流程图。FIG. 5 is a flow chart of another specific implementation manner of the sound effect processing method in Embodiment 1 of the present invention.
图6为本发明的实施例3的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device according to Embodiment 3 of the present invention.
具体实施方式Detailed ways
下面通过实施例的方式进一步说明本发明,但并不因此将本发明限制在所述的实施例范围之中。The present invention is further illustrated below by means of examples, but the present invention is not limited to the scope of the examples.
实施例1Example 1
本实施例提供一种音效处理方法,应用于电子设备,电子设备的操作系统存储有多种音效算法,参照图1,音效处理方法包括:This embodiment provides a sound effect processing method, which is applied to an electronic device. The operating system of the electronic device stores a variety of sound effect algorithms. Referring to FIG. 1, the sound effect processing method includes:
S11、响应于音频播放请求,确定待播放的初始音频数据和初始音频数据的请求音效类型。S11. In response to the audio play request, determine the initial audio data to be played and the requested sound effect type of the initial audio data.
S12、从多种音效算法中确定与请求音效类型相匹配的目标音效算法。S12. Determine a target sound effect algorithm that matches the requested sound effect type from multiple sound effect algorithms.
S13、采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据。S13. Perform sound effect processing on the initial audio data by using the target sound effect algorithm to obtain audio data to be played.
S14、将待播放音频数据发送至音频播放模块进行播放。S14. Send the audio data to be played to the audio playback module for playback.
例如,电子设备的操作系统存储有多种音效算法:立体声音效算法、重低音音效算法、摇滚音效算法、小房间音效算法、大房间音效算法、礼堂音效算法、清新田园风音效算法、热情沙漠风音效算法等。For example, the operating system of an electronic device stores a variety of sound effect algorithms: stereo sound effect algorithm, subwoofer sound effect algorithm, rock sound effect algorithm, small room sound effect algorithm, large room sound effect algorithm, auditorium sound effect algorithm, fresh pastoral sound effect algorithm, warm desert wind Sound algorithm, etc.
响应于音频播放请求,确定待播放的初始音频数据为xxx歌曲和初始音频数据的请求音效类型为立体声,从多种音效算法中确定与请求音效类型相匹配的目标音效算法为立体声音效算法,采用立体声音效算法对xxx歌曲进行音效处理,得到待播放音频数据,最后将待播放音频数据发送至音频播放模块进行播放,用户就可以听到带立体声音效的xxx歌曲。In response to the audio playback request, determine that the initial audio data to be played is the xxx song and the requested sound effect type of the initial audio data is stereo, and determine from a variety of sound effect algorithms that the target sound effect algorithm that matches the requested sound effect type is a stereo sound effect algorithm, using The stereo sound effect algorithm performs sound effect processing on the xxx song to obtain audio data to be played, and finally sends the audio data to be played to the audio playback module for playback, and the user can hear the xxx song with stereo sound effect.
本实施例通过确定待播放的初始音频数据及其请求音效类型,从操作系统存储的多种音效算法中确定与请求音效类型相匹配的目标音效算法,采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据进行播放,支持应用层的各个平台从操作系统调用音效算法,实现系统内置音效,即实现音效在车辆控制系统内全局生效,实现各个平台音效统一。In this embodiment, by determining the initial audio data to be played and its requested sound effect type, a target sound effect algorithm that matches the requested sound effect type is determined from various sound effect algorithms stored in the operating system, and the target sound effect algorithm is used to perform sound effect processing on the initial audio data , obtain the audio data to be played, and support each platform of the application layer to call the sound effect algorithm from the operating system to realize the built-in sound effect of the system, that is, to realize the global effect of the sound effect in the vehicle control system, and to realize the unified sound effect of each platform.
由于支持应用层的各个平台从操作系统调用音效算法,应用层的各个平台无需自己部署音效算法,在需要使用音效算法处理播放音频数据时,可以从操作系统调用音效算法对音频数据进行音效处理并播放。Since each platform that supports the application layer calls the sound effect algorithm from the operating system, each platform of the application layer does not need to deploy the sound effect algorithm by itself. play.
具体实施时,每一音效算法设有对应的音效标识,电子设备还存储有音效类型与音效算法的对应关系。其中,音效标识为操作系统中的参数UUID,UUID的值表征对应的音效算法。During specific implementation, each sound effect algorithm is provided with a corresponding sound effect identifier, and the electronic device also stores the corresponding relationship between the sound effect type and the sound effect algorithm. Wherein, the sound effect identifier is a parameter UUID in the operating system, and the value of the UUID represents the corresponding sound effect algorithm.
参照图2,步骤S11包括:With reference to Fig. 2, step S11 comprises:
S111、响应于音频播放请求,从音频播放请求中获取待播放的初始音频数据和初始音频数据的请求音效类型。S111. In response to the audio play request, acquire initial audio data to be played and a requested sound effect type of the initial audio data from the audio play request.
音频播放请求可以但不限于是用户通过各个平台选择预播放的音频和音频类型而生成的,生成的音频播放请求携带对应于预播放的音频的初始音频数据和音频类型,或者音频播放请求携带对应于预播放的音频的音频获取地址和音频类型,例如:用户在音频播放请求中请求使用音效类型“立体声”播放音频“xxx歌曲”,或者用户在音频播放请求中请求使用音效类型“立体声”播放www网址的音频“xxx歌曲”。The audio playback request can be, but not limited to, generated by the user selecting the pre-played audio and audio type through each platform, and the generated audio playback request carries the initial audio data and audio type corresponding to the pre-played audio, or the audio playback request carries the corresponding The audio acquisition address and audio type of the pre-played audio, for example: the user requests to use the sound effect type "stereo" to play the audio "xxx song" in the audio play request, or the user requests to use the sound effect type "stereo" to play in the audio play request Audio "xxx song" from www url.
步骤S12包括:Step S12 includes:
S121、从操作系统获取请求音效类型与音效标识的对应关系。S121. Obtain the correspondence between the requested sound effect type and the sound effect identifier from the operating system.
请求音效类型与音效标识的对应关系可以根据实际需求自行配置,并将配置好的对应关系存储于操作系统,以供音效处理时使用。The corresponding relationship between the requested sound effect type and the sound effect identifier can be configured according to actual needs, and the configured corresponding relationship can be stored in the operating system for use in sound effect processing.
S122、根据对应关系,确定对应于请求音效类型的目标音效标识,以目标音效标识对应的音效算法作为目标音效算法。S122. Determine the target sound effect identifier corresponding to the requested sound effect type according to the corresponding relationship, and use the sound effect algorithm corresponding to the target sound effect identifier as the target sound effect algorithm.
例如,假设UUID的值为10的音效算法为立体声音效算法,响应于音频播放请求,从音频播放请求中获取待播放的初始音频数据为xxx歌曲以及初始音频数据的请求音效类型为立体声,从操作系统获取请求音效类型与音效标识的对应关系,根据对应关系,确定对应于请求音效类型的目标音效标识为10,目标音效标识为10对应的音效算法为立体声音效算法,以立体声音效算法作为目标音效算法,采用立体声音效算法对xxx歌曲进行音效处理,得到待播放音频数据,最后将待播放音频数据发送至音频播放模块进行播放,用户就可以听到带立体声音效的xxx歌曲。For example, assuming that the sound effect algorithm whose UUID value is 10 is a stereo sound effect algorithm, in response to the audio play request, the initial audio data to be played is obtained from the audio play request as xxx song and the requested sound effect type of the initial audio data is stereo, from the operation The system obtains the corresponding relationship between the requested sound effect type and the sound effect identifier, and according to the corresponding relationship, determines that the target sound effect identifier corresponding to the requested sound effect type is 10, and the sound effect algorithm corresponding to the target sound effect identifier of 10 is a stereo sound effect algorithm, and the stereo sound effect algorithm is used as the target sound effect The algorithm uses the stereo sound effect algorithm to perform sound effect processing on the xxx song to obtain the audio data to be played, and finally sends the audio data to be played to the audio playback module for playback, and the user can hear the xxx song with stereo sound effect.
本实施例通过从音频播放请求中获取待播放的初始音频数据及其请求音效类型,根据请求音效类型与音效标识的对应关系,确定对应于请求音效类型的目标音效标识,以目标音效标识对应的音效算法作为目标音效算法,采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据进行播放,支持应用层的各个平台从操作系统调用音效算法,实现系统内置音效,即实现音效在车辆控制系统内全局生效,实现各个平台音效统一。In this embodiment, the initial audio data to be played and the requested sound effect type are obtained from the audio playback request, and the target sound effect identifier corresponding to the requested sound effect type is determined according to the corresponding relationship between the requested sound effect type and the sound effect identifier, and the target audio effect identifier corresponding to the target audio effect identifier is determined. The sound effect algorithm is used as the target sound effect algorithm. The target sound effect algorithm is used to perform sound effect processing on the initial audio data, and the audio data to be played is obtained for playback. It supports each platform of the application layer to call the sound effect algorithm from the operating system to realize the built-in sound effect of the system, that is, to realize the sound effect in the vehicle. The control system takes effect globally to realize the unified sound effect of each platform.
具体实施时,在调用操作系统存储的音效算法之前,通过反射机制将目标音效标识的值写入操作系统的AudioEffect的实例中,修改后的AudioEffect的实例用于被操作系统和/或电子设备的应用程序调用,以对初始音频数据进行音效处理。During specific implementation, before calling the sound effect algorithm stored by the operating system, the value of the target sound effect identifier is written into the instance of the AudioEffect of the operating system through a reflection mechanism, and the modified AudioEffect instance is used by the operating system and/or the electronic device Called by the application to perform sound effects processing on raw audio data.
其中,由于AudioEffect的实例是隐藏不公开的,操作系统管理音效标识(UUID),如果不是基于Framework层编译的应用程序均无法将自定义的目标音效标识的值写入操作系统的AudioEffect的实例中,从而无法完成设置自定义音效算法。Among them, since the instance of AudioEffect is hidden and undisclosed, the operating system manages the audio effect identifier (UUID), and the application program compiled based on the Framework layer cannot write the value of the customized target audio effect identifier into the instance of AudioEffect of the operating system , so that the setting of the custom sound effect algorithm cannot be completed.
以Java为例,Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法和属性;这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反射机制(注意关键词:运行状态)换句话说,Java程序可以加载一个运行时才得知名称的class,获悉其完整构造,并生成其对象实体、或对其成员变量赋值、或调用其方法。这种“看透class”的能力称为反射。Taking Java as an example, the Java reflection mechanism is in the running state. For any class, you can know all the properties and methods of this class; for any object, you can call any of its methods and properties; this dynamic acquisition The information and the function of dynamically calling the method of the object are called the reflection mechanism of the java language (note the keyword: running state). In other words, a Java program can load a class whose name is known only at runtime, learn its complete structure, and generate Its object entities, or assign values to its member variables, or call its methods. This ability to "see through classes" is called reflection.
在本实施例中,通过反射机制将目标音效标识的值写入操作系统的AudioEffect的实例中,修改后的AudioEffect的实例可以被操作系统调用,也可以被电子设备的应用程序调用,来对初始音频数据进行音效处理。In this embodiment, the value of the target sound effect identifier is written into the AudioEffect instance of the operating system through the reflection mechanism, and the modified AudioEffect instance can be called by the operating system or by the application program of the electronic device to update the initial The audio data is processed with sound effects.
具体实施时,参照图3,在步骤S12之后,音效处理方法还包括:During specific implementation, with reference to Fig. 3, after step S12, the sound effect processing method also includes:
S15、将目标音效算法设置为默认音效算法。S15. Set the target sound effect algorithm as a default sound effect algorithm.
S16、在当前接收到的音频播放请求包括初始音频数据并且不包括请求音效类型时,采用默认音效算法对初始音频数据进行音效处理,得到待播放音频数据。S16. When the currently received audio playback request includes initial audio data and does not include the requested sound effect type, perform sound effect processing on the initial audio data by using a default sound effect algorithm to obtain audio data to be played.
本实施例中,在接收到的音频播放请求包括请求音效类型时,会将该请求音效类型对应的目标音效算法设置为默认音效算法,使用默认音效算法进行音效处理,如果后续的音频播放请求都不包括请求音效类型,即不发起变更默认音效算法,那么操作系统会一直保持默认音效算法不变,始终使用默认音效算法进行音效处理。In this embodiment, when the received audio playback request includes the requested sound effect type, the target sound effect algorithm corresponding to the requested sound effect type will be set as the default sound effect algorithm, and the default sound effect algorithm will be used for sound effect processing. If the requested sound effect type is not included, that is, if the default sound effect algorithm is not changed, the operating system will always keep the default sound effect algorithm unchanged, and always use the default sound effect algorithm for sound effect processing.
在一个实施例中,电子设备为车载终端,参照图4,音效处理方法还包括:In one embodiment, the electronic device is a vehicle-mounted terminal. Referring to FIG. 4, the sound effect processing method further includes:
S17、获取车载终端所属于的车辆的当前道路信息。S17. Obtain current road information of the vehicle to which the vehicle-mounted terminal belongs.
S18、在当前道路信息表征当前路段拥堵或路况湿滑时,选取默认音效算法为轻柔舒缓的音效算法。S18. When the current road information indicates that the current road section is congested or the road condition is slippery, select a soft and soothing sound effect algorithm as the default sound effect algorithm.
本实施例中,将音效处理方法应用到车载终端,在获取到的当前道路信息表征当前路段拥堵或路况湿滑时,选取默认音效算法为轻柔舒缓的音效算法,以缓解车辆内部人员由于路况导致的不良情绪。In this embodiment, the sound effect processing method is applied to the vehicle-mounted terminal. When the obtained current road information indicates that the current road section is congested or the road condition is wet and slippery, the default sound effect algorithm is selected as a soft and soothing sound effect algorithm, so as to relieve the pain caused by the road conditions caused by the personnel inside the vehicle. bad mood.
具体实施时,参照图5,音效处理方法还包括:During specific implementation, with reference to Fig. 5, the sound effect processing method also includes:
S19、获取播放记录。S19. Obtain a playback record.
S20、根据播放记录设置默认音效算法。S20. Set a default sound effect algorithm according to the playback record.
例如,根据电子设备的音效播放记录,将最近x天内使用次数最多的音效算法设置默认音效算法,或者,将最近x天内累计使用时长最长的音效算法设置默认音效算法,或者,将最近x天内单次使用时长最长的音效算法设置默认音效算法等。For example, according to the sound effect playback records of electronic devices, set the sound effect algorithm that has been used the most times in the last x days as the default sound effect algorithm, or set the sound effect algorithm that has been used for the longest cumulative time in the last x days as the default sound effect algorithm, or set the sound effect algorithm that has been used the most in the last x days The sound effect algorithm with the longest single use time sets the default sound effect algorithm, etc.
本实施例中,根据播放记录设置默认音效算法,即按照用户喜好和习惯进行设置,可以节省用户用于设置操作的时间。In this embodiment, the default sound effect algorithm is set according to the playback record, that is, the setting is performed according to the user's preferences and habits, which can save the user's time for setting operations.
具体实施时,音效处理方法还包括:During specific implementation, the sound effect processing method also includes:
通过云服务端更新音效算法。Update the sound effect algorithm through the cloud server.
本实施例可以对自定义的音效算法进行更新,提供了丰富操作系统存储的音效算法的一种具体实施方式。This embodiment can update the self-defined sound effect algorithm, and provides a specific implementation manner of enriching the sound effect algorithm stored in the operating system.
实施例2Example 2
本实施例提供一种音效处理系统,应用于电子设备,电子设备的操作系统存储有多种音效算法,音效处理系统包括:This embodiment provides a sound effect processing system, which is applied to electronic equipment. The operating system of the electronic device stores multiple sound effect algorithms. The sound effect processing system includes:
一个或多个处理器以及存储器。one or more processors and memory.
一个或多个处理器与存储器通信连接。One or more processors are communicatively coupled to the memory.
存储器被配置成存储指令,当存储指令被一个或多个处理器执行时,使一个或多个处理器执行步骤,步骤包括:The memory is configured to store instructions that, when executed by the one or more processors, cause the one or more processors to perform steps comprising:
响应于音频播放请求,确定待播放的初始音频数据和初始音频数据的请求音效类型。In response to the audio play request, determine the initial audio data to be played and the requested sound effect type of the initial audio data.
从多种音效算法中确定与请求音效类型相匹配的目标音效算法。Determine a target sound effect algorithm that matches the requested sound effect type from multiple sound effect algorithms.
采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据。The target sound effect algorithm is used to perform sound effect processing on the initial audio data to obtain the audio data to be played.
将待播放音频数据发送至音频播放模块进行播放。Send the audio data to be played to the audio playback module for playback.
例如,电子设备的操作系统存储有多种音效算法:立体声音效算法、重低音音效算法、摇滚音效算法、小房间音效算法、大房间音效算法、礼堂音效算法、清新田园风音效算法、热情沙漠风音效算法等。For example, the operating system of an electronic device stores a variety of sound effect algorithms: stereo sound effect algorithm, subwoofer sound effect algorithm, rock sound effect algorithm, small room sound effect algorithm, large room sound effect algorithm, auditorium sound effect algorithm, fresh pastoral sound effect algorithm, warm desert wind Sound algorithm, etc.
响应于音频播放请求,确定待播放的初始音频数据为xxx歌曲和初始音频数据的请求音效类型为立体声,从多种音效算法中确定与请求音效类型相匹配的目标音效算法为立体声音效算法,采用立体声音效算法对xxx歌曲进行音效处理,得到待播放音频数据,最后将待播放音频数据发送至音频播放模块进行播放,用户就可以听到带立体声音效的xxx歌曲。In response to the audio playback request, determine that the initial audio data to be played is the xxx song and the requested sound effect type of the initial audio data is stereo, and determine from a variety of sound effect algorithms that the target sound effect algorithm that matches the requested sound effect type is a stereo sound effect algorithm, using The stereo sound effect algorithm performs sound effect processing on the xxx song to obtain audio data to be played, and finally sends the audio data to be played to the audio playback module for playback, and the user can hear the xxx song with stereo sound effect.
本实施例通过确定待播放的初始音频数据及其请求音效类型,从操作系统存储的多种音效算法中确定与请求音效类型相匹配的目标音效算法,采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据进行播放,支持应用层的各个平台从操作系统调用音效算法,实现系统内置音效,即实现音效在车辆控制系统内全局生效,实现各个平台音效统一。In this embodiment, by determining the initial audio data to be played and its requested sound effect type, a target sound effect algorithm that matches the requested sound effect type is determined from various sound effect algorithms stored in the operating system, and the target sound effect algorithm is used to perform sound effect processing on the initial audio data , obtain the audio data to be played, and support each platform of the application layer to call the sound effect algorithm from the operating system to realize the built-in sound effect of the system, that is, to realize the global effect of the sound effect in the vehicle control system, and to realize the unified sound effect of each platform.
由于支持应用层的各个平台从操作系统调用音效算法,应用层的各个平台无需自己部署音效算法,在需要使用音效算法处理播放音频数据时,可以从操作系统调用音效算法对音频数据进行音效处理并播放。Since each platform that supports the application layer calls the sound effect algorithm from the operating system, each platform of the application layer does not need to deploy the sound effect algorithm by itself. play.
具体实施时,每一音效算法设有对应的音效标识,电子设备还存储有音效类型与音效算法的对应关系。其中,音效标识为操作系统中的参数UUID,UUID的值表征对应的音效算法。During specific implementation, each sound effect algorithm is provided with a corresponding sound effect identifier, and the electronic device also stores the corresponding relationship between the sound effect type and the sound effect algorithm. Wherein, the sound effect identifier is a parameter UUID in the operating system, and the value of the UUID represents the corresponding sound effect algorithm.
处理器从音频播放请求中获取待播放的初始音频数据和初始音频数据的请求音效类型。The processor obtains the initial audio data to be played and the requested sound effect type of the initial audio data from the audio playback request.
音频播放请求可以但不限于是用户通过各个平台选择预播放的音频和音频类型而生成的,生成的音频播放请求携带对应于预播放的音频的初始音频数据和音频类型,或者音频播放请求携带对应于预播放的音频的音频获取地址和音频类型,例如:用户在音频播放请求中请求使用音效类型“立体声”播放音频“xxx歌曲”,或者用户在音频播放请求中请求使用音效类型“立体声”播放www网址的音频“xxx歌曲”。The audio playback request can be, but not limited to, generated by the user selecting the pre-played audio and audio type through each platform, and the generated audio playback request carries the initial audio data and audio type corresponding to the pre-played audio, or the audio playback request carries the corresponding The audio acquisition address and audio type of the pre-played audio, for example: the user requests to use the sound effect type "stereo" to play the audio "xxx song" in the audio play request, or the user requests to use the sound effect type "stereo" to play in the audio play request Audio "xxx song" from www url.
处理器从操作系统获取请求音效类型与音效标识的对应关系。The processor obtains the corresponding relationship between the requested sound effect type and the sound effect identifier from the operating system.
请求音效类型与音效标识的对应关系可以根据实际需求自行配置,并将配置好的对应关系存储于操作系统,以供音效处理时使用。The corresponding relationship between the requested sound effect type and the sound effect identifier can be configured according to actual needs, and the configured corresponding relationship can be stored in the operating system for use in sound effect processing.
处理器根据对应关系,确定对应于请求音效类型的目标音效标识,以目标音效标识对应的音效算法作为目标音效算法。The processor determines the target sound effect identifier corresponding to the requested sound effect type according to the corresponding relationship, and uses the sound effect algorithm corresponding to the target sound effect identifier as the target sound effect algorithm.
例如,假设UUID的值为10的音效算法为立体声音效算法,响应于音频播放请求,从音频播放请求中获取待播放的初始音频数据为xxx歌曲以及初始音频数据的请求音效类型为立体声,从操作系统获取请求音效类型与音效标识的对应关系,根据对应关系,确定对应于请求音效类型的目标音效标识为10,目标音效标识为10对应的音效算法为立体声音效算法,以立体声音效算法作为目标音效算法,采用立体声音效算法对xxx歌曲进行音效处理,得到待播放音频数据,最后将待播放音频数据发送至音频播放模块进行播放,用户就可以听到带立体声音效的xxx歌曲。For example, assuming that the sound effect algorithm whose UUID value is 10 is a stereo sound effect algorithm, in response to the audio play request, the initial audio data to be played is obtained from the audio play request as xxx song and the requested sound effect type of the initial audio data is stereo, from the operation The system obtains the corresponding relationship between the requested sound effect type and the sound effect identifier, and according to the corresponding relationship, determines that the target sound effect identifier corresponding to the requested sound effect type is 10, and the sound effect algorithm corresponding to the target sound effect identifier of 10 is a stereo sound effect algorithm, and the stereo sound effect algorithm is used as the target sound effect The algorithm uses the stereo sound effect algorithm to perform sound effect processing on the xxx song to obtain the audio data to be played, and finally sends the audio data to be played to the audio playback module for playback, and the user can hear the xxx song with stereo sound effect.
本实施例通过从音频播放请求中获取待播放的初始音频数据及其请求音效类型,根据请求音效类型与音效标识的对应关系,确定对应于请求音效类型的目标音效标识,以目标音效标识对应的音效算法作为目标音效算法,采用目标音效算法对初始音频数据进行音效处理,得到待播放音频数据进行播放,支持应用层的各个平台从操作系统调用音效算法,实现系统内置音效,即实现音效在车辆控制系统内全局生效,实现各个平台音效统一。In this embodiment, the initial audio data to be played and the requested sound effect type are obtained from the audio playback request, and the target sound effect identifier corresponding to the requested sound effect type is determined according to the corresponding relationship between the requested sound effect type and the sound effect identifier, and the target audio effect identifier corresponding to the target audio effect identifier is determined. The sound effect algorithm is used as the target sound effect algorithm. The target sound effect algorithm is used to perform sound effect processing on the initial audio data, and the audio data to be played is obtained for playback. It supports each platform of the application layer to call the sound effect algorithm from the operating system to realize the built-in sound effect of the system, that is, to realize the sound effect in the vehicle. The control system takes effect globally to realize the unified sound effect of each platform.
具体实施时,处理器通过反射机制将目标音效标识的值写入操作系统的AudioEffect的实例中,修改后的AudioEffect的实例用于被操作系统和/或电子设备的应用程序调用,以对初始音频数据进行音效处理。During specific implementation, the processor writes the value of the target sound effect identifier into the instance of the AudioEffect of the operating system through the reflection mechanism, and the modified instance of AudioEffect is used to be called by the operating system and/or the application program of the electronic device to modify the original audio The data is processed with sound effects.
其中,由于AudioEffect的实例是隐藏不公开的,操作系统管理音效标识(UUID),如果不是基于Framework层编译的应用程序均无法将自定义的目标音效标识的值写入操作系统的AudioEffect的实例中,从而无法完成设置自定义音效算法。Among them, since the instance of AudioEffect is hidden and undisclosed, the operating system manages the audio effect identifier (UUID), and the application program compiled based on the Framework layer cannot write the value of the customized target audio effect identifier into the instance of AudioEffect of the operating system , so that the setting of the custom sound effect algorithm cannot be completed.
以Java为例,Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法和属性;这种动态获取的信息以及动态调用对象的方法的功能称为java语言的反射机制(注意关键词:运行状态)换句话说,Java程序可以加载一个运行时才得知名称的class,获悉其完整构造,并生成其对象实体、或对其成员变量赋值、或调用其方法。这种“看透class”的能力称为反射。Taking Java as an example, the Java reflection mechanism is in the running state. For any class, you can know all the properties and methods of this class; for any object, you can call any of its methods and properties; this dynamic acquisition The information and the function of dynamically calling the method of the object are called the reflection mechanism of the java language (note the keyword: running state). In other words, a Java program can load a class whose name is known only at runtime, learn its complete structure, and generate Its object entities, or assign values to its member variables, or call its methods. This ability to "see through classes" is called reflection.
在本实施例中,通过反射机制将目标音效标识的值写入操作系统的AudioEffect的实例中,修改后的AudioEffect的实例可以被操作系统调用,也可以被电子设备的应用程序调用,来对初始音频数据进行音效处理。In this embodiment, the value of the target sound effect identifier is written into the AudioEffect instance of the operating system through the reflection mechanism, and the modified AudioEffect instance can be called by the operating system or by the application program of the electronic device to update the initial The audio data is processed with sound effects.
具体实施时,在处理器从多种音效算法中确定与请求音效类型相匹配的目标音效算法之后,处理器将目标音效算法设置为默认音效算法。During specific implementation, after the processor determines a target sound effect algorithm that matches the requested sound effect type from multiple sound effect algorithms, the processor sets the target sound effect algorithm as a default sound effect algorithm.
在处理器当前接收到的音频播放请求包括初始音频数据并且不包括请求音效类型时,处理器采用默认音效算法对初始音频数据进行音效处理,得到待播放音频数据。When the audio playback request currently received by the processor includes initial audio data and does not include the requested sound effect type, the processor uses a default sound effect algorithm to perform sound effect processing on the initial audio data to obtain audio data to be played.
本实施例中,在接收到的音频播放请求包括请求音效类型时,会将该请求音效类型对应的目标音效算法设置为默认音效算法,使用默认音效算法进行音效处理,如果后续的音频播放请求都不包括请求音效类型,即不发起变更默认音效算法,那么操作系统会一直保持默认音效算法不变,始终使用默认音效算法进行音效处理。In this embodiment, when the received audio playback request includes the requested sound effect type, the target sound effect algorithm corresponding to the requested sound effect type will be set as the default sound effect algorithm, and the default sound effect algorithm will be used for sound effect processing. If the requested sound effect type is not included, that is, if the default sound effect algorithm is not changed, the operating system will always keep the default sound effect algorithm unchanged, and always use the default sound effect algorithm for sound effect processing.
具体实施时,电子设备为车载终端,处理器获取车载终端所属于的车辆的当前道路信息。During specific implementation, the electronic device is a vehicle-mounted terminal, and the processor acquires current road information of the vehicle to which the vehicle-mounted terminal belongs.
在当前道路信息表征当前路段拥堵或路况湿滑时,处理器选取默认音效算法为轻柔舒缓的音效算法。When the current road information indicates that the current road section is congested or the road condition is wet and slippery, the processor selects the default sound effect algorithm as a soft and soothing sound effect algorithm.
本实施例中,将音效处理方法应用到车载终端,在获取到的当前道路信息表征当前路段拥堵或路况湿滑时,选取默认音效算法为轻柔舒缓的音效算法,以缓解车辆内部人员由于路况导致的不良情绪。In this embodiment, the sound effect processing method is applied to the vehicle-mounted terminal. When the obtained current road information indicates that the current road section is congested or the road condition is wet and slippery, the default sound effect algorithm is selected as a soft and soothing sound effect algorithm, so as to relieve the pain caused by the road conditions caused by the personnel inside the vehicle. bad mood.
具体实施时,处理器获取播放记录。During specific implementation, the processor acquires the playback record.
处理器根据播放记录设置默认音效算法。The processor sets the default sound effect algorithm according to the playback record.
例如,根据电子设备的音效播放记录,将最近x天内使用次数最多的音效算法设置默认音效算法,或者,将最近x天内累计使用时长最长的音效算法设置默认音效算法,或者,将最近x天内单次使用时长最长的音效算法设置默认音效算法等。For example, according to the sound effect playback records of electronic devices, set the sound effect algorithm that has been used the most times in the last x days as the default sound effect algorithm, or set the sound effect algorithm that has been used for the longest cumulative time in the last x days as the default sound effect algorithm, or set the sound effect algorithm that has been used the most in the last x days The sound effect algorithm with the longest single use time sets the default sound effect algorithm, etc.
本实施例中,根据播放记录设置默认音效算法,即按照用户喜好和习惯进行设置,可以节省用户用于设置操作的时间。In this embodiment, the default sound effect algorithm is set according to the playback record, that is, the setting is performed according to the user's preferences and habits, which can save the user's time for setting operations.
具体实施时,音效处理方法还包括:During specific implementation, the sound effect processing method also includes:
通过云服务端更新音效算法。Update the sound effect algorithm through the cloud server.
本实施例可以对自定义的音效算法进行更新,提供了丰富操作系统存储的音效算法的一种具体实施方式。This embodiment can update the self-defined sound effect algorithm, and provides a specific implementation manner of enriching the sound effect algorithm stored in the operating system.
实施例3Example 3
图6为本发明实施例3提供的一种电子设备的结构示意图。所述电子设备包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现实施例1中的音效处理方法。图6显示的电子设备30仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。FIG. 6 is a schematic structural diagram of an electronic device provided by Embodiment 3 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and operable on the processor. The processor implements the sound effect processing method in Embodiment 1 when executing the program. The
电子设备30可以以通用计算设备的形式表现,例如其可以为服务器设备。电子设备30的组件可以包括但不限于:上述至少一个处理器31、上述至少一个存储器32、连接不同系统组件(包括存储器32和处理器31)的总线33。
总线33包括数据总线、地址总线和控制总线。The
存储器32可以包括易失性存储器,例如随机存取存储器(RAM)321和/或高速缓存存储器322,还可以进一步包括只读存储器(ROM)323。The
存储器32还可以包括具有一组(至少一个)程序模块324的程序/实用工具325,这样的程序模块324包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。
处理器31通过运行存储在存储器32中的计算机程序,从而执行各种功能应用以及数据处理,例如本发明实施例1中的音效处理方法。The
电子设备30也可以与一个或多个外部设备34(例如按键、指向设备等)通信。这种通信可以通过输入/输出(I/O)接口35进行。并且,模型生成的电子设备30还可以通过网络适配器36与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器36通过总线33与模型生成的电子设备30的其它模块通信。应当明白,尽管图中未示出,可以结合模型生成的电子设备30使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理器、外部磁盘驱动阵列、RAID(磁盘阵列)系统、磁带驱动器以及数据备份存储系统等。
应当注意,尽管在上文详细描述中提及了电子设备的若干单元/模块或子单元/模块,但是这种划分仅仅是示例性的并非强制性的。实际上,根据本发明的实施方式,上文描述的两个或更多单元/模块的特征和功能可以在一个单元/模块中具体化;反之,上文描述的一个单元/模块的特征和功能可以进一步划分为由多个单元/模块来具体化。It should be noted that although several units/modules or subunits/modules of an electronic device are mentioned in the above detailed description, such division is only exemplary and not mandatory. In fact, according to the embodiment of the present invention, the features and functions of two or more units/modules described above can be embodied in one unit/module; conversely, the features and functions of one unit/module described above Can be further divided to be embodied by multiple units/modules.
实施例4Example 4
本实施例提供了一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现实施例1中的音效处理方法。This embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the sound effect processing method in Embodiment 1 is implemented.
其中,可读存储介质可以采用的更具体可以包括但不限于:便携式盘、硬盘、随机存取存储器、只读存储器、可擦拭可编程只读存储器、光存储器件、磁存储器件或上述的任意合适的组合。Wherein, the readable storage medium that can be used more specifically may include, but is not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device or any of the above-mentioned the right combination.
在可能的实施方式中,本发明还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行实现实施例1中的音效处理方法。In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes program code, and when the program product runs on a terminal device, the program code is used to make the terminal device execute The sound effect processing method in Embodiment 1.
其中,可以以一种或多种程序设计语言的任意组合来编写用于执行本发明的程序代码,所述程序代码可以完全地在用户设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户设备上部分在远程设备上执行或完全在远程设备上执行。Wherein, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be completely executed on the user equipment, partially executed on the user equipment, or used as an independent The package executes, partly on the user device and partly on the remote device, or entirely on the remote device.
虽然以上描述了本发明的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本发明的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本发明的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本发明的保护范围。Although the specific implementation of the present invention has been described above, those skilled in the art should understand that this is only an example, and the protection scope of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111589286.8ACN116340564A (en) | 2021-12-23 | 2021-12-23 | Sound effect processing method and system thereof, electronic device and storage medium |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111589286.8ACN116340564A (en) | 2021-12-23 | 2021-12-23 | Sound effect processing method and system thereof, electronic device and storage medium |
| Publication Number | Publication Date |
|---|---|
| CN116340564Atrue CN116340564A (en) | 2023-06-27 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111589286.8APendingCN116340564A (en) | 2021-12-23 | 2021-12-23 | Sound effect processing method and system thereof, electronic device and storage medium |
| Country | Link |
|---|---|
| CN (1) | CN116340564A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105721469A (en)* | 2016-02-18 | 2016-06-29 | 腾讯科技(深圳)有限公司 | Audio data processing method, server, client and system |
| CN106126173A (en)* | 2016-06-17 | 2016-11-16 | 广州酷狗计算机科技有限公司 | A kind of method and apparatus exporting voice data |
| WO2017215512A1 (en)* | 2016-06-16 | 2017-12-21 | 广东欧珀移动通信有限公司 | Audio stream processing method and related devices |
| CN109271128A (en)* | 2018-09-04 | 2019-01-25 | Oppo广东移动通信有限公司 | Audio setting method, device, electronic equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105721469A (en)* | 2016-02-18 | 2016-06-29 | 腾讯科技(深圳)有限公司 | Audio data processing method, server, client and system |
| WO2017215512A1 (en)* | 2016-06-16 | 2017-12-21 | 广东欧珀移动通信有限公司 | Audio stream processing method and related devices |
| CN106126173A (en)* | 2016-06-17 | 2016-11-16 | 广州酷狗计算机科技有限公司 | A kind of method and apparatus exporting voice data |
| CN109271128A (en)* | 2018-09-04 | 2019-01-25 | Oppo广东移动通信有限公司 | Audio setting method, device, electronic equipment and storage medium |
| Publication | Publication Date | Title |
|---|---|---|
| CN111367692B (en) | Search engine data processing method and device, electronic equipment and medium | |
| US20130067530A1 (en) | DNS-Based Content Routing | |
| CN110837479B (en) | Data processing method, related equipment and computer storage medium | |
| WO2020221190A1 (en) | Applet state synchronization method, device and computer storage medium | |
| CN1811704A (en) | System and method for a context-awareness platform | |
| CN105701257A (en) | Data processing method and device | |
| CN113849752B (en) | Page caching method, device and storage medium | |
| WO2022001027A1 (en) | Projection screen picture self-adaption method and apparatus in network teaching | |
| CN114697683A (en) | Intelligent scheduling method, equipment and computer program product for streaming media file | |
| CN107908791A (en) | Data cache method, device, equipment and storage medium in distributed memory system | |
| CN118824302A (en) | Audio signal processing method, audio signal processing device and storage medium | |
| CN112235132A (en) | Method, device, medium and server for dynamically configuring service | |
| CN108829370B (en) | Audio resource playing method and device, computer equipment and storage medium | |
| CN113010816A (en) | Webpage cache updating method and device, electronic equipment and storage medium | |
| WO2020038135A1 (en) | Processing method and device for multimedia material, and multimedia playing apparatus | |
| CN116340564A (en) | Sound effect processing method and system thereof, electronic device and storage medium | |
| CN114968216A (en) | Application program development project generation method and device | |
| CN110704691A (en) | Data management method and device, electronic equipment and storage medium | |
| CN113678102A (en) | Memory efficient software patching for updating applications on a computing device | |
| CN117851352A (en) | An environmental management system and method based on TiDB distributed cluster | |
| CN116192825A (en) | Cross-terminal sound reproducing method and system | |
| CN115203252A (en) | Cache function control method and device, computer equipment and storage medium | |
| CN116074688A (en) | Audio playing method, device and computer readable storage medium | |
| JP7178537B2 (en) | Playback update method, device and storage medium | |
| CN115208762B (en) | Configuration update method, device, configuration server and computer readable storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |