Convert MP3 scripts using WAV and FLAC

Source: Internet
Author: User
Convert MP3 scripts using WAV and FLAC

From: latteye.com/2007/11/ape-0000-to-mp3-shell.html

Jump to comments

I found this script on a forum where I discussed music, and it was well written. Solve the Problem of inputting cue information into MP3. Because the processing of his lame is not put in shntool.
Because of the blocking of single quotes, the MP3 tag input file cannot be in shntool. This script places all the information in the variable and then enters it.

In addition to the shntool mentioned earlier, this script also uses the cueprint toolkit. You can run the following command to install the SDK:

An error occurred while using the original template on the latest shntool. I modified it slightly.

Apt-Get install custmls


#! /Bin/bash
Echo "Brian's archive cue/FLAC splitter v0.1"
Echo "no sanity checking in place. Be careful ."

# Get the filenames # When executing the script, define the first file followed by the script as the cue file, and the second file as the FLAC file.
Cuefile = $1
Export File = $2

# Other variables capture the number of CD tracks through cueprint. -D is the template for reading disc, and % N is the number of tracks.
Tracks = $ (cueprint-d '% N' "$ cuefile ")

# Get the filenames into an array
# Read the information of each song cyclically.
# Cueprint-N $ count-T '% P-% T-% 02n-% t' in "$ cuefile",-N defines the track number, and-T indicates reading the song template, % P author, % t album name.
# % N is the song number. If it is written as % 02n, the length is 2, that is, 01 and 02. If % 05n is used, the value is 00001.
# % T is the song name.
Count = 1
While [$ count-Le $ tracks]
Do
Tracknames [$ count] =$ (cueprint-N $ count-T '% P-% T-% 02n-% t' "$ cuefile ") # initialize the tracknames array and write a trackname in
Count = 'expr $ count + 1' # increment the counter
Done

# Load up the ID3 tag info into variables for later use
# Read Information cyclically and place different variables. Including artists.
Id3count = 1
While [$ id3count-Le $ tracks]
Do
Artist [$ id3count] = $ (cueprint-N $ id3count-T '% P' "$ cuefile ")
Album [$ id3count] =$ (cueprint-N $ id3count-T '% t' "$ cuefile ")
Tracknum [$ id3count] = $ (cueprint-N $ id3count-T '% 02n' "$ cuefile ")
Title [$ id3count] = $ (cueprint-N $ id3count-t' % t' "$ cuefile ")
Echo "artist :$ {artist [$ id3count]}"
Echo "Album :$ {album [$ id3count]}"
Echo "track no :$ {tracknum [$ id3count]}"
Echo "song title :$ {Title [$ id3count]}"
Id3count = $ [$ id3count + 1]
Done

# Output General File Information
Cueprint-d '% P-% t \ n' "$ cuefile"
Echo "total number of tracks:" $ tracks

# Split this bitch
Cuebreakpoints "$ cuefile" | shntool split-T '% N'-o wav "$ folder file" # outputs 01.wav 02.wav, etc

# Convert those waves into MP3s
# When the output is a WAV file, the number format is 001, 002, and so on. So let's make up the following.
Convertcount = 1
While [$ convertcount-Le $ tracks]
Do
If [$ convertcount-LT 10] # Got to pad with zeros
Then
Wavenum = 0 $ convertcount
Else
Wavenum = $ convertcount
Fi

# Use lame to convert wav to MP3 and add tags.
# Lame-noreplaygain-B 320 unzip invalid wavenum.wav "too many tracknames?$convertcount={.mp3" # compress the file and give it the trackname in the array
Lame-noreplaygain-B 320-ta "$ {artist [$ convertcount]}"-Tl "$ {album [$ convertcount]}"-Tn "$ {tracknum [$ convertcount]} "-TT" $ {Title [$ convertcount]} "{$wavenum.wav" {{{tracknames[{convertcount ″
Rm./"$wavenum.wav "# cleanup Delete temporary WAV Files
Convertcount = $ [$ convertcount + 1]

Done

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.