Search Results for

    Show / Hide Table of Contents

    MIDI file writing

    The simplest code for MIDI file writing is:

    file.Write("Some great song.mid");
    

    If file with this name already exist, you'll get an excption. To overwrite existing file pass true to overwriteFile parameter:

    file.Write("Some great song.mid", overwriteFile: true);
    

    Compression

    You can set specific policies via WritingSettings to reduce size of an output file. For example, to use running status and thus don't write status bytes of channel events of the same type, set properties shown in the following code:

    file.Write("Some great song.mid", settings: new WritingSettings
    {
        UseRunningStatus = true,
        NoteOffAsSilentNoteOn = true
    });
    

    Complete list of available properties is placed in documentation of WritingSettings.

    In This Article
    Back to top 2022 / Generated by DocFX