Exemplo n.º 1
0
    void Start()
    {
        //text.text = Application.dataPath;
        List <Note> notes = new List <Note> ();

        for (int i = 1; i < 21; i++)
        {
            notes.Add(new Note(4, 1.0f * i));
            notes.Add(new Note(0, 1.0f * i));
        }
        MusicNotes ms = new MusicNotes(notes);

        IFormatter formatter = new BinaryFormatter();
        Stream     stream    = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);

        formatter.Serialize(stream, ms);
        stream.Close();


        //text2.text = String.Format("{0}", ms2.AvgFreq());



        Debug.Log(String.Format("{0}", ms.AvgFreq()));
    }
Exemplo n.º 2
0
    public static void Serialize(string path, MusicNotes notes)
    {
        IFormatter formatter = new BinaryFormatter();
        Stream     stream    = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None);

        formatter.Serialize(stream, notes);
        stream.Close();
    }
Exemplo n.º 3
0
    public static MusicNotes Deserialize(string path)
    {
        IFormatter formatter = new BinaryFormatter();
        Stream     stream    = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
        MusicNotes ms2       = (MusicNotes)formatter.Deserialize(stream);

        return(ms2);
    }
Exemplo n.º 4
0
 void Update()
 {
     if (!source.isPlaying)
     {
         Debug.Log("Compiling MusicNotes");
         MusicNotes ms = new MusicNotes(notes);
         MusicNotesSerialization.Serialize(String.Format("{0}.bin", source.clip.name), ms);
     }
 }
Exemplo n.º 5
0
        private void OnExecute()
        {
            var rootNote = MusicNotes.FromString(Note);
            var scale    = CreateScaleInstance(rootNote);

            var tuning    = new[] { MusicNotes.E, MusicNotes.B, MusicNotes.G, MusicNotes.D, MusicNotes.A, MusicNotes.E };
            var fretboard = new Fretboard(tuning, Frets);

            fretboard.SetScale(scale);

            PrintFretboard(rootNote, scale, Frets, fretboard);
        }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        //RhythmDemoPatternNormal();
        //RhythmDemoPatternEasy ();
        //IAmEvil ();
        BossThemePattern();
        //TempPattern();
        Debug.Log("Outputing MusicSheet");
        MusicNotesSerialization.Serialize("Boss Theme 1.bin", new MusicNotes(notes));
        Debug.Log("Testing");
        MusicNotes music = MusicNotesSerialization.Deserialize("Boss Theme 1.bin");

        Debug.Log(music.AvgFreq());
    }