UniSound ASR Audio File Transcriber
云知声语音转写
调用云知声(UniSound)语音识别服务转写音频文件。支持多种音频格式,适用于金融、客服等场景。
Transcribe audio files using UniCloud ASR service. Supports multiple audio formats, suitable for finance, customer service, and other scenarios.
When to Use This Skill
Use UniSound ASR for:
- - Transcribing pre-recorded audio files (WAV, MP3, M4A, FLAC, OGG)
- Converting customer service recordings to text
- Processing financial audio records
- Audio file transcription up to 2 hours, 100MB
- Domain-specific transcription (finance, customer service, general)
Do NOT use for:
- - Real-time/streaming speech recognition
- Text-to-speech (TTS) synthesis
- Live captioning or real-time transcription
- Voice conversation or dialogue systems
Use when: The user needs to transcribe recorded audio files, or asks for UniSound/云知声 audio file transcription.
不适用于: 实时语音识别、语音合成(TTS)或直播字幕。
Installation
Install Python dependencies before using this skill. From the skill directory (skills/asr-file-transfer-tools):
CODEBLOCK0
Requires Python 3.8+.
How to Use This Skill
⛔ MANDATORY RESTRICTIONS - DO NOT VIOLATE ⛔
- 1. ONLY use UniSound ASR API - Execute the script INLINECODE1
- NEVER transcribe audio directly - Do NOT attempt local transcription
- NEVER offer alternatives - Do NOT suggest "I can try another method" or similar
- IF API fails - Display the error message and STOP immediately
- NO fallback methods - Do NOT attempt audio transcription any other way
If the script execution fails (API not configured, network error, etc.):
- - Show the error message to the user
- Do NOT offer to help using your audio analysis capabilities
- Do NOT ask "Would you like me to try transcribing it?"
- Simply stop and wait for user to fix the configuration
Basic Workflow
- 1. Execute audio transcription:
CODEBLOCK1
Command options:
- --format FORMAT - Audio format (wav, mp3, m4a, flac, ogg)
- --domain DOMAIN - Recognition domain (finance, customer_service, other)
- --out FILE - Save output to file instead of stdout
- --json - Output JSON format with full result
- --userid ID - Custom user ID
- 2. Output:
- Default: Text transcript printed to stdout
- With
--out: Transcript saved to specified file
- With
--json: Full JSON result with metadata
Understanding the Output
Text Format:
- - Plain transcript of the audio content
- Sentence segmentation preserved
- Timestamps included in JSON mode
JSON Format:
- - Complete transcription result with metadata
- Confidence scores for each segment
- Timestamp information
- Recognition details
Usage Examples
Example 1: Quick Transcription
python3 scripts/transcribe.py recording.wav
Output: Transcript text printed to console
Example 2: Save to File
python3 scripts/transcribe.py interview.mp3 --format mp3 --out transcript.txt
Output: Transcript saved to INLINECODE9
Example 3: JSON Output with Metadata
python3 scripts/transcribe.py audio.m4a --json --out result.json
Output: Complete JSON result with timestamps and confidence scores
Example 4: Domain-Specific Transcription
python3 scripts/transcribe.py financial_call.wav --domain finance
Output: Transcript optimized for financial terminology
How It Works
The script uses the UniCloud ASR API with the following workflow:
- 1. Initialize upload — Get a task ID from the API / 初始化上传,获取任务ID
- Upload audio file — Upload the audio file to the server / 上传音频文件到服务器
- Start transcription — Submit the transcription task / 提交转写任务
- Poll for results — Wait for transcription to complete (typically 10-60 seconds) / 轮询等待转写完成(通常10-60秒)
- Return transcript — Output the recognized text / 输出识别文本
Privacy: Audio files are uploaded directly to UniCloud servers. No data is sent to third-party services.
隐私说明:音频文件直接上传到云知声服务器。不会将数据发送到第三方服务。
Supported Formats
Supported file types:
Limits:
- - Maximum duration: 2 hours
- Maximum file size: 100MB
Use the --format flag to specify the format if auto-detection fails:
CODEBLOCK6
First-Time Configuration
When API is not configured:
The error will show:
CODEBLOCK7
Obtaining Credentials
To use this skill, you need API credentials from UniCloud (云知声):
您需要从云知声获取 API 凭据:
- 1. Contact UniCloud to obtain your API credentials
联系云知声获取您的 API 凭据
- 2. You will receive:
您将收到:
-
AppKey: Application key / 应用密钥
-
Secret: Secret key for authentication / 认证密钥
-
UserId: Your user identifier / 用户标识
-
Base URL: API endpoint URL / API 端点地址
Test Credentials (UAT Environment)
For testing and evaluation only (用于测试和评估):
CODEBLOCK8
⚠️ Important Security Notice / 重要安全提示
- - Test environment only — These credentials are for UAT testing only
- 仅测试环境 — 这些凭据仅用于 UAT 测试
- - No sensitive data — Never use with production or sensitive audio files
- 勿用于敏感数据 — 切勿用于生产或敏感音频文件
- - Get your own credentials — For production use, contact UniCloud
- 获取自己的凭据 — 生产环境请联系云知声
- - Data privacy — Audio files are uploaded to UniSound servers
- 数据隐私 — 音频文件将上传至云知声服务器
Configuration Steps
Guide the user to configure securely:
- - Recommend configuring through environment variables or
.env file - Recommend using the host application's configuration method when possible
- Warn about sharing credentials in chat (may be stored in conversation history)
Required environment variables:
| Variable | Required | Description | Default |
|---|
| INLINECODE12 | Yes | Application key / 应用密钥 | - |
| INLINECODE13 |
Yes | Secret key / 认证密钥 | - |
|
UNISOUND_USERID | No | User identifier / 用户标识 |
unisound-python-demo |
|
UNISOUND_BASE_URL | No | API base URL / API 基础地址 |
http://af-asr.uat.hivoice.cn |
|
UNISOUND_DOMAIN | No | Recognition domain / 识别领域 |
other |
|
UNISOUND_AUDIOTYPE | No | Default audio format / 默认音频格式 |
wav |
Configuration examples:
Linux/macOS:
CODEBLOCK9
Windows (PowerShell):
CODEBLOCK10
Using .env file (Recommended):
CODEBLOCK11
Security Note: Never commit .env files or actual credentials to version control.
安全提示:切勿将 .env 文件或实际凭据提交到版本控制系统。
Error Handling
Authentication failed:
API returned error: 401
→ AppKey or Secret is invalid, reconfigure with correct credentials
→ AppKey 或 Secret 无效,请重新配置正确的凭据
Network error:
Connection timeout
→ Check network connectivity to UniCloud API
→ 检查到云知声 API 的网络连接
Audio file not found:
错误: 音频文件不存在
→ Check the file path, use absolute path if needed
→ 检查文件路径,必要时使用绝对路径
Transcription timeout:
转写超时
→ Transcription is taking longer than expected (server may be busy)
→ 转写时间过长(服务器可能繁忙)
→ Try again later / 稍后重试
→ Check if the audio file is too large / 检查音频文件是否过大
Unsupported audio format:
Unsupported audio format
→ The audio format is not supported by the API
→ API 不支持该音频格式
→ Convert to a supported format (WAV recommended) / 转换为支持的格式(推荐 WAV)
→ Use
--format flag to explicitly specify the format / 使用
--format 参数显式指定格式
CODEBLOCK17
API quota exceeded:
API returned error: 429
→ Too many requests, wait before retrying
→ 请求过多,请稍后重试
Important Notes
- - Requires network connectivity to UniCloud ASR API
需要网络连接到云知声 ASR API
- - Cloud-based processing - Audio files are uploaded to UniSound servers
云端处理——音频文件会上传到云知声服务器
- - File size limits: Maximum 2 hours duration, 100MB file size
文件大小限制:最长 2 小时,最大 100MB
- - Domain optimization: Use appropriate
--domain for better accuracy
领域优化:使用适当的
--domain 以获得更高的准确率
- - Test credentials: UAT environment credentials are for testing only
测试凭据:UAT 环境凭据仅供测试使用
Security Best Practices
For production deployment / 生产部署:
- - Obtain your own credentials from UniCloud / 云知声
从云知声获取您自己的凭据
- - Use environment variables — Never embed production credentials in scripts or configuration files
使用环境变量——切勿在脚本或配置文件中嵌入生产凭据
- - Review privacy policy — Audio files are uploaded to UniSound servers; review their privacy policy
审查隐私政策——音频文件会上传到云知声服务器;请查看其隐私政策
- - Test with non-sensitive data first — Always test with non-sensitive audio files first
首先使用非敏感数据进行测试——始终先使用非敏感音频文件进行测试
Troubleshooting
Issue: Script fails with import error
→ Ensure dependencies are installed: pip install -r scripts/requirements.txt
→ Ensure using Python 3.8 or later / 确保使用 Python 3.8 或更高版本
Issue: Cannot connect to API server
无法连接到 API 服务器
→ Check network connectivity / 检查网络连接
→ Verify API endpoint URL is correct / 验证 API 端点 URL 是否正确
→ Try using a different network / 尝试使用其他网络
Issue: Poor transcription quality
→ Check audio quality (background noise, clarity) / 检查音频质量(背景噪音、清晰度)
→ Try using appropriate --domain parameter / 尝试使用适当的 --domain 参数
→ Ensure audio format is correct / 确保音频格式正确
Getting Help
If you encounter issues not covered here:
如果遇到未涵盖的问题:
- 1. Check the UniCloud ASR documentation for the latest API changes
查看云知声 ASR 文档了解最新的 API 变更
- 2. Verify your network connection to the API server
验证到 API 服务器的网络连接
- 3. Check the error message details for specific error codes
检查错误消息详情以获取特定错误代码
- 4. Ensure you're using Python 3.8 or later
确保使用 Python 3.8 或更高版本
CODEBLOCK19
Note: API capabilities and supported formats are determined by your UniCloud ASR API service configuration.
注意:API 功能和支持的格式由您的云知声 ASR API 服务配置决定。
UniSound ASR 音频文件转写器
云知声语音转写
调用云知声(UniSound)语音识别服务转写音频文件。支持多种音频格式,适用于金融、客服等场景。
使用云知声 ASR 服务转写音频文件。支持多种音频格式,适用于金融、客服等场景。
何时使用此技能
使用 UniSound ASR 的场景:
- - 转写预录的音频文件(WAV、MP3、M4A、FLAC、OGG)
- 将客服录音转换为文本
- 处理金融音频记录
- 音频文件转写,最长 2 小时,最大 100MB
- 特定领域转写(金融、客服、通用)
不适用于:
- - 实时/流式语音识别
- 文本转语音(TTS)合成
- 实时字幕或实时转写
- 语音对话或对话系统
使用时机:用户需要转写录制的音频文件,或要求使用 UniSound/云知声进行音频文件转写。
不适用于:实时语音识别、语音合成(TTS)或直播字幕。
安装
使用此技能前需安装 Python 依赖。从技能目录(skills/asr-file-transfer-tools)执行:
bash
pip install -r scripts/requirements.txt
需要 Python 3.8 或更高版本。
如何使用此技能
⛔ 强制性限制——不得违反 ⛔
- 1. 仅使用 UniSound ASR API——执行脚本 python3 scripts/transcribe.py
- 切勿直接转写音频——不要尝试本地转写
- 切勿提供替代方案——不要建议我可以尝试其他方法或类似内容
- 如果 API 失败——显示错误消息并立即停止
- 无备用方法——不要以任何其他方式尝试音频转写
如果脚本执行失败(API 未配置、网络错误等):
- - 向用户显示错误消息
- 不要主动提供使用您的音频分析能力帮助
- 不要询问您希望我尝试转写它吗?
- 直接停止,等待用户修复配置
基本工作流程
- 1. 执行音频转写:
bash
python3 scripts/transcribe.py /path/to/audio.wav
命令选项:
- --format FORMAT - 音频格式(wav、mp3、m4a、flac、ogg)
- --domain DOMAIN - 识别领域(finance、customer_service、other)
- --out FILE - 将输出保存到文件而非标准输出
- --json - 输出包含完整结果的 JSON 格式
- --userid ID - 自定义用户 ID
- 2. 输出:
- 默认:文本转写结果输出到标准输出
- 使用 --out:转写结果保存到指定文件
- 使用 --json:包含元数据的完整 JSON 结果
理解输出
文本格式:
- - 音频内容的纯文本转写
- 保留句子分割
- JSON 模式下包含时间戳
JSON 格式:
- - 包含元数据的完整转写结果
- 每个片段的置信度分数
- 时间戳信息
- 识别详情
使用示例
示例 1:快速转写
bash
python3 scripts/transcribe.py recording.wav
输出:转写文本打印到控制台
示例 2:保存到文件
bash
python3 scripts/transcribe.py interview.mp3 --format mp3 --out transcript.txt
输出:转写结果保存到 transcript.txt
示例 3:带元数据的 JSON 输出
bash
python3 scripts/transcribe.py audio.m4a --json --out result.json
输出:包含时间戳和置信度分数的完整 JSON 结果
示例 4:特定领域转写
bash
python3 scripts/transcribe.py financial_call.wav --domain finance
输出:针对金融术语优化的转写结果
工作原理
该脚本使用云知声 ASR API,工作流程如下:
- 1. 初始化上传——从 API 获取任务 ID / 初始化上传,获取任务ID
- 上传音频文件——将音频文件上传到服务器 / 上传音频文件到服务器
- 开始转写——提交转写任务 / 提交转写任务
- 轮询结果——等待转写完成(通常 10-60 秒)/ 轮询等待转写完成(通常10-60秒)
- 返回转写结果——输出识别文本 / 输出识别文本
隐私说明:音频文件直接上传到云知声服务器。不会将数据发送到第三方服务。
隐私说明:音频文件直接上传到云知声服务器。不会将数据发送到第三方服务。
支持的格式
支持的文件类型:
限制:
如果自动检测失败,使用 --format 标志指定格式:
bash
python3 scripts/transcribe.py audio.mp3 --format mp3
首次配置
当 API 未配置时:
错误将显示:
CONFIGERROR: UNISOUNDAPPKEY or UNISOUND_SECRET not configured.
获取凭据
要使用此技能,您需要从云知声获取 API 凭据:
您需要从云知声获取 API 凭据:
- 1. 联系云知声以获取您的 API 凭据
联系云知声获取您的 API 凭据
- 2. 您将收到:
您将收到:
-
AppKey:应用密钥 / 应用密钥
-
Secret:认证密钥 / 认证密钥
-
UserId:您的用户标识 / 用户标识
-
Base URL:API 端点地址 / API 端点地址
测试凭据(UAT 环境)
仅用于测试和评估(用于测试和评估):
yaml
AppKey: 681e01d78d8a40e8928bc8268020639b
Secret: d7b2980cb61843d69fdab5e99deafcdf
UserId: unisound-python-demo
Base URL: http://af-asr.uat.hivoice.cn
⚠️ 重要安全提示 / 重要安全提示
- 仅测试环境——这些凭据仅用于 UAT 测试
- 勿用于敏感数据——切勿用于生产或敏感音频文件
- 获取自己的凭据——生产环境请联系云知声
- 数据隐私——音频文件将上传至云知声服务器
配置步骤
引导用户安全配置:
- - 建议通过环境变量或 .env 文件进行配置
- 建议尽可能使用宿主应用的配置方法
- 警告不要在聊天中分享凭据(可能存储在对话历史中)
所需环境变量:
| 变量 | 必需 | 描述 | 默认值 |
|---|
| UNISOUNDAPPKEY | 是 | 应用密钥 / 应用密钥 | - |
| UNISOUNDSECRET |
是 | 认证密钥 / 认证密钥 | - |
| UNISOUND_USERID | 否 | 用户标识 / 用户标识 | unisound-python-demo |
| UNISOUND
BASEURL | 否 | API 基础地址 / API 基础地址 | http://af-asr.uat.hivoice.cn |
| UNISOUND_DOMAIN | 否 | 识别领域 / 识别领域 | other |
| UNISOUND_AUDIOTYPE | 否 | 默认音频格式 / 默认音频格式 | wav |
配置示例:
Linux/macOS:
bash
export UNISOUND_APPKEY=681e01d78d8a40e8928bc8268020639b
export UNISOUND_SECRET=d7b2980cb61843d69fdab5e99deafcdf
export UNISOUND_USERID=unisound-python-demo
Windows(PowerShell):
powershell
$env:UNISOUND_APPKEY=681e01d78d8a40e8928bc8268020639b
$env:UNISOUND_SECRET=d7