Audio seamless loop playing method and device, electronic equipment and storage medium

CN122777082APending Publication Date: 2026-09-18CHINA FAW CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610909734.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-23
Publication Date
2026-09-18

AI Technical Summary

Technical Problem

[0008]1.硬切循环的致命缺陷:当音频片段的起始采样点与结束采样点的振幅或波形斜率不一致时(绝大多数自然录音都是如此),直接跳转会产生严重的瞬态失真,表现为刺耳的“咔哒”声或“噗”声,严重破坏听觉体验

Benefits of technology

[0035] The technical solution provided by this invention first performs fade-in and fade-out processing on the original audio segment to obtain new audio data; then, based on a multi-channel buffering and alternating mixing loop mechanism, the new audio data is played and paused intermittently between at least two independent playback channels, ensuring that at any given time, at least one independent playback channel outputs a valid audio signal. Therefore, this invention can achieve high-quality, configurable, seamless loop playback of any ordinary audio segment with low cost and low computational power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122777082A_ABST
    Figure CN122777082A_ABST
Patent Text Reader

Abstract

The present application relates to the field of audio technology, and discloses an audio seamless loop playing method and device, electronic equipment and storage medium. The method comprises: performing fade-in and fade-out processing on an original audio segment to obtain new audio data; based on a multi-channel buffer and an alternating sound mixing loop mechanism, the new audio data is staggered playing and stopping between at least two independent playing channels, so that at least one independent playing channel outputs valid audio signals at any time. The present application can prevent any ordinary audio segment from appearing discontinuity problems such as stuttering, loud noise and cutting at the beginning and end of the loop playing, and can also solve the problems of high calculation complexity and high processor power requirement of the existing high-quality loop algorithm. At least, under the premise of low cost and low power consumption, high-quality and configurable seamless loop playing of any ordinary audio segment can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In actual audio processing and playback, in order to achieve continuity of background music (BGM), ambient sound effects, or specific audio cues, it is often necessary to loop a finite-length audio segment.

[0003] Existing loop playback technologies mainly include the following solutions:

[0004] Option 1: Hard Cut Loop: This is the most basic playback method. When the player detects that an audio segment has reached the end (EOF), it immediately jumps to the beginning (BOF) of the audio segment and resumes playback. This method does not require preprocessing of the audio data.

[0005] Option 2: Fade In / Out Loop: To mitigate the "click" or "pop" sound caused by abrupt cuts, existing technologies process the beginning and end of the original audio. A common practice is to add a fade-in effect at the beginning of the audio and a fade-out effect at the end, allowing the volume to smoothly transition to zero. When played in a loop, the fade-out at the end overlaps with the fade-in at the beginning in time, attempting to conceal the seam.

[0006] Option 3: Crossfade Loop: This is a more advanced processing method. In the last few milliseconds before the end of playback, the currently playing audio sample and the upcoming audio sample are weighted and averaged (interpolated) to achieve a smooth transition between the two waveforms.

[0007] While the above solutions improve the looping experience to some extent, they still have significant drawbacks:

[0008] 1. The fatal flaw of hard-cut loops: When the amplitude or waveform slope of the starting and ending sampling points of an audio segment is inconsistent (this is the case for most natural recordings), a direct jump will produce severe transient distortion, which manifests as a harsh "click" or "pop" sound, severely damaging the listening experience.

[0009] 2. Limitations of traditional fade-in / fade-out solutions: Although Solution 2 processes the beginning and end, in actual playback logic, it is usually still played sequentially on a single channel. Achieving overlap between the beginning and end in the playback logic often requires complex slicing and reassembly of the audio file itself, and it is difficult to dynamically adjust the transition duration. If the audio material itself is not designed as a loop (such as a randomly recorded rain or wind sound), its spectral characteristics are difficult to match at the beginning and end, and simple fade-in / fade-out cannot eliminate the unnaturalness caused by spectral abrupt changes.

[0010] 3. Computational complexity and resource consumption of cross-gradient: Although Scheme 3 achieves better results, it requires high-precision sampling rate conversion and interpolation calculations in real time during playback, placing high demands on the computing power of the CPU or DSP. In low-power devices (such as embedded toys and IoT devices) or systems that need to play a large number of sound effects simultaneously, this high computing power requirement will increase hardware costs or cause system response delays.

[0011] 4. Lack of flexibility and versatility: Most existing solutions are designed for specific, meticulously crafted "looping audio sources." If a user randomly selects a segment of ordinary audio (such as a chorus of a song) for looping, existing technologies struggle to achieve high-quality, seamless looping without re-encoding the audio file.

[0012] In conclusion, existing technologies are at least unable to achieve high-quality, configurable, seamless looping playback of any ordinary audio segment while maintaining low cost and low computing power consumption. Summary of the Invention

[0013] The purpose of this invention is to provide a method, apparatus, electronic device and storage medium for seamless audio loop playback, which can at least achieve high-quality, configurable seamless loop playback of any ordinary audio segment under the premise of low cost and low computing power consumption.

[0014] To address the aforementioned technical problems, in a first aspect, the present invention provides a method for seamless audio loop playback, comprising at least:

[0015] S1. Perform fade-in / fade-out processing on the original audio segment to obtain new audio data;

[0016] S2. Based on a multi-channel buffer and alternating mixing loop mechanism, the new audio data is played and stopped alternately between at least two independent playback channels, so that at any given time, at least one of the independent playback channels outputs a valid audio signal.

[0017] Optionally, after step S2, at least the following steps are also included:

[0018] S3. In response to the issuance of a playback stop command at any time, determine whether the current audio playback loop is in any audio playback loop; if the current audio playback loop is in any audio playback loop, do not interrupt the current audio playback loop, and at least perform fade-out processing on the valid audio signal; otherwise, if the current audio playback loop is not in any audio playback loop, at least control all the independent playback channels to be muted.

[0019] Optionally, step S1 specifically includes at least:

[0020] The new audio data is obtained by applying a fade-in gain to at least the preset beginning segment of the original audio segment and a fade-out gain to the preset ending segment of the original audio segment.

[0021] Optionally, the multi-channel buffering and alternating mixing loop mechanism is implemented at least based on a preset channel transition time;

[0022] The preset channel transition duration is used to characterize at least the time difference between the audio playback node of the later playback channel and the audio stop playback node of the earlier playback channel when any two independent playback channels are to perform interleaved playback actions.

[0023] Optionally, the duration of the preset beginning segment is at least equal to the duration of the preset ending segment.

[0024] Optionally, the duration of the segment is not less than the preset channel transition duration.

[0025] Optionally, step S2 specifically includes at least:

[0026] S21. For any audio playback loop, select one of at least two independent playback channels as the preceding playback channel and select one of the other independent playback channels excluding the preceding playback channel as the following playback channel. In response to the start of the current audio playback loop, instruct the preceding playback channel to play the new audio data and instruct the following playback channel to enter an idle state.

[0027] S22. In response to the remaining preset channel transition time between the previous playback channel and the audio playback stop node, instruct the subsequent playback channel to play the new audio data;

[0028] S23. In response to the new audio data being played to the audio stop node in the previous playback channel, the previous playback channel is instructed to stop or mute. Then, the subsequent playback channel in the current audio playback loop is used as the previous playback channel in the next audio playback loop. The subsequent playback channel in the next audio playback loop is re-determined and instructed to enter an idle state. Then, proceed to step S22.

[0029] Based on the same concept, in a second aspect, the present invention also provides an audio seamless loop playback device for performing the audio seamless loop playback method described in any one of the first aspects;

[0030] The seamless audio loop playback device includes at least:

[0031] The audio processing module is used to perform fade-in and fade-out processing on the original audio segments to obtain new audio data;

[0032] An audio output module is used to play and pause the new audio data intermittently between at least two independent playback channels based on a multi-channel buffer and alternating mixing loop mechanism, so that at any given time, at least one of the independent playback channels outputs a valid audio signal.

[0033] Based on the same concept, in a third aspect, the present invention also provides an electronic device including a memory and a processor, the memory storing a computer program executable on the processor, the processor executing the program to implement the steps of the seamless audio looping method of any of the first aspects.

[0034] Based on the same concept, in a fourth aspect, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the audio seamless loop playback method described in any of the first aspects.

[0035] The technical solution provided by this invention first performs fade-in and fade-out processing on the original audio segment to obtain new audio data; then, based on a multi-channel buffering and alternating mixing loop mechanism, the new audio data is played and paused intermittently between at least two independent playback channels, ensuring that at any given time, at least one independent playback channel outputs a valid audio signal. Therefore, this invention can achieve high-quality, configurable, seamless loop playback of any ordinary audio segment with low cost and low computational power consumption. Attached Figure Description

[0036] Figure 1 This is a flowchart of an audio seamless loop playback method provided in an embodiment of the present invention;

[0037] Figure 2 This is a schematic diagram of the structure of an audio seamless loop playback device provided in an embodiment of the present invention;

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

[0039] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0040] It should be noted that any symbols and / or numbers present in the specification that are not marked in the accompanying drawings are not reference numerals.

[0041] Figure 1 This is a flowchart of a seamless audio loop playback method provided by an embodiment of the present invention. This embodiment is applicable to audio playback scenarios under at least any working condition. The seamless audio loop playback method can be, but is not limited to, executed by the seamless audio loop playback device in this embodiment of the present invention as the execution subject, which can be implemented in software and / or hardware. Figure 1 As shown, this seamless audio loop playback method includes at least the following steps:

[0042] S1. Perform fade-in / fade-out processing on the original audio segment to obtain new audio data.

[0043] The original audio segment can be any recording segment that the user wants to loop, such as a 5-second recording of rain sounds.

[0044] In one specific implementation, step S1 may optionally include at least the following:

[0045] At least the preset beginning segment of the original audio segment is given a fade-in gain, and the preset end segment of the original audio segment is given a fade-out gain to obtain new audio data.

[0046] In another specific implementation, optionally, the duration of the preset opening segment is at least equal to the duration of the preset ending segment. Of course, in other implementations, the duration of the preset opening segment may not be equal to the duration of the preset ending segment.

[0047] More specifically, the original audio segment to be looped, Audioraw, can be obtained first. Then, a linear or logarithmic fade-in gain (e.g., Gain increasing from 0 to 1) is applied to the beginning of Audioraw (e.g., the first Tfade milliseconds; i.e., the aforementioned preset beginning segment). Next, a fade-out gain (e.g., Gain decreasing from 1 to 0) is applied to the end of Audioraw (e.g., the last Tfade milliseconds; i.e., the aforementioned preset ending segment). Finally, new audio data, Audioproc, is generated.

[0048] S2. Based on a multi-channel buffer and alternating mixing loop mechanism, new audio data is played and stopped intermittently between at least two independent playback channels, so that at any given time, at least one independent playback channel outputs a valid audio signal.

[0049] In this context, "at any given moment, at least one independent playback channel outputs a valid audio signal" can mean that at any given moment, at least one independent playback channel plays a new audio signal.

[0050] In another specific implementation, optionally, the multi-channel buffering and alternating mixing loop mechanism is implemented at least based on the preset channel transition time;

[0051] The preset channel transition duration is used to characterize the time difference between the audio playback node of the later playback channel and the audio stop playback node of the earlier playback channel when any two independent playback channels are to perform interleaved playback.

[0052] In another specific implementation, optionally, the segment duration is not less than the preset channel transition duration.

[0053] It is understood that the preset channel transition duration Tadvance can be a user-configurable parameter, such as 20ms, 50ms, or 100ms. More specifically, Tadvance determines at least how long before the first channel (i.e., the previously played channel) ends in any audio playback loop, the second channel (i.e., the channel played later in the previous audio loop) begins playback. It is also understood that the value of Tfade should be greater than or equal to Tadvance to at least ensure that the fade-in and fade-out can encompass the entire overlapping area (i.e., the audio region in any audio playback loop where the previously played channel and the channel playing new audio data simultaneously).

[0054] In yet another specific implementation, step S2 may optionally include at least the following:

[0055] S21. For any audio playback loop, select one of at least two independent playback channels as the preceding playback channel and select one of the other independent playback channels excluding the preceding playback channel as the following playback channel. In response to the start of the current audio playback loop, instruct the preceding playback channel to play new audio data and instruct the following playback channel to enter an idle state.

[0056] S22. In response to the preset channel transition time remaining between the previous playback channel and the audio playback stop node, instruct the subsequent playback channel to play new audio data.

[0057] S23. In response to the playback of new audio data to the audio stop node in the previous playback channel, the previous playback channel is instructed to stop or mute. Then, the subsequent playback channel in the current audio playback loop is used as the previous playback channel in the next audio playback loop. The subsequent playback channel in the next audio playback loop is re-determined and instructed to enter the idle state. Then, proceed to step S22.

[0058] The above technical solutions are illustrated below with a specific example. In this example, the multi-channel buffering and alternating mixing loop mechanism is a two-channel buffering and alternating mixing loop mechanism, in which new audio data is played and paused alternately between two independent playback channels.

[0059] The first audio playback is triggered after new audio data is generated and the user has configured the preset channel transition time.

[0060] 1. Triggered on first playback

[0061] The timing controller can be set to instruct Channel 1 (i.e., the first channel played in the initial audio playback loop) to start playing Audioproc.

[0062] At this time, Channel 2 (i.e., the later playback channel in the initial audio playback loop) is in an idle state.

[0063] 2. Overlapping playback stage

[0064] The playback progress of Channel 1 can be monitored in real time through the timing controller.

[0065] When there are still Tadvance milliseconds between the current audio playback position of Channel 1 and the end of the audio, a command can be immediately issued through the timing controller to start Channel 2 to play Audioproc from the beginning.

[0066] At this moment, Channel 1 and Channel 2 are playing simultaneously. Because the new audio data has undergone fade-in and fade-out processing, during the period when the audio is played on both channels overlapping, Channel 1 is undergoing a fade-out phase (volume gradually decreasing), while Channel 2 is undergoing a fade-in phase (volume gradually increasing).

[0067] 3. Channel switching and cleanup

[0068] When Channel 1 reaches its physical end, a command can be issued via the timing controller to immediately stop its playback (or mute it). At this point, Channel 2 is already in a stable playback state (or is at the rising edge of a fade-in completion), filling the sound gap left by Channel 1's cessation.

[0069] The system enters single-channel playback mode (only channel two is working).

[0070] 4. Cyclic maintenance

[0071] The playback progress of Channel 2 can be monitored via the timing controller.

[0072] When the current audio playback position of channel two is still Tadvance milliseconds away from the end of the audio, repeat the logic of the first audio playback loop, restart channel one, and stop channel two.

[0073] This cycle repeats itself, forming a closed loop.

[0074] Based on this, due to the existence of Tadvance, at any given time, at least one input channel of the mixer is always active. When one channel "retires," the other channel has already "warmed up," ensuring the continuity of the output signal. Simultaneously, throughout the entire process, the audio data itself does not undergo real-time waveform distortion or interpolation calculations; it is merely a simple volume envelope (pre-processed) and the switching / mixing of the two players. Compared to real-time crossfading algorithms, this saves over 90% of DSP computing power, achieving low computational consumption.

[0075] In yet another specific implementation, optionally, after step S2, at least the following is included:

[0076] S3. In response to the issuance of a playback stop command at any time, determine whether the current audio playback loop is in any audio playback loop; if the current audio playback loop is in any audio playback loop, do not interrupt the current audio playback loop, and at least fade out the valid audio signal; otherwise, if the current audio playback loop is not in any audio playback loop, at least control all independent playback channels to be muted.

[0077] Understandably, in response to the playback stop command, if at least one independent playback channel is currently playing new audio data, the audio playback process of the corresponding independent playback channel will not be interrupted. Instead, a fade-out process will be performed on the overall audio output. This configuration can effectively reduce click or pop sounds, which helps to improve the user's audio listening experience.

[0078] The technical solution provided in this embodiment first performs fade-in and fade-out processing on the original audio segment to obtain new audio data. Then, based on a multi-channel buffer and alternating mixing loop mechanism, the new audio data is played and paused intermittently between at least two independent playback channels, ensuring that at any given time, at least one independent playback channel outputs a valid audio signal. Therefore, this embodiment can achieve high-quality, configurable, seamless loop playback of any ordinary audio segment with low cost and low computational power consumption.

[0079] More specifically, the present invention aims to solve the following problems existing in the prior art:

[0080] 1. Resolved the issues of stuttering, popping, and truncated sounds at the beginning and end of any ordinary audio clip (not material specifically designed for looping) during loop playback.

[0081] 2. It solves the problems of high computational complexity and high processor power requirements of existing high-quality loop algorithms (such as real-time crossover).

[0082] Compared with the prior art, the present invention has at least the following beneficial effects:

[0083] 1. A configurable audio looping scheme is provided, allowing users to adjust the transition duration according to actual needs to adapt to different auditory scenarios and audio characteristics.

[0084] 2. High versatility and no special requirements for audio sources: This invention does not require the audio material itself to have seamless looping acoustic characteristics. Only a simple fade-in and fade-out preprocessing is needed on the original audio for looping playback, which greatly reduces the requirements for audio source production.

[0085] 3. Extremely low computational resource consumption: The core of this invention lies in the dual-channel playback timing control, rather than real-time complex waveform interpolation calculations. Its main operations are switching audio channels on and off and volume control. The computing power requirements of CPU / DSP are far lower than those of traditional cross-gradient algorithms, making it particularly suitable for embedded systems and mobile devices.

[0086] 4. Simple to implement and low cost: From a software perspective, only two audio playback instances and a state machine need to be maintained; from a hardware perspective, it can be implemented using existing dual-channel DACs or independent audio buffers, without the need for additional dedicated chips.

[0087] 5. Smooth and natural auditory effect: At least through the mechanism of alternating and overlapping playback of dual channels, the auditory masking effect of the human ear is simulated; at any given moment, one channel is always outputting a stable sound, while the other channel is fading in and out, thus eliminating the sense of discontinuity in the hearing.

[0088] It should be noted that the following scenario embodiment is provided to illustrate the aforementioned technical solutions. In this example, the multi-channel buffering and alternating mixing loop mechanism is still a two-channel buffering and alternating mixing loop mechanism, where new audio data is played and paused alternately between two independent playback channels.

[0089] Suppose the user wants to loop a 5-second recording of rain sounds, and sets the preset channel transition time Tadvance=30ms.

[0090] 1. Preprocessing: Fade in the first 30ms of the rain sound recording and fade out the last 30ms to generate new audio data rain_loop.wav.

[0091] 2.T=0.000s: The process starts, and channel A begins playing rain_loop.wav.

[0092] 3. T=4.970s: Channel A's playback progress reaches 4970ms (i.e., 30ms remaining until the end). Upon detecting this time point, immediately command Channel B to start playing rain_loop.wav (from the beginning).

[0093] 4. T=4.970s~T=5.000s: Entering the overlap period.

[0094] Channel A is playing the last 30ms of data, and its volume is gradually decreasing from full volume to 0 due to fade-out processing.

[0095] Channel B is playing the first 30ms of data, and its volume gradually increases from 0 to full volume due to fade-in processing.

[0096] The signal output by the mixer can be the superposition of these two signals, maintaining a constant energy level.

[0097] 5.T=5.000s: Channel A finishes playing and is forcibly turned off. At this time, the volume of Channel B has reached 100%, and there is no noticeable pause in sound.

[0098] 6. T=9.970s: Channel B's playback progress has reached 4970ms (i.e., there are 30ms left until the end). Command Channel A to restart.

[0099] 7. T=10.000s: Channel B is closed, and Channel A takes over.

[0100] 8. Continue the loop...

[0101] In addition, other implementation details may include:

[0102] (1) Fade-in / fade-out curves: Cosine Ramp or Logarithmic Curve can be used for fade-in / fade-out. Compared with linear fade-in / fade-out, it can better simulate the human ear’s perception of loudness and reduce the phase cancellation phenomenon in the low-frequency part.

[0103] (2) Hardware implementation: In embedded systems, the DMA (Direct Memory Access) controller can be used to switch between two different memory buffers, and the channel switching can be triggered by timer interrupts to achieve seamless hardware-level looping with zero CPU intervention.

[0104] It should also be noted that the following are some alternative solutions:

[0105] 1. Multi-channel expansion scheme: The core idea of ​​this invention is not limited to dual channels, but can be expanded to N channels (N>2) for rotational playback. For example, in scenarios with extremely high performance requirements, three channels can be used for triangular rotation, further increasing the system's stability and fault tolerance.

[0106] 2. Software Buffer Simulation Scheme: In a pure software implementation, the "dual-channel" concept of the underlying hardware can be avoided. Instead, two audio buffers (Buffer A and Buffer B) can be constructed at the application layer. A callback function monitors the playback pointer position of the audio hardware. When the playback pointer approaches the end of Buffer A, data from Buffer B is pre-filled into the hardware output queue, achieving logical dual-channel mixing.

[0107] 3. Reverse Playback Variation: Although not as intuitive as forward playback, it can be used to achieve special sound effect loops by playing one channel forward and another channel backward (Reverse Playback).

[0108] It should also be noted that, based on the N-channel buffer and alternating mixing loop mechanism, new audio data is played and paused intermittently among N independent playback channels, so that at any given time, at least one independent playback channel outputs a valid audio signal. Therefore, before selecting the next playback channel in at least any audio playback loop, a pre-playback check is performed on the other independent playback channels excluding the previous playback channel. (For example, this could be to output independent test signals for each channel in a loop to synchronously acquire the output of all channels; at least compare the level difference, crosstalk value, distortion THD, and noise floor amplitude of each channel output; if any indicator exceeds the corresponding preset threshold, it is marked as a faulty channel; otherwise, it is marked as a candidate for the next playback channel.) The independent playback channels that pass the pre-playback check are used as candidate channels for the next playback channel, and then the next playback channel in the current audio playback loop is selected from all candidate channels for the next playback channel.

[0109] Figure 2 This is a schematic diagram of the structure of an audio seamless loop playback device provided in an embodiment of the present invention. This embodiment is applicable to audio playback scenarios under at least any working condition. The audio seamless loop playback device can be implemented in software and / or hardware. Figure 2 As shown,

[0110] A seamless audio loop playback device includes at least the following:

[0111] The audio processing module 110 is used to perform fade-in and fade-out processing on the original audio segment to obtain new audio data;

[0112] The audio output module 120 is used to interleave new audio data between at least two independent playback channels based on a multi-channel buffer and alternating mixing loop mechanism, so that at any given time, at least one independent playback channel outputs a valid audio signal.

[0113] Optionally, it may also include at least a playback stop module 130;

[0114] Playback stop module 130 is used for at least:

[0115] In response to a playback stop command issued at any time, determine whether the current audio playback loop is in any audio playback loop; if it is in any audio playback loop, do not interrupt the current audio playback loop, and at least fade out the valid audio signal; otherwise, if it is not in any audio playback loop, at least control all independent playback channels to be muted.

[0116] Optionally, the audio processing module 110 is specifically used for at least:

[0117] At least the preset beginning segment of the original audio segment is given a fade-in gain, and the preset end segment of the original audio segment is given a fade-out gain to obtain new audio data.

[0118] Optionally, the multi-channel buffering and alternating mixing loop mechanism is implemented at least based on the preset channel transition time;

[0119] The preset channel transition duration is used to characterize the time difference between the audio playback node of the later playback channel and the audio stop playback node of the earlier playback channel when any two independent playback channels are to perform interleaved playback.

[0120] Optionally, the duration of the preset opening segment is at least equal to the duration of the preset ending segment.

[0121] Optionally, the segment duration is not less than the preset channel transition duration.

[0122] Optionally, the audio output module 120 is specifically used for at least:

[0123] For any audio playback loop, one of at least two independent playback channels is selected as the preceding playback channel, and one of the other independent playback channels excluding the preceding playback channel is selected as the following playback channel. In response to the start of the current audio playback loop, the preceding playback channel is instructed to play new audio data, and the following playback channel is instructed to enter an idle state.

[0124] In response to the preset channel transition time remaining before the audio playback stop point in the previous playback channel, instruct the subsequent playback channel to play new audio data;

[0125] In response to the playback of new audio data to the audio stop node in the previous playback channel, the previous playback channel is instructed to stop or mute. Then, the next playback channel in the current audio playback loop is used as the previous playback channel in the next audio playback loop. The next playback channel in the next audio playback loop is re-determined and instructed to enter the idle state. Then, the process returns to the previous step.

[0126] The technical solution provided by this invention first uses an audio processing module to perform fade-in and fade-out processing on the original audio segment to obtain new audio data. Then, using an audio output module based on a multi-channel buffer and alternating mixing loop mechanism, the new audio data is played and paused intermittently between at least two independent playback channels, ensuring that at any given time, at least one independent playback channel outputs a valid audio signal. Therefore, this invention can achieve high-quality, configurable, seamless loop playback of any ordinary audio segment with low cost and low computational power consumption.

[0127] This embodiment provides an electronic device. Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. See also: Figure 3 The electronic device 1000 includes a processor 1001 and a memory 1002. The memory 1002 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 1001, the steps in any of the above-described seamless audio loop playback methods are performed. Through the above technical solution, the processor 1001 and the memory 1002 are interconnected and communicate with each other via a communication bus and / or other forms of connection mechanisms (not shown). The memory 1002 stores a processor-executable computer program. When the electronic device 1000 is running, the processor 1001 executes the computer program to perform the seamless audio loop playback method in any of the optional implementations of the above embodiments, to at least achieve the following functions: performing fade-in and fade-out processing on the original audio segment to obtain new audio data; based on a multi-channel buffer and alternating mixing loop mechanism, interleaving and stopping the new audio data between at least two independent playback channels, so that at any given time, at least one independent playback channel outputs a valid audio signal.

[0128] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the seamless audio loop playback method provided in all embodiments of the present invention: performing fade-in and fade-out processing on the original audio segment to obtain new audio data; and based on a multi-channel buffer and alternating mixing loop mechanism, interleaving the new audio data between at least two independent playback channels and stopping playback, so that at any given time at least one independent playback channel outputs a valid audio signal.

[0129] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0130] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0131] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0132] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0133] 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 or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for seamless audio loop playback, characterized in that, At least including: S1. Perform fade-in / fade-out processing on the original audio segment to obtain new audio data; S2. Based on a multi-channel buffer and alternating mixing loop mechanism, the new audio data is played and stopped alternately between at least two independent playback channels, so that at any given time, at least one of the independent playback channels outputs a valid audio signal.

2. The seamless audio loop playback method according to claim 1, characterized in that, After step S2, at least the following is also included: S3. In response to the issuance of a playback stop command at any time, determine whether the current audio playback loop is in any audio playback loop; if the current audio playback loop is in any audio playback loop, do not interrupt the current audio playback loop, and at least perform fade-out processing on the valid audio signal; otherwise, if the current audio playback loop is not in any audio playback loop, at least control all the independent playback channels to be muted.

3. The seamless audio loop playback method according to claim 1, characterized in that, Step S1 specifically includes at least the following: The new audio data is obtained by applying a fade-in gain to at least the preset beginning segment of the original audio segment and a fade-out gain to the preset ending segment of the original audio segment.

4. The seamless audio loop playback method according to claim 3, characterized in that, The multi-channel buffering and alternating mixing loop mechanism is implemented at least based on the preset channel transition time; The preset channel transition duration is used to characterize at least the time difference between the audio playback node of the later playback channel and the audio stop playback node of the earlier playback channel when any two independent playback channels are to perform interleaved playback actions.

5. The seamless audio loop playback method according to claim 4, characterized in that, The duration of the preset opening segment is at least equal to the duration of the preset ending segment.

6. The seamless audio loop playback method according to claim 5, characterized in that, The duration of the segment is not less than the preset channel transition duration.

7. The seamless audio loop playback method according to claim 6, characterized in that, Step S2 specifically includes at least the following: S21. For any audio playback loop, select one of at least two independent playback channels as the preceding playback channel and select one of the other independent playback channels excluding the preceding playback channel as the following playback channel. In response to the start of the current audio playback loop, instruct the preceding playback channel to play the new audio data and instruct the following playback channel to enter an idle state. S22. In response to the remaining preset channel transition time between the previous playback channel and the audio playback stop node, instruct the subsequent playback channel to play the new audio data; S23. In response to the new audio data being played to the audio stop node in the previous playback channel, the previous playback channel is instructed to stop or mute. Then, the subsequent playback channel in the current audio playback loop is used as the previous playback channel in the next audio playback loop. The subsequent playback channel in the next audio playback loop is re-determined and instructed to enter an idle state. Then, proceed to step S22.

8. An audio seamless loop playback device, characterized in that, Used to perform the seamless audio loop playback method according to any one of claims 1-7; The seamless audio loop playback device includes at least: The audio processing module is used to perform fade-in and fade-out processing on the original audio segments to obtain new audio data; An audio output module is used to play and pause the new audio data intermittently between at least two independent playback channels based on a multi-channel buffer and alternating mixing loop mechanism, so that at any given time, at least one of the independent playback channels outputs a valid audio signal.

9. An electronic device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the seamless audio loop playback method according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the seamless audio looping method according to any one of claims 1-7.