Commit
·
0a7d03f
1
Parent(s):
149d674
add 1 second padding
Browse files
decode.py
CHANGED
|
@@ -83,11 +83,16 @@ def decode(
|
|
| 83 |
|
| 84 |
all_text = []
|
| 85 |
|
|
|
|
|
|
|
| 86 |
while True:
|
| 87 |
# *2 because int16_t has two bytes
|
| 88 |
data = process.stdout.read(frames_per_read * 2)
|
| 89 |
if not data:
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
samples = np.frombuffer(data, dtype=np.int16)
|
| 93 |
samples = samples.astype(np.float32) / 32768
|
|
|
|
| 83 |
|
| 84 |
all_text = []
|
| 85 |
|
| 86 |
+
is_last = False
|
| 87 |
+
|
| 88 |
while True:
|
| 89 |
# *2 because int16_t has two bytes
|
| 90 |
data = process.stdout.read(frames_per_read * 2)
|
| 91 |
if not data:
|
| 92 |
+
if is_last:
|
| 93 |
+
break
|
| 94 |
+
is_last = True
|
| 95 |
+
data = np.zeros(sample_rate, dtype=np.int16)
|
| 96 |
|
| 97 |
samples = np.frombuffer(data, dtype=np.int16)
|
| 98 |
samples = samples.astype(np.float32) / 32768
|