ECHO 13D API Reference
The ECHO 13D API provides comprehensive interfaces for advanced voice processing, including speech recognition, natural language understanding, and voice synthesis using a 13-dimensional harmonic framework.
API Overview
The ECHO 13D API enables developers to integrate advanced voice processing capabilities into their applications, leveraging DragonFire's 13-dimensional harmonic analysis framework.
Integration Requirements
ECHO 13D requires integration with DragonHeart for harmonic processing. Optional integration with NESH provides enhanced capabilities for voice pattern storage and retrieval. See the Initialization section for details.
Core Capabilities
- Voice Recognition: Identify and authenticate users by their unique voice patterns
- Speech Analysis: Convert speech to text, extract meaning, and analyze emotional tone
- Voice Synthesis: Generate natural-sounding voice output with controllable characteristics
- Integration: Connect with DragonHeart, NESH, and Aurora AI systems
API Organization
The ECHO 13D API is organized into the following main modules:
Module | Description | Key Functions |
---|---|---|
Core | Main system initialization and management | echo_init() , echo_shutdown() |
Audio Processing | Voice input/output and processing | echo_process_audio() , extract_voice_pattern() |
Recognition | Voice identification and authentication | recognize_voice() , register_voice() |
Analysis | Speech transcription and understanding | transcribe_speech() , analyze_speech() |
Synthesis | Voice generation and output | echo_synthesize_speech() , create_voice_template() |
Integration | Connection with other DragonFire components | connect_echo_to_dragonheart() , integrate_echo_with_aurora() |
Initialization
The ECHO 13D system must be initialized before use, typically with a connection to DragonHeart and optionally NESH.
echo_init()
ECHO13D* echo_init(echo_config_t* config);
Initializes the ECHO 13D system with the specified configuration.
Parameters
config |
echo_config_t* |
Configuration structure (can be NULL for defaults) |
Returns
Pointer to initialized ECHO13D structure, or NULL on failure.
Configuration Structure
typedef struct {
DragonHeart* dragonheart; // Required DragonHeart instance
NESH* nesh; // Optional NESH instance
voice_config_t* voice_config; // Optional voice processing configuration
uint32_t flags; // Optional feature flags
} echo_config_t;
Example
// Initialize DragonHeart
DragonHeart* heart = dragonheart_init(NULL);
// Initialize NESH (optional)
NESH* nesh = nesh_init(NULL);
// Create ECHO 13D configuration
echo_config_t config;
config.dragonheart = heart;
config.nesh = nesh;
config.voice_config = NULL; // Use defaults
config.flags = 0; // No special flags
// Initialize ECHO 13D
ECHO13D* echo = echo_init(&config);
if (!echo) {
printf("Failed to initialize ECHO 13D\n");
return -1;
}
echo_shutdown()
void echo_shutdown(ECHO13D* echo);
Shuts down the ECHO 13D system and frees all resources.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance to shut down |
Returns
None.
Example
// Clean up resources
echo_shutdown(echo);
nesh_shutdown(nesh);
dragonheart_shutdown(heart);
Audio Processing
The audio processing module handles voice input processing and pattern extraction.
echo_process_audio()
echo_result_t* echo_process_audio(ECHO13D* echo, audio_buffer_t* audio, process_mode_t mode);
Processes an audio buffer through the ECHO 13D system.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
audio |
audio_buffer_t* |
Audio buffer containing voice data |
mode |
process_mode_t |
Processing mode (recognition, transcription, analysis, or full) |
Returns
Pointer to echo_result_t structure containing processing results. Must be freed with free_echo_result().
Process Modes
typedef enum {
PROCESS_RECOGNITION, // Only perform voice recognition
PROCESS_TRANSCRIPTION, // Only transcribe speech to text
PROCESS_ANALYSIS, // Only perform speech analysis
PROCESS_FULL // Perform all processing types
} process_mode_t;
Example
// Open audio input device
audio_device_t* input_device = open_audio_input_device(DEFAULT_DEVICE);
// Record audio (5 seconds)
audio_buffer_t* audio = record_audio(input_device, 5.0);
// Process audio through ECHO 13D (full processing)
echo_result_t* result = echo_process_audio(echo, audio, PROCESS_FULL);
// Print transcription result
printf("Transcription: %s\n", result->transcription->text);
printf("Confidence: %.2f\n", result->transcription->confidence);
// Print emotion analysis
printf("Detected emotion: %s (%.2f confidence)\n",
get_emotion_name(result->analysis->emotion->primary_emotion),
result->analysis->emotion->primary_confidence);
// Clean up resources
free_echo_result(result);
free_audio_buffer(audio);
close_audio_device(input_device);
extract_voice_pattern()
voice_pattern_t* extract_voice_pattern(ECHO13D* echo, audio_buffer_t* audio);
Extracts a 13-dimensional voice pattern from audio data.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
audio |
audio_buffer_t* |
Audio buffer containing voice data |
Returns
Pointer to voice_pattern_t structure containing 13-dimensional voice pattern. Must be freed with free_voice_pattern().
Voice Pattern Structure
typedef struct {
uint32_t dimension_count; // Number of dimensions (13)
float** dimensional_patterns; // Patterns in each dimension
uint32_t frame_count; // Number of time frames
voice_signature_t* signature; // Derived voice signature
} voice_pattern_t;
Voice Recognition
The voice recognition module provides functions for identifying and authenticating users by their voice.
recognize_voice()
recognition_result_t* recognize_voice(ECHO13D* echo, audio_buffer_t* audio);
Recognizes a voice from audio input and returns identity information.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
audio |
audio_buffer_t* |
Audio buffer containing voice data |
Returns
Pointer to recognition_result_t structure containing recognition results. Must be freed with free_recognition_result().
Recognition Result Structure
typedef struct {
bool recognized; // Whether voice was recognized
voice_identity_t* identity; // Identity information (if recognized)
float confidence; // Recognition confidence (0.0-1.0)
uint32_t match_count; // Number of potential matches
void* additional_data; // Additional recognition data
} recognition_result_t;
Example
// Open audio input device
audio_device_t* input_device = open_audio_input_device(DEFAULT_DEVICE);
// Record audio for voice recognition
audio_buffer_t* audio = record_audio(input_device, 3.0);
// Recognize voice
recognition_result_t* result = recognize_voice(echo, audio);
// Process recognition result
if (result->recognized) {
printf("Voice recognized: %s (%.2f confidence)\n",
result->identity->name, result->confidence);
// Retrieve user information
user_info_t* user_info = get_user_info(result->identity);
// Process user-specific actions
process_user_specific_actions(user_info);
free_user_info(user_info);
} else {
printf("Voice not recognized\n");
}
// Clean up resources
free_recognition_result(result);
free_audio_buffer(audio);
close_audio_device(input_device);
register_voice()
bool register_voice(ECHO13D* echo, voice_identity_t* identity, audio_buffer_t* audio);
Registers a new voice profile in the system.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
identity |
voice_identity_t* |
Identity information for the voice |
audio |
audio_buffer_t* |
Audio buffer containing voice sample |
Returns
Boolean indicating success or failure.
Voice Identity Structure
typedef struct {
char* id; // Unique identifier
char* name; // User name
uint32_t flags; // Identity flags
void* user_data; // Custom user data
} voice_identity_t;
Speech Analysis
The speech analysis module provides functions for transcribing speech to text and analyzing content.
transcribe_speech()
transcription_result_t* transcribe_speech(ECHO13D* echo, audio_buffer_t* audio);
Transcribes speech from audio to text.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
audio |
audio_buffer_t* |
Audio buffer containing speech |
Returns
Pointer to transcription_result_t structure containing transcription results. Must be freed with free_transcription_result().
Transcription Result Structure
typedef struct {
char* text; // Transcribed text
float confidence; // Overall confidence (0.0-1.0)
word_info_t* words; // Word-level information
uint32_t word_count; // Number of words
language_t detected_language; // Detected language
} transcription_result_t;
analyze_speech()
speech_analysis_t* analyze_speech(ECHO13D* echo, audio_buffer_t* audio);
Performs comprehensive analysis of speech including linguistic content and emotional tone.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
audio |
audio_buffer_t* |
Audio buffer containing speech |
Returns
Pointer to speech_analysis_t structure containing analysis results. Must be freed with free_speech_analysis().
Speech Analysis Structure
typedef struct {
text_content_t* text; // Transcribed text
semantic_content_t* semantics; // Semantic meaning
emotion_analysis_t* emotion; // Emotional content analysis
confidence_metrics_t* metrics; // Analysis confidence
} speech_analysis_t;
Emotion Analysis Structure
typedef struct {
emotion_type_t primary_emotion; // Primary detected emotion
float primary_confidence; // Confidence in primary emotion
emotion_type_t secondary_emotion; // Secondary detected emotion
float secondary_confidence; // Confidence in secondary emotion
float intensity; // Overall emotional intensity
emotion_metrics_t* detailed_metrics; // Detailed emotion metrics
} emotion_analysis_t;
Example
// Record audio
audio_buffer_t* audio = record_audio(input_device, 5.0);
// Analyze speech
speech_analysis_t* analysis = analyze_speech(echo, audio);
// Print results
printf("Transcription: %s\n", analysis->text->text);
// Print semantic analysis
printf("Intent: %s (%.2f confidence)\n",
get_intent_name(analysis->semantics->primary_intent),
analysis->semantics->intent_confidence);
// Print top entities
for (uint32_t i = 0; i < analysis->semantics->entity_count; i++) {
entity_t* entity = &analysis->semantics->entities[i];
printf("Entity %d: %s (type: %s, confidence: %.2f)\n",
i + 1, entity->text, get_entity_type_name(entity->type),
entity->confidence);
}
// Print emotion analysis
printf("Emotion: %s (%.2f confidence)\n",
get_emotion_name(analysis->emotion->primary_emotion),
analysis->emotion->primary_confidence);
printf("Intensity: %.2f\n", analysis->emotion->intensity);
// Free resources
free_speech_analysis(analysis);
free_audio_buffer(audio);
Voice Synthesis
The voice synthesis module provides functions for generating voice output from text.
echo_synthesize_speech()
audio_buffer_t* echo_synthesize_speech(ECHO13D* echo, text_content_t* text, voice_template_t* voice, emotion_params_t* emotion);
Synthesizes speech from text using specified voice template and emotional parameters.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
text |
text_content_t* |
Text to synthesize |
voice |
voice_template_t* |
Voice template to use |
emotion |
emotion_params_t* |
Emotional parameters for synthesis |
Returns
Pointer to audio_buffer_t containing synthesized speech. Must be freed with free_audio_buffer().
Example
// Get default voice template
voice_template_t* voice = get_default_voice_template(echo);
// Create text content
text_content_t* content = create_text_content("Hello, how are you today?");
// Create emotion parameters (neutral emotion)
emotion_params_t* emotion = create_emotion_params(EMOTION_NEUTRAL);
// Synthesize speech
audio_buffer_t* audio = echo_synthesize_speech(echo, content, voice, emotion);
// Play synthesized speech
audio_device_t* output_device = open_audio_output_device(DEFAULT_DEVICE);
play_audio(output_device, audio);
// Wait for playback to complete
wait_for_playback_completion(output_device);
// Clean up resources
free_text_content(content);
free_emotion_params(emotion);
free_audio_buffer(audio);
close_audio_device(output_device);
play_audio()
bool play_audio(audio_device_t* device, audio_buffer_t* audio);
Plays audio buffer through specified output device.
Parameters
device |
audio_device_t* |
Audio output device |
audio |
audio_buffer_t* |
Audio buffer to play |
Returns
Boolean indicating success or failure.
Voice Templates
The voice templates module provides functions for creating and managing voice synthesis templates.
create_voice_template()
voice_template_t* create_voice_template(ECHO13D* echo, const char* name, voice_characteristics_t* characteristics);
Creates a new voice template with specified characteristics.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
name |
const char* |
Template name |
characteristics |
voice_characteristics_t* |
Voice characteristics |
Returns
Pointer to voice_template_t structure. Must be freed with free_voice_template().
Voice Characteristics Structure
typedef struct {
float pitch_base; // Base pitch (1.0 = standard)
float pitch_range; // Pitch range (0.0-2.0)
float speech_rate; // Speech rate (1.0 = standard)
float timbre; // Voice timbre (0.0-1.0)
float breathiness; // Breathiness (0.0-1.0)
float articulation; // Articulation precision (0.0-1.0)
float resonance; // Vocal resonance (0.0-1.0)
age_category_t age; // Age category
gender_category_t gender; // Gender category
} voice_characteristics_t;
Example
// Create voice characteristics
voice_characteristics_t characteristics;
characteristics.pitch_base = 0.9f; // Slightly lower pitch
characteristics.pitch_range = 1.2f; // Slightly wider pitch range
characteristics.speech_rate = 1.0f; // Standard rate
characteristics.timbre = 0.7f; // Warm timbre
characteristics.breathiness = 0.2f; // Low breathiness
characteristics.articulation = 0.8f; // Clear articulation
characteristics.resonance = 0.6f; // Medium resonance
characteristics.age = AGE_ADULT;
characteristics.gender = GENDER_NEUTRAL;
// Create voice template
voice_template_t* template = create_voice_template(echo, "Warm Voice", &characteristics);
// Set language
set_voice_template_language(template, LANGUAGE_ENGLISH);
// Store voice template in ECHO 13D system
store_voice_template(echo, template);
// Use voice template for synthesis
text_content_t* text = create_text_content("This is a test of the custom voice template.");
audio_buffer_t* audio = echo_synthesize_speech(echo, text, template, NULL);
// Clean up
free_text_content(text);
free_audio_buffer(audio);
get_voice_template()
voice_template_t* get_voice_template(ECHO13D* echo, const char* name);
Retrieves a voice template by name.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
name |
const char* |
Template name |
Returns
Pointer to voice_template_t structure, or NULL if not found. The returned pointer is owned by the ECHO 13D system and should not be freed by the caller.
Integration
The integration module provides functions for connecting ECHO 13D with other DragonFire components.
connect_echo_to_dragonheart()
bool connect_echo_to_dragonheart(ECHO13D* echo, DragonHeart* heart);
Connects ECHO 13D to a DragonHeart instance for harmonic processing.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
heart |
DragonHeart* |
Pointer to DragonHeart instance |
Returns
Boolean indicating success or failure.
connect_echo_to_nesh()
bool connect_echo_to_nesh(ECHO13D* echo, NESH* nesh);
Connects ECHO 13D to a NESH instance for voice pattern storage.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
nesh |
NESH* |
Pointer to NESH instance |
Returns
Boolean indicating success or failure.
integrate_echo_with_aurora()
bool integrate_echo_with_aurora(ECHO13D* echo, Aurora* aurora);
Integrates ECHO 13D with an Aurora AI instance for voice interface capabilities.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
aurora |
Aurora* |
Pointer to Aurora instance |
Returns
Boolean indicating success or failure.
Example
// Initialize components
DragonHeart* heart = dragonheart_init(NULL);
NESH* nesh = nesh_init(NULL);
Aurora* aurora = aurora_init(NULL);
// Initialize ECHO 13D
echo_config_t config;
config.dragonheart = heart;
config.nesh = nesh;
config.voice_config = NULL;
config.flags = 0;
ECHO13D* echo = echo_init(&config);
// Integrate ECHO 13D with Aurora
bool success = integrate_echo_with_aurora(echo, aurora);
if (!success) {
printf("Failed to integrate ECHO 13D with Aurora\n");
return -1;
}
// Now Aurora can use ECHO 13D for voice interface capabilities
printf("Aurora voice interface ready\n");
Error Handling
The ECHO 13D API uses various error handling mechanisms for reporting and managing errors.
echo_get_last_error()
const char* echo_get_last_error(ECHO13D* echo);
Returns a string description of the last error that occurred.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
Returns
String containing error description. The returned string is owned by the ECHO 13D system and should not be freed by the caller.
echo_get_error_code()
echo_error_t echo_get_error_code(ECHO13D* echo);
Returns the error code of the last error that occurred.
Parameters
echo |
ECHO13D* |
Pointer to ECHO13D instance |
Returns
Error code (enum value).
Error Codes
typedef enum {
ECHO_ERROR_NONE, // No error
ECHO_ERROR_INITIALIZATION, // Initialization error
ECHO_ERROR_INVALID_PARAMETER, // Invalid parameter
ECHO_ERROR_MEMORY_ALLOCATION, // Memory allocation failure
ECHO_ERROR_PROCESSING, // Processing error
ECHO_ERROR_RECOGNITION, // Recognition error
ECHO_ERROR_SYNTHESIS, // Synthesis error
ECHO_ERROR_AUDIO_DEVICE, // Audio device error
ECHO_ERROR_NOT_IMPLEMENTED, // Feature not implemented
ECHO_ERROR_INTEGRATION, // Integration error
ECHO_ERROR_UNKNOWN // Unknown error
} echo_error_t;
Example
// Try to initialize ECHO 13D without DragonHeart
ECHO13D* echo = echo_init(NULL);
// Check for errors
if (!echo) {
// Get global error information (for functions that return NULL)
echo_error_t error_code = echo_get_global_error_code();
const char* error_msg = echo_get_global_error_message();
printf("Failed to initialize ECHO 13D: %s (code %d)\n",
error_msg, error_code);
return -1;
}
// Try to synthesize speech with invalid parameters
audio_buffer_t* audio = echo_synthesize_speech(echo, NULL, NULL, NULL);
// Check for errors
if (!audio) {
echo_error_t error_code = echo_get_error_code(echo);
const char* error_msg = echo_get_last_error(echo);
printf("Speech synthesis failed: %s (code %d)\n",
error_msg, error_code);
}
Release Notes
Version 1.2.0 (Current)
- Added support for multi-speaker voice models
- Enhanced emotion detection accuracy with phi-resonance analysis
- Improved voice synthesis quality, especially for prosody
- Optimized 13-dimensional processing for better performance
- Added integration with Aurora AI for voice interface
Version 1.1.0
- Added support for NESH voice pattern storage
- Implemented advanced voice recognition with signature matching
- Enhanced speech analysis with semantic understanding
- Added voice template customization
Version 1.0.0
- Initial release of ECHO 13D API
- Basic voice processing capabilities
- Integration with DragonHeart for harmonic processing
- Basic speech recognition and synthesis