Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 36ad1fb

Browse files
committed
[skip ci] Fixes #17
1 parent bf97efb commit 36ad1fb

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,35 @@ for phrase in audio:
115115
print(phrase)
116116
```
117117

118+
Convert frame into time coordinates:
119+
120+
```python
121+
from pocketsphinx import AudioFile
122+
123+
# Frames per Second
124+
fps = 100
125+
126+
for phrase in AudioFile(frate=fps): # frate (default=100)
127+
print('-' * 28)
128+
print('| %5s | %3s | %4s |' % ('start', 'end', 'word'))
129+
print('-' * 28)
130+
for s in phrase.seg():
131+
print('| %4ss | %4ss | %8s |' % (s.start_frame / fps, s.end_frame / fps, s.word))
132+
print('-' * 28)
133+
134+
# ----------------------------
135+
# | start | end | word |
136+
# ----------------------------
137+
# | 0.0s | 0.24s | <s> |
138+
# | 0.25s | 0.45s | <sil> |
139+
# | 0.46s | 0.63s | go |
140+
# | 0.64s | 1.16s | forward |
141+
# | 1.17s | 1.52s | ten |
142+
# | 1.53s | 2.11s | meters |
143+
# | 2.12s | 2.6s | </s> |
144+
# ----------------------------
145+
```
146+
118147
### Pocketsphinx
119148

120149
It's a simple and flexible proxy class to `pocketsphinx.Decode`.

0 commit comments

Comments
 (0)