2025-01-30 22:56:23 -07:00
|
|
|
import os
|
|
|
|
|
2025-02-09 18:32:17 -07:00
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
2025-01-30 22:56:23 -07:00
|
|
|
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)
|
2025-02-09 18:32:17 -07:00
|
|
|
|
2025-01-30 22:56:23 -07:00
|
|
|
# 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
|
2025-02-09 18:32:17 -07:00
|
|
|
|
2025-01-30 22:56:23 -07:00
|
|
|
# Create test_data directory if it doesn't exist
|
2025-02-09 18:32:17 -07:00
|
|
|
os.makedirs("api/tests/test_data", exist_ok=True)
|
|
|
|
|
2025-01-30 22:56:23 -07:00
|
|
|
# Save the test audio
|
2025-02-09 18:32:17 -07:00
|
|
|
np.save("api/tests/test_data/test_audio.npy", audio)
|
|
|
|
|
2025-01-30 22:56:23 -07:00
|
|
|
|
2025-02-09 18:32:17 -07:00
|
|
|
if __name__ == "__main__":
|
|
|
|
generate_test_audio()
|