MCPcopy Index your code
hub / github.com/acids-ircam/RAVE / process_audio_array

Function process_audio_array

scripts/preprocess.py:139–158  ·  view source on GitHub ↗
(audio: Tuple[int, bytes],
                        env: lmdb.Environment,
                        channels: int = 1)

Source from the content-addressed store, hash-verified

137
138
139def process_audio_array(audio: Tuple[int, bytes],
140 env: lmdb.Environment,
141 channels: int = 1) -> int:
142 audio_id, audio_samples = audio
143 buffers = {}
144 buffers['waveform'] = AudioExample.AudioBuffer(
145 shape=(channels, int(len(audio_samples) / channels)),
146 sampling_rate=FLAGS.sampling_rate,
147 data=audio_samples,
148 precision=AudioExample.Precision.INT16,
149 )
150
151 ae = AudioExample(buffers=buffers)
152 key = f'{audio_id:08d}'
153 with env.begin(write=True) as txn:
154 txn.put(
155 key.encode(),
156 ae.SerializeToString(),
157 )
158 return audio_id
159
160
161def process_audio_file(audio: Tuple[int, Tuple[str, float]],

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected