Libraries

Open-source libraries, and packages for developers.

Language & Speech Processing

Libraries for natural language processing, speech synthesis, and language detection.

  • Speech Provider Python 2025

    Python package for accessing text-to-speech APIs in a uniform way.

    Example usage:
    # Import the package
    from speech_provider import get_voice_provider
    
    # Basic usage
    provider = get_voice_provider()
    
    # Get available voices for a specific language
    voices = provider.get_voices(lang='en-US')
    
    if voices:
        # Create and play an utterance with the first available voice
        utterance = voices[0].create_utterance('Hello, welcome to my application!')
    
        # Start speaking
        utterance.play()
    
    # Use with Eleven Labs for higher quality voices
    elevenlabs_provider = get_voice_provider(
        elevenlab_api_key='your-api-key',
        cache_max_age=3600  # Cache for 1 hour
    )
    
    # Get default voice for a language
    default_voice = elevenlabs_provider.get_default_voice(lang='zh-CN')
    
    if default_voice:
        utterance = default_voice.create_utterance('你好,欢迎使用我的应用程序!')
        utterance.play()
    
    # Get voices for specific language
    voices = provider.get_voices(lang='fr-FR')
    for voice in voices:
        print(f"Voice: {voice.name}, Language: {voice.lang}")
    
  • A context-aware language detection library that improves accuracy by considering document-level language patterns.

    Example usage:
    # Basic usage with context-awareness
    from contextual_langdetect import contextual_detect
    
    # Example multilingual text
    sentences = [
        "你好。",                           # Chinese
        "你好吗?",                          # Chinese
        "很好。",                           # Could be detected as Japanese without context
        "我家也有四个,刚好。",                # Chinese
        "那么现在天气很冷,你要开暖气吗?",      # Chinese (Wu dialect)
        "Okay, fine I'll see you next week.", # English
        "Great, I'll see you then."          # English
    ]
    
    # Context-aware detection (default)
    languages = contextual_detect(sentences)
    print(languages)  # ['zh', 'zh', 'zh', 'zh', 'zh', 'en', 'en']
    
    # Context-unaware detection
    languages = contextual_detect(sentences, context_correction=False)
    print(languages)  # ['zh', 'zh', 'ja', 'zh', 'wuu', 'en', 'en']
    
    # Get language distribution in a document
    from contextual_langdetect.detection import count_by_language
    
    mixed_sentences = [
        "Hello world.",        # English
        "Bonjour le monde.",   # French
        "Hallo Welt.",         # German
        "Hello again."         # English
    ]
    
    counts = count_by_language(mixed_sentences)
    print(counts)  # {'en': 2, 'fr': 1, 'de': 1}
    
    # Get the majority language in a document
    from contextual_langdetect.detection import get_majority_language
    
    majority = get_majority_language(mixed_sentences)
    print(majority)  # 'en'
    

p5.js Libraries

Libraries and extensions for the p5.js creative coding framework.

  • p5.layers JavaScript 2021

    Simplifies use of createGraphics and p5.js Renders objects for drawing layers.

    Example usage:
    // Include the library in your HTML
    <script src="https://cdn.jsdelivr.net/gh/osteele/p5.libs/p5.layers/dist/p5.layers.min.js"></script>
    
    function setup() {
      createCanvas(400, 400);
    }
    
    function draw() {
      // Start drawing to a layer
      beginLayer();
      background(100);
      fill('blue');
      circle(width / 2, height / 2, 100);
      endLayer();
    
      // Create a named layer
      beginLayer('overlay');
      noFill();
      stroke('red');
      strokeWeight(3);
      rect(width / 4, height / 4, width / 2, height / 2);
      endLayer();
    
      // Draw all layers to the canvas
      drawLayers();
    }
    
  • p5.rotate-about JavaScript 2021

    Adds rotateAbout() and scaleAbout() functions for rotating and scaling around a point.

    Example usage:
    // Include the library in your HTML
    <script src="https://cdn.jsdelivr.net/gh/osteele/p5.libs/p5.rotate-about/dist/p5.rotate-about.min.js"></script>
    
    function setup() {
      createCanvas(400, 400);
      rectMode(CENTER);
    }
    
    function draw() {
      background(220);
    
      // Rotate around a specific point (100, 200)
      // instead of around the canvas origin
      push();
      const angle = radians(frameCount);
      rotateAbout(angle, 100, 200);
      rect(100, 200, 50, 50);
      pop();
    
      // Scale around a specific point (300, 200)
      push();
      const scale = 1 + 0.5 * sin(frameCount / 30);
      scaleAbout(scale, 300, 200);
      rect(300, 200, 50, 50);
      pop();
    }
    
  • p5.vector-arguments JavaScript 2021

    Modifies p5.js Shape functions to accept p5.Vector instances as arguments.

    Example usage:
    // Include the library in your HTML
    <script src="https://cdn.jsdelivr.net/gh/osteele/p5.libs/p5.vector-arguments/dist/p5.vector-arguments.min.js"></script>
    
    function setup() {
      createCanvas(400, 400);
    }
    
    function draw() {
      background(220);
    
      // Create a vector for the mouse position
      let mousePos = createVector(mouseX, mouseY);
    
      // Draw a circle at the mouse position using the vector
      fill('red');
      circle(mousePos, 30);
    
      // Create another vector and draw a rectangle
      let pos = createVector(width/2, height/2);
      fill('blue');
      rect(pos, 50, 50);
    
      // Draw a line between two vectors
      let start = createVector(0, 0);
      let end = createVector(mouseX, mouseY);
      line(start, end);
    }
    
  • p5.pose Playback JavaScript 2020

    Record and play back pose data in p5.js

LLM Libraries

Libraries for working with Large Language Models.

  • Prompt Matrix (JS) TypeScript 2023

    JavaScript library for expanding prompt matrix strings.

    Example usage:
    // Import the library
    import { expandPrompt, generatePromptExpansions } from 'prompt-matrix';
    
    // Expand a prompt matrix into an array of all possible combinations
    const prompt = "<hi|hello> <there|you>";
    const expansions = expandPrompt(prompt);
    console.log(expansions); // ["hi there", "hi you", "hello there", "hello you"]
    
    // Use optional elements with brackets
    const optionalPrompt = "The [small] cat";
    console.log(expandPrompt(optionalPrompt)); // ["The small cat", "The cat"]
    
    // Generate expansions one by one using a generator
    for (const expansion of generatePromptExpansions("<hi|hello> <there|you>")) {
      console.log(expansion);
    }
    
  • Python package for expanding prompt matrix strings.

    Example usage:
    # Import the package
    import prompt_matrix
    
    # Expand a prompt matrix into a list of all possible combinations
    prompt = "<hi|hello> <there|you>"
    expansions = prompt_matrix.expand(prompt)
    print(expansions)  # ["hi there", "hi you", "hello there", "hello you"]
    
    # Use optional elements with brackets
    optional_prompt = "The [small] cat"
    print(prompt_matrix.expand(optional_prompt))  # ["The small cat", "The cat"]
    
    # Generate expansions one by one using an iterator
    for expansion in prompt_matrix.iterexpand("<hi|hello> <there|you>"):
        print(expansion)
    

Historical JavaScript

Historical JavaScript libraries for functional programming and fluent interfaces.

OpenLaszlo Libraries

Libraries and tools for OpenLaszlo development.

Other Projects

Projects that do not fit in other categories.