private void Awake() { _st = SettingsReader.GetInstance(); _mn = GetComponent <Metronome>(); R = new Random(); //var folder = new DirectoryInfo(Application.dataPath + "/"); //var files = folder.GetFiles("*.notes", SearchOption.AllDirectories); //if (files.Length == 0) throw new Exception("No sample files found."); TextAsset prnFile = Resources.Load("input") as TextAsset; var sample = new Markov <string>(" "); var content = new List <string>(); char[] archDelim = new char[] { ' ' }; string txt = prnFile.text; content = txt.Split(archDelim, StringSplitOptions.RemoveEmptyEntries).ToList(); //using (var sampleFile = new StreamReader(t.FullName)) // { //while (!sampleFile.EndOfStream) // { //var line = sampleFile.ReadLine().Trim(); // foreach (var entry in line.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries)) // content.Add(entry); //} //sampleFile.Close(); //} if (content.Count > 4) { sample.Train(content, 4); } _requiredWordCount = (int)_st.AudioLength; var result = sample.GeneratePiece(_requiredWordCount, true); var resultString = new StringBuilder(); foreach (var entry in result) { resultString.Append(entry + " "); } _mn.BuildNoteList(result); }