// Creates a new .ly file and writes to it. /// <summary> /// Creates a new .ly and .pdf file to the path C:\LilyPond\ /// </summary> /// <returns>A string representing the path the pdf was created in. </returns> public string CreateSheets() { UtilMethods.GetLengthOfNotes(notes, inputs.Tempo, inputs.TimeSignature); string path = @"C:\LilyPond\" + inputs.PdfName + ".ly"; if (!File.Exists(path)) { using (StreamWriter sw = File.CreateText(path)) { // Header section sw.WriteLine("\\version \"2.18.2\""); sw.WriteLine(); sw.WriteLine("\\header {"); sw.WriteLine("\t title = \"" + inputs.Title + "\""); sw.WriteLine("\t composer = \"" + inputs.Composer + "\""); sw.WriteLine("\t instrument = \"" + inputs.Instrument + "\""); sw.WriteLine("}"); // Melody section - This is where we declare what clef we're in, what // key signature, and what time signature sw.WriteLine("melody = {"); sw.WriteLine("\t \\clef " + inputs.Clef); sw.WriteLine("\t \\key " + inputs.KeySignature); sw.WriteLine("\t \\time " + inputs.TimeSignature); sw.WriteLine(); // This is where we input the list of notes and lengths string noteString = BuildNoteString(notes); sw.WriteLine(noteString); sw.WriteLine("}"); sw.WriteLine(); sw.WriteLine("\\score {"); sw.WriteLine("\t \\new Staff \\melody"); sw.WriteLine("\t \\layout { }"); sw.WriteLine("}"); } } ExecuteLilyPond(); return(@"C:\LilyPond\" + inputs.PdfName + ".pdf"); }