- 共享引擎(app/src/main):GestureEngine 6 手势识别、AudioEngine 三层音频 (ExoPlayer BGM 交叉淡入 / 对白 ducking / SoundPool 低延迟)、Game/GameEngine 状态机接口、MainActivity 全屏封面 + TalkBack - 《声命线》storyline:末世互动广播剧,3 幕 8 抉择点 4 结局 - 《声东击西》reflex:听声辨位反应,12 波战斗 + BGM 三档 BPM 变速 - 《暗室》escape:3x3 网格密室逃脱,钥匙→铁柜→保险丝→电箱→大门谜题链 - 文档:setup(从零搭建)/ architecture(架构)/ engine-api(引擎 API)/ asset-pipeline(资产流水线)/ games/*(三款游戏设计文档) - 资产管线:Qwen3-TTS 对白 + 程序合成音效/BGM + Mureka BGM 的 gen 脚本与台账, 全部 ogg 资产入库可复现 - env.d 环境脚本:android/tts 入库;sfx/mureka 含密钥不入库,仅提交 .example.sh 模板
89 lines
4.2 KiB
PowerShell
89 lines
4.2 KiB
PowerShell
# sa3_tflite bootstrap for Windows - Stable Audio 3 inference on CPU (LiteRT/TFLite).
|
|
#
|
|
# The PowerShell twin of bootstrap.sh. Hosted at:
|
|
# https://raw.githubusercontent.com/Stability-AI/stable-audio-3/main/optimized/tflite/bootstrap.ps1
|
|
#
|
|
# Usage (default demo):
|
|
# irm https://raw.githubusercontent.com/Stability-AI/stable-audio-3/main/optimized/tflite/bootstrap.ps1 | iex
|
|
#
|
|
# Custom args (iex cannot forward arguments - download first):
|
|
# irm https://raw.githubusercontent.com/Stability-AI/stable-audio-3/main/optimized/tflite/bootstrap.ps1 -OutFile bootstrap.ps1
|
|
# .\bootstrap.ps1 --prompt "Death Metal" --dit medium --decoder same-l
|
|
#
|
|
# What it does:
|
|
# 1. Fetches the project (git clone if git is installed, else a zip pull).
|
|
# 2. Runs install.bat (python -m venv + pip install; needs Python 3.10-3.13
|
|
# on PATH - ai-edge-litert ships win_amd64 wheels for those versions).
|
|
# 3. Runs sa3.bat with your args (default: 30 s demo prompt + --play).
|
|
# Weights auto-download from HuggingFace on first use.
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Older Windows PowerShell 5.1 hosts may default to TLS < 1.2, which GitHub
|
|
# rejects. Harmless no-op on PowerShell 7+ / current Win10+.
|
|
try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 } catch {}
|
|
|
|
$RepoOwner = "Stability-AI"
|
|
$RepoName = "stable-audio-3"
|
|
$Branch = "main"
|
|
$SubDir = "optimized\tflite"
|
|
$LocalDir = "sa3_tflite"
|
|
|
|
function Step($msg) { Write-Host "`n-> $msg" -ForegroundColor Cyan }
|
|
function Ok($msg) { Write-Host " OK $msg" -ForegroundColor Green }
|
|
|
|
# --- 1. fetch the project -------------------------------------------------
|
|
if (Get-Command git -ErrorAction SilentlyContinue) {
|
|
$WorkDir = Join-Path $RepoName $SubDir
|
|
if (Test-Path (Join-Path $RepoName ".git")) {
|
|
Step "Reusing existing .\$RepoName (git pull --ff-only)"
|
|
git -C $RepoName pull --ff-only
|
|
} elseif (Test-Path $RepoName) {
|
|
throw ".\$RepoName exists but isn't a git repo - remove or rename it."
|
|
} else {
|
|
Step "git clone https://github.com/$RepoOwner/$RepoName -> .\$RepoName"
|
|
git clone --depth=1 "https://github.com/$RepoOwner/$RepoName" $RepoName
|
|
}
|
|
if (-not (Test-Path $WorkDir)) { throw "Expected '$SubDir' inside the repo but didn't find it." }
|
|
} else {
|
|
$WorkDir = $LocalDir
|
|
if (Test-Path (Join-Path $LocalDir "install.bat")) {
|
|
Step "Reusing existing $LocalDir\ (delete it to re-download)"
|
|
} elseif (Test-Path $LocalDir) {
|
|
throw ".\$LocalDir exists but doesn't look like a sa3_tflite checkout - remove or rename it."
|
|
} else {
|
|
Step "git not installed - downloading $RepoOwner/$RepoName ($Branch) zip -> .\$LocalDir"
|
|
$zip = Join-Path $env:TEMP "sa3_repo.zip"
|
|
$extract = Join-Path $env:TEMP "sa3_extract"
|
|
Invoke-WebRequest "https://github.com/$RepoOwner/$RepoName/archive/refs/heads/$Branch.zip" -OutFile $zip
|
|
if (Test-Path $extract) { Remove-Item $extract -Recurse -Force }
|
|
Expand-Archive $zip -DestinationPath $extract -Force
|
|
Move-Item (Join-Path $extract "$RepoName-$Branch\$SubDir") $LocalDir
|
|
Remove-Item $zip -Force
|
|
Remove-Item $extract -Recurse -Force
|
|
Ok "extracted to .\$LocalDir"
|
|
}
|
|
}
|
|
|
|
Set-Location $WorkDir
|
|
Ok "ready at $(Get-Location)"
|
|
|
|
# --- 2. install -----------------------------------------------------------
|
|
Step "Running install.bat"
|
|
cmd /c install.bat
|
|
if ($LASTEXITCODE -ne 0) { throw "install.bat failed (exit $LASTEXITCODE)." }
|
|
|
|
# --- 3. inference ---------------------------------------------------------
|
|
if ($args.Count -gt 0) {
|
|
Step "Running sa3.bat $($args -join ' ')"
|
|
cmd /c sa3.bat @args
|
|
} else {
|
|
Step 'Running demo: sa3.bat --prompt "Impending tribal, epic orchestral buildup" --dit sm-music --decoder same-s --seconds 30 --play'
|
|
Write-Host ' (for custom args, download bootstrap.ps1 first and run: .\bootstrap.ps1 --prompt "..." ...)' -ForegroundColor DarkGray
|
|
cmd /c sa3.bat --prompt "Impending tribal, epic orchestral buildup" --dit sm-music --decoder same-s --seconds 30 --play
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "You are set up in $(Get-Location)" -ForegroundColor Green
|
|
Write-Host " run .\sa3.bat --help for options" -ForegroundColor DarkGray
|