Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DrMarc/slab
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMarc committed Apr 21, 2022
2 parents 6ecfc0c + 54b1800 commit 1db2a79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion slab/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def equalizing_filterbank(reference, sound, length=1000, bandwidth=1/8, low_cuto
filts = numpy.zeros((length, sound.n_channels))
for chan in range(sound.n_channels):
gain = [1] + list(amp_diffs[:, chan])
filt = Filter.band(frequency=list(center_freqs), gain=gain, samplerate=reference.samplerate, fir=True)
filt = Filter.band(frequency=list(center_freqs), gain=gain, samplerate=reference.samplerate, fir=True, length=length)
filts[:, chan] = filt.data.flatten()
return Filter(data=filts, samplerate=reference.samplerate, fir=True)

Expand Down
3 changes: 3 additions & 0 deletions tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def test_center_freqs():

def test_equalization():
for i in range(10):
length = numpy.random.randint(1000, 5000)
low_cutoff = numpy.random.randint(20, 2000)
high_cutoff = numpy.random.randint(10000, 20000)
sound = slab.Sound.pinknoise(samplerate=44100)
filt = slab.Filter.band(frequency=[100., 800., 2000., 4300., 8000., 14500., 18000.],
gain=[0., 1., 0., 1., 0., 1., 0.], samplerate=sound.samplerate)
Expand Down

0 comments on commit 1db2a79

Please sign in to comment.