2013年10月20日

WHITE ALBUM -綴られる冬の想い出- Original Soundtrack CUE文件

在网上下载了 WHITE ALBUM -綴られる冬の想い出- Original Soundtrack 这张专辑(flac),但却没有CUE。发现很多人都在求这个CUE,澄空的链接失效了,KFC上有人搞出来个,结果却没有共享。今天花了1个小时写了个生成CUE的小程序,把这张专辑的CUE生成出来了。
CD1

REM DATE 2010
REM COMMENT "CUECreator V1.0"
REM GENRE "Game"
PERFORMER "Aquaplus"
TITLE "White Album-綴られる冬の想い出-Original Soundtrack CD1"
FILE "KICA-1483.flac" WAVE
  TRACK 01 AUDIO
    TITLE "あの頃のように -Remix Version-"
    PERFORMER "Aquaplus"
    INDEX 01 0:00.00
  TRACK 02 AUDIO
    TITLE "雪の魔法 -GAME ver.-"
    PERFORMER "Aquaplus"
    INDEX 01 2:52.70
  TRACK 03 AUDIO
    TITLE "朝陽"
    PERFORMER "Aquaplus"
    INDEX 01 4:36.07
  TRACK 04 AUDIO
    TITLE "出逢いの街"
    PERFORMER "Aquaplus"
    INDEX 01 7:39.20
  TRACK 05 AUDIO
    TITLE "ひとときの休息"
    PERFORMER "Aquaplus"
    INDEX 01 9:54.60
  TRACK 06 AUDIO
    TITLE "森川由綺"
    PERFORMER "Aquaplus"
    INDEX 01 11:59.72
  TRACK 07 AUDIO
    TITLE "緒方理奈"
    PERFORMER "Aquaplus"
    INDEX 01 14:23.22
  TRACK 08 AUDIO
    TITLE "河島はるか"
    PERFORMER "Aquaplus"
    INDEX 01 17:19.58
  TRACK 09 AUDIO
    TITLE "澤倉美咲"
    PERFORMER "Aquaplus"
    INDEX 01 20:00.27
  TRACK 10 AUDIO
    TITLE "観月マナ"
    PERFORMER "Aquaplus"
    INDEX 01 22:51.62
  TRACK 11 AUDIO
    TITLE "篠塚弥生"
    PERFORMER "Aquaplus"
    INDEX 01 24:48.70
  TRACK 12 AUDIO
    TITLE "如月小夜子"
    PERFORMER "Aquaplus"
    INDEX 01 27:11.22
  TRACK 13 AUDIO
    TITLE "フランク長瀬"
    PERFORMER "Aquaplus"
    INDEX 01 29:11.20
  TRACK 14 AUDIO
    TITLE "WINTER VACATION"
    PERFORMER "Aquaplus"
    INDEX 01 31:22.58
  TRACK 15 AUDIO
    TITLE "聖夜"
    PERFORMER "Aquaplus"
    INDEX 01 33:46.42
  TRACK 16 AUDIO
    TITLE "TENSION"
    PERFORMER "Aquaplus"
    INDEX 01 36:01.49
  TRACK 17 AUDIO
    TITLE "星を見上げて"
    PERFORMER "Aquaplus"
    INDEX 01 38:11.26
  TRACK 18 AUDIO
    TITLE "ぬくもり"
    PERFORMER "Aquaplus"
    INDEX 01 41:34.06
  TRACK 19 AUDIO
    TITLE "FILL YOU"
    PERFORMER "Aquaplus"
    INDEX 01 43:37.40
  TRACK 20 AUDIO
    TITLE "あの頃のように"
    PERFORMER "Aquaplus"
    INDEX 01 45:24.27
  TRACK 21 AUDIO
    TITLE "冷たい雨"
    PERFORMER "Aquaplus"
    INDEX 01 46:50.72

CD2

REM DATE 2010
REM COMMENT "CUECreator V1.0"
REM GENRE "Game"
PERFORMER "Aquaplus"
TITLE "White Album-綴られる冬の想い出-Original Soundtrack CD2"
FILE "KICA-1484.flac" WAVE
  TRACK 01 AUDIO
    TITLE " WHITE ALBUM"
    PERFORMER "Aquaplus"
    INDEX 01 0:00.00
  TRACK 02 AUDIO
    TITLE " SOUND OF DESTINY"
    PERFORMER "Aquaplus"
    INDEX 01 4:41.47
  TRACK 03 AUDIO
    TITLE " 星を見上げて -Remix Version-"
    PERFORMER "Aquaplus"
    INDEX 01 9:41.57
  TRACK 04 AUDIO
    TITLE " WHITE ALBUM PIANO"
    PERFORMER "Aquaplus"
    INDEX 01 13:58.37
  TRACK 05 AUDIO
    TITLE " 君のかわり"
    PERFORMER "Aquaplus"
    INDEX 01 17:31.35
  TRACK 06 AUDIO
    TITLE " 深淵"
    PERFORMER "Aquaplus"
    INDEX 01 23:39.57
  TRACK 07 AUDIO
    TITLE " POWDER SNOW"
    PERFORMER "Aquaplus"
    INDEX 01 26:33.51
  TRACK 08 AUDIO
    TITLE " POWDER SNOW [Pure Version]"
    PERFORMER "Aquaplus"
    INDEX 01 31:46.44

为了赶工所有的表演者都写成Aquaplus了,其实雪の魔法 -GAME ver.、君のかわり、POWDER SNOW、POWDER SNOW [Pure Version]都是Suara唱的;WHITE ALBUM和SOUND OF DESTINY分别是平野绫跟水樹奈々唱的。昨天玩了一下这游戏,马上就发现这张专辑真是不错。

实际上,我是有这张专辑的MP3版的,128Kbps。幸好有这MP3才能很快生成一个歌曲名列表,像这样:

dir /b >list.txt

这段bat脚本需要在MP3所在目录下运行才可以。同时为了方便起见,生成的列表文本又重新转存为UTF-8编码。


今天在网上发现7天前有人在天使动漫上发过该专辑的cue,质量比我的更好。链接 以下是我的代码:


DefaultBuilder.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CUEBuilder
{
    /// <summary>
    /// 摘要:生成CUE信息、将CUE信息写入文件
    /// 作者:ReiJi
    /// Email:joecaisc#gmail.com
    /// 编写日期:2013.10.20
    /// </summary>
    public class DefaultBuilder
    {

        private string _albumPerformer="Unknow";
        /// <summary>
        /// 专辑表演者,默认为Unknow
        /// </summary>
        public string AlbumPerformer 
        {
            get
            {
                return _albumPerformer;
            }
            set 
            {
                _albumPerformer = value;
            }
        }

        private string _albumTitle = "Unkonw";
        /// <summary>
        /// 专辑名称,默认为Unknow
        /// </summary>
        public string AlbumTitle
        {
            get
            {
                return _albumTitle;
            }
            set
            {
                _albumTitle = value;
            }
        }

        private string _date = DateTime.Now.ToString("yyyy-MM-dd");
        /// <summary>
        /// 专辑发售时间,默认为当前时间
        /// </summary>
        public string Date
        {
            get
            {
                return _date;
            }
            set
            {
                _date = value;
            }
        }


        private string _genre = "Other";
        /// <summary>
        /// 流派,默认为Other
        /// </summary>
        public string Genre
        {
            get
            {
                return _genre;
            }
            set
            {
                _genre = value;
            }
        }

        /// <summary>
        /// 光盘编号,默认为空
        /// </summary>
        private string DiscId { get; set; }

        /// <summary>
        /// 未分轨文件名,短文件名,如:KSDB-1923.flac
        /// </summary>
        public string Filename { get; set; }

        /// <summary>
        /// 抓轨日志信息文件路径
        /// </summary>
        public string ReferenceLog { get; set; }

        /// <summary>
        /// 曲目列表文件路径
        /// </summary>
        public string TitleList { get; set; }

        /// <summary>
        /// 实例化一个DefaultBuilder实例
        /// </summary>
        /// <param name="filename">未分轨文件名,短文件名,如:KSDB-1923.flac</param>
        /// <param name="referenceLog"> 抓轨日志信息文件路径</param>
        /// <param name="titleList">曲目列表文件路径</param>
        public DefaultBuilder(string filename, string referenceLog, string titleList)
        {
            Filename = filename;
            ReferenceLog = referenceLog;
            TitleList = titleList;
        }

        /// <summary>
        ///  实例化一个DefaultBuilder实例
        /// </summary>
        /// <param name="albumPerformer">专辑表演者</param>
        /// <param name="albumTitle">专辑名称</param>
        /// <param name="filename">未分轨文件名,短文件名,如:KSDB-1923.flac</param>
        /// <param name="referenceLog"> 抓轨日志信息文件路径</param>
        /// <param name="titleList">曲目列表文件路径</param>
        public DefaultBuilder(string albumPerformer, string albumTitle, string filename, string referenceLog, string titleList)
            : this(filename, referenceLog, titleList)
        {
            AlbumPerformer = albumPerformer;
            AlbumTitle = albumTitle;
        }

        /// <summary>
        /// 生成CUE信息
        /// </summary>
        /// <returns>生成的CUE信息</returns>
        public string Build()
        {
            StringBuilder result = new StringBuilder();
            result.Append(BuildREM());
            result.Append(BuildTitle());
            result.Append(BuildAudio());
            return result.ToString();
        }

        /// <summary>
        /// 生成CUE信息并保存到文件
        /// </summary>
        /// <param name="path">生成文件的保存路径</param>
        public void BuildToFile(string path)
        {
            string content = Build();
            StreamWriter sw = new StreamWriter(new FileStream(path, FileMode.Create), Encoding.UTF8);
            sw.Write(content);
            sw.Flush();
            sw.Close();
            Console.WriteLine("ALL DONE!");
        }

        /// <summary>
        /// 生成REM信息
        /// </summary>
        /// <returns></returns>
        protected string BuildREM()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("REM DATE ").AppendLine(Date);
            sb.Append("REM GENRE ").AppendLine(Genre);
            sb.Append("REM DISCID ").AppendLine(DiscId);
            sb.Append("REM COMMENT ").AppendLine(QuotoBraced("CUECreator V1.0"));
            return sb.ToString();
        }

        /// <summary>
        /// 生成专辑表演者、专辑名、未分轨文件
        /// </summary>
        /// <returns></returns>
        protected string BuildTitle()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("PERFORMER ").AppendLine(QuotoBraced(AlbumPerformer));
            sb.Append("TITLE ").AppendLine(QuotoBraced(AlbumTitle));
            sb.Append("FILE ").Append(QuotoBraced(Filename)).AppendLine(" WAVE");
            return sb.ToString();
        }

        /// <summary>
        /// 生成分轨的曲目信息
        /// </summary>
        /// <returns></returns>
        protected string BuildAudio()
        {
            StreamReader refsr = new StreamReader(ReferenceLog, Encoding.UTF8);
            StreamReader listsr = new StreamReader(TitleList);
            StringBuilder result = new StringBuilder();
            int count = 1;
            while (!refsr.EndOfStream)
            {
                string[] timeInfo = GetTimeInfo(refsr.ReadLine());
                string title = GetTitle(listsr.ReadLine());
                result.Append("  TRACK ").Append(count.ToString("D2")).AppendLine(" AUDIO");
                result.Append("    TITLE ").AppendLine(QuotoBraced(title));
                result.Append("    PERFORMER ").AppendLine(QuotoBraced(AlbumPerformer));
                result.Append("    INDEX 01 ").AppendLine(timeInfo[0]);
                count++;
            }
            refsr.Close();
            listsr.Close();
            return result.ToString();

        }

        /// <summary>
        /// 将所给字符串用""包裹
        /// </summary>
        /// <param name="str">原文本</param>
        /// <returns></returns>
        private string QuotoBraced(string str)
        {
            return "\"" + str + "\"";
        }

        /// <summary>
        /// 根据抓轨日志获取曲目时间信息
        /// </summary>
        /// <param name="str">从文件中读取的信息</param>
        /// <returns>result[0]为开始时间,result[1]为持续时间</returns>
        protected string[] GetTimeInfo(string str)
        {
            string[] temp = str.Split('|');
            string[] result = new string[2];
            result[0] = temp[1].Trim();
            result[1] = temp[2].Trim();
            return result;
        }

        /// <summary>
        /// 从文件中获取曲目名称
        /// </summary>
        /// <param name="str">从文件中读取的信息</param>
        /// <returns></returns>
        protected string GetTitle(string str)
        {
            string result = str.Substring(3);
            result = result.Substring(0, result.Length - 4);
            return result;
        }

    }
}

调用就很简单了:

DefaultBuilder builder = new DefaultBuilder("Aquaplus", 
                "White Album-綴られる冬の想い出-Original Soundtrack CD2", 
                "KICA-1484.flac",
                @"D:\log2.txt",
                @"D:\log.txt");
builder.Date = "2010-07-21";
builder.Genre = "Game";
builder.BuildToFile(@"D:\KICA-1484.cue");

没有评论:

发表评论