Core MIDI and Friends

Source: Internet
Author: User

Http://www.slideshare.net/invalidname/core-midi-and-friends  from  Core MIDI and Friends8,215 views
    • Share
    • Like
Chris Adamson , Developer, Author at subsequently and Furthermore, Inc. Follow 0 1 0

Published on Nov 7, 2011

CocoaHeads Ann Arbor presentation on handling MIDI events in Mac OS X and iOS

...Published in:technology, entertainment & Humor
1 Comment
5 likes
Statistics
Notes
    • Ben Smiley I ' ve written a series of compreshensive Coremidi tutorials At:http://www.deluge.co/?q=all-things-midi4 years ago
Core MIDI and Friends
  1. 1. Coremidi and Friendschris Adamson, cocoaheads Ann Arbor Sept. 8, 2011
  2. 2. Road Map MIDI Basics MIDI APIs on OSX MIDI APIs on IOS
  3. 3. MIDI Basics MIDI = Musical Instrument Digital interface circa 1982! sends messages between devices, not sounds no TES to play (pitch, impact, vibrato), patch selection, timing synchronization, etc.
  4. 4. MIDI terms device-participant in a MIDI network endpoint-one connection to or out of a device source-endpoin T that sends data destination-endpoint that receives data
  5. 5. MIDI messagesstatus Data 1 Data 2
  6. 6. MIDI Messages Channel Voice messages-note on, Note O, After-touch, Pitch Wheel High nybble of the status is command, Low nybble are channel number channel Mode, System messages various extensions to the spec over the Yearshttp://www.midi. org/techspecs/midimessages.php
  7. 7. MIDI APIs on OSX coremidi-implementation of MIDI messaging instrument units-audio Units, generate sound in Re Sponse to MIDI Events Music device-sends commands to instrument units music sequence/music player-plays MIDI (. mid )? Les
  8. 8. Core MIDI c-based API in Audio Toolbox largely similar to other core Audio APIs uses core Foundation opaque types, memory management, etc.
  9. 9. Core MIDI Types Midiclientref-holds state for your MIDI session MIDIDEVICEREF-A device (real or virtual) with "en Tities "(Midientityref), which is logical sub-systems Midiendpointref-source or destination Midiportref-an input or Output port
  10. Creating Client & Input port! Midiclientref client = null;! Midiclientcreate (Cfstr ("Core MIDI to System Sounds Demo"), Mymidinotifyproc, Self, &client);!! Midiportref InPort = null;! Midiinputportcreate (Client, Cfstr ("Input port"), Mymidireadproc, Self, &inport);
  11. Discovering and connecting sources!unsigned long Sourcecount = Midigetnumberofsources ();! for (int i = 0; i < Sourcecount; ++i) {!! Midiendpointref src = midigetsource (i);!! Cfstringref Endpointname = null;!! Osstatus nameerr = Midiobjectgetstringproperty (src, kmidipropertyname, &endpointname);!! if (NOERR = = nameerr) {!!! NSLog (@ "source%d:%@n", I, endpointname);!! }!! Midiportconnectsource (InPort, SRC, NULL);!}
  12. Read Proc callback function indicated by Midiinputportcreate () receives midipacketlist numpackets and MIDIPacket[ ] receives User-info/context pointers that's set up in Midiinputportcreate () and Midiportconnectsource ()
  13. Midipacket contains TimeStamp, length, and byte[] byte[] data is the MIDI message data[0]: status Data[1]: MIDI Data 1 Data[2] (if present): MIDI data 2
  14. Parsing a NOTE on message! Midipacket *packet = (Midipacket *) pktlist->packet;!! Byte Midicommand = packet->data[0] >> 4;! Is it a note-on?! if (Midicommand = = 0x09) {!! Byte Note = packet->data[1] & 0x7f;!! Byte velocity = packet->data[2] & 0x7F;
  15. What is now?
  16. Instrument units Audio Units, generate sound in response to MIDI events Kaudiounittype_musicdevice do not Curr ently exist on IOS
  17. Instrument to audio h/w I/O Unit unit AU Graph
  18. Instrument to Audio h/w Effect unit I/O Unit unit AU Graph
  19. Instrument to audio h/w I/O Unit unit AU Graph
  20. Mu si cD ev ic eM ID IE ve NT () Instrument to audio h/w I/O Unit unit AU Graph
  21. Musicdevice.h small API to deliver MIDI events to instrument units not in Xcode documentation. Check out the headers? Le only 4 functions musicdevicemidievent () sends status, DATA1, data2 to a musicdevicecomponent (i.e., an instrument Audio Unit)
  22. Demo
  23. All. MIDI on iOS core MIDI added in IOS 4.2 device connectivity are via dock port custom hardware ipad Camera connecti On Kit
  24. Midi via the CCK MIDI-TO-USB adapters semi-o?cially blessed by Apple adapter must be USB MIDI class-compliant (i.e ., doesn ' t need drivers) bus-powered devices may isn't work, due to low power supplied by IPad. Powered USB devices generally Work. http://iosmidi.com/devices/
  25. Playing sounds on iOS no instrument units on IOS. Options: synthesize your own with a render callback play sampled sounds with Audio Queue, AV Player, System sounds, et C.
  26. Demo
  27. Demo
  28. Ausampler New Instrument Audio Unit in Lion ... and ... takes a sampled waveform and pitch-shifts it to make it into an Instrument call with musicdevicemidievent (), just as other instrument units
  29. Ausampler Con?guration is a huge hassle huge and tota!y undocumented hassle build an. Aupreset with AU Lab utilit Y, or Load DLS bank or SoundFont 2 les, or provide your own? Les see WWDC Session 411 ("Music in IOS and MacOSX"), then ? Le documentation bugs against absence of sample code
  30. Summary musicians love MIDI. Devices is cheap and plentiful osx and IOS love Media, midi included by comparison, Android have crap midi support (no Javax.sound.midi, just. Mid le Support in android.media.JetPlayer) if you ' re doing Mac or IOS media apps, you should con Sider supporting MIDI device I/O
  31. Also, you should buy my bookhttp://www.mypearsonstore.com/bookstore/product.asp?isbn=9780321636843 http:// my.safaribooksonline.com/9780321636973 http://www.informit.com/promotions/promotion.aspx?promo=137039

Core MIDI and Friends

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.