{"id":17077619,"url":"https://github.com/ales-tsurko/simple-midi","last_synced_at":"2025-07-22T05:02:34.551Z","repository":{"id":91037325,"uuid":"67698804","full_name":"ales-tsurko/Simple-MIDI","owner":"ales-tsurko","description":"Swift classes for simple usage of Core MIDI","archived":false,"fork":false,"pushed_at":"2016-09-09T21:48:40.000Z","size":16,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T20:34:08.558Z","etag":null,"topics":["core-midi","coremidi","midi","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ales-tsurko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-08T11:53:04.000Z","updated_at":"2023-05-06T16:44:38.000Z","dependencies_parsed_at":"2023-07-07T07:15:15.478Z","dependency_job_id":null,"html_url":"https://github.com/ales-tsurko/Simple-MIDI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ales-tsurko/Simple-MIDI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2FSimple-MIDI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2FSimple-MIDI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2FSimple-MIDI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2FSimple-MIDI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ales-tsurko","download_url":"https://codeload.github.com/ales-tsurko/Simple-MIDI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ales-tsurko%2FSimple-MIDI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266430671,"owners_count":23927165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["core-midi","coremidi","midi","swift"],"created_at":"2024-10-14T12:16:02.479Z","updated_at":"2025-07-22T05:02:34.467Z","avatar_url":"https://github.com/ales-tsurko.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple-MIDI\nSwift classes for simple usage of Core MIDI. Currently only MIDI input is available.\n\n# Usage\n\nFirst, we need to define a MIDIMap with appropriate callbacks.\nFor example, we have some audio unit with a parameter \"volume\":\n```Swift\nlet volumeParam = audioUnit.parameterTree?.valueForKey(\"volume\") as! AUParameter\n```\n\nWe define CC-map, where we bind CC-number with a parameter.\nHere we bind an AUParameter with key \"volume\" to a CC with number 7.\n```Swift\nlet ccMap: [UInt8 : AUParameter] = [7 : volumeParam] // CC-map is a dictionary of type [CCNum : AUParameter]\n```\n\nNow we initialize MIDIMap with the given CC-map.\n```Swift\n// All parameters in the MIDIMap class are optional.\nlet map = MIDIMap(noteOnOffCallback: nil, sustainPedalCallback: nil, pitchBendCallback: nil, modulationWheelCallback: nil, notificationCallback: nil, ccMapping: ccMap)\n```\n\nWe also can define callbacks for another common MIDI messages: Note On/Off, Pitch Bend, Modulation Wheel and MIDI Notifications.\n\nLet's define a callback for the modulation wheel. Our audio unit has a parameter \"filter-frequency\" with a minimum value of 0 and a maximum value of 1. We're going to change it's value with the modulation wheel.\n\n```Swift\n// get the parameter and initialize a callback\nlet frequencyParam = audioUnit.parameterTree?.valueForKey(\"filter-frequency\") as! AUParamter\nlet modulationWheelCallback = {(value: UInt8) in\n  frequencyParam.value = AUValue(value)/127\n}\n\n// set callback to the MIDIMap\nmap.modulationWheelCallback = modulationWheelCallback\n```\n\nNow we can initialize MIDIIn.\n```Swift\nlet midiIn = MIDIIn(clientName: \"Here The Name For Your MIDI Client\", portName: \"Here The Name For Your MIDI Input Port\", midiMap: map)\n```\n\nAnd we can get available MIDI devices now.\nLet's connect the first one (if any).\n```Swift\nif !midiIn.availableDevices.isEmpty {\n  midiIn.availableDevices[0].isConnected = true\n}\n```\n\nNow we can control the audio unit's parameters with the connected device.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fales-tsurko%2Fsimple-midi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fales-tsurko%2Fsimple-midi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fales-tsurko%2Fsimple-midi/lists"}