Skip to content

Commit c5f8be5

Browse files
committed
make epg loader more robust to sampling frequency
1 parent d0c5912 commit c5f8be5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/audio-read-plugins/load-epg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import scipy.io.wavfile as spiowav
1212

1313
def audio_read(fullpath_aq8_rec_or_wav, start_tic, stop_tic,
14-
nchan=8, ncomments=3, Fs="smpl.frq= ([0-9.,]+)Hz", mmap=True, **kw):
14+
nchan=8, ncomments=3, Fs="smpl.frq= +([0-9.,]+)Hz", mmap=True, **kw):
1515
if not start_tic: start_tic=0
1616
ext = os.path.splitext(fullpath_aq8_rec_or_wav)[1]
1717

@@ -22,7 +22,7 @@ def audio_read(fullpath_aq8_rec_or_wav, start_tic, stop_tic,
2222
for _ in range(ncomments):
2323
line = fid.readline().decode()
2424
m = re.search(Fs, line)
25-
if m: sampling_rate = float(m.group(1).replace(",", "."))
25+
if m: sampling_rate = round(float(m.group(1).replace(",", ".")))
2626
n0 = fid.tell()
2727
n1 = fid.seek(0,2)
2828
nsamples = (n1-n0)//4//nchan
@@ -61,7 +61,7 @@ def audio_read(fullpath_aq8_rec_or_wav, start_tic, stop_tic,
6161
for _ in range(ncomments):
6262
line = fid.readline().decode()
6363
m = re.search(Fs, line)
64-
if m: sampling_rate = float(m.group(1).replace(",", "."))
64+
if m: sampling_rate = round(float(m.group(1).replace(",", ".")))
6565
n0 = fid.tell()
6666
n1 = fid.seek(0,2)
6767
nsamples = (n1-n0)//4

0 commit comments

Comments
 (0)