comparison demos/audio_trim_demo.py @ 4:31c97510b16b

README.md, demos/audio_trim_demo.py updated
author Amine Sehili <amine.sehili@gmail.com>
date Tue, 22 Sep 2015 11:12:11 +0200
parents 364eeb8e8bd2
children 9be2d0ca4c00
comparison
equal deleted inserted replaced
3:364eeb8e8bd2 4:31c97510b16b
65 65
66 # Create a validator with an energy threshold of 50 66 # Create a validator with an energy threshold of 50
67 validator = AudioEnergyValidator(sample_width=asource.get_sample_width(), energy_threshold=50) 67 validator = AudioEnergyValidator(sample_width=asource.get_sample_width(), energy_threshold=50)
68 68
69 # Create a tokenizer with an unlimited token length and continuous silence within a token 69 # Create a tokenizer with an unlimited token length and continuous silence within a token
70 # Note the DROP_TRAILING_SILENCE mode that will ensure removing tailing silence 70 # Note the DROP_TAILING_SILENCE mode that will ensure removing tailing silence
71 trimmer = StreamTokenizer(validator, min_length = 20, max_length=99999999, 71 trimmer = StreamTokenizer(validator, min_length = 20, max_length=99999999,
72 max_continuous_silence=9999999, mode=StreamTokenizer.DROP_TRAILING_SILENCE, init_min=3, init_max_silence=1) 72 max_continuous_silence=9999999, mode=StreamTokenizer.DROP_TAILING_SILENCE, init_min=3, init_max_silence=1)
73 73
74 74
75 tokens = trimmer.tokenize(asource) 75 tokens = trimmer.tokenize(asource)
76 76
77 # Make sure we only have one token 77 # Make sure we only have one token