public TabSection(TabFile tabFile, SongSection section)
     : base(tabFile, section.StartTime)
 {
     Name  = section.Name;
     Start = section.StartTime;
     End   = section.EndTime;
 }
 public TabSection(TabFile tabFile, SongSection section)
     : base(tabFile, section.StartTime)
 {
     Name = section.Name;
     Start = section.StartTime;
     End = section.EndTime;
 }
 public override void Apply(TabFile tabFile)
 {
     if (tabFile.CurrentMeasure != null)
     {
         tabFile.CurrentMeasure.AddNote(this);
     }
 }
 public TuningInfo(TabFile tabFile, Tuning tuning, string name, string[] notes)
 {
     TabFile = tabFile;
     Tuning = tuning;
     Name = name;
     Notes = notes;
 }
        private void Convert(string inputFile, string savePath, bool all)
        {
            SngFile sngFile = new SngFile(inputFile);

            if (String.IsNullOrEmpty(sngFile.Metadata.Arrangement))
                return; // Vocal

            int maxDifficulty = Common.getMaxDifficulty(sngFile);

            int[] difficulties;
            if (all)
                difficulties = Enumerable.Range(0, maxDifficulty + 1).ToArray();
            else // if (max)
                difficulties = new int[] { maxDifficulty };

            foreach (int d in difficulties)
            {
                TabFile tabFile = new TabFile(sngFile, d);

                var outputFileName = (sngFile != null && sngFile.Metadata != null) ? String.Format("{0} - ", sngFile.Metadata.SongTitle) : "";
                outputFileName += Path.GetFileNameWithoutExtension(inputFile);
                outputFileName += (difficulties.Length != 1) ? String.Format(" (level {0:00}).txt", d) : ".txt";
                var outputFilePath = Path.Combine(savePath, outputFileName);

                using (TextWriter tw = new StreamWriter(outputFilePath))
                {
                    tw.Write(tabFile.ToString());
                }
            }
        }
Esempio n. 6
0
 public TabHeader(TabFile tabFile, SngFile sngFile)
 {
     TabFile    = tabFile;
     Title      = sngFile.Metadata.SongTitle;
     Artist     = sngFile.Metadata.Artist;
     Length     = Common.TimeToString(sngFile.Metadata.Length);
     TuningInfo = tabFile.TuningInfos[(Tuning)sngFile.Metadata.Tuning];
 }
 public TabHeader(TabFile tabFile, SngFile sngFile)
 {
     TabFile = tabFile;
     Title = sngFile.Metadata.SongTitle;
     Artist = sngFile.Metadata.Artist;
     Length = Common.TimeToString(sngFile.Metadata.Length);
     TuningInfo = tabFile.TuningInfos[(Tuning)sngFile.Metadata.Tuning];
 }
 public void Apply(TabFile tabFile)
 {
     tabFile.AppendLine(" TITLE: " + Title + Environment.NewLine);
     if (Artist != "DUMMY")
         tabFile.AppendLine("ARTIST: " + Artist + Environment.NewLine);
     tabFile.AppendLine("LENGTH: " + Length + Environment.NewLine);
     tabFile.AppendLine("TUNING: " + TuningInfo.Description + Environment.NewLine);
 }
Esempio n. 9
0
 public void Apply(TabFile tabFile)
 {
     tabFile.AppendLine(" TITLE: " + Title + Environment.NewLine);
     if (Artist != "DUMMY")
     {
         tabFile.AppendLine("ARTIST: " + Artist + Environment.NewLine);
     }
     tabFile.AppendLine("LENGTH: " + Length + Environment.NewLine);
     tabFile.AppendLine("TUNING: " + TuningInfo.Description + Environment.NewLine);
 }
 public void Apply(TabFile tabFile, int diff)
 {
     tabFile.AppendLine("TITLE: " + Title + Environment.NewLine);
     if (Artist != "DUMMY")
         tabFile.AppendLine("ARTIST: " + Artist + Environment.NewLine);
     if (diff == 255)
         tabFile.AppendLine("LENGTH: " + Length + " (MAXIMUM DIFFICULTY LEVEL)" + Environment.NewLine);
     else
         tabFile.AppendLine("LENGTH: " + Length + String.Format(" (DIFFICULTY LEVEL {0})", diff) + Environment.NewLine);
     tabFile.AppendLine("TUNING: " + TuningInfo.Description + Environment.NewLine);
 }
        public void Convert(string sngFilePath, string outputDir, bool allDif)
        {
            SngFile sngFile = new SngFile(sngFilePath);

            if (String.IsNullOrEmpty(sngFile.Metadata.Arrangement))
            {
                return; // Vocal
            }
            int maxDifficulty = Common.getMaxDifficulty(sngFile);

            int[] difficulties;
            if (allDif)
            {
                difficulties = Enumerable.Range(0, maxDifficulty + 1).ToArray();
            }
            else // if (max)
                 //  difficulties = new int[] { maxDifficulty };
            {
                difficulties = new int[] { 255 }
            };

            foreach (int d in difficulties)
            {
                TabFile tabFile = new TabFile(sngFile, d);

                var outputFileName = String.Empty;
                if (sngFile != null && sngFile.Metadata != null)
                {
                    if (sngFile.Metadata.Artist == "DUMMY")
                    {
                        outputFileName = String.Format("{0}", sngFile.Metadata.SongTitle);
                    }
                    else
                    {
                        outputFileName = String.Format("{0} - {1}", sngFile.Metadata.Artist, sngFile.Metadata.SongTitle);
                    }
                }
                else
                {
                    outputFileName = String.Format("{0}", "Unknown Song");
                }

                outputFileName += (difficulties.Length != 1) ? String.Format(" (level {0:D2})", d) : "";
                outputFileName  = outputFileName.GetValidFileName();
                var outputFilePath = Path.Combine(outputDir, outputFileName + ".txt");

                using (TextWriter tw = new StreamWriter(outputFilePath))
                {
                    tw.Write(tabFile.ToString());
                }
            }
        }
 public TabChord(TabFile tabFile, Note note, SngFile sngFile)
     : base(tabFile, note)
 {
     ChordTemplate chord = sngFile.ChordTemplates[note.ChordId];
     ChordName = chord.Name;
     Frets = new int[TabFile.StringCount];
     Frets[0] = chord.Fret0;
     Frets[1] = chord.Fret1;
     Frets[2] = chord.Fret2;
     Frets[3] = chord.Fret3;
     Frets[4] = chord.Fret4;
     Frets[5] = chord.Fret5;
 }
        public override void Apply(TabFile tabFile)
        {
            // Uppercase the first letter
            string name = Name;
            if (name.Length > 0)
                name = char.ToUpper(name[0]) + name.Substring(1);

            string line = name + " (" + Common.TimeToString(Start) + " - " + Common.TimeToString(End) + ")";
            tabFile.AppendLine("");
            tabFile.AppendLine("");
            tabFile.AppendLine("");
            tabFile.AppendLine(line);
        }
        public TabChord(TabFile tabFile, Note note, SngFile sngFile)
            : base(tabFile, note)
        {
            ChordTemplate chord = sngFile.ChordTemplates[note.ChordId];

            ChordName = chord.Name;
            Frets     = new int[TabFile.StringCount];
            Frets[0]  = chord.Fret0;
            Frets[1]  = chord.Fret1;
            Frets[2]  = chord.Fret2;
            Frets[3]  = chord.Fret3;
            Frets[4]  = chord.Fret4;
            Frets[5]  = chord.Fret5;
        }
 public TabNote(TabFile tabFile, Note note)
     : base(tabFile, note.Time)
 {
     String = note.String;
     Fret = note.Fret;
     Bend = note.Bend;
     HammerOn = note.HammerOn != 0 ? true : false;
     Harmonic = note.Harmonic != 0 ? true : false;
     PalmMute = note.PalmMute != 0 ? true : false;
     PullOff = note.PullOff != 0 ? true : false;
     SlideTo = note.SlideTo;
     SustainTime = note.SustainTime;
     Tremolo = note.Tremolo != 0 ? true : false;
 }
 public TabNote(TabFile tabFile, Note note)
     : base(tabFile, note.Time)
 {
     String      = note.String;
     Fret        = note.Fret;
     Bend        = note.Bend;
     HammerOn    = note.HammerOn != 0 ? true : false;
     Harmonic    = note.Harmonic != 0 ? true : false;
     PalmMute    = note.PalmMute != 0 ? true : false;
     PullOff     = note.PullOff != 0 ? true : false;
     SlideTo     = note.SlideTo;
     SustainTime = note.SustainTime;
     Tremolo     = note.Tremolo != 0 ? true : false;
 }
        public override void Apply(TabFile tabFile)
        {
            // Uppercase the first letter
            string name = Name;

            if (name.Length > 0)
            {
                name = char.ToUpper(name[0]) + name.Substring(1);
            }

            string line = name + " (" + Common.TimeToString(Start) + " - " + Common.TimeToString(End) + ")";

            tabFile.AppendLine("");
            tabFile.AppendLine("");
            tabFile.AppendLine("");
            tabFile.AppendLine(line);
        }
 public void Apply(TabFile tabFile, int diff)
 {
     tabFile.AppendLine("TITLE: " + Title + Environment.NewLine);
     if (Artist != "DUMMY")
     {
         tabFile.AppendLine("ARTIST: " + Artist + Environment.NewLine);
     }
     if (diff == 255)
     {
         tabFile.AppendLine("LENGTH: " + Length + " (MAXIMUM DIFFICULTY LEVEL)" + Environment.NewLine);
     }
     else
     {
         tabFile.AppendLine("LENGTH: " + Length + String.Format(" (DIFFICULTY LEVEL {0})", diff) + Environment.NewLine);
     }
     tabFile.AppendLine("TUNING: " + TuningInfo.Description + Environment.NewLine);
 }
        public TabMeasure(TabFile tabFile, float start, Single end, int beatCount)
            : base(tabFile, start)
        {
            Start = start;
            End = end;
            BeatCount = beatCount;

            Notes = new SortedList<float, TabLinesEntity>();
            Beats = new SortedList<float, TabBeat>();

            float step = (end - start) / (float)beatCount;
            for (int t = 0; t < beatCount; t++)
            {
                float tt = start + (float)t * step;
                Beats.Add(tt, new TabBeat(TabFile, tt));
            }

            _lines = null;
        }
Esempio n. 20
0
        public TabMeasure(TabFile tabFile, float start, Single end, int beatCount)
            : base(tabFile, start)
        {
            Start     = start;
            End       = end;
            BeatCount = beatCount;

            Notes = new SortedList <float, TabLinesEntity>();
            Beats = new SortedList <float, TabBeat>();

            float step = (end - start) / (float)beatCount;

            for (int t = 0; t < beatCount; t++)
            {
                float tt = start + (float)t * step;
                Beats.Add(tt, new TabBeat(TabFile, tt));
            }

            _lines = null;
        }
        public void Convert(string sngFilePath, string outputDir, bool allDif)
        {
            SngFile sngFile = new SngFile(sngFilePath);

            if (String.IsNullOrEmpty(sngFile.Metadata.Arrangement))
                return; // Vocal

            int maxDifficulty = Common.getMaxDifficulty(sngFile);

            int[] difficulties;
            if (allDif)
                difficulties = Enumerable.Range(0, maxDifficulty + 1).ToArray();
            else // if (max)
                //  difficulties = new int[] { maxDifficulty };
                difficulties = new int[] { 255 };

            foreach (int d in difficulties)
            {
                TabFile tabFile = new TabFile(sngFile, d);

                var outputFileName = String.Empty;
                if (sngFile != null && sngFile.Metadata != null)
                    if (sngFile.Metadata.Artist == "DUMMY")
                        outputFileName = String.Format("{0}", sngFile.Metadata.SongTitle);
                    else
                        outputFileName = String.Format("{0} - {1}", sngFile.Metadata.Artist, sngFile.Metadata.SongTitle);
                else
                    outputFileName = String.Format("{0}", "Unknown Song");

                outputFileName += (difficulties.Length != 1) ? String.Format(" (level {0:D2})", d) : "";
                outputFileName = outputFileName.GetValidName(true);
                var outputFilePath = Path.Combine(outputDir, outputFileName + ".txt");

                using (TextWriter tw = new StreamWriter(outputFilePath))
                {
                    tw.Write(tabFile.ToString());
                }
            }
        }
 public TabEntity(TabFile tabFile, Single time)
 {
     TabFile = tabFile;
     Time    = time;
 }
 public abstract void Apply(TabFile tabFile);
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.Out.WriteLine("Syntax: sngtotab.exe [files]");
                return;
            }

            int difficulty = Common.MAX_DIFFICULTY_ONLY;

            try {
                foreach (string filename in args)
                {
                    if (filename.StartsWith("-l"))
                    {
                        string difficultyString = filename.Substring(2);
                        if (difficultyString.Equals("a", StringComparison.Ordinal))
                            difficulty = Common.ALL_DIFFICULTIES;
                        else if (difficultyString.Equals("m", StringComparison.Ordinal))
                            difficulty = Common.MAX_DIFFICULTY_ONLY;
                        else
                            difficulty = int.Parse(difficultyString);

                        continue;
                    }

                    SngFile sngFile = new SngFile(filename);

                    int maxDifficulty = Common.getMaxDifficulty(sngFile);

                    int[] difficulties;
                    switch (difficulty)
                    {
                        case Common.MAX_DIFFICULTY_ONLY:
                            difficulties = new int[] { maxDifficulty };
                            break;

                        case Common.ALL_DIFFICULTIES:
                            difficulties = Enumerable.Range(0, maxDifficulty + 1).ToArray();
                            break;

                        default:
                            difficulties = new int[] { difficulty };
                            break;
                    }

                    foreach (int d in difficulties)
                    {
                        TabFile tabFile = new TabFile(sngFile, d);

                        string outputFilename;
                        if (filename.EndsWith(".sng"))
                            outputFilename = filename.Substring(0, filename.Length - 4) + "." + d + ".txt";
                        else
                            outputFilename = filename + "." + d + ".txt";
                        TextWriter tw = new StreamWriter(outputFilename);
                        tw.Write(tabFile.ToString());
                        tw.Close();
                    }
                }
                Console.WriteLine("The conversion is complete.");
            } catch (Exception ex){
                Console.WriteLine("Error ocurred: " + ex.Message + Environment.NewLine + ex.InnerException);
            }
        }
 public override void Apply(TabFile tabFile)
 {
     if (tabFile.CurrentMeasure != null)
         tabFile.CurrentMeasure.AddNote(this);
 }
 public abstract void Apply(TabFile tabFile);
 public TabEntity(TabFile tabFile, Single time)
 {
     TabFile = tabFile;
     Time = time;
 }
Esempio n. 28
0
 public override void Apply(TabFile tabFile)
 {
 }
 public override void Apply(TabFile tabFile)
 {
     tabFile.NextMeasure(this);
 }
Esempio n. 30
0
 public override void Apply(TabFile tabFile)
 {
     tabFile.NextMeasure(this);
 }
Esempio n. 31
0
 public TabLinesEntity(TabFile tabFile, Single time)
     : base(tabFile, time)
 {
 }
Esempio n. 32
0
 public TabBeat(TabFile tabFile, Single time)
     : base(tabFile, time)
 {
 }