Esempio n. 1
0
        static void InstrumentalTest()
        {
            Databank db = new Databank("lib");
            var cat = db.Load("Classical");

            InstrumentalGenerator gen = new InstrumentalGenerator(cat);
            gen.Initialize();
            var outMel = gen.GenerateInstrument(PatchNames.Acoustic_Grand, 40);

            MusicPlayer player = new MusicPlayer();
            player.Play(outMel);

            Composition comp = new Composition();
            Track t = new Track(PatchNames.Acoustic_Grand, 3);
            t.AddSequence(outMel);
            comp.Add(t);
            comp.WriteToMidi("instrumental_acousticgrand.mid");
        }
        public void LoadFromFile()
        {
            InstrumentalGenerator gen = new InstrumentalGenerator();

            ProtoBuf.Serializer.PrepareSerializer<InstrumentalGenerator>();

            System.IO.FileStream fs = new System.IO.FileStream(SavePath, System.IO.FileMode.Open);

            gen = ProtoBuf.Serializer.Deserialize<InstrumentalGenerator>(fs);

            instruments = gen.instruments;
            //Might give problems
            instrument_tracker = gen.instrument_tracker;

            fs.Close();
        }