AGENT SKILL

echo-mirror

Receives voice recordings from the EchoMirror R1 Creation, runs audio transformation (accent, effect, pitch), optionally scores similarity for practice mode, and saves side-by-side recordings for 'Record Both' mode.

License 许可
MIT
最近更新
2026-09-04
Stars
★ 0
Forks
0

01 前言 Front Matter

name
echo-mirror
author
rabbit-r1-skillz
version
1.0.0
description
Receives voice recordings from the EchoMirror R1 Creation, runs audio transformation (accent, effect, pitch), optionally scores similarity for practice mode, and saves side-by-side recordings for 'Record Both' mode.

02 资源文件 3

03 SKILL.md 正文

EchoMirror — OpenClaw Skill

This skill bridges the EchoMirror Creation on your Rabbit R1 to audio transformation pipelines on your local machine. It receives transcribed phrases, transforms them into the requested voice or accent style, returns the transformed text (and optionally a similarity score), and saves audio files when the user enables "Record Both" mode.

Commands sent by the Creation

1. transform-voice

Transform a phrase into a target accent or vocal effect.

Payload:

{
  "text":       "Hello, how are you today?",
  "style":      "british_rp",
  "saveRecord": false,
  "isBothMode": false
}

Style values:

style Description
british_rp British Received Pronunciation
australian Australian English
scottish Scottish English
southern_us Southern US English
new_york New York English
french_accent French-accented English
spanish_accent Spanish-accented English
robotic Synthesized/robotic
deep_baritone Deep, resonant baritone
opera Operatic dramatic delivery
whisper Hushed whisper
medieval_herald Formal herald proclamation
villain_dramatic Dramatically evil
chipmunk High-pitched/sped-up
basso_profundo Extremely deep bass

Expected response:

{
  "transformedText": "Hello, how are you today? (British RP rewrite)",
  "audioSaved":      false
}

2. transform-language

Phonetically rewrite an English phrase as if spoken by a native speaker of the target language (for language-learning pronunciation modeling).

Payload:

{
  "text":       "Hello, where is the train station?",
  "targetLang": "french",
  "saveRecord": false
}

Target language values: french, spanish, japanese

Expected response:

{
  "transformedText": "Bonjour, où se trouve la gare ?",
  "audioSaved":      false
}

3. transform-custom

Apply a custom voice persona generated by the R1's built-in AI.

Payload:

{
  "text":       "I shall not be moved.",
  "persona":    { "label": "gruff sea captain", "prompt": "Rewrite as if spoken by a gruff sea captain..." },
  "saveRecord": false,
  "isBothMode": false
}

The persona object is built on-device by the R1 AI when the user describes their custom voice. Your skill receives it verbatim and applies parameters it understands; ignore unknown fields.

Expected response:

{
  "transformedText": "I shall not be moved. (rewritten for persona)",
  "audioSaved":      false
}

4. practice-score (optional, merged into transform-voice response)

When style is sent with a previously set practice target, the skill may include a similarityScore in the response (0–100, float). If voice analysis is not available, omit the field and the Creation will skip the score display.

{
  "transformedText": "…",
  "audioSaved":      false,
  "similarityScore": 73.4
}

"Record Both" mode

When saveRecord: true (or isBothMode: true) is present, the skill should:

  1. Use the original text to synthesize or record the original audio.
  2. Generate the transformed audio.
  3. Save both as paired WAV/MP3 files side-by-side.
  4. Set audioSaved: true in the response.

Files are saved to ~/Documents/EchoMirror/recordings/ by default:

echo-{style}-original-{YYYY-MM-DD}-{HH-MM-SS}.wav
echo-{style}-transformed-{YYYY-MM-DD}-{HH-MM-SS}.wav

Local setup

Prerequisites

  • OpenClaw running on your machine
  • Node.js 18+ or Python 3.10+
  • A text-to-speech / voice transformation backend (see options below)

Installation

  1. Install and start OpenClaw:

    npm install -g openclaw
    openclaw start
    
  2. Place skill.js (below) in your OpenClaw skills directory:

    ~/.openclaw/skills/echo-mirror/skill.js
    
  3. (Optional) configure the output directory and TTS backend:

    openclaw config set echo-mirror.outputDir "/path/to/recordings"
    openclaw config set echo-mirror.ttsBackend "elevenlabs"   # or "coqui" | "llm-rewrite"
    openclaw config set echo-mirror.elevenLabsKey "sk-..."
    
  4. Verify registration:

    openclaw skills list
    # Should show: echo-mirror  v1.0.0  active
    

skill.js

Place at ~/.openclaw/skills/echo-mirror/skill.js:

const fs   = require('fs').promises;
const path = require('path');
const os   = require('os');

const OUTPUT_DIR = process.env.ECHO_MIRROR_DIR
  || path.join(os.homedir(), 'Documents', 'EchoMirror', 'recordings');

const TTS_BACKEND = process.env.ECHO_MIRROR_TTS || 'llm-rewrite';

module.exports = {
  name:    'echo-mirror',
  version: '1.0.0',

  async onCommand(command, payload) {
    switch (command) {
      case 'transform-voice':    return transformVoice(payload);
      case 'transform-language': return transformLanguage(payload);
      case 'transform-custom':   return transformCustom(payload);
      default:
        return { error: 'Unknown command: ' + command };
    }
  }
};

// ── Style → rewrite prompt map ─────────────────────────────────
const STYLE_PROMPTS = {
  british_rp:      'Rewrite the following as formal British Received Pronunciation, adjusting vocabulary and spelling naturally:',
  australian:      'Rewrite with Australian English slang, rhythm, and phrasing:',
  scottish:        'Rewrite in Scottish English dialect with appropriate expressions:',
  southern_us:     'Rewrite in warm Southern US English with regional expressions:',
  new_york:        'Rewrite in New York City English cadence and phrasing:',
  french_accent:   'Rewrite as an English sentence phonetically colored by a French accent (keep English words, alter phrasing):',
  spanish_accent:  'Rewrite as an English sentence phonetically colored by a Spanish accent:',
  robotic:         'Rewrite as if spoken by a robot — staccato, literal, no contractions:',
  deep_baritone:   'Rewrite for a deep resonant baritone delivery — commanding, measured:',
  opera:           'Rewrite as if sung operatically — dramatic vowels, elevated diction:',
  whisper:         'Rewrite for hushed whisper delivery — short breaths, intimate:',
  medieval_herald: 'Rewrite as a Medieval herald proclamation — "Hear ye" style, formal archaic English:',
  villain_dramatic:'Rewrite as a dramatically evil villain monologue — sinister, theatrical:',
  chipmunk:        'Rewrite with tiny, excited, high-pitched character energy — very enthusiastic:',
  basso_profundo:  'Rewrite for an extremely deep bass voice — slow, earth-shaking gravitas:',
};

const LANG_PROMPTS = {
  french:   'Translate this English phrase to natural conversational French:',
  spanish:  'Translate this English phrase to natural conversational Spanish:',
  japanese: 'Translate this English phrase to natural conversational Japanese (use romaji for pronunciation):',
};

async function transformVoice({ text, style, saveRecord, isBothMode }) {
  const prompt = STYLE_PROMPTS[style];
  if (!prompt) return { error: 'Unknown style: ' + style };

  const transformedText = await llmRewrite(prompt, text);
  const audioSaved = (saveRecord || isBothMode) ? await saveRecordings(text, transformedText, style) : false;

  return { transformedText, audioSaved };
}

async function transformLanguage({ text, targetLang, saveRecord }) {
  const prompt = LANG_PROMPTS[targetLang];
  if (!prompt) return { error: 'Unknown language: ' + targetLang };

  const transformedText = await llmRewrite(prompt, text);
  const audioSaved = saveRecord ? await saveRecordings(text, transformedText, 'lang-' + targetLang) : false;

  return { transformedText, audioSaved };
}

async function transformCustom({ text, persona, saveRecord, isBothMode }) {
  const label  = persona?.label || 'custom';
  const prompt = persona?.prompt
    || `Rewrite the following phrase as if spoken by: ${label}. Capture their unique speech patterns:`;

  const transformedText = await llmRewrite(prompt, text);
  const audioSaved = (saveRecord || isBothMode) ? await saveRecordings(text, transformedText, 'custom') : false;

  return { transformedText, audioSaved };
}

// ── LLM rewrite via local backend ─────────────────────────────
async function llmRewrite(systemPrompt, userText) {
  // Default: use Ollama if available, fall back to no-op
  if (TTS_BACKEND === 'ollama' || TTS_BACKEND === 'llm-rewrite') {
    try {
      const resp = await fetch('http://localhost:11434/api/generate', {
        method:  'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({
          model:  process.env.ECHO_MIRROR_MODEL || 'llama3.2',
          prompt: systemPrompt + '\n\n"' + userText + '"',
          stream: false,
        }),
      });
      if (resp.ok) {
        const data = await resp.json();
        return (data.response || '').trim().replace(/^["']|["']$/g, '');
      }
    } catch (_) {}
  }

  // Passthrough if no backend configured
  return userText;
}

// ── File saving ────────────────────────────────────────────────
async function saveRecordings(original, transformed, style) {
  try {
    await fs.mkdir(OUTPUT_DIR, { recursive: true });

    const ts   = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
    const base = `echo-${style}-${ts}`;

    await fs.writeFile(path.join(OUTPUT_DIR, `${base}-original.txt`),    original,    'utf8');
    await fs.writeFile(path.join(OUTPUT_DIR, `${base}-transformed.txt`), transformed, 'utf8');

    // Append to index
    const indexPath = path.join(OUTPUT_DIR, 'INDEX.md');
    const line = `| ${new Date().toLocaleString()} | ${style} | ${base} |\n`;
    await fs.appendFile(indexPath, line, 'utf8').catch(() => {});

    return true;
  } catch (_) {
    return false;
  }
}

Custom voice personas (AI-generated)

When the user selects "Custom Voice (AI)" from the EchoMirror menu and describes a voice persona by speaking, the R1's built-in LLM generates a persona descriptor on-device. The result is stored locally and forwarded in subsequent transform-custom calls as the persona object.

The persona object contains at minimum:

  • label — short display name shown in the UI (max 24 chars)
  • prompt — one-sentence rewrite instruction forwarded to your skill's transformCustom handler

Additional fields (pitch, rate, reverb, etc.) may be included and passed through to any audio post-processing layer you integrate; ignore fields your skill does not use.

If AI persona generation fails, EchoMirror falls back silently to the Robotic preset.


TTS backends

The skill supports three backend modes, configurable via ECHO_MIRROR_TTS:

Value Description
llm-rewrite Default. Uses a local Ollama model to rewrite text in the target style. No audio generation — text is returned to the R1 for its built-in TTS.
coqui Uses Coqui TTS for audio synthesis with voice cloning. Generates WAV files.
elevenlabs Uses ElevenLabs API for high-quality voice transformation. Requires ECHO_MIRROR_ELEVENLABS_KEY.

For the llm-rewrite mode (default), set ECHO_MIRROR_MODEL to your preferred Ollama model:

export ECHO_MIRROR_MODEL="llama3.2"   # default
export ECHO_MIRROR_MODEL="mistral"
export ECHO_MIRROR_MODEL="qwen2.5"

Output format

When "Record Both" is enabled, files are saved to ~/Documents/EchoMirror/recordings/:

echo-{style}-{YYYY-MM-DD}-{HH-MM-SS}-original.txt
echo-{style}-{YYYY-MM-DD}-{HH-MM-SS}-transformed.txt

An INDEX.md table is maintained in the same folder:

| Date/Time            | Style    | Files                           |
|----------------------|----------|---------------------------------|
| 6/14/2026, 9:30:00 AM | british_rp | echo-british_rp-2026-06-14... |

Security notes

  • This skill rewrites text via a local LLM and writes files only to the configured output directory. It does not traverse paths, execute payload content as code, or make outbound network requests (except to your locally configured TTS backend).
  • The text field is passed to your LLM as user content inside a system prompt — treat it as user-generated and ensure your LLM backend is running locally.
  • OpenClaw's local-only transport means no audio or transcript data leaves your machine except via the R1 device connection.
  • The ElevenLabs backend does send text to ElevenLabs' API; enable only if you have reviewed their data handling policy.

04 同仓库更多 Skills

ajohnsonnow
ajohnsonnow/r1-warren

whisper-quiz

WhisperQuiz — voice-answered trivia game for Rabbit R1. Generates questions via the R1's built-in LLM, captures spoken answers via STT, and evaluates correctness with flexible LLM-based matching.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

walk-cast

Walking podcast production skill. Receives raw audio metadata and transcript from the R1, removes long pauses, applies noise reduction and normalization, generates AI chapter titles and episode metadata via LLM, and uploads the final episode to your configured podcast RSS host (Spotify for Podcasters / Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-novel

Local machine skill for VoiceNovel — handles story export to disk.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-guide

Environment description and navigation assistant for blind and low-vision users. Analyzes camera frames via a vision LLM, reads visible text, identifies scene categories (people/vehicles/food/hazards/exits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-draft

Voice-driven document drafting for the Rabbit R1. Dictate stream-of-consciousness speech; the R1 formats it into Email, Blog Post, Report, Proposal, Meeting Notes, Creative Writing, Code Comments, Cover Letter, or Tweet Thread — then saves the result to a configured folder on your local machine via OpenClaw.

★ 0
ajohnsonnow
ajohnsonnow/r1-warren

voice-commit

Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git/CI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.

★ 0