kopia lustrzana https://github.com/corrscope/corrscope
Rename Wave.get_around(region_len) to region_nsamp
rodzic
8a781c9d3a
commit
ce3849cd54
|
|
@ -94,11 +94,11 @@ class Wave:
|
|||
|
||||
return out
|
||||
|
||||
def get_around(self, sample: int, region_len: int, subsampling: int):
|
||||
def get_around(self, sample: int, region_nsamp: int, subsampling: int):
|
||||
"""" Copies self.data[...] """
|
||||
region_len *= subsampling
|
||||
end = sample + region_len // 2
|
||||
begin = end - region_len
|
||||
region_nsamp *= subsampling
|
||||
end = sample + region_nsamp // 2
|
||||
begin = end - region_nsamp
|
||||
return self._get(begin, end, subsampling)
|
||||
|
||||
def get_s(self) -> float:
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def test_wave_subsampling():
|
|||
wave = Wave(None, 'tests/sine440.wav')
|
||||
# period = 48000 / 440 = 109.(09)*
|
||||
|
||||
wave.get_around(1000, region_len=501, subsampling=4)
|
||||
wave.get_around(1000, region_nsamp=501, subsampling=4)
|
||||
# len([:region_len:subsampling]) == ceil(region_len / subsampling)
|
||||
# If region_len % subsampling != 0, len() != region_len // subsampling.
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue