Skip to content

Commit

Permalink
move filtering in features.* into STFT processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Böck committed Jul 23, 2019
1 parent 6e83204 commit c970d7b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions madmom/features/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ def __init__(self, post_processor=average_predictions, online=False,
multi = ParallelProcessor([])
for frame_size, diff_frame in zip(frame_sizes, diff_frames):
frames = FramedSignalProcessor(frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank,
num_bands=num_bands, fmin=30,
fmax=17000, norm_filters=True,
frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, mul=1, add=1)
diff = SpectrogramDifferenceProcessor(diff_frames=diff_frame,
positive_diffs=True,
stack_diffs=np.hstack)
# process each frame size with spec and diff sequentially
multi.append(SequentialProcessor((frames, stft, filt, log, diff)))
multi.append(SequentialProcessor((frames, stft, log, diff)))
# stack the features and processes everything sequentially
pre_processor = SequentialProcessor((sig, multi, np.hstack))
# process the pre-processed signal with a NN ensemble and the given
Expand Down
4 changes: 2 additions & 2 deletions madmom/features/chords.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ def __init__(self, **kwargs):
# spectrogram computation
sig = SignalProcessor(**kwargs)
frames = FramedSignalProcessor(**kwargs)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank, num_bands=24,
fmin=60, fmax=2600, unique_filters=True,
**kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, add=1)
# padding, neural network and global average pooling
pad = _cnncfp_pad
Expand All @@ -212,7 +212,7 @@ def __init__(self, **kwargs):
avg = _cnncfp_avg
# create processing pipeline
super(CNNChordFeatureProcessor, self).__init__([
sig, frames, stft, filt, log, pad, nn, superframes, avg
sig, frames, stft, log, pad, nn, superframes, avg
])


Expand Down
4 changes: 2 additions & 2 deletions madmom/features/downbeats.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ def __init__(self, **kwargs):
for frame_size, num_bands, diff_frame in \
zip(frame_sizes, num_bands, diff_frames):
frames = FramedSignalProcessor(frame_size=frame_size, fps=100)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank,
num_bands=num_bands, fmin=30,
fmax=17000, norm_filters=True,
frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, mul=1, add=1)
diff = SpectrogramDifferenceProcessor(diff_frames=diff_frame,
positive_diffs=True,
stack_diffs=np.hstack)
# process each frame size with spec and diff sequentially
multi.append(SequentialProcessor((frames, stft, filt, log, diff)))
multi.append(SequentialProcessor((frames, stft, log, diff)))
# stack the features and processes everything sequentially
pre_processor = SequentialProcessor((sig, multi, np.hstack))
# process the pre-processed signal with a NN ensemble
Expand Down
4 changes: 2 additions & 2 deletions madmom/features/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ def __init__(self, nn_files=None, **kwargs):
# spectrogram computation
sig = SignalProcessor(**kwargs)
frames = FramedSignalProcessor(fps=5, **kwargs)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank, num_bands=24,
fmin=65, fmax=2100, unique_filters=True,
**kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, add=1)
# neural network
nn_files = nn_files or KEY_CNN
nn = NeuralNetworkEnsemble.load(nn_files)
# create processing pipeline
super(CNNKeyRecognitionProcessor, self).__init__([
sig, frames, stft, filt, log, nn, add_axis, softmax
sig, frames, stft, log, nn, add_axis, softmax
])
4 changes: 2 additions & 2 deletions madmom/features/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ def __init__(self, **kwargs):
multi = ParallelProcessor([])
for frame_size, diff_frame in zip([1024, 2048, 4096], [1, 1, 2]):
frames = FramedSignalProcessor(frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank,
num_bands=12, fmin=30, fmax=17000,
norm_filters=True,
frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, mul=5, add=1)
diff = SpectrogramDifferenceProcessor(diff_frames=diff_frame,
positive_diffs=True,
stack_diffs=np.hstack)
# process each frame size with spec and diff sequentially
multi.append(SequentialProcessor((frames, stft, filt, log, diff)))
multi.append(SequentialProcessor((frames, stft, log, diff)))
# stack the features and processes everything sequentially
pre_processor = SequentialProcessor((sig, multi, np.hstack))

Expand Down
4 changes: 2 additions & 2 deletions madmom/features/onsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,17 +782,17 @@ def __init__(self, **kwargs):
for frame_size, diff_frame in zip(frame_sizes, diff_frames):
# pass **kwargs in order to be able to process in online mode
frames = FramedSignalProcessor(frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(complex=False)
filt = FilterbankProcessor(LogarithmicFilterbank,
num_bands=6, fmin=30,
fmax=17000, norm_filters=True,
frame_size=frame_size, **kwargs)
stft = ShortTimeFourierTransformProcessor(filterbank=filt)
log = ScalingProcessor(scaling_fn=np.log10, mul=5, add=1)
diff = SpectrogramDifferenceProcessor(diff_frames=diff_frame,
positive_diffs=True,
stack_diffs=np.hstack)
# process each frame size with spec and diff sequentially
multi.append(SequentialProcessor((frames, stft, filt, log, diff)))
multi.append(SequentialProcessor((frames, stft, log, diff)))
# stack the features and processes everything sequentially
pre_processor = SequentialProcessor((sig, multi, np.hstack))

Expand Down

0 comments on commit c970d7b

Please sign in to comment.