fixes for mac music
This commit is contained in:
@ -1,63 +1,11 @@
|
||||
# Convert MP3 sound effects to WAV format
|
||||
# This script converts all MP3 sound effect files to WAV for better compatibility
|
||||
# Deprecated shim: point developers to the OGG conversion workflow
|
||||
Write-Host "convert_to_wav.ps1 is deprecated." -ForegroundColor Yellow
|
||||
Write-Host "Use convert_to_ogg.ps1 for generating assets with OGG Vorbis." -ForegroundColor Yellow
|
||||
|
||||
$musicDir = "assets\music"
|
||||
$mp3Files = @(
|
||||
"amazing.mp3",
|
||||
"boom_tetris.mp3",
|
||||
"great_move.mp3",
|
||||
"impressive.mp3",
|
||||
"keep_that_ryhtm.mp3",
|
||||
"lets_go.mp3",
|
||||
"nice_combo.mp3",
|
||||
"smooth_clear.mp3",
|
||||
"triple_strike.mp3",
|
||||
"well_played.mp3",
|
||||
"wonderful.mp3",
|
||||
"you_fire.mp3",
|
||||
"you_re_unstoppable.mp3"
|
||||
)
|
||||
|
||||
Write-Host "Converting MP3 sound effects to WAV format..." -ForegroundColor Green
|
||||
|
||||
foreach ($mp3File in $mp3Files) {
|
||||
$mp3Path = Join-Path $musicDir $mp3File
|
||||
$wavFile = $mp3File -replace "\.mp3$", ".wav"
|
||||
$wavPath = Join-Path $musicDir $wavFile
|
||||
|
||||
if (Test-Path $mp3Path) {
|
||||
Write-Host "Converting $mp3File to $wavFile..." -ForegroundColor Yellow
|
||||
|
||||
# Try ffmpeg first (most common)
|
||||
$ffmpegResult = $null
|
||||
try {
|
||||
$ffmpegResult = & ffmpeg -i $mp3Path -acodec pcm_s16le -ar 44100 -ac 2 $wavPath -y 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "✓ Successfully converted $mp3File" -ForegroundColor Green
|
||||
continue
|
||||
}
|
||||
} catch {
|
||||
# FFmpeg not available, try other methods
|
||||
}
|
||||
|
||||
# Try Windows Media Format SDK (if available)
|
||||
try {
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName Microsoft.VisualBasic
|
||||
|
||||
# Use Windows built-in audio conversion
|
||||
$shell = New-Object -ComObject Shell.Application
|
||||
# This is a fallback method - may not work on all systems
|
||||
Write-Host "⚠ FFmpeg not found. Please install FFmpeg or convert manually." -ForegroundColor Red
|
||||
} catch {
|
||||
Write-Host "⚠ Could not convert $mp3File automatically." -ForegroundColor Red
|
||||
}
|
||||
} else {
|
||||
Write-Host "⚠ File not found: $mp3Path" -ForegroundColor Red
|
||||
}
|
||||
$oggScript = Join-Path $PSScriptRoot "convert_to_ogg.ps1"
|
||||
if (Test-Path $oggScript) {
|
||||
& $oggScript
|
||||
} else {
|
||||
Write-Host "Missing convert_to_ogg.ps1" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "`nConversion complete! If FFmpeg was not found, please:" -ForegroundColor Cyan
|
||||
Write-Host "1. Install FFmpeg: https://ffmpeg.org/download.html" -ForegroundColor White
|
||||
Write-Host "2. Or use an audio converter like Audacity" -ForegroundColor White
|
||||
Write-Host "3. Convert to: 44.1kHz, 16-bit, Stereo WAV" -ForegroundColor White
|
||||
|
||||
Reference in New Issue
Block a user