Endpoint: /api/generate-wav
Method: POST
Description: Generates a modulated WAV file from text data using the SoundAuth SDK.
Request Body:
{
"data": "Text to encode",
"range_config": 1,
"api_key": "your-api-key"
}Parameters:
data(string, required): The text data to encode into the WAV filerange_config(integer, required): Transmission range configuration (1-4)api_key(string, required): Valid API key for authentication
Response:
- Success: WAV file download (Content-Type: audio/wav)
- Error: JSON response with error details
{ "status": "error", "message": "Error message" }
Error Codes:
- 400: Missing required parameters
- 401: Invalid or expired API key
- 500: Server-side error during processing
Example:
curl -X POST -H "Content-Type: application/json" \
-d '{"data": "Hello World", "range_config": 1, "api_key": "your-api-key"}' \
-o output.wav \
http://api.soundauth.com/api/generate-wavURL: ws://server:port/
Description: Establishes a WebSocket connection to the SoundAuth server for real-time audio processing.
Connection Parameters:
api_key(query parameter or auth object): Valid API key for authenticationX-Demo-Mode(header, optional): Set to "true" to enable demo mode with temporary API key
Authentication Methods:
- Query parameter:
ws://server:port/?api_key=your-api-key - Auth object:
socket.connect({ auth: { api_key: "your-api-key" } });
- Session key reuse: Include
X-Session-Keyheader with previously issued temporary key
Connection Response:
- Success:
statusevent with server information{ "message": "Connected to SoundAuth Python Server", "sdk_initialized": true, "sdk_version": "1.0.0", "api_key": "your-api-key", "api_key_tier": "PRO" } - Error:
errorevent with error details{ "message": "Invalid or expired API key" }
audio_data
Sends audio data for processing.
socket.emit('audio_data', {
buffer: audioBuffer, // ArrayBuffer or base64 string
sampleRate: 16000, // Default: 16000
channels: 1 // Default: 1
});start_recording
Starts recording and processing audio.
socket.emit('start_recording');stop_recording
Stops recording and finalizes processing.
socket.emit('stop_recording');status
Server status updates.
{
"message": "Connected to SoundAuth Python Server",
"sdk_initialized": true,
"sdk_version": "1.0.0"
}recording_started
Confirmation that recording has started.
{
"timestamp": "20230101_120000",
"auto_started": true
}data_received
Notification that data has been received and decoded.
{
"payload": "Hello World",
"payload_len": 11,
"ssi": 75,
"range_config": 1,
"channel": 0
}result
Processing status updates.
{
"status": "processing",
"bytes_received": 1024
}error
Error notifications.
{
"message": "Error processing audio data"
}decode_failed
Notification that decoding failed.
{
"message": "Decoding failed"
}- The API server automatically initializes the Trill SDK when a WebSocket connection is established
- Recording starts automatically when a connection is established
- API usage is tracked based on connection time and is limited according to the API key tier
- Temporary API keys are available in demo mode with limited usage
- WebSocket connections are cleaned up when disconnected or when usage limits are reached