-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes call to deprecated scipy.integrate.trapz function. (#363)
Fixes issues #362
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import numpy as np | ||
|
||
import pyroomacoustics as pra | ||
|
||
|
||
def test_iterative_wiener(): | ||
""" | ||
A simple functional test that the call does not produce any errors. | ||
""" | ||
# parameters | ||
num_blocks = 20 | ||
nfft = 512 | ||
hop = nfft // 2 | ||
|
||
# create a dummy signal | ||
blocks = np.random.randn(num_blocks, hop) | ||
|
||
# initialize STFT and IterativeWiener objects | ||
stft = pra.transform.STFT(nfft, hop=hop, analysis_window=pra.hann(nfft)) | ||
scnr = pra.denoise.IterativeWiener( | ||
frame_len=nfft, lpc_order=20, iterations=2, alpha=0.8, thresh=0.01 | ||
) | ||
|
||
# apply block-by-block | ||
processed_blocks = [] | ||
for n in range(num_blocks): | ||
|
||
# go to frequency domain, 50% overlap | ||
stft.analysis(blocks[n]) | ||
|
||
# compute wiener output | ||
X = scnr.compute_filtered_output( | ||
current_frame=stft.fft_in_buffer, frame_dft=stft.X | ||
) | ||
|
||
# back to time domain | ||
mono_denoised = stft.synthesis(X) | ||
processed_blocks.append(mono_denoised) |