(input, in_rate, out_rate)
| 35 | |
| 36 | |
| 37 | def 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 |
no outgoing calls
no test coverage detected