Hecttor logo
Hecttor SDK Docs
Hermes SDK

Examples

Pick the configuration that matches the functionalities you want to enable. Each example below is a complete, runnable snippet. Replace the placeholder model name with the value provided during onboarding.

Full stack: Noise Cancellation + Speed Control + Voice Boost

All three features together. Requires a 20 ms chunk size because speed control is enabled. Note that with speed control on, the per-chunk enhancement call returns variable-length output.

import os
import numpy as np
from hecttor_sdk import (
    HumanSpeechEnhancer,
    HumanSpeechEnhancerConfig,
    NoiseCancellationConfig,
    SpeedControlConfig,
)

config = HumanSpeechEnhancerConfig(
    api_key=os.environ["HECTTOR_API_KEY"],
    chunk_size_ms=20,
    sample_rate=16000,
    enable_voice_boost=True,
    noise_cancellation_config=NoiseCancellationConfig(
        model_name="your_model",
        enhancer_weight=1.0,
    ),
    speed_control_config=SpeedControlConfig(
        speed_intensity=1.0,
        slowdown_capacity_ms=800.0,
    ),
)

enhancer = HumanSpeechEnhancer()
success, error = enhancer.initialize(config)
if not success:
    raise RuntimeError(f"Initialization failed: {error}")

chunk_size = enhancer.get_chunk_size_samples()
audio_chunk = np.random.randn(chunk_size).astype(np.float32)
enhanced, error = enhancer.process_chunk(audio_chunk)
if enhanced is None:
    raise RuntimeError(f"Processing failed: {error}")

print(f"Input: {chunk_size} -> Output: {len(enhanced)} samples")
const { HumanSpeechEnhancer } = require('hecttor_sdk');

async function main() {
  const enhancer = new HumanSpeechEnhancer();

  await enhancer.initialize({
    apiKey: 'your_api_key_here',
    chunkSizeMs: 20,                 // Required for speed control
    sampleRate: 16000,               // Supported: 4000, 8000, 16000, 24000, 32000, 44100, 48000
    enableVoiceBoost: true,
    noiseCancellationConfig: {
      modelName: 'your_model',       // "auris-1.0" or "coda-1.0"
      enhancerWeight: 1.0,           // 0.0 = original, 1.0 = fully enhanced (default)
    },
    speedControlConfig: {
      speedIntensity: 1.0,           // 0.7-1.5
      slowdownCapacityMs: 800.0,     // recommended 400-1000
    },
  });

  const chunkSize = enhancer.getChunkSizeSamples();
  const audioChunk = new Float32Array(chunkSize);  // ... fill with audio data ...

  const enhanced = await enhancer.processChunk(audioChunk);
  console.log(`Input: ${chunkSize} -> Output: ${enhanced.length} samples (varies with speed control)`);
}

main().catch((err) => console.error(err.message));
import io.hecttor.sdk.*;

public class FullExample {
    public static void main(String[] args) {
        HumanSpeechEnhancerConfig config = HumanSpeechEnhancerConfig.builder("your_api_key_here")
            .chunkSizeMs(20)
            .sampleRate(16000)
            .enableVoiceBoost(true)
            .noiseCancellation(new HumanSpeechEnhancerConfig.NoiseCancellationConfig(
                "your_model", 1.0f))
            .speedControl(new HumanSpeechEnhancerConfig.SpeedControlConfig(
                1.0f, 800.0f))
            .build();

        try (HumanSpeechEnhancer enhancer = new HumanSpeechEnhancer()) {
            enhancer.initialize(config);
            int chunkSize = enhancer.getChunkSizeSamples();
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.processChunk(audioChunk);
            System.out.println("Input: " + chunkSize + " -> Output: " + enhanced.length
                + " samples (varies with speed control)");
        } catch (HecttorException e) {
            System.err.println("Error: " + e.getMessage());
            System.exit(1);
        }
    }
}
#include <hecttor/human_speech_enhancer.hpp>
#include <iostream>
#include <vector>

int main() {
    try {
        hecttor::HumanSpeechEnhancerConfig config;
        config.apiKey = "your_api_key_here";
        config.chunkSizeMs = 20;
        config.sampleRate = 16000;
        config.enableVoiceBoost = true;
        config.noiseCancellationConfig = hecttor::NoiseCancellationConfig{"your_model", 1.0f};
        config.speedControlConfig = hecttor::SpeedControlConfig{1.0f, 800.0f};

        hecttor::HumanSpeechEnhancer enhancer;
        enhancer.initialize(config);
        const size_t chunkSize = enhancer.getChunkSizeSamples();
        std::vector<float> audioChunk(chunkSize, 0.0f);
        std::vector<float> enhanced = enhancer.processChunk(audioChunk);
        std::cout << "Input: " << chunkSize << " -> Output: " << enhanced.size()
                  << " samples (varies with speed control)\n";
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << "\n";
        return 1;
    }
    return 0;
}
using System;
using Hecttor.SDK;

class Program
{
    static void Main()
    {
        try
        {
            var config = new HumanSpeechEnhancerConfig
            {
                ApiKey = "your_api_key_here",
                ChunkSizeMs = 20,
                SampleRate = 16000,
                EnableVoiceBoost = true,
                NoiseCancellation = new NoiseCancellationConfig
                {
                    ModelName = "your_model",
                    EnhancerWeight = 1.0f,
                },
                SpeedControl = new SpeedControlConfig
                {
                    SpeedIntensity = 1.0f,
                    SlowdownCapacityMs = 800.0f,
                },
            };

            using var enhancer = new HumanSpeechEnhancer();
            enhancer.Initialize(config);

            int chunkSize = enhancer.ChunkSizeSamples;
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.ProcessChunk(audioChunk);
            Console.WriteLine($"Input: {chunkSize} -> Output: {enhanced.Length} samples (varies with speed control)");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
            Environment.Exit(1);
        }
    }
}
package main

import (
	"fmt"
	"log"
	"os"

	hecttor "hecttor.ai/sdk"
)

func main() {
	enh, err := hecttor.NewHumanSpeechEnhancer()
	if err != nil {
		log.Fatal(err)
	}
	defer enh.Close()

	nc := hecttor.NewNoiseCancellationConfig("your_model")
	nc.EnhancerWeight = 1.0

	if err := enh.Initialize(hecttor.HumanSpeechEnhancerConfig{
		APIKey:            os.Getenv("HECTTOR_API_KEY"),
		ChunkSizeMs:       20,
		SampleRate:        16000,
		EnableVoiceBoost:  true,
		NoiseCancellation: nc,
		SpeedControl: &hecttor.SpeedControlConfig{
			SpeedIntensity:     1.0,
			SlowdownCapacityMs: 800.0,
		},
	}); err != nil {
		log.Fatalf("Initialization failed: %v", err)
	}

	chunkSize, err := enh.ChunkSizeSamples()
	if err != nil {
		log.Fatal(err)
	}
	audioChunk := make([]float32, chunkSize)
	enhanced, err := enh.ProcessChunk(audioChunk)
	if err != nil {
		log.Fatalf("Processing failed: %v", err)
	}
	fmt.Printf("Input: %d -> Output: %d samples (varies with speed control)\n",
		chunkSize, len(enhanced))
}

Noise Cancellation only

Denoising without voice boost or speed control. The denoising model loads but speed control and voice boost are skipped.

import os
import numpy as np
from hecttor_sdk import HumanSpeechEnhancer, HumanSpeechEnhancerConfig, NoiseCancellationConfig

config = HumanSpeechEnhancerConfig(
    api_key=os.environ["HECTTOR_API_KEY"],
    chunk_size_ms=20,
    sample_rate=48000,
    noise_cancellation_config=NoiseCancellationConfig(
        model_name="your_model",
        enhancer_weight=1.0,
    ),
)

enhancer = HumanSpeechEnhancer()
success, error = enhancer.initialize(config)
if not success:
    raise RuntimeError(f"Initialization failed: {error}")

chunk_size = enhancer.get_chunk_size_samples()
audio_chunk = np.random.randn(chunk_size).astype(np.float32)
enhanced, error = enhancer.process_chunk(audio_chunk)
print(f"Enhanced {len(enhanced)} samples")
const { HumanSpeechEnhancer } = require('hecttor_sdk');

async function main() {
  const enhancer = new HumanSpeechEnhancer();

  await enhancer.initialize({
    apiKey: 'your_api_key_here',
    chunkSizeMs: 20,                 // 16 or 20 for "auris-1.0"; 20 only for "coda-1.0"
    sampleRate: 48000,
    noiseCancellationConfig: {
      modelName: 'your_model',
      enhancerWeight: 1.0,
    },
  });

  const chunkSize = enhancer.getChunkSizeSamples();
  const audioChunk = new Float32Array(chunkSize);
  const enhanced = await enhancer.processChunk(audioChunk);
  console.log(`Successfully enhanced ${enhanced.length} samples!`);
}

main().catch((err) => console.error(err.message));
import io.hecttor.sdk.*;

public class NoiseCancellationOnly {
    public static void main(String[] args) {
        HumanSpeechEnhancerConfig config = HumanSpeechEnhancerConfig.builder("your_api_key_here")
            .chunkSizeMs(20)
            .sampleRate(48000)
            .noiseCancellation(new HumanSpeechEnhancerConfig.NoiseCancellationConfig(
                "your_model", 1.0f))
            .build();

        try (HumanSpeechEnhancer enhancer = new HumanSpeechEnhancer()) {
            enhancer.initialize(config);
            int chunkSize = enhancer.getChunkSizeSamples();
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.processChunk(audioChunk);
            System.out.println("Successfully enhanced " + enhanced.length + " samples!");
        } catch (HecttorException e) {
            System.err.println("Error: " + e.getMessage());
            System.exit(1);
        }
    }
}
#include <hecttor/human_speech_enhancer.hpp>
#include <iostream>
#include <vector>

int main() {
    try {
        hecttor::HumanSpeechEnhancerConfig config;
        config.apiKey = "your_api_key_here";
        config.chunkSizeMs = 20;
        config.sampleRate = 48000;
        config.noiseCancellationConfig = hecttor::NoiseCancellationConfig{"your_model", 1.0f};

        hecttor::HumanSpeechEnhancer enhancer;
        enhancer.initialize(config);
        const size_t chunkSize = enhancer.getChunkSizeSamples();
        std::vector<float> audioChunk(chunkSize, 0.0f);
        std::vector<float> enhanced = enhancer.processChunk(audioChunk);
        std::cout << "Successfully enhanced " << enhanced.size() << " samples!\n";
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << "\n";
        return 1;
    }
    return 0;
}
using System;
using Hecttor.SDK;

class Program
{
    static void Main()
    {
        try
        {
            var config = new HumanSpeechEnhancerConfig
            {
                ApiKey = "your_api_key_here",
                ChunkSizeMs = 20,
                SampleRate = 48000,
                NoiseCancellation = new NoiseCancellationConfig
                {
                    ModelName = "your_model",
                    EnhancerWeight = 1.0f,
                },
            };

            using var enhancer = new HumanSpeechEnhancer();
            enhancer.Initialize(config);
            int chunkSize = enhancer.ChunkSizeSamples;
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.ProcessChunk(audioChunk);
            Console.WriteLine($"Successfully enhanced {enhanced.Length} samples!");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
            Environment.Exit(1);
        }
    }
}
package main

import (
	"fmt"
	"log"
	"os"

	hecttor "hecttor.ai/sdk"
)

func main() {
	enh, err := hecttor.NewHumanSpeechEnhancer()
	if err != nil {
		log.Fatal(err)
	}
	defer enh.Close()

	if err := enh.Initialize(hecttor.HumanSpeechEnhancerConfig{
		APIKey:      os.Getenv("HECTTOR_API_KEY"),
		ChunkSizeMs: 20, // 16 or 20 for "auris-1.0"; 20 only for "coda-1.0"
		SampleRate:  48000,
		NoiseCancellation: hecttor.NewNoiseCancellationConfig("your_model"),
	}); err != nil {
		log.Fatalf("Error: %v", err)
	}

	chunkSize, err := enh.ChunkSizeSamples()
	if err != nil {
		log.Fatal(err)
	}
	audioChunk := make([]float32, chunkSize)
	enhanced, err := enh.ProcessChunk(audioChunk)
	if err != nil {
		log.Fatalf("Error: %v", err)
	}
	fmt.Printf("Successfully enhanced %d samples!\n", len(enhanced))
}

Voice Boost only

Voice boost with no denoising model loaded; initialization is faster and memory footprint is smaller.

import os
import numpy as np
from hecttor_sdk import HumanSpeechEnhancer, HumanSpeechEnhancerConfig

config = HumanSpeechEnhancerConfig(
    api_key=os.environ["HECTTOR_API_KEY"],
    chunk_size_ms=16,
    sample_rate=16000,
    enable_voice_boost=True,
)

enhancer = HumanSpeechEnhancer()
success, error = enhancer.initialize(config)
if not success:
    raise RuntimeError(f"Initialization failed: {error}")

chunk_size = enhancer.get_chunk_size_samples()
audio_chunk = np.random.randn(chunk_size).astype(np.float32)
enhanced, error = enhancer.process_chunk(audio_chunk)
print(f"Enhanced {len(enhanced)} samples")
const { HumanSpeechEnhancer } = require('hecttor_sdk');

async function main() {
  const enhancer = new HumanSpeechEnhancer();

  await enhancer.initialize({
    apiKey: 'your_api_key_here',
    chunkSizeMs: 16,
    sampleRate: 16000,
    enableVoiceBoost: true,
  });

  const chunkSize = enhancer.getChunkSizeSamples();
  const audioChunk = new Float32Array(chunkSize);
  const enhanced = await enhancer.processChunk(audioChunk);
  console.log(`Successfully enhanced ${enhanced.length} samples!`);
}

main().catch((err) => console.error(err.message));
import io.hecttor.sdk.*;

public class VoiceBoostOnly {
    public static void main(String[] args) {
        HumanSpeechEnhancerConfig config = HumanSpeechEnhancerConfig.builder("your_api_key_here")
            .chunkSizeMs(16)
            .sampleRate(16000)
            .enableVoiceBoost(true)
            .build();

        try (HumanSpeechEnhancer enhancer = new HumanSpeechEnhancer()) {
            enhancer.initialize(config);
            int chunkSize = enhancer.getChunkSizeSamples();
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.processChunk(audioChunk);
            System.out.println("Successfully enhanced " + enhanced.length + " samples!");
        } catch (HecttorException e) {
            System.err.println("Error: " + e.getMessage());
            System.exit(1);
        }
    }
}
#include <hecttor/human_speech_enhancer.hpp>
#include <iostream>
#include <vector>

int main() {
    try {
        hecttor::HumanSpeechEnhancerConfig config;
        config.apiKey = "your_api_key_here";
        config.chunkSizeMs = 16;
        config.sampleRate = 16000;
        config.enableVoiceBoost = true;

        hecttor::HumanSpeechEnhancer enhancer;
        enhancer.initialize(config);
        const size_t chunkSize = enhancer.getChunkSizeSamples();
        std::vector<float> audioChunk(chunkSize, 0.0f);
        std::vector<float> enhanced = enhancer.processChunk(audioChunk);
        std::cout << "Successfully enhanced " << enhanced.size() << " samples!\n";
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << "\n";
        return 1;
    }
    return 0;
}
using System;
using Hecttor.SDK;

class Program
{
    static void Main()
    {
        try
        {
            var config = new HumanSpeechEnhancerConfig
            {
                ApiKey = "your_api_key_here",
                ChunkSizeMs = 16,
                SampleRate = 16000,
                EnableVoiceBoost = true,
            };

            using var enhancer = new HumanSpeechEnhancer();
            enhancer.Initialize(config);
            int chunkSize = enhancer.ChunkSizeSamples;
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.ProcessChunk(audioChunk);
            Console.WriteLine($"Successfully enhanced {enhanced.Length} samples!");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
            Environment.Exit(1);
        }
    }
}
package main

import (
	"fmt"
	"log"
	"os"

	hecttor "hecttor.ai/sdk"
)

func main() {
	enh, err := hecttor.NewHumanSpeechEnhancer()
	if err != nil {
		log.Fatal(err)
	}
	defer enh.Close()

	if err := enh.Initialize(hecttor.HumanSpeechEnhancerConfig{
		APIKey:           os.Getenv("HECTTOR_API_KEY"),
		ChunkSizeMs:      16,
		SampleRate:       16000,
		EnableVoiceBoost: true,
	}); err != nil {
		log.Fatalf("Error: %v", err)
	}

	chunkSize, err := enh.ChunkSizeSamples()
	if err != nil {
		log.Fatal(err)
	}
	audioChunk := make([]float32, chunkSize)
	enhanced, err := enh.ProcessChunk(audioChunk)
	if err != nil {
		log.Fatalf("Error: %v", err)
	}
	fmt.Printf("Successfully enhanced %d samples!\n", len(enhanced))
}

Speed Control only

Speed control without denoising or voice boost. Requires a 20 ms chunk size and produces variable-length output.

import os
import numpy as np
from hecttor_sdk import HumanSpeechEnhancer, HumanSpeechEnhancerConfig, SpeedControlConfig

config = HumanSpeechEnhancerConfig(
    api_key=os.environ["HECTTOR_API_KEY"],
    chunk_size_ms=20,
    sample_rate=16000,
    speed_control_config=SpeedControlConfig(
        speed_intensity=1.0,
        slowdown_capacity_ms=800.0,
    ),
)

enhancer = HumanSpeechEnhancer()
success, error = enhancer.initialize(config)
if not success:
    raise RuntimeError(f"Initialization failed: {error}")

chunk_size = enhancer.get_chunk_size_samples()
audio_chunk = np.random.randn(chunk_size).astype(np.float32)
enhanced, error = enhancer.process_chunk(audio_chunk)
print(f"Input: {chunk_size} -> Output: {len(enhanced)} samples")
const { HumanSpeechEnhancer } = require('hecttor_sdk');

async function main() {
  const enhancer = new HumanSpeechEnhancer();

  await enhancer.initialize({
    apiKey: 'your_api_key_here',
    chunkSizeMs: 20,                 // Required for speed control
    sampleRate: 16000,
    speedControlConfig: {
      speedIntensity: 1.0,           // 0.7-1.5
      slowdownCapacityMs: 800.0,     // recommended 400-1000
    },
  });

  const chunkSize = enhancer.getChunkSizeSamples();
  const audioChunk = new Float32Array(chunkSize);
  const enhanced = await enhancer.processChunk(audioChunk);
  console.log(`Input: ${chunkSize} -> Output: ${enhanced.length} samples`);
}

main().catch((err) => console.error(err.message));
import io.hecttor.sdk.*;

public class SpeedOnly {
    public static void main(String[] args) {
        HumanSpeechEnhancerConfig config = HumanSpeechEnhancerConfig.builder("your_api_key_here")
            .chunkSizeMs(20)
            .sampleRate(16000)
            .speedControl(new HumanSpeechEnhancerConfig.SpeedControlConfig(1.0f, 800.0f))
            .build();

        try (HumanSpeechEnhancer enhancer = new HumanSpeechEnhancer()) {
            enhancer.initialize(config);
            int chunkSize = enhancer.getChunkSizeSamples();
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.processChunk(audioChunk);
            System.out.println("Input: " + chunkSize + " -> Output: " + enhanced.length + " samples");
        } catch (HecttorException e) {
            System.err.println("Error: " + e.getMessage());
            System.exit(1);
        }
    }
}
#include <hecttor/human_speech_enhancer.hpp>
#include <iostream>
#include <vector>

int main() {
    try {
        hecttor::HumanSpeechEnhancerConfig config;
        config.apiKey = "your_api_key_here";
        config.chunkSizeMs = 20;
        config.sampleRate = 16000;
        config.speedControlConfig = hecttor::SpeedControlConfig{1.0f, 800.0f};

        hecttor::HumanSpeechEnhancer enhancer;
        enhancer.initialize(config);
        const size_t chunkSize = enhancer.getChunkSizeSamples();
        std::vector<float> audioChunk(chunkSize, 0.0f);
        std::vector<float> enhanced = enhancer.processChunk(audioChunk);
        std::cout << "Input: " << chunkSize << " -> Output: " << enhanced.size() << " samples\n";
    } catch (const std::exception& e) {
        std::cerr << "Error: " << e.what() << "\n";
        return 1;
    }
    return 0;
}
using System;
using Hecttor.SDK;

class Program
{
    static void Main()
    {
        try
        {
            var config = new HumanSpeechEnhancerConfig
            {
                ApiKey = "your_api_key_here",
                ChunkSizeMs = 20,
                SampleRate = 16000,
                SpeedControl = new SpeedControlConfig
                {
                    SpeedIntensity = 1.0f,
                    SlowdownCapacityMs = 800.0f,
                },
            };

            using var enhancer = new HumanSpeechEnhancer();
            enhancer.Initialize(config);
            int chunkSize = enhancer.ChunkSizeSamples;
            float[] audioChunk = new float[chunkSize];
            float[] enhanced = enhancer.ProcessChunk(audioChunk);
            Console.WriteLine($"Input: {chunkSize} -> Output: {enhanced.Length} samples");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
            Environment.Exit(1);
        }
    }
}
package main

import (
	"fmt"
	"log"
	"os"

	hecttor "hecttor.ai/sdk"
)

func main() {
	enh, err := hecttor.NewHumanSpeechEnhancer()
	if err != nil {
		log.Fatal(err)
	}
	defer enh.Close()

	if err := enh.Initialize(hecttor.HumanSpeechEnhancerConfig{
		APIKey:      os.Getenv("HECTTOR_API_KEY"),
		ChunkSizeMs: 20, // Required for speed control
		SampleRate:  16000,
		SpeedControl: &hecttor.SpeedControlConfig{
			SpeedIntensity:     1.0,
			SlowdownCapacityMs: 800.0,
		},
	}); err != nil {
		log.Fatalf("Error: %v", err)
	}

	chunkSize, err := enh.ChunkSizeSamples()
	if err != nil {
		log.Fatal(err)
	}
	audioChunk := make([]float32, chunkSize)
	enhanced, err := enh.ProcessChunk(audioChunk)
	if err != nil {
		log.Fatalf("Error: %v", err)
	}
	fmt.Printf("Input: %d -> Output: %d samples\n", chunkSize, len(enhanced))
}

Initialize Hermes once per session and reuse the enhancer across all chunks. Initialization loads models and validates the key; that's the costly step, not the per-chunk processing call.