Spaces:
Runtime error
Runtime error
add docstring
Browse files- audiodiffusion/__init__.py +10 -0
audiodiffusion/__init__.py
CHANGED
@@ -43,6 +43,16 @@ class AudioDiffusion:
|
|
43 |
|
44 |
@staticmethod
|
45 |
def loop_it(audio, sample_rate, loops=12):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
tempo, beats = beat_track(y=audio, sr=sample_rate, units='samples')
|
47 |
if len(beats) > 8:
|
48 |
return np.tile(audio[beats[0]:beats[8]], loops)
|
|
|
43 |
|
44 |
@staticmethod
|
45 |
def loop_it(audio, sample_rate, loops=12):
|
46 |
+
"""Loop audio
|
47 |
+
|
48 |
+
Args:
|
49 |
+
audio (array): audio as numpy array
|
50 |
+
sample_rate (int): sample rate of audio
|
51 |
+
loops (int): number of times to loop
|
52 |
+
|
53 |
+
Returns:
|
54 |
+
(float, array): sample rate and raw audio or None
|
55 |
+
"""
|
56 |
tempo, beats = beat_track(y=audio, sr=sample_rate, units='samples')
|
57 |
if len(beats) > 8:
|
58 |
return np.tile(audio[beats[0]:beats[8]], loops)
|