Skip to content

HumeAI

C# SDK for the Hume AI API -- emotion recognition and analysis from audio, video, text, and images.

Installation

1
dotnet add package HumeAI

Features

  • Expression Measurement (Batch) -- Submit audio, video, text, or images for emotion analysis
  • Empathic Voice Interface (EVI) -- Conversational AI with emotion understanding
  • Text-to-Speech (TTS) -- Emotionally expressive speech synthesis
  • Microsoft.Extensions.AI -- AIFunction tools for use with any IChatClient

Emotion Analysis

Submit text for batch emotion analysis using the Expression Measurement API.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
// Create an authenticated client
using var client = new HumeAIClient(apiKey);

// Start a batch inference job with text analysis
var jobResult = await client.Batch.StartBatchInferenceJobAsync(
    request: new InferenceBaseRequest
    {
        Text = ["I am so happy to see you! This is wonderful news."],
        Models = new ModelsConfig
        {
            Language = new LanguageModelConfig(),
        },
    });

// The job ID can be used to check status and retrieve predictions

Text-to-Speech

Synthesize speech from text using the Hume TTS API.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// Create an authenticated client
using var client = new HumeAIClient(apiKey);

// Synthesize speech from text
var result = await client.Tts.SynthesizeJsonAsync(
    request: new PostedTts
    {
        Utterances =
        [
            new PostedUtterance
            {
                Text = "Hello! I am excited to demonstrate Hume's text-to-speech capabilities.",
                Speed = 1.0,
            },
        ],
    });

// The result contains generation metadata and audio data

MEAI Tools

Use AIFunction tools with Microsoft.Extensions.AI for integration with any IChatClient.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// Create an authenticated client
using var client = new HumeAIClient(apiKey);

// Create AIFunction tools for use with any IChatClient
var startJobTool = client.AsStartBatchJobTool();
var getStatusTool = client.AsGetJobStatusTool();
var listJobsTool = client.AsListJobsTool();
var synthesizeTool = client.AsSynthesizeSpeechTool();
var listVoicesTool = client.AsListVoicesTool();
var listChatsTool = client.AsListChatsTool();

// Verify tools are created with proper metadata

License

This project is licensed under the MIT License.