MCPcopy Create free account
hub / github.com/NVIDIA/DALI / rosa_resample

Function rosa_resample

dali/test/python/test_audio_decoder_utils.py:37–49  ·  view source on GitHub ↗
(input, in_rate, out_rate)

Source from the content-addressed store, hash-verified

35
36
37def rosa_resample(input, in_rate, out_rate):
38 if input.shape[1] == 1:
39 return librosa.resample(input[:, 0], orig_sr=in_rate, target_sr=out_rate)[:, np.newaxis]
40
41 channels = [
42 librosa.resample(np.array(input[:, c]), orig_sr=in_rate, target_sr=out_rate)
43 for c in range(input.shape[1])
44 ]
45 ret = np.zeros(shape=[channels[0].shape[0], len(channels)], dtype=channels[0].dtype)
46 for c, a in enumerate(channels):
47 ret[:, c] = a
48
49 return ret

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected