public override void FormLoad(object sender, EventArgs e) { PianoNoteRetriever retriever = new PianoNoteRetriever(); var midiEvents = new InstrumentMidiEventProducer( Directory.EnumerateFiles(@"C:\Users\armen_000\Documents\Visual Studio 2013\Projects\Improvisation\Improvisation\bin\Debug\MusicSeperated\RayCharles").Select(x => new Sequence(x))); var midi = midiEvents.GetOrderedMessages(GeneralMidiInstrument.AcousticGrandPiano); var accords = Chord.RetrieveChords(midi, retriever); // var mahboyeminem = Chord.RetrieveChords( // new InstrumentMidiEventProducer(Directory.EnumerateFiles("MusicSeperated\\Eminem").Select(x => new Sequence(x))).GetOrderedMessages(GeneralMidiInstrument.AcousticGrandPiano), // retriever); var grams = HeterogenousNGrams <Chord> .BuildNGrams(3, 7, accords.ToList()); this.MarkovGraph = new NGramGraphMarkovChain <Chord>(grams); this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <Chord>(new NGramGraphMarkovChain <Chord>(HomogenousNGrams <Chord> .DirectBuiltUnsafe(new NGram <Chord>().AsEnumerableObject(), 1)))); this.ZoomControl.ZoomToFill(); this.GraphArea.GenerateGraph(true); this.GraphArea.SetVerticesDrag(true, true); this.UpdateThemeListBox(); }
public virtual void GenerateButtonClick(object sender, System.EventArgs e) { this.NGramListBox.Enabled = true; var dataVertex = new DataVertex(); if (this.serachTextBox.Text != string.Empty) { NGram <T> s = this.CreateNGRamFromSearchTextBox(); if (s != NGram <T> .Empty) { this.CurrentMarkovGraph = this.MarkovGraph.GetSubGraphFromNGram(s, this.Depth); if (this.MarkovGraph.ValidNode(s)) { this.wpfContainer.Child = this.GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI(this.CurrentMarkovGraph)); } } } GraphArea.GenerateGraph(true); GraphArea.SetVerticesDrag(true, true); ZoomControl.ZoomToFill(); this.UpdateListBox(); }
public override void FormLoad(object sender, EventArgs e) { PianoNoteRetriever retriever = new PianoNoteRetriever(); var midiEvents = new InstrumentMidiEventProducer(Directory.EnumerateFiles("Music").Skip(4).Take(1).Select(x => new Sequence(x))); var k = midiEvents.GetOrderedMessages(GeneralMidiInstrument.AcousticGrandPiano); var accords = Chord.RetrieveChords(k, retriever); accords.Count(); var prod = new InstrumentChannelMessengerProducer(Directory.EnumerateFiles("Music").Select(x => new Sequence(x))) .GetOrderedMessages(GeneralMidiInstrument.AcousticGrandPiano) .Where(x => retriever.ValidNoteId(x)) .Select(x => new SimplisticPianoNote(x)) .ToList(); var grams = HeterogenousNGrams <SimplisticPianoNote> .BuildNGrams(1, 5, prod); this.MarkovGraph = new NGramGraphMarkovChain <SimplisticPianoNote>(grams); this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <SimplisticPianoNote>(this.MarkovGraph)); this.ZoomControl.ZoomToFill(); this.GraphArea.GenerateGraph(true); this.GraphArea.SetVerticesDrag(true, true); }
private void UpdateGraph(NGramGraphMarkovChain <T> chain) { this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <T>(chain)); GraphArea.GenerateGraph(true); GraphArea.SetVerticesDrag(true, true); ZoomControl.ZoomToFill(); }
private void UpdateGraph() { this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <T>(this.CurrentMarkovGraph)); GraphArea.GenerateGraph(true); GraphArea.SetVerticesDrag(true, true); ZoomControl.ZoomToFill(); }
public override void FormLoad(object sender, EventArgs e) { this.DisableButtons(); this.serachTextBox.ReadOnly = true; this.Size = this.Size; // List<string> corp = new List<string>() { "a", "b", "c", "a", "e", "f", "g", "h", "e", "f", "h", "b", "b", "c", "h", "g" }; List <string> corp = TextCorpus.RetrieveAnyCompleteWordCorpus(); HeterogenousNGrams <string> grams = HeterogenousNGrams <string> .BuildNGrams(1, 3, corp); //HomogenousNGrams<string> grams = HomogenousNGrams<string>.BuildNGrams(1, corp); //NGramGraphMarkovChain<string> graphHetero = new NGramGraphMarkovChain<string>(heterograms); NGramGraphMarkovChain <string> graph = new NGramGraphMarkovChain <string>(grams); this.MarkovGraph = graph; this.wpfContainer.Child = GenerateWpfVisuals(GraphUIHelper.GenerateGraphUI <string>(NGramGraphMarkovChain <string> .Empty(true))); ZoomControl.ZoomToFill(); this.serachTextBox.ReadOnly = false; }