Skip to content

Commit

Permalink
More re-arranging for autodoc
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVinyard committed Aug 27, 2017
1 parent 9c061df commit 7ad1d6e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions zounds/timeseries/samplerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,20 @@ def __init__(self):
super(SR11025, self).__init__(11025, 512, 256)


_samplerates = (SR96000(), SR48000(), SR44100(), SR22050(), SR11025())


def audio_sample_rate(samples_per_second):
for sr in _samplerates:
samplerates = (SR96000(), SR48000(), SR44100(), SR22050(), SR11025())
for sr in samplerates:
if samples_per_second == sr.samples_per_second:
return sr
raise ValueError(
'{samples_per_second} is an invalid sample rate'.format(**locals()))


def nearest_audio_sample_rate(samples_per_second):
samplerates = np.array([s.samples_per_second for s in _samplerates])
samplerates = (SR96000(), SR48000(), SR44100(), SR22050(), SR11025())
samplerates = np.array([s.samples_per_second for s in samplerates])
diffs = np.abs(samples_per_second - samplerates)
return _samplerates[np.argmin(diffs)]
return samplerates[np.argmin(diffs)]


class HalfLapped(SampleRate):
Expand Down

0 comments on commit 7ad1d6e

Please sign in to comment.