# Recording Analysis

## Working with Call Recordings

MixedVoices provides powerful capabilities for analysing voice recordings. The system processes stereo audio files where the user and assistant are recorded on separate channels.

#### Load project and version

Before analysing calls, create or load a project and version.

```python
import mixedvoices as mv
project = mv.load_project("your_project_name")
version = project.load_version("v1")
```

#### Add call recording to version

To analyse call recordings, add them to a version. Ensure that the audio files are stereo recordings with the user and assistant on separate channels.

```python
# without any of the optional parameters
version.add_recording("path/to/call.wav")

# Set user_channel, override transcript/summary generation
# manually set success and add custom metadata
version.add_recording(
    audio_path="path/to/call.wav",
    user_channel="right", # Specify which channel,
    blocking=False, # instantly return and process audio in background
    transcript="Custom transcript", # Provide your own transcript
    summary="Call summary", # Provide your own summary
    is_successful=True # Manually set success status
    metadata={"call_id": "123"} # Add custom metadata
)
```

#### Processing Details

When you add a recording, MixedVoices performs several analyses:

1. **Channel Separation**: Splits user and assistant audio
2. **Transcription**: Generates detailed transcript with speaker labels using OpenAI or Deepgram
3. **Quality Metrics**: Measures technical aspects like signal to noise ratio, words per minute, latency and interruptions
4. **Conversation Analysis**: Evaluates multiple factors such as empathy and conciseness
5. **Flow Mapping**: Identifies conversation steps and patterns
6. **Success Evaluation**: Checks against success criteria if defined
7. **Call Summarization**: Generates a short summary of the call

#### Asynchronous Processing

For long recordings or batch processing or in scripts where analysis becomes a bottleneck, use non-blocking mode and processing will happen in the background:

```python
version.add_recording(
    audio_file,
    blocking=False
)
```
