Variable speed playback audio Principle Analysis and implementation

[Time: 2019-05] [Status: the Open]
[Keywords: audio, audio, speed, variable speed, pitch, soundtouch, sonic]

The audio tone shift Principle Analysis

First to a voice processing theory:

变速变调可分为:变速不变调和变调不变速。

语音变速不变调是指保持音调和语义保持不变,语速变快或变慢。该过程表现为语谱图在时间轴上如手风琴般压缩或者扩展。那也就是说,基频值几乎不变,对应于音调不变;整个时间过程被压缩或者扩展,声门周期的数目减小或者增加,即声道运动速率发生改变,语速也随之变化。对应于语音产生模型,激励和系统经历与原始发音情况几乎相同的状态,但持续时间相比原来或长或短。

严格地讲,基频和音调是两个不同的概念,基频是指声带振动的频率,音调是指人类对基频的主观感知,但是两者变化基本一致,即基频越高,音调越高,基频越低,音调越低,音调是由基频决定的。因此,语音变调不变速就是指改变说话人基频的大小,同时保持语速和语义不变,即保持短时频谱包络(共振峰的位置和带宽)和时间过程基本不变。对应于语音产生模型,变调改变了激励源;声道模型的共振峰参数几乎不变,保证了语义和语速不变。

综上所述,变速改变声道运动速率,力求保持激励源不变;变调改变激励源,力求保持声道的共振峰信息不变。但是声源和声道不是相互独立的,在改变声源时,必然也会非线性的影响声道,同样地,改变声道时也会或多或少的影响声源,两者之间相互影响,相互作用。

Voice tone more commonly used in Voice changing software. And voice transmission used in the player, such as double-speed playback (fast play, slow broadcast). This article focuses on speed.
Based on the principle of shifting relative to the video frame or an interpolation frame skipping. Audio transmission principle is not so simple, because simple pumping sound sampling points can cause discontinuities, poor noise or plosive, subjective experience.
So some simple audio processing strategy usually does not work :( to x2 speed, for example)

1. The playback device implemented, provided the sampling rate is doubled playback device playback, playback number of samples per unit time is doubled so, double-speed change can be realized the same tune, but the sound discontinuity.
2. Before playing PCM is resampled to half of the original sampling rate can be achieved double-speed, but will tone.
3. The drop-frame, every one lose one, you can achieve double speed, but there will be a thorn thorn friends of friends noise, and the sound will produce intermittent, very poor experience.

Available programs

Therefore, in order to achieve a better subjective experience, but to use relatively sophisticated speech processing strategies. Now more common audio transmission has two solutions: soundtouch and Sonic.

ijkplayer using soundtouch, EXOPlayer using Sonic.

On Android there is one implementation, based on the shift playback AudioTrack code is as follows:

    PlaybackParams params = audioTrack.getPlaybackParams();
    //params.setSpeed(1.0f);  // available
    //params.setSpeed(0.5f);  // available
    params.setSpeed(1.5f);  // not available
    audioTrack.setPlaybackParams(params);

Detailed usage proposed reference PlaybackParams .

Sonic Soundtouch usage and the like, are packaged provided library, the original PCM audio data through the interface processing function to the target format, such as double-speed, PCM samples may be cut in half.
Here Soundtouch interfaces to provide an example to illustrate the use of the following:

Class interface parameters:

  • setChannels (int) Set Channel, 1 = mono mono, 2 = stereo sound
  • setSampleRate (uint) set the sample rate
  • setRate (double) specified playback rate, the original value of 1.0, large small slow fast
  • setTempo (double) specifies beats, the original value of 1.0, large small slow fast
  • setRateChange (double), setTempoChange (double) at the original speed on the basis of 1.0, percentage increments do, the value (-50 .. + 100%)
  • setPitch (double) specifies the tone value, the original value of 1.0
  • setPitchOctaves (double) on the basis of the original tone octave units to adjust the value of [-1.00, + 1.00]
  • setPitchSemiTones (int) based on the original tone in semitones adjusted value of [-12, + 12]

PCM processing class interface:

  • putSamples (const SAMPLETYPE * samples, uint nSamples) input sample data
  • receiveSamples (SAMPLETYPE * output, uint maxSamples) data output processing loop executed needed
  • () Data processing pipeline out of the last group "residue" of the flush, to be performed in the last

From the above point of view the interface, similar to a conventional decoder or multiplexer logic demodulation.

summary

The theory of the audio transmission of tone, and currently available on the Android platform audio transmission scheme summarized, including Soundtouch, Sonic and AudioTrack three options, only for subsequent reference.

Reference material

  1. Audio speed (the same transfer speed) is achieved
  2. Principle and Methods tone shift
  3. SoundTouch official website
  4. ijkplayer speed tone solutions to problems
  5. Shift for audio tone SoundTouch

Guess you like

Origin www.cnblogs.com/tocy/p/audio-tune-speed-change.html