An audio playback method, apparatus, electronic device, and storage medium

By converting the switched audio format to a format acceptable to the existing audio playback object during audio playback, the interruption problem caused by audio format switching is solved, achieving seamless audio track switching and improving the user experience.

CN110083328BActive Publication Date: 2026-04-03BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-03-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

During audio playback, audio format switching causes audio playback object reconstruction due to changes in sampling rate, resulting in sound interruption and affecting user experience.

Method used

When a track switching command is received, the corresponding second audio is obtained and converted into the first audio format. The existing audio playback object is then used to continue playback, avoiding the need to rebuild a new object.

Benefits of technology

Seamless switching of audio playback is achieved, avoiding interruptions caused by rebuilding the audio playback object and improving the playback experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110083328B_ABST
    Figure CN110083328B_ABST
Patent Text Reader

Abstract

This invention relates to an audio playback method, apparatus, electronic device, and storage medium. The audio playback method includes: when playing audio using an audio playback object of a first audio format, if a track switching operation command is received, obtaining a second audio corresponding to the track switching operation command; converting the second audio into a playable audio in the first audio format; and playing the playable audio using the audio playback object. In this embodiment, when playing the first audio, if a track switching operation command is received, the second audio corresponding to the track switching operation command is obtained, and the audio format of the second audio is converted to the first audio format. The playable audio converted from the second audio is then played through the original audio playback object. This solution, by converting the second audio, continues to play audio without creating a new audio playback object, avoiding the time consumed in the audio playback object reconstruction process and achieving seamless track switching during audio playback.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of audio playback technology, and in particular to an audio playback method, apparatus, electronic device, and storage medium. Background Technology

[0002] A common scenario during streaming media playback is the switching of audio bitrates. Many online video sources contain multiple audio tracks, such as high-speed, standard, and high-quality tracks, as well as different audio encoding technologies, such as AAC and Dolby. Corresponding to these numerous formats are multiple audio source files. For audio, there are often multiple bitrate streams containing different audio formats, and audio players need to be compatible with these different audio bitrate streams.

[0003] Specifically, if the sampling rate of a standard quality stream is 44.1kHz, and the sampling rate of a high quality stream is 48kHz, the sampling rate must be specified when the audio playback object is created during playback. Therefore, when a user switches between the two streams, the change in sampling rate will cause the audio playback object to be rebuilt, that is, the previous playback object will be deleted and a new playback object will be created with the new sampling rate.

[0004] Because the human ear is very sensitive to sound playback, when the playback object is reconstructed, it will cause the sound playback to be interrupted for a short time. Even if the interruption time is only tens of milliseconds, users can still keenly perceive it, affecting the playback experience. Summary of the Invention

[0005] To address the problems existing in the prior art, at least one embodiment of the present invention provides an audio playback method, apparatus, electronic device, and storage medium.

[0006] In a first aspect, embodiments of the present invention provide an audio playback method, the audio playback method comprising:

[0007] When playing the first audio using the audio playback object of the first audio format, check whether a track switching operation command has been received;

[0008] If an audio track switching operation command is received, the second audio corresponding to the audio track switching operation command is obtained;

[0009] Convert the second audio file into the first audio format for playback.

[0010] Using the audio playback object, play the audio to be played in the first audio format.

[0011] Based on the above technical solutions, the embodiments of the present invention can be further improved as follows.

[0012] In conjunction with the first aspect, in a first embodiment of the first aspect, the detection of whether an audio track switching operation command is received includes:

[0013] Detect whether a trigger operation command has been received for the audio track control in the playback interface;

[0014] If a trigger command for the audio track control in the playback interface is detected, it is determined that an audio track switching command has been received.

[0015] In conjunction with the first aspect, in a second embodiment of the first aspect, before converting the second audio into a playable audio in a first audio format, the audio playback method further includes:

[0016] Extract the second audio format from the second audio file;

[0017] Determine whether the second audio format and the first audio format are the same;

[0018] If the second audio format is the same as the first audio format, then the second audio will be used as the audio to be played.

[0019] Alternatively, if the second audio and the first audio formats are different, the second audio is converted into the first audio format to be played.

[0020] In conjunction with the second embodiment of the first aspect, in the third embodiment of the first aspect, the step of determining whether the second audio format and the first audio format are the same includes:

[0021] Obtain the first pulse code modulation data block corresponding to the first audio format;

[0022] Obtain the second pulse code modulation data block corresponding to the second audio format;

[0023] Determine whether the first pulse code modulation data block and the second pulse code modulation data block are the same;

[0024] If the first pulse code modulation data block is the same as the second pulse code modulation data block, the second audio format is the same as the first audio format;

[0025] Alternatively, if the first pulse code modulation data block is different from the second pulse code modulation data block, the second audio format is different from the first audio format.

[0026] In conjunction with the first aspect, in a fourth embodiment of the first aspect, the first audio format includes at least one of: audio sampling rate, number of channels, audio sampling format, audio sampling precision, and channel arrangement order.

[0027] In conjunction with the first aspect or the first, second, third or fourth embodiments of the first aspect, in the fifth embodiment of the first aspect, the step of converting the second audio into a playable audio in a first audio format includes:

[0028] Get the second channel number of the second audio;

[0029] Get the number of the first channel of the first audio;

[0030] Compare the number of the second channel with the number of the first channel;

[0031] If the number of the second channel is greater than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula:

[0032]

[0033] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m The second audio channel data is not converted to the first channel number; A1 is the front positive channel data. m For the subwoofer channel; k1, k2...k m Here, n is a preset constant, and m is the number of the first channel and the second channel.

[0034] If the number of the second channel is less than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula:

[0035]

[0036] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m This represents the channel data of the second audio that has not been converted to the first channel number; n is the first channel number, and m is the second channel number.

[0037] Secondly, embodiments of the present invention provide an audio playback device, the audio playback device comprising:

[0038] The detection unit is used to detect whether a track switching operation command is received when playing audio using an audio playback object of the first audio format.

[0039] The first acquisition unit is used to acquire the second audio corresponding to the audio track switching operation instruction if an audio track switching operation instruction is received.

[0040] A conversion unit is used to convert the second audio into a first audio format audio to be played.

[0041] The playback unit is used to play the audio to be played in the first audio format using the audio playback object.

[0042] In conjunction with the second aspect, in the first embodiment of the second aspect, the detection unit is specifically used to detect whether a trigger operation instruction for the audio track control in the playback interface is received; if a trigger operation instruction for the audio track control in the playback interface is received, it is determined that an audio track switching operation instruction has been received.

[0043] In conjunction with the second aspect, in a second embodiment of the second aspect, the audio playback device further includes:

[0044] The second acquisition unit is used to extract the second audio format of the second audio;

[0045] The judgment unit is used to determine whether the second audio format and the first audio format are the same;

[0046] The conversion unit is specifically used to, if the second audio format and the first audio format are the same, use the second audio as the audio to be played; if the second audio format and the first audio format are different, convert the second audio into the first audio format audio to be played.

[0047] In conjunction with the second embodiment of the second aspect, in the third embodiment of the second aspect, the determining unit is specifically used to obtain the first pulse code modulation data block corresponding to the first audio, and to obtain the second pulse code modulation data block corresponding to the second audio format; to determine whether the first pulse code modulation data block and the second pulse code modulation data block are the same; if the first pulse code modulation data block and the second pulse code modulation data block are the same, the second audio format and the first audio format are the same; if the first pulse code modulation data block and the second pulse code modulation data block are not the same, the second audio format and the first audio format are not the same.

[0048] In conjunction with the second aspect or the first, second, or third embodiment of the second aspect, in the fourth embodiment of the second aspect, the conversion unit is specifically used for,

[0049] Get the second channel number of the second audio;

[0050] Get the number of the first channel of the first audio;

[0051] Compare the number of the second channel with the number of the first channel;

[0052] If the number of the second channel is greater than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula:

[0053]

[0054] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m The second audio channel data is not converted to the first channel number; A1 is the front positive channel data. m For the subwoofer channel; k1, k2...k m Here, n is a preset constant, and m is the number of the first channel and the second channel.

[0055] If the number of the second channel is less than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula:

[0056]

[0057] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m This represents the channel data of the second audio that has not been converted to the first channel number; n is the first channel number, and m is the second channel number.

[0058] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0059] Memory, used to store computer programs;

[0060] The processor, when executing a program stored in memory, implements the audio playback method described in any embodiment of the first aspect.

[0061] Fourthly, embodiments of the present invention provide a computer-storable medium storing one or more programs, which can be executed by one or more processors to implement the audio playback method described in any embodiment of the first aspect.

[0062] Compared with the prior art, the above-mentioned technical solution of the present invention has the following advantages: When the audio playback object plays audio, if a track switching operation command is received, the second audio corresponding to the track switching operation command is obtained, and the audio format of the second audio is converted into a first audio format that the audio playback object can accept. Finally, the audio playback object continues to play the audio to be played after the second audio is converted. This solution converts the second audio and continues to play the audio without creating a new audio playback object, thus avoiding the time consumed by the audio playback object reconstruction process and realizing seamless track switching during audio playback. Attached Figure Description

[0063] Figure 1 A schematic diagram of a terminal provided in various embodiments of the present invention;

[0064] Figure 2 This is a schematic flowchart of an audio playback method provided in an embodiment of the present invention;

[0065] Figure 3 This is a schematic flowchart of an audio playback method provided in another embodiment of the present invention;

[0066] Figure 4 This is a schematic flowchart of an audio playback method provided in another embodiment of the present invention;

[0067] Figure 5 This is a second schematic diagram of an audio playback method provided in another embodiment of the present invention;

[0068] Figure 6 This is a third schematic diagram of an audio playback method provided in another embodiment of the present invention;

[0069] Figure 7 This is a schematic diagram of an audio playback device according to another embodiment of the present invention;

[0070] Figure 8 This is a schematic diagram of an electronic device structure provided in another embodiment of the present invention. Detailed Implementation

[0071] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0072] like Figure 1The diagram shown is a hardware structure schematic of a terminal implementing various embodiments of the present invention, including an audio decoder 111, an audio playback object generator 112, an audio converter 113, a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140. The processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140. The terminal can be a mobile terminal such as a mobile phone, tablet computer, laptop computer, handheld computer, personal digital assistant (PDA), portable media player (PMP), navigation device, wearable device, smart bracelet, pedometer, etc., as well as a fixed terminal such as a digital TV, desktop computer, etc.

[0073] like Figure 2 As shown in the figure, an audio playback method is provided in an embodiment of the present invention. The audio playback method includes:

[0074] S11. When playing the first audio using the first audio format audio playback object generated by the audio playback object generator 112, the processor 1110 detects whether it has received an audio track switching operation instruction.

[0075] In this embodiment, the audio playback object is a program process created when playing audio in a specified audio format. When the audio format of the played audio changes, a new audio playback object needs to be created to adapt to the new audio format, and the original audio playback object is deleted. Therefore, the audio format that the audio playback object in this embodiment can play is the first audio format. At this time, the processor 1110 detects whether an audio track switching operation command has been received. The audio track switching operation command can be received through a physical button or virtual button set on the audio playback device, or it can be an audio switching operation command sent by an external device received by the audio playback device through a wireless connection device.

[0076] Specifically, the processor 1110 can detect whether it has received an audio track switching operation instruction by: detecting whether it has received a trigger operation instruction for the audio track control in the playback interface; if it detects that a trigger operation instruction for the audio track control in the playback interface has been received, it determines that an audio track switching operation instruction has been received.

[0077] S12. If the processor 1110 receives an audio track switching operation instruction, it controls the audio decoder 111 to obtain the second audio corresponding to the audio track switching operation instruction.

[0078] In this embodiment, the second audio to be played is obtained according to the audio track switched to by the audio track switching operation command. The first audio is the audio that the audio playback object is currently playing, and the second audio is the audio to be played obtained by the terminal from the memory 1130 or from the network according to the control of the audio track switching operation.

[0079] For example, when playing a video, if the user switches the video resolution, the audio quality will also change accordingly. Since each video has its own corresponding audio, and the video resolution is designed to allow the user to choose the optimal playback method based on their device's performance. Of course, the audio tracks of the two videos may be the same. If the audio doesn't switch after the video is switched, the playback system needs to extract the audio from the first video and the video from the second video. This can easily lead to audio-visual desynchronization. Therefore, in a video playback system, if the video resolution changes, the audio source will also change accordingly because the video source changes.

[0080] In conjunction with the above-described video playback scenario, in a specific embodiment, the audio playback method includes:

[0081] When playing the first video and playing the first audio corresponding to the first video using the audio playback object of the first audio format, detect whether the resolution switching operation of the first video is obtained.

[0082] If the resolution switching operation is obtained, the second video and the second audio corresponding to the resolution switching operation are obtained;

[0083] Convert the second audio file into the first audio format for playback.

[0084] While playing the second video, the audio to be played is played using the audio playback object in the first audio format.

[0085] S13, the audio converter 113 converts the second audio into the first audio format to be played.

[0086] In this embodiment, the audio format of the second audio to be played, obtained in the previous step, is converted into the first audio format. For example, the audio sampling rate, number of channels, audio sampling format, audio sampling precision, channel arrangement order, endianness, and sample packing format of the second audio are all converted to the same audio format as the first audio format. The audio sampling rate conversion can be achieved using the third-party open-source software SoundTouch 2.0.0, and the conversion of the number of channels, audio sampling format, audio sampling precision, endianness, and sample packing format can be achieved using the third-party open-source software ffmpeg 3.4. The channel arrangement order conversion can be achieved by arranging the order of the decoded pulse code modulation data blocks after audio decoding.

[0087] S14. Using the audio playback object, play the audio to be played in the first audio format.

[0088] In this embodiment, the corresponding audio to be played is played through the aforementioned audio playback object. Since the reconstruction of the audio playback object is not involved, the audio playback process will not be interrupted. At the same time, since the audio format conversion is performed in the time domain and not in the frequency domain, the playback of the audio to be played meets the real-time requirements. For example, in the field of video playback, the audio and video will not be out of sync as in this embodiment, and seamless switching of audio tracks is achieved during audio playback.

[0089] like Figure 3 As shown, this embodiment of the invention provides an audio playback method, which includes:

[0090] S21. When playing the first audio using the first audio format audio playback object generated by the audio playback object generator 112, the processor 1110 detects whether it has received an audio track switching operation instruction.

[0091] For details regarding step S21, please refer to the description in step S11. This embodiment will not repeat the details here.

[0092] S22. If the processor 1110 receives an audio track switching operation instruction, the audio decoder 111 acquires the second audio corresponding to the audio track switching operation instruction.

[0093] For details regarding step S22, please refer to the description in step S12. This embodiment will not repeat the details here.

[0094] S23, Processor 1110 extracts the second audio format of the second audio.

[0095] In this embodiment, the processor 1110 extracts the audio format of the second audio as the second audio format. The data type in the second audio format is completely consistent with the data type in the first audio format, including: audio sampling rate, number of channels, audio sampling format, audio sampling precision, channel arrangement order, endianness, and sampling packing format, etc.

[0096] S24, Processor 1110 determines whether the second audio format and the first audio format are the same.

[0097] In this embodiment, it can be determined whether the second audio format and the first audio format are the same by comparing the values ​​of audio sampling rate, number of channels, audio sampling format, audio sampling precision, channel arrangement order, endianness, and sampling packing format in the audio formats in turn.

[0098] like Figure 4 As shown, in this embodiment, the determination of whether the second audio format and the first audio format are the same can be made by the following method:

[0099] S31, Processor 1110 acquires the first pulse code modulation data block corresponding to the first audio format.

[0100] In this embodiment, the first pulse code modulation data block corresponding to the first audio format is the PCM data block obtained after demodulating the first audio. PCM (Pulse Code Modulation) transforms a time-continuous, value-continuous analog signal into a time-discrete, value-discrete digital signal for transmission in the channel. Pulse code modulation involves sampling the analog signal, quantizing the amplitude of the samples, and then encoding them. When the player is playing normally, the audio playback thread continuously produces PCM data blocks, which are the decoded original audio data.

[0101] S32, Processor 1110 acquires the second pulse code modulation data block corresponding to the second audio format.

[0102] In this embodiment, the second pulse code modulation data block corresponding to the second audio format is the PCM data block obtained after demodulating the second audio. Pulse code modulation is the process of transforming a time-continuous, continuously valued analog signal into a time-discrete, discrete-valued digital signal for transmission in the channel. Pulse code modulation involves sampling the analog signal, then quantizing and encoding the sample amplitude. When the player is playing normally, the audio playback thread continuously produces PCM data blocks, which are the decoded original audio data.

[0103] S33, Processor 1110 determines whether the first pulse code modulation data block and the second pulse code modulation data block are the same.

[0104] When the player is playing normally, the audio playback thread continuously produces PCM data blocks, which are the decoded raw audio data. Since this scheme involves switching audio tracks, if the first audio format and the second audio format are the same, the corresponding first and second pulse code modulation data blocks obtained from the audio decoding will also be exactly the same. Therefore, if the first and second pulse code modulation data blocks are the same, it can be confirmed that the first and second audio formats are the same.

[0105] S34a. If the first pulse code modulation data block is the same as the second pulse code modulation data block, then the second audio format is the same as the first audio format.

[0106] S34b, or, if the first pulse code modulation data block is different from the second pulse code modulation data block, then the second audio format is different from the first audio format.

[0107] S25a. If the second audio format is the same as the first audio format, then the second audio will be used as the audio to be played.

[0108] S25b, or, if the second audio format is different from the first audio format, the second audio is converted into the first audio format to be played by the audio converter 113.

[0109] For details regarding step S25b, please refer to the description in step S13; this embodiment will not repeat them here.

[0110] S26. Using the audio playback object, play the audio to be played in the first audio format.

[0111] For details regarding step S26, please refer to the description in step S14; this embodiment will not repeat them here.

[0112] like Figure 5 As shown, this embodiment of the invention provides an audio playback method, which includes:

[0113] S41. When playing the first audio using the first audio format audio playback object generated by the audio playback object generator 112, the processor 1110 detects whether it has received an audio track switching operation instruction.

[0114] For details regarding step S41, please refer to the description in step S11. This embodiment will not repeat the details here.

[0115] S42. If the processor 1110 receives an audio track switching operation command, the audio decoder 111 acquires the second audio corresponding to the audio track switching operation command.

[0116] For details regarding step S42, please refer to the description in step S12; this embodiment will not repeat them here.

[0117] S43. The second audio is converted into the first audio format audio to be played by the audio converter 113.

[0118] For details regarding step S43, please refer to the description in step S13; this embodiment will not repeat them here.

[0119] like Figure 6 As shown, in this embodiment, for example, the method for converting the number of channels of the second audio to the number of channels of the first audio format to be played audio can be:

[0120] S51, Audio converter 113 obtains the second channel number of the second audio.

[0121] S52, Audio converter 113 obtains the first channel number of the first audio.

[0122] S53, Audio converter 113 compares the number of second channels with the number of first channels.

[0123] In this embodiment, when the number of second channels is greater than the number of first channels, the number of channels for the second audio needs to be reduced. For example, when converting from six channels to two channels, the data related to the left channel in the six channels needs to be converted to the left channel in the two-channel system, and the data related to the right channel in the six channels needs to be converted to the right channel in the two-channel system. The front channel and subwoofer channel in the six channels are related channels to the left and right channels. Moreover, when converting from multi-channel to a channel with a relatively small number of channels, the front channel and subwoofer channel need to be considered. When the number of second channels is less than the number of first channels, the number of channels for the second audio needs to be increased. For example, when converting from two channels to six channels, since the number of channels increases and the source data is relatively small, the expanded channel data can be obtained by average copying.

[0124] S54a. If the number of second channels is greater than the number of first channels, the audio converter 113 converts the number of second channels of the second audio to the number of first channels using the following first calculation formula:

[0125]

[0126] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A mThe second audio channel data is not converted to the first channel number; A1 is the front positive channel data. m For the subwoofer channel; k1, k2...k m Here, n is a preset constant, and m is the number of the first channel and the second channel.

[0127] In this embodiment, referring to the above embodiment, the two-channel is converted to six-channel, that is, the number of channels referenced by the converted channel S1 is 4. For example, if S1 is the left channel, the referenced channels are the front channel, the left front channel, the left rear channel, and the subwoofer channel; correspondingly, S2 is the right channel, and the referenced channels are the front channel, the right front channel, the right rear channel, and the subwoofer channel.

[0128] In this embodiment, k1, k2...k m The value can be set by the user. For example, it can be equal in the same group of formulas equal to 1, or it can be reasonably distributed according to the proportion of each channel.

[0129] In this embodiment, if the audio is converted from six channels to eight channels, based on the above formula, then the channels referenced by S1 are A1, A7, and A8; the channels referenced by S2 are A1, A2, and A8; the channels referenced by S3 are A1, A3, and A8; the channels referenced by S4 are A1, A4, and A8; the channels referenced by S5 are A1, A5, and A8; and the channels referenced by S6 are A1, A6, and A8.

[0130] S54b, or, if the number of second channels is less than the number of first channels, then the audio converter 113 converts the number of second channels of the second audio to the number of first channels using the following second calculation formula:

[0131]

[0132] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m This represents the channel data of the second audio that has not been converted to the first channel number; n is the first channel number, and m is the second channel number.

[0133] In this embodiment, if the number of channels of the second audio is increased, the channel data of each channel in the second audio is averaged and superimposed, and then assigned to the newly added channels respectively.

[0134] S54c, or, if the number of the second channel is equal to the number of the first channel, then no conversion is required.

[0135] S44. Using the audio playback object, play the audio to be played in the first audio format.

[0136] For details regarding step S44, please refer to the description in step S14; this embodiment will not repeat them here.

[0137] like Figure 7 As shown, an embodiment of the present invention provides an audio playback device, which includes: a detection unit 11, a first acquisition unit 12, a conversion unit 13, and a playback unit 14.

[0138] In this embodiment, the detection unit 11 is used to detect whether a track switching operation instruction is received when playing audio using an audio playback object of the first audio format; specifically, the detection unit 11 is used to detect whether a trigger operation instruction for the audio track control in the playback interface is received; if a trigger operation instruction for the audio track control in the playback interface is received, it is determined that a track switching operation instruction has been received. Specifically, the first audio format includes audio formats such as audio sampling rate, number of channels, audio sampling format, audio sampling precision, channel arrangement order, big-endian format, and sampling packing format.

[0139] In this embodiment, the first acquisition unit 12 is used to acquire the second audio corresponding to the audio track switching operation instruction if an audio track switching operation instruction is received.

[0140] In this embodiment, the conversion unit 13 is used to convert the second audio into the first audio format to be played audio.

[0141] In this embodiment, the playback unit 14 is used to play audio of a first audio format using an audio playback object.

[0142] Combination such as Figure 7 In one specific embodiment, the audio playback device further includes a second acquisition unit and a judgment unit.

[0143] In this embodiment, the second acquisition unit is used to extract the second audio format of the second audio.

[0144] In this embodiment, the judging unit is used to judge whether the second audio format and the first audio format are the same. Specifically, the judging unit is used to obtain the first pulse code modulation data block corresponding to the first audio and obtain the second pulse code modulation data block corresponding to the second audio format; and to judge whether the first pulse code modulation data block and the second pulse code modulation data block are the same. If the first pulse code modulation data block and the second pulse code modulation data block are the same, the second audio format and the first audio format are the same. If the first pulse code modulation data block and the second pulse code modulation data block are not the same, the second audio format and the first audio format are not the same.

[0145] In this embodiment, the conversion unit 13 is specifically used to convert the second audio as the audio to be played if the second audio format is the same as the first audio format, and to convert the second audio into the audio to be played in the first audio format if the second audio format is different from the first audio format.

[0146] Combination such as Figure 7 In one specific embodiment of the audio playback device shown, the conversion unit 13 is specifically used for,

[0147] Get the second channel number of the second audio;

[0148] Get the first channel number of the first audio file;

[0149] Compare the number of the second channel with the number of the first channel;

[0150] If the number of second channels is greater than the number of first channels, then the number of second channels of the second audio is converted to the number of first channels using the following first calculation formula:

[0151]

[0152] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m The second audio channel data is not converted to the first channel number; A1 is the front positive channel data. m For the subwoofer channel; k1, k2...k m Here, n is a preset constant, and m is the number of the first channel and the second channel.

[0153] If the number of second channels is less than the number of first channels, the number of second channels of the second audio is converted to the number of first channels using the following second calculation formula:

[0154]

[0155] Among them, S1, S2.......S n This is the channel data for the second audio frequency, converted to the first channel number; A1, A2...A m This represents the channel data of the second audio that has not been converted to the first channel number; n is the first channel number, and m is the second channel number.

[0156] like Figure 8 As shown, this embodiment of the invention provides an electronic device, including a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other through the communication bus 1140.

[0157] Memory 1130 is used to store computer programs;

[0158] When processor 1110 executes the program stored in memory 1130, it performs the following steps:

[0159] When playing audio using an audio playback object of the first audio format, check whether a track switching operation command has been received;

[0160] If a track switching operation command is received, the second audio corresponding to the track switching operation command is obtained;

[0161] Convert the second audio file into the first audio format for playback.

[0162] Use the audio playback object to play the audio to be played in the first audio format.

[0163] The electronic device provided in this embodiment of the invention, wherein the processor 1110 executes the program stored in the memory 1130 to realize the function of seamlessly switching audio tracks during audio playback. If an audio track switching operation instruction is detected during audio playback, the processor obtains the second audio corresponding to the audio track switching operation instruction, converts the second audio into an audio to be played in the first audio format, and continues to play the audio to be played in the first audio format through the original audio playback object. Without creating a new audio playback object, the audio continues to play, thus realizing the function of seamlessly switching audio tracks during audio playback.

[0164] The communication bus 1140 mentioned in the above-mentioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus 1140 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0165] The communication interface 1120 is used for communication between the above-mentioned electronic device and other devices.

[0166] The memory 1130 may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1130 may also be at least one storage device located remotely from the aforementioned processor 1110.

[0167] The processor 1110 mentioned above can be a general-purpose processor 1110, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0168] This invention also provides a computer-storable medium storing one or more programs, which can be executed by one or more processors 1110 to implement the audio playback method described in any of the above embodiments.

[0169] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A 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 flow or function according to the embodiments of the present invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An audio playback method, characterized in that, The audio playback method includes: When playing the first audio using the audio playback object of the first audio format, check whether a track switching operation command has been received; If an audio track switching operation command is received, the second audio corresponding to the audio track switching operation command is obtained; If the second audio format is different from the first audio format, then the second audio is converted into the first audio format to be played. Using the audio playback object, play the audio to be played in the first audio format; The step of obtaining the second audio corresponding to the audio track switching operation instruction includes: when playing the first video and playing the first audio corresponding to the first video using an audio playback object of the first audio format, detecting whether a resolution switching operation of the first video is obtained; if the resolution switching operation is obtained, then obtaining the second video and the second audio corresponding to the resolution switching operation. The step of converting the second audio into a playable audio in a first audio format includes: converting the number of channels of the second audio according to the first audio format to obtain the playable audio; The step of using the audio playback object to play the audio to be played in the first audio format includes: while playing the second video, using the audio playback object to play the audio to be played in the first audio format; The step of converting the second audio into a first audio format for playback includes: Get the second channel number of the second audio; Get the number of the first channel of the first audio; Compare the number of the second channel with the number of the first channel; If the number of the second channel is greater than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula: ; ; in, The channel data for the second audio frequency, converted to the first channel number; The channel data for the second audio frequency that has not been converted to the first channel number. This is the data for the front channel. For subwoofer channel; As a preset constant, The number of the first channel. This refers to the number of the second channel; If the number of the second channel is less than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula: ; in, The channel data for the second audio frequency, converted to the first channel number; The channel data for the second audio frequency that has not been converted to the first channel number; The number of the first channel. This refers to the number of the second audio channel.

2. The audio playback method according to claim 1, characterized in that, The detection of whether an audio track switching operation command has been received includes: Detect whether a trigger operation command has been received for the audio track control in the playback interface; If a trigger command for the audio track control in the playback interface is detected, it is determined that an audio track switching command has been received.

3. The audio playback method according to claim 1, characterized in that, Before converting the second audio to the first audio format to be played, the audio playback method further includes: Extract the second audio format from the second audio file; Determine whether the second audio format and the first audio format are the same; If the second audio format is the same as the first audio format, then the second audio will be used as the audio to be played.

4. The audio playback method according to claim 3, characterized in that, The step of determining whether the second audio format and the first audio format are the same includes: Obtain the first pulse code modulation data block corresponding to the first audio format; Obtain the second pulse code modulation data block corresponding to the second audio format; Determine whether the first pulse code modulation data block and the second pulse code modulation data block are the same; If the first pulse code modulation data block is the same as the second pulse code modulation data block, the second audio format is the same as the first audio format; If the first pulse code modulation data block is different from the second pulse code modulation data block, the second audio format is different from the first audio format.

5. The audio playback method according to claim 1, characterized in that, The first audio format includes at least one of the following: audio sampling rate, number of channels, audio sampling format, audio sampling precision, and channel arrangement order.

6. An audio playback device, characterized in that, The audio playback device includes: The detection unit is used to detect whether a track switching operation command is received when playing audio using an audio playback object of the first audio format. The first acquisition unit is configured to acquire a second audio corresponding to the audio track switching operation instruction if an audio track switching operation instruction is received; the acquisition of the second audio corresponding to the audio track switching operation instruction includes: when playing a first video and playing a first audio corresponding to the first video using an audio playback object of a first audio format, detecting whether a resolution switching operation of the first video is acquired; if the resolution switching operation is acquired, then acquiring the second video and the second audio corresponding to the resolution switching operation; A conversion unit is configured to convert the second audio into a playable audio in the first audio format when the second audio format and the first audio format are different; the conversion of the second audio into a playable audio in the first audio format includes: converting the number of channels of the second audio according to the first audio format to obtain the playable audio; A playback unit is configured to play the audio to be played in the first audio format using the audio playback object; the step of playing the audio to be played in the first audio format using the audio playback object includes: playing the audio to be played in the first audio format using the audio playback object while playing the second video; The conversion unit is specifically used for: Get the second channel number of the second audio; Get the number of the first channel of the first audio; Compare the number of the second channel with the number of the first channel; If the number of the second channel is greater than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula: ; ; in, The channel data for the second audio frequency, converted to the first channel number; The channel data for the second audio frequency that has not been converted to the first channel number. This is the data for the front channel. For subwoofer channel; As a preset constant, The number of the first channel. This refers to the number of the second channel; If the number of the second channel is less than the number of the first channel, the number of the second channel of the second audio is converted to the number of the first channel using the following calculation formula: ; in, The channel data for the second audio frequency, converted to the first channel number; The channel data for the second audio frequency that has not been converted to the first channel number; The number of the first channel. This refers to the number of the second audio channel.

7. The audio playback device according to claim 6, characterized in that, The detection unit is specifically used to detect whether a trigger operation command for the audio track control in the playback interface is received; if a trigger operation command for the audio track control in the playback interface is received, it is determined that an audio track switching operation command has been received.

8. The audio playback device according to claim 6, characterized in that, The audio playback device further includes: The second acquisition unit is used to extract the second audio format of the second audio; The judgment unit is used to determine whether the second audio format and the first audio format are the same; The conversion unit is specifically used to, if the second audio format and the first audio format are the same, use the second audio as the audio to be played; if the second audio format and the first audio format are different, convert the second audio into the first audio format audio to be played.

9. The audio playback device according to claim 8, characterized in that, The judgment unit is specifically used to obtain the first pulse code modulation data block corresponding to the first audio and the second pulse code modulation data block corresponding to the second audio format; to determine whether the first pulse code modulation data block and the second pulse code modulation data block are the same; if the first pulse code modulation data block and the second pulse code modulation data block are the same, the second audio format and the first audio format are the same; if the first pulse code modulation data block and the second pulse code modulation data block are not the same, the second audio format and the first audio format are not the same.

10. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the audio playback method according to any one of claims 1 to 5.

11. A computer-storable medium, characterized in that, The computer may store one or more programs on a storage medium, and the one or more programs may be executed by one or more processors to implement the audio playback method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Audio-channel processing device and audio-channel processing method for video

    CN103237259A

  • Multiple-channel audio frequency replaying apparatus and method

    CN1277532A

  • Channel number converter

    JP2015186144A

  • System for selecting video tracks during playback of a media production

    US20040126085A1

  • Device and method for encoding and decoding multichannel signal

    US20140372130A1