{"id":13743755,"url":"https://github.com/heyfrench/as3midilib","last_synced_at":"2025-05-09T01:31:51.361Z","repository":{"id":98631236,"uuid":"39020614","full_name":"heyfrench/as3midilib","owner":"heyfrench","description":"ActionScript 3.0 library for working with MIDI data.","archived":false,"fork":false,"pushed_at":"2015-07-13T18:41:32.000Z","size":1064,"stargazers_count":8,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-15T14:35:51.199Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"ActionScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heyfrench.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-13T15:29:21.000Z","updated_at":"2024-05-17T15:20:53.000Z","dependencies_parsed_at":"2023-03-07T16:00:37.667Z","dependency_job_id":null,"html_url":"https://github.com/heyfrench/as3midilib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyfrench%2Fas3midilib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyfrench%2Fas3midilib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyfrench%2Fas3midilib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyfrench%2Fas3midilib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyfrench","download_url":"https://codeload.github.com/heyfrench/as3midilib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253174369,"owners_count":21865852,"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","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":[],"created_at":"2024-08-03T05:00:56.464Z","updated_at":"2025-05-09T01:31:47.672Z","avatar_url":"https://github.com/heyfrench.png","language":"ActionScript","funding_links":[],"categories":["Networking"],"sub_categories":["Protocols"],"readme":"# Introduction\n\nThis is a library for working with MIDI in ActionScript 3.0. It can be manually used to parse a stream of MIDI data into objects, or it can be used to connect to a MIDI socket server and receive live performance MIDI. It can also be used to parse MIDI files or stream them for performance syncing.\n\n\n## Receiving live performance MIDI\n\n```as3\nimport com.newgonzo.midi.io.*;\nimport com.newgonzo.midi.*;\nimport com.newgonzo.midi.events.*;\nimport com.newgonzo.midi.messages.*;\nimport com.newgonzo.midi.filters.*;\n\nvar connection:IMIDIConnection = new MIDISocketConnection();\n\n// Only receive VoiceMessages\nvar voiceReceiver:MIDIReceiver = new MIDIReceiver(receiver, new VoiceFilter());\n// add event listener...\n\n// Only receive messages on Channel 1\nvar channelReceiver:MIDIReceiver = new MIDIReceiver(receiver, new ChannelFilter([1]));\n// add event listener...\n\n// Only receive TIMING_CLOCK SystemMessages\nvar clockReceiver:MIDIReceiver = new MIDIReceiver(receiver, new SystemFilter([SystemMessageType.TIMING_CLOCK]));\n// add event listener...\n\n// Only receive NOTE_OFF VoiceMessages on Channel 3\nvar channel3NoteOffVoices:MIDIReceiver = new MIDIReceiver(receiver, new ChannelFilter([3], new StatusFilter(MessageStatus.NOTE_OFF, new VoiceFilter())));\n\n\n// listen to receivers for message events\nchannel3NoteOffVoices.addEventListener(MessageEvent.MESSAGE, messageReceived);\n\n// connect to the MIDI2.jar socket server\nconnection.connect(\"localhost\", 10000);\n\nprivate function messageReceived(event:MessageEvent):void\n{\n  trace(event.message); // [Message(status=...]\n}\n```\n\n## Syncing to MIDI clock\n\n```as3\nimport com.newgonzo.midi.io.*;\nimport com.newgonzo.midi.messages.*;\nimport com.newgonzo.midi.events.*;\n\nvar connection:IMIDIConnection = new MIDISocketConnection();\nvar clock:MIDIClock = new MIDIClock(connection);\n\nclock.addEventListener(ClockEvent.BEAT, midiBeat);\nclock.addEventListener(ClockEvent.POSITION, midiPosition);\nclock.addEventListener(ClockEvent.START, midiStartStop);\nclock.addEventListener(ClockEvent.STOP, midiStartStop);\n\n// connect to MIDI2.jar socket server\nconnection.connect(\"127.0.0.1\", 10000);\n\n// event handling functions\n```\n\n## Reading a MIDI file\n\n```as3\nimport com.newgonzo.midi.MIDIDecoder;\nimport com.newgonzo.midi.file.*;\n\n// assuming you've loaded your MIDI file into a \n// ByteArray via URLLoader, FileStream (AIR), etc.\nvar midiData:ByteArray;\n\nvar decoder:MIDIDecoder = new MIDIDecoder();\nvar file:MIDIFile = decoder.decodeFile(midiData);\n\n// a MIDI file has an array of tracks that each contain an array of track events\nvar track:MIDITrack;\nvar event:MIDITrackEvent;\n                                                                \nfor each(track in file.tracks)\n{\n    for each(event in track.events)\n    {\n        trace(\"event.time: \" + event.time);\n        trace(\"event.message: \" + event.message); // [Message(status=...]\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyfrench%2Fas3midilib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyfrench%2Fas3midilib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyfrench%2Fas3midilib/lists"}