-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (21 loc) · 742 Bytes
/
Copy pathtest.py
File metadata and controls
27 lines (21 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import logging
import time
from riff_wave.core import WaveContainer, riff_wave_logger
riff_wave_logger.setLevel(logging.DEBUG)
# 1. read and parse
time_start = time.perf_counter()
with open('samples/sil_2s_marker.wav', 'rb') as f:
wave = WaveContainer.from_stream(f)
time_end = time.perf_counter()
print(f'[parse] time cost: {time_end - time_start:.3f}s')
print(f'{wave.fmt = }')
print(f'{wave.duration = }')
# 2. get adtl annotations
adtl_annotations = wave.get_adtl_annotations()
print(f'{adtl_annotations = }')
# 3. rewrite
time_start = time.perf_counter()
with open('samples/sil_2s_marker_rewrite.wav', 'wb') as f:
f.write(wave.dump())
time_end = time.perf_counter()
print(f'[dump] time cost: {time_end - time_start:.3f}s')