Replace wav-to-mp3

This commit is contained in:
josh committed 2026-10-26 10:17:28 -04:00
1 parent 4796c9633e
commit b1539e8985
2 files changed
+18 -15

No files matched your search

Executable
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby
if ARGV.empty?
files = Dir["*.wav"].sort
else
files = ARGV
end
files.each do |infile|
outfile = infile.sub(".wav", ".mp3")
puts "Converting: #{infile} -> #{outfile}"
command = %W[lame -v -b 256 #{infile} #{outfile}]
system(*command)
end
puts "Conversion complete!"
-15
View File
@@ -1,15 +0,0 @@
#!/usr/bin/env bash
# Loop through all .wav files in the current directory
for file in *.wav; do
# Skip if no .wav files exist (prevents literal "*.wav" execution)
[ -e "$file" ] || continue
# Replace .wav extension with .mp3
output="${file%.wav}.mp3"
echo "Converting: $file -> $output"
lame -v -b 256 "$file" "$output"
done
echo "Conversion complete!"