Commit ·
264a089
1
Parent(s): 12384dc
crop examples to 5 seconds
Browse files- crop_audio_files.py +2 -2
- data/audio_cropped.tar.gz +2 -2
- metadata_cropped.csv +0 -0
crop_audio_files.py
CHANGED
|
@@ -27,7 +27,7 @@ def copy_sample(data: Any, sample_rate: int, start: float, end: float):
|
|
| 27 |
# [id, audio data, sample rate, extension, words]
|
| 28 |
TSegment = Tuple[str, Any, int, str, str]
|
| 29 |
|
| 30 |
-
def crop_audio_file(audio_file: str, ctm_file: str, target_duration_secs: float, max_word_duration_secs: float = 2.0, min_segment_duration_secs: float =
|
| 31 |
data, sample_rate = sf.read(audio_file)
|
| 32 |
ctm = read_ctm_file(ctm_file)
|
| 33 |
|
|
@@ -107,7 +107,7 @@ if __name__ == "__main__":
|
|
| 107 |
ctm_files_dir = 'data/ctm/words'
|
| 108 |
output_audio_dir = 'data/audio_cropped'
|
| 109 |
output_metadata_file = 'metadata_cropped.csv'
|
| 110 |
-
target_len_secs =
|
| 111 |
|
| 112 |
n = crop_audio_files(input_audio_dir, ctm_files_dir, output_audio_dir, output_metadata_file, target_len_secs)
|
| 113 |
print(f'{n} crops created')
|
|
|
|
| 27 |
# [id, audio data, sample rate, extension, words]
|
| 28 |
TSegment = Tuple[str, Any, int, str, str]
|
| 29 |
|
| 30 |
+
def crop_audio_file(audio_file: str, ctm_file: str, target_duration_secs: float, max_word_duration_secs: float = 2.0, min_segment_duration_secs: float = 3.0, max_segment_duration_secs: float = 5.5) -> List[TSegment]:
|
| 31 |
data, sample_rate = sf.read(audio_file)
|
| 32 |
ctm = read_ctm_file(ctm_file)
|
| 33 |
|
|
|
|
| 107 |
ctm_files_dir = 'data/ctm/words'
|
| 108 |
output_audio_dir = 'data/audio_cropped'
|
| 109 |
output_metadata_file = 'metadata_cropped.csv'
|
| 110 |
+
target_len_secs = 5
|
| 111 |
|
| 112 |
n = crop_audio_files(input_audio_dir, ctm_files_dir, output_audio_dir, output_metadata_file, target_len_secs)
|
| 113 |
print(f'{n} crops created')
|
data/audio_cropped.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:602121cd728fb0214a9aab57b2faf908430d586896622b94f46ea25e97f94ddb
|
| 3 |
+
size 1284149469
|
metadata_cropped.csv
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|