Update by following reviewer's comments for pull request #355.

pull/2/head
Xinghai Sun 7 years ago
parent be1fbc68a1
commit 8e5c2eb969

@ -118,7 +118,25 @@ class AudioSegment(object):
@classmethod @classmethod
def from_sequence_file(cls, filepath): def from_sequence_file(cls, filepath):
"""Create audio segment from sequence file. """Create audio segment from sequence file. Sequence file is a binary
file containing a collection of multiple audio files, with several
header bytes in the head indicating the offsets of each audio byte data
chunk.
The format is:
4 bytes (int, version),
4 bytes (int, num of utterance),
4 bytes (int, bytes per header),
[bytes_per_header*(num_utterance+1)] bytes (offsets for each audio),
audio_bytes_data_of_1st_utterance,
audio_bytes_data_of_2nd_utterance,
......
Sequence file name must end with ".seqbin". And the filename of the 5th
utterance's audio file in sequence file "xxx.seqbin" must be
"xxx.seqbin_5", with "5" indicating the utterance index within this
sequence file (starting from 1).
:param filepath: Filepath of sequence file. :param filepath: Filepath of sequence file.
:type filepath: basestring :type filepath: basestring

@ -148,11 +148,7 @@ def xmap_readers_mp(mapper, reader, process_num, buffer_size, order=False):
w.start() w.start()
# get results # get results
sample = out_queue.get() finish = 0
while not isinstance(sample, XmapEndSignal):
yield sample
sample = out_queue.get()
finish = 1
while finish < process_num: while finish < process_num:
sample = out_queue.get() sample = out_queue.get()
if isinstance(sample, XmapEndSignal): if isinstance(sample, XmapEndSignal):

Loading…
Cancel
Save