Skip to content

It is possible to play note directly without read midi file? #231

Answered by melanchall
Werasilz asked this question in Q&A
Discussion options

You must be logged in to vote

You can always create Playback manually from desired objects:

var tempoMap = TempoMap.Default;
var playback = new Playback(
    new[]
    {
        new Note(NoteName.ASharp, 2).SetLength(MusicalTimeSpan.Quarter, tempoMap)
    },
    tempoMap);

Here we create playback for single quarter note – A#2. Of course you can pass output device to the Playback's constructor. Please read documentation on the playback, you'll find there all required info – https://melanchall.github.io/drywetmidi/api/Melanchall.DryWetMidi.Multimedia.Playback.html.

Also if you create piano, maybe it's better to just send a Note On on key press and a Note Off on key release?

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
5 replies
@Werasilz
Comment options

@Napst-a
Comment options

@melanchall
Comment options

@Napst-a
Comment options

@melanchall
Comment options

Answer selected by Werasilz
Comment options

You must be logged in to vote
7 replies
@melanchall
Comment options

@Napst-a
Comment options

@melanchall
Comment options

@Napst-a
Comment options

@melanchall
Comment options

Comment options

You must be logged in to vote
1 reply
@melanchall
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Just question about the library unity Issue is related to Unity game engine
3 participants