Skip to content

Conversation

tuxzz
Copy link
Contributor

@tuxzz tuxzz commented Mar 24, 2020

Fix Issue #471

@mthrok mthrok requested a review from vincentqb March 24, 2020 14:17
@mthrok
Copy link
Contributor

mthrok commented Mar 24, 2020

@vincentqb Some jobs failed at some artifact upload step. Tests are passing, so I think this one is good.

@mthrok
Copy link
Contributor

mthrok commented Mar 24, 2020

I did quick experiments and it indeed is faster for long audio;

import time

import torch
import torchaudio.functional
path = 'test/assets/whitenoise_1min.mp3'
audio, sr = torchaudio.load(path)
audio = audio.repeat(1, 10)

kwargs = {
    'n_fft': 12,
    'hop_length': 4,
    'win_length': 12,
    'window': torch.hann_window(12),
    'center': True,
    'pad_mode': 'reflect',
    'normalized': True,
    'onesided': True,
}

stft = torch.stft(audio, **kwargs)
t0 = time.process_time()
torchaudio.functional.istft(stft, **kwargs)
t1 = time.process_time()
print(t1 - t0)
$ git checkout tuxzz-master
Previous HEAD position was d7c79b3 Add test transform and functional AmplitudeToDB (#463)
Switched to branch 'tuxzz-master'
$ python run_istft.py
7.318665638999999
$ git checkout upstream/master
HEAD is now at d7c79b3 Add test transform and functional AmplitudeToDB (#463)
$ python run_istft.py
8.697154317

Copy link
Contributor

@vincentqb vincentqb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tuxzz -- Thanks for the PR!
@mthrok -- Thanks for adding the performance comparison!

LGTM

@vincentqb vincentqb merged commit fcc9a51 into pytorch:master Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants