← エンジン一覧に戻る ← Back to Engines Phase Vocoder & Phase Locking Engine | DS Soft
EN JP

フェーズボコーダ & 位相同期(Phase Locking)エンジン Phase Vocoder & Phase Locking Engine

「なぜピッチやテンポを変えても音質が濁らないのか?」高品質時間伸縮の設計思想 High-Quality Time Stretching & Pitch Shifting Artifact Elimination

概要と搭載アプリケーション Overview & Applications

フェーズボコーダ(Phase Vocoder)は、オーディオ信号の時間長(テンポ)と周波数(ピッチ)を互いに独立して変化させるDSPアルゴリズムです。
DS Softでは、従来の処理で発生しやすい「金属的なフランジャー音(Phasing Artifact)」「超スロー再生時の波形荒れ」「リサンプリング時の高域ノイズ」を抑えるため、位相ロックの精度向上とアンチエイリアス付き高品質リサンプリングを組み込んだ、C++マルチスレッド対応エンジンを構築しました。

【自作に至った開発の経緯】
当初は既存のサードパーティ製オーディオライブラリ(SoundTouch等)を導入していましたが、ピッチシフトやタイムストレッチ時の音質の曇りや輪郭の劣化がどうしても拭えず、音響的クオリティに納得がいかないという課題に直面しました。
そこで、ライブラリ依存を脱却し、独自に「Phase Vocoder + Phase Locking(位相同期)」を一から設計・実装。圧倒的に原音のハリと透明感を保つエンジンへの完全刷新を果たしました。

The Phase Vocoder decouples pitch and tempo adjustments. DS Soft designed a high-performance C++ multi-threaded engine optimized for mobile devices, with refined phase locking and anti-aliased high-quality resampling to suppress metallic phasing, slow-speed distortion, and high-frequency noise.

[Development Background]
Initially utilizing third-party libraries such as SoundTouch, we encountered audio dullness and detail degradation during pitch and tempo scaling. To overcome these quality limitations, we built a custom Phase Vocoder with Phase Locking from scratch.
採用アプリ:Adopted Apps:
Pitch Tempo Changer Video Speed & Pitch Changer Notewise AutoTuner

1. 方式の使い分けとピッチ・テンポの独立制御 ➔ 2パス処理アーキテクチャ 1. Method Selection & Independent Pitch/Tempo Control ➔ Two-Pass Architecture

💬 開発者のつぶやき: 「”音が酷い”というレビューを受けて一念発起、エンジンを自作してみよう」 💬 Dev's Note: "Motivated by user reviews pointing out sound degradation, I decided to build a custom audio engine from scratch."

ピッチやテンポを変える方法には、PSOLAやWSOLAなど、素材や用途に応じて有効な手法があります。本エンジンでは、25%のスロー再生から400%の高速再生までのような大きなテンポ変更にも対応しやすい、周波数領域ベースのPhase Vocoderを中核に採用しています。

【問題】 音声波形をそのまま伸縮させると、テンポの変更に伴ってピッチ(音程)まで一緒に上下してしまうため、テンポとピッチを個別にコントロールすることができない。

【対処(アプローチ)】 処理を明確に2ステップに分離する「2パス戦略(Stretch ➔ Resample)」を採用しました。

  • Pass 1(STFT タイムストレッチ): 短時間フーリエ変換(STFT)を用い、周波数ドメイン上で時間軸(テンポ)のみを正確に伸縮。
  • Pass 2(3次スプライン補間リサンプリング): 伸縮後の時間波形に対し、Catmull-Rom型の高精度3次スプライン補間(Cubic Interpolation)を適用して目的のピッチへ着地。
この分離アプローチにより、処理の数学的独立性と圧倒的なスピード、およびリアルタイムでの滑らかなパラメーター追従を実現しています。

PSOLA and WSOLA are effective options depending on the source material and use case. This engine centers on a frequency-domain Phase Vocoder, which is well suited to large tempo changes such as 25% slow playback through 400% fast playback.

[Problem] Directly stretching time waveforms inherently alters pitch alongside tempo, making independent control impossible.

[Solution] A clear 2-pass strategy (Stretch ➔ Resample): Pass 1 stretches the time axis via STFT in the frequency domain; Pass 2 applies high-precision Catmull-Rom cubic spline interpolation to reach target pitch cleanly.

2. 金属的フランジャーノイズの発生 ➔ ピーク検出型 Phase Locking(位相同期) 2. Metallic Phasing Artifacts ➔ Peak-Tracking Phase Locking

💬 開発者のつぶやき: 「え・・・・フェーズボコーダって音良いんじゃないの?」 💬 Dev's Note: "Wait... isn't a Phase Vocoder supposed to sound great...?"

【問題】 ナイーブな(単純な)フェーズボコーダでは、時間軸を引き伸ばした際に「隣り合う周波数ビン(Bin)どうしの位相関係がバラバラ」になり、波形が相互干渉することでコーラスがかかったようなキンキンした金属音(Phasing Artifact)や濁りが発生する。

【対処(アプローチ)】 ピーク追跡型のPhase Locked Bins(位相同期機構)を精度向上しました。主音・倍音成分の局所的ピークをサブビン精度で推定し、各周波数ビンを最も近いピークへ割り当てて位相回転を同期。さらに、微小なノイズ成分は不要にロックしないことで、波形の位相コヒーレンスを保ちながら、金属的な響きやシュワシュワした濁りを抑制します。

[Problem] Naive STFT time-stretching disrupts relative phase coherence between adjacent frequency bins, causing unnatural metallic phasing/flanging noise.

[Solution] Refined peak-tracking Phase Locking. The algorithm estimates local spectral peaks with sub-bin precision, assigns each bin to its nearest peak, and synchronizes phase rotation while leaving very low-level noise bins unlocked. This preserves phase coherence while reducing metallic and watery artifacts.

3. スロー再生時の波形荒れ ➔ 動的オーバーラップ & WOLA再合成 3. Slow-Tempo Artifacts ➔ Dynamic Overlap & WOLA Synthesis

💬 開発者のつぶやき: 「なんか、トレモロ掛かってない?」 💬 Dev's Note: "Wait, why does this sound like a tremolo effect is turned on...?"

【問題】 25%のような極端なスロー再生では、分析フレーム間隔が開いて窓関数の重ね合わせ密度が疎になり、波形の荒れやブツ切りノイズが生じやすくなる。

【対処(アプローチ)】
  • 動的オーバーラップ(Dynamic Overlap Adjustment): テンポ減速量に応じて内部オーバーラップ倍率を動的に自動制御。どのような超スロー再生でも重ね合わせ密度を常に高く維持。
  • WOLA(Weighted Overlap-Add)再合成: 窓関数による加重Overlap-Addと正規化処理を適用し、フレーム境界の振幅リップルやブツ切り音を物理的に消去。

[Problem] At extreme slow-down rates such as 25%, wider analysis hop sizes can make overlap-add synthesis sparse, producing frame clicks and amplitude ripples.

[Solution]
  • Dynamic Overlap Adjustment: Automatically scales internal overlap factors up during slow-tempo playback to ensure continuous window density.
  • WOLA Synthesis: Applies windowing and weight normalization to physically eliminate boundary amplitude clicks.

4. リサンプリング時の高域ノイズ ➔ アンチエイリアス付き高品質リサンプリング 4. High-Frequency Resampling Noise ➔ Anti-Aliased High-Quality Resampling

💬 開発者のつぶやき: 「ユーザー様からいただいた参考音源を聞き衝撃。え、こんな滑らかでシルキーにピッチ変えられるの?」 💬 Dev's Note: "Listening to a reference audio sample sent by a user, I was stunned: 'Wait, pitch can actually be shifted this smoothly and silkily?!'"

【問題】 ピッチ変更後のリサンプリングでは、処理条件によって不要な高域成分が折り返し、ザラつきや高音域のノイズとして聞こえることがある。

【対処(アプローチ)】 高品質モードでは、アンチエイリアスフィルタを内包したKaiser窓付きsincリサンプリングを採用しました。不要な高域成分を抑えながら補間することで、高音域のザラつきや折り返し由来のノイズを低減し、滑らかで明瞭な再生を目指します。

[Problem] During resampling after pitch adjustment, unwanted high-frequency content can fold back into the audible range, creating graininess and high-frequency noise.

[Solution] High-quality mode uses Kaiser-windowed sinc resampling with integrated anti-alias filtering. By suppressing unnecessary high-frequency content during interpolation, it reduces graininess and alias-related noise for smoother, clearer playback.

5. モバイルでの高計算負荷 ➔ C++マルチスレッド並列処理(Lock-Free) 5. Heavy Mobile Compute Load ➔ C++ Multi-Thread Parallel Processing

💬 開発者のつぶやき: 「さすがに1曲の変換に1分以上は長すぎるよな・・・」 💬 Dev's Note: "Converting one song taking over a minute is definitely too long..."

【問題】 長尺ファイルやステレオ音声を高精度なFFT/STFTフレーム分解・合成処理する際、重い複素数演算によってモバイル端末のCPU負荷が高まり、ファイル変換やリアルタイムプレビューに時間を要する。

【対処(アプローチ)】 C++のマルチスレッド機能を活用し、L/Rステレオ各チャンネルのSTFT処理を完全独立スレッドで並列実行するアーキテクチャを設計しました。
各スレッドが専用の演算リソースと状態バッファを個別保持することで、スレッド間のロック競合をゼロ(Lock-Free)にし、CPUのマルチコア性能を100%引き出す爆速処理を実現しています。

[Problem] High-resolution STFT/FFT frame processing over stereo channels incurs significant CPU load on mobile hardware.

[Solution] Multi-threaded execution via C++. Stereo channels process in parallel with isolated thread-local state buffers, eliminating lock contention and utilizing 100% multi-core capacity.

6. プロダクト設計における割り切り ➔ あえて使わない選択(Media3の採用) 6. Architectural Trade-offs ➔ Leveraging Android Media3

💬 開発者のつぶやき: 「全部マシマシだと却って使いづらい?」 💬 Dev's Note: "Piling on every heavy feature actually makes it harder to use...?"

DS Softでは、すべてのアプリで自作フェーズボコーダを盲目的に採用するのではなく、「アプリが追求する体験の軸」によってエンジンを柔軟に切り替えています。

Pitch Tempo Changer Flash での割り切り選択
「Pitch Tempo Changer Flash」のコンセプトは「とにかく動作が軽い爆速レスポンス」です。
STFT演算の負荷を伴うフェーズボコーダをあえて搭載せず、Androidシステムと最も深く密着して超高速に動作する「Android Media3(ExoPlayer / Sonic系)のピッチ・スピード機能」を全面的に採用しました。
極限の高速起動・即時スライド反応・システム負荷ゼロを最優先するための、技術的アプローチの明確な使い分け(割り切り)を行っています。

We do not blindly force custom Phase Vocoder engines into every application. Architectural choices are matched strictly to the user experience goals of each product:

Pitch Tempo Changer Flash Case Study
For "Pitch Tempo Changer Flash," instantaneous responsiveness and minimal CPU footprint are paramount. Rather than running CPU-heavy custom Phase Vocoder loops, we leveraged Android's native Media3 pitch/speed API for system-integrated, ultra-fast performance.

おわりに:実際の音でお試しください Conclusion: Experience the Sound

これらの理論や仕組みが実際に音としてどのような効果をもたらしているか、ぜひご自身の耳でお試しください。
その上で、もしご意見やご感想をいただけましたら、それが今後の開発の原動力になります。

Experience how these algorithms and design ideas actually shape the sound in our applications.
If you have any feedback or thoughts, we would love to hear from you—it directly fuels our ongoing development!

搭載アプリ(Pitch Tempo Changer)を見る » View App (Pitch Tempo Changer) »