Skip to content

Commit

Permalink
Remove SDFT prototype #5
Browse files Browse the repository at this point in the history
  • Loading branch information
jurihock committed Nov 12, 2023
1 parent 0ab11c2 commit f33f1c4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 370 deletions.
1 change: 0 additions & 1 deletion cpp/StftPitchShift/LibStftPitchShift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ set(HEADERS
"${CMAKE_CURRENT_LIST_DIR}/Pitcher.h"
"${CMAKE_CURRENT_LIST_DIR}/Resampler.h"
"${CMAKE_CURRENT_LIST_DIR}/RFFT.h"
"${CMAKE_CURRENT_LIST_DIR}/SDFT.h"
"${CMAKE_CURRENT_LIST_DIR}/STFT.h"
"${CMAKE_CURRENT_LIST_DIR}/StftPitchShift.h"
"${CMAKE_CURRENT_LIST_DIR}/StftPitchShiftCore.h"
Expand Down
226 changes: 0 additions & 226 deletions cpp/StftPitchShift/SDFT.h

This file was deleted.

45 changes: 10 additions & 35 deletions cpp/StftPitchShift/StftPitchShift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <StftPitchShift/FFT.h>
#include <StftPitchShift/RFFT.h>

#include <StftPitchShift/SDFT.h>
#include <StftPitchShift/STFT.h>

#include <StftPitchShift/StftPitchShiftCore.h>
Expand Down Expand Up @@ -162,24 +161,12 @@ void StftPitchShift::shiftpitch(
core.distortion(distortion);
core.normalization(normalization);

if (hopsize == 1)
{
SDFT<float> sdft(framesize, /* latency */ 1, chronometry);

sdft(size, input, output, [&](std::vector<std::complex<float>>& dft)
{
core.shiftpitch(dft);
});
}
else
{
STFT<float> stft(fft, framesize, hopsize, chronometry);
STFT<float> stft(fft, framesize, hopsize, chronometry);

stft(size, input, output, [&](std::vector<std::complex<float>>& dft)
{
core.shiftpitch(dft);
});
}
stft(size, input, output, [&](std::vector<std::complex<float>>& dft)
{
core.shiftpitch(dft);
});
}

void StftPitchShift::shiftpitch(
Expand All @@ -197,22 +184,10 @@ void StftPitchShift::shiftpitch(
core.distortion(distortion);
core.normalization(normalization);

if (hopsize == 1)
{
SDFT<double> sdft(framesize, /* latency */ 1, chronometry);

sdft(size, input, output, [&](std::vector<std::complex<double>>& dft)
{
core.shiftpitch(dft);
});
}
else
{
STFT<double> stft(fft, framesize, hopsize, chronometry);
STFT<double> stft(fft, framesize, hopsize, chronometry);

stft(size, input, output, [&](std::vector<std::complex<double>>& dft)
{
core.shiftpitch(dft);
});
}
stft(size, input, output, [&](std::vector<std::complex<double>>& dft)
{
core.shiftpitch(dft);
});
}
2 changes: 1 addition & 1 deletion cpp/StftPitchShift/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char** argv)

StftPitchShift stft(
cli.framesize,
cli.hoprate ? cli.framesize / cli.hoprate : 1,
cli.framesize / cli.hoprate,
samplerate,
cli.normalization,
cli.chronometry);
Expand Down
2 changes: 1 addition & 1 deletion cpp/StftPitchShift/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extern "C"
{
StftPitchShift stft(
cli.framesize,
cli.hoprate ? cli.framesize / cli.hoprate : 1,
cli.framesize / cli.hoprate,
samplerate,
cli.normalization,
cli.chronometry);
Expand Down
10 changes: 0 additions & 10 deletions python/stftpitchshift/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from stftpitchshift import __version__ as version
from stftpitchshift.io import read, write
from stftpitchshift.plot import spectrogram
from stftpitchshift.sdft import sdft
from stftpitchshift.stft import stft

import click
Expand Down Expand Up @@ -55,18 +54,9 @@ def cent(value): return pow(2, float(re.match('([+,-]?\\d+){1}([+,-]\\d+){0,1}',

for channel in range(channels):

# STFT
framesX = stft(x[:, channel], framesize, hopsize)
framesY = stft(y[:, channel], framesize, hopsize)

# SDFT
# framesX = sdft(x[:, channel], framesize // 2)
# framesY = sdft(y[:, channel], framesize // 2)

# TEST
# framesX = stft(x[:, channel], framesize, hopsize)
# framesY = sdft(x[:, channel], framesize // 2)

figure = plot.figure(f'Channel {channel+1}/{channels}')

spectrogramX = figure.add_subplot(2, 1, 1, title='Input Spectrogram')
Expand Down
Loading

0 comments on commit f33f1c4

Please sign in to comment.