MATLAB Answers

How to setup a MIDI device for a software instrument?

11 views (last 30 days)
BreezyWest
BreezyWest on 6 Nov 2018
Answered: Charlie DeVane on 9 Oct 2019
How would I go about interfacing my digital piano with Matlab, such that I can play audio files from my computer in real-time?
Many implementations available only use a computer keyboard for input and thus don't have the velocity or sustain (via pedal) associated with the use of software instruments. I have access to the Audio System Toolbox, but am struggling through the documentation to see how such can be implemented. Additionally, what concerns are there about latency with Matlab's MIDI interface?

  1 Comment

Frederic Piat
Frederic Piat on 9 Jun 2019
This is what I believe with the little experience I have but you'd need to check on my answer:
  • when playing files, I do not need Matlab and did not try from within Matlab, but when I play a midi file from windows, the standard windows (or any other) player plays it and if I plug my keyboard on the USB port (cord bought from Amazon for 5€, works great) the sound is redirected to my keyboard without anything else to do. I believe that will be the same if playing the midifile (but probably not just any sound file) with a Matlab command (unless Matlab translates it into a soundwave or something, different from the midi standard)
  • to do MIDI in real-time (I know that's not what you're asking but you may still find some answers to related questions):
https://fr.mathworks.com/help/audio/musical-instrument-digital-interface-midi.html?s_tid=CRUX_lftnav
Musical Instrument Digital Interface (MIDI)
Create, send, and receive MIDI messages
Audio Toolbox™ enables you to create, send, and receive MIDI messages. You can interface with MIDI Control Surfaces and MIDI Devices in real time.
  • Regarding latency, I don't know

Sign in to comment.

Answers (1)

Charlie DeVane
Charlie DeVane on 9 Oct 2019
Sorry, the Audio Toolbox does not have any builtin capability to read or write MIDI files.
hth,
Charlie

  0 Comments

Sign in to comment.

Products


Release

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!