Skip to content

Commit e816969

Browse files
committed
Audio: Phase Vocoder: Add new component
This patch adds the Phase Vocoder SOF module. It provides render speed control in range 0.5-2.0x. The pitch is preserved in audio waveform stretch or shorten. The module is using a frequency domain algorithm in STFT domain to interpolate magnitude and phase of output IFFT frames from input FFT frames. The render speed can be controlled via enable/disable switch and enum control with steps of 0.1, or with finer precision with bytes control. (WIP) The STFT parameters are configured with bytes control blob. The default is 1024 size FFT with hop of 256 and Hann window. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 2199842 commit e816969

25 files changed

+1894
-0
lines changed

app/boards/intel_adsp_ace15_mtpm.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CONFIG_COMP_MFCC=y
1515
CONFIG_COMP_MULTIBAND_DRC=y
1616
CONFIG_FORMAT_CONVERT_HIFI3=n
1717
CONFIG_SAMPLE_KEYPHRASE=y
18+
CONFIG_COMP_PHASE_VOCODER=y
1819
CONFIG_COMP_STFT_PROCESS=y
1920

2021
# SOF / audio modules / mocks

app/boards/intel_adsp_ace20_lnl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CONFIG_COMP_TESTER=m
1111
CONFIG_COMP_SRC_IPC4_FULL_MATRIX=y
1212
CONFIG_FORMAT_CONVERT_HIFI3=n
1313
CONFIG_SAMPLE_KEYPHRASE=y
14+
CONFIG_COMP_PHASE_VOCODER=y
1415
CONFIG_COMP_STFT_PROCESS=y
1516

1617
# SOF / infrastructure

app/boards/intel_adsp_ace30_ptl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CONFIG_FORMAT_CONVERT_HIFI3=n
1414
# tests it can't use extra CONFIGs. See #9410, #8722 and #9386
1515
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=m
1616
CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK=y
17+
CONFIG_COMP_PHASE_VOCODER=y
1718
CONFIG_COMP_STFT_PROCESS=y
1819

1920
# SOF / infrastructure

app/boards/intel_adsp_ace30_wcl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CONFIG_FORMAT_CONVERT_HIFI3=n
1414
# tests it can't use extra CONFIGs. See #9410, #8722 and #9386
1515
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=m
1616
CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK=y
17+
CONFIG_COMP_PHASE_VOCODER=y
1718
CONFIG_COMP_STFT_PROCESS=y
1819

1920
# SOF / infrastructure

src/arch/host/configs/library_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CONFIG_COMP_MFCC=y
1414
CONFIG_COMP_MODULE_ADAPTER=y
1515
CONFIG_COMP_MULTIBAND_DRC=y
1616
CONFIG_COMP_MUX=y
17+
CONFIG_COMP_PHASE_VOCODER=y
1718
CONFIG_COMP_RTNR=y
1819
CONFIG_COMP_SEL=y
1920
CONFIG_COMP_SOUND_DOSE=y

src/audio/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
7171
if(CONFIG_COMP_MUX)
7272
add_subdirectory(mux)
7373
endif()
74+
if(CONFIG_COMP_PHASE_VOCODER)
75+
add_subdirectory(phase_vocoder)
76+
endif()
7477
if(CONFIG_COMP_RTNR)
7578
add_subdirectory(rtnr)
7679
endif()

src/audio/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ rsource "module_adapter/Kconfig"
139139
rsource "multiband_drc/Kconfig"
140140
rsource "mux/Kconfig"
141141
rsource "nxp/Kconfig"
142+
rsource "phase_vocoder/Kconfig"
142143
rsource "rtnr/Kconfig"
143144
rsource "selector/Kconfig"
144145
rsource "smart_amp/Kconfig"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
3+
if(CONFIG_COMP_PHASE_VOCODER STREQUAL "m" AND DEFINED CONFIG_LLEXT)
4+
add_subdirectory(llext ${PROJECT_BINARY_DIR}/phase_vocoder_llext)
5+
add_dependencies(app phase_vocoder)
6+
else()
7+
add_local_sources(sof phase_vocoder.c)
8+
add_local_sources(sof phase_vocoder_setup.c)
9+
add_local_sources(sof phase_vocoder_common.c)
10+
add_local_sources(sof phase_vocoder-generic.c)
11+
12+
if(CONFIG_IPC_MAJOR_4)
13+
add_local_sources(sof phase_vocoder-ipc4.c)
14+
endif()
15+
endif()

src/audio/phase_vocoder/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
3+
config COMP_PHASE_VOCODER
4+
tristate "Phase Vocoder component"
5+
default n
6+
select MATH_FFT
7+
select MATH_32BIT_FFT
8+
help
9+
Select for phase_vocoder component. The component provides
10+
render speed control in range 0.5-2.0x. The pitch is
11+
preserved in audio waveform stretch or shorten. The module
12+
is using a frequency domain algorithm in STFT domain to
13+
interpolate magnitude and phase of output IFFT frames from
14+
input FFT frames.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2026 Intel Corporation.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
sof_llext_build("phase_vocoder"
5+
SOURCES ../phase_vocoder.c
6+
../phase_vocoder_setup.c
7+
../phase_vocoder_common.c
8+
../phase_vocoder-generic.c
9+
../phase_vocoder-ipc4.c
10+
LIB openmodules
11+
)

0 commit comments

Comments
 (0)