mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
20 lines
No EOL
625 B
Python
20 lines
No EOL
625 B
Python
import numpy as np
|
|
import os
|
|
|
|
def generate_test_audio():
|
|
"""Generate test audio data - 1 second of 440Hz tone"""
|
|
# Create 1 second of silence at 24kHz
|
|
audio = np.zeros(24000, dtype=np.float32)
|
|
|
|
# Add a simple sine wave to make it non-zero
|
|
t = np.linspace(0, 1, 24000)
|
|
audio += 0.5 * np.sin(2 * np.pi * 440 * t) # 440 Hz tone at half amplitude
|
|
|
|
# Create test_data directory if it doesn't exist
|
|
os.makedirs('api/tests/test_data', exist_ok=True)
|
|
|
|
# Save the test audio
|
|
np.save('api/tests/test_data/test_audio.npy', audio)
|
|
|
|
if __name__ == '__main__':
|
|
generate_test_audio() |