3

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?

Eric S
  • 1,001
  • 10
  • 14
  • 2
    The IAC driver routes the messages to some other application. Try GarageBand. – CL. Nov 09 '16 at 07:30
  • When I ran the command mido.get_output_names() IAC Driver Bus 1 is the only result displayed. Is there a way to set garageband as an output port? – Eric S Nov 09 '16 at 17:19
  • You have to go through IAC from both applications. – CL. Nov 09 '16 at 18:57
  • Could you please give more detail on how to do this? I've never used IAC or done any MIDI programming before, having a lot of difficultly finding clear instructions online as to how to set this up. – Eric S Nov 09 '16 at 19:58

1 Answers1

5

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.

z0r
  • 8,185
  • 4
  • 64
  • 83