Eric S
Eric S

Reputation: 1031

Outputting MIDI sound from Python Mido library on Mac

I'm trying to output a note to my computers internal speakers using python with the mido library. I have a mac, and I've learned that by default you need to go through the IAC Driver to output any sound to the speakers. I enable the IAC Driver and searched for the correct output using the command:

>>> mido.get_output_names()
['IAC Driver Bus 1']

From there I created the simple script:

import mido

def main():

    outport = mido.open_output('IAC Driver Bus 1')
    outport.send(mido.Message('note_on', note=60, velocity = 100))

main()

note=60 should be outputting middle C and velocity is the volume.

However no sound is being produced at all. I'm assuming the port must be recognized as I get no errors but again there is no sound being output. Anyone have any idea what's going on?

Upvotes: 4

Views: 2396

Answers (1)

z0r
z0r

Reputation: 8595

Screenshot of Audio MIDI Setup app

  1. Open the Audio MIDI Setup app
  2. Choose Window > Show MIDI Studio
  3. Double-click on IAC Driver
  4. Check Device is online
  5. Start Garage Band and add a software MIDI track
  6. Test that it's working with your keyboard

Now you should hear something when you run your code.

Upvotes: 5

Related Questions