{"id":18171342,"url":"https://github.com/leandrodaf/midi","last_synced_at":"2025-07-15T17:33:23.264Z","repository":{"id":260463513,"uuid":"880491117","full_name":"leandrodaf/midi","owner":"leandrodaf","description":"MIDI is a native Go library for capturing and manipulating MIDI events. With full support for macOS and Windows, it requires no external libraries, making it easy to integrate into your projects. Capture events, filter commands, and monitor MIDI flow effortlessly!","archived":false,"fork":false,"pushed_at":"2024-11-01T11:27:15.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T08:38:28.373Z","etag":null,"topics":["audioprocessing","crossplatform","development","digitalmusic","eventcapture","go","library","midi","midiclient","music","musicsoftware","musictech","nativelibrary","opensource","programming","realtime"],"latest_commit_sha":null,"homepage":"","language":"Go","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/leandrodaf.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}},"created_at":"2024-10-29T20:25:40.000Z","updated_at":"2024-11-23T12:09:26.000Z","dependencies_parsed_at":"2025-04-07T08:46:09.555Z","dependency_job_id":null,"html_url":"https://github.com/leandrodaf/midi","commit_stats":null,"previous_names":["leandrodaf/midi"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/leandrodaf/midi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrodaf%2Fmidi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrodaf%2Fmidi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrodaf%2Fmidi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrodaf%2Fmidi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leandrodaf","download_url":"https://codeload.github.com/leandrodaf/midi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leandrodaf%2Fmidi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265450173,"owners_count":23767559,"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":["audioprocessing","crossplatform","development","digitalmusic","eventcapture","go","library","midi","midiclient","music","musicsoftware","musictech","nativelibrary","opensource","programming","realtime"],"created_at":"2024-11-02T15:08:43.321Z","updated_at":"2025-07-15T17:33:23.253Z","avatar_url":"https://github.com/leandrodaf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MIDI Client Library\n\nA native Go library for capturing and manipulating MIDI events, supporting macOS and Windows operating systems without the need for external libraries or DLLs.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [Installation](#installation)\n- [Quick Usage](#quick-usage)\n- [Configuration](#configuration)\n- [Contribution](#contribution)\n- [License](#license)\n\n## Introduction\n\nThis project provides a **fully native** interface for working with MIDI devices, enabling the capture of events and filtering of MIDI commands without relying on any external libraries or dependencies. The library is designed to be easy to use and extensible, making it a straightforward choice for applications that require MIDI manipulation.\n\n## Features\n\n- **Native Support**: Works seamlessly on macOS and Windows without the need for additional libraries or DLLs.\n- **Device Listing**: Easily list available MIDI devices connected to your system.\n- **Device Selection**: Select MIDI devices for capturing events with simple function calls.\n- **Event Capturing**: Capture MIDI events with support for filtering commands, allowing you to focus on the events that matter.\n- **Built-in Logging**: Implemented logging for monitoring and debugging, providing insights into the MIDI event flow.\n\n## Installation\n\nTo install the library, you can use the following Go command:\n\n```bash\ngo get github.com/leandrodaf/midi\n```\n\n## Quick Usage\n\nHere is a simple example of how to use the library to capture MIDI events:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/leandrodaf/midi/internal/logger\"\n\t\"github.com/leandrodaf/midi/sdk/contracts\"\n\t\"github.com/leandrodaf/midi/sdk/midi\"\n)\n\nfunc main() {\n\tlog := logger.NewStandardLogger()\n\n\tclient, err := midi.NewMIDIClient(\n\t\tcontracts.WithLogger(log),\n\t\tcontracts.WithLogLevel(contracts.InfoLevel),\n\t\tcontracts.WithMIDIEventFilter(contracts.MIDIEventFilter{\n\t\t\tCommands: []contracts.MIDICommand{contracts.NoteOn, contracts.NoteOff},\n\t\t}),\n\t)\n\tif err != nil {\n\t\tlog.Error(\"Failed to initialize MIDI client\", log.Field().Error(\"error\", err))\n\t\treturn\n\t}\n\n\tdevices, err := client.ListDevices()\n\tif err != nil || len(devices) == 0 {\n\t\tlog.Error(\"No MIDI devices found or error listing devices\", log.Field().Error(\"error\", err))\n\t\treturn\n\t}\n\tfmt.Println(\"Available MIDI devices:\", devices)\n\n\tif err = client.SelectDevice(0); err != nil {\n\t\tlog.Error(\"Failed to select MIDI device\", log.Field().Error(\"error\", err))\n\t\treturn\n\t}\n\n\teventChannel := make(chan contracts.MIDI, 100)\n\tgo func() {\n\t\tfor event := range eventChannel {\n\t\t\tlog.Info(\"MIDI Event\",\n\t\t\t\tlog.Field().Uint64(\"Timestamp\", event.Timestamp),\n\t\t\t\tlog.Field().Int(\"Command\", int(event.Command)),\n\t\t\t\tlog.Field().Int(\"Note\", int(event.Note)),\n\t\t\t\tlog.Field().Int(\"Velocity\", int(event.Velocity)),\n\t\t\t)\n\t\t}\n\t}()\n\n\tclient.StartCapture(eventChannel)\n\tdefer client.Stop()\n\n\tfmt.Println(\"Capturing MIDI events... Press Ctrl+C to exit.\")\n\tselect {} // Run indefinitely\n}\n```\n\n## Configuration\n\nThe library allows for various configuration options when creating a MIDI client. Here are some of the available options:\n\n- **Logger**: A custom logger can be provided.\n- **LogLevel**: Logging level (Info, Debug, Error, etc.).\n- **MIDIEventFilter**: A filter to specify which MIDI commands to capture.\n\nExample configuration:\n\n```go\nclient, err := midi.NewMIDIClient(\n\tcontracts.WithLogger(log),\n\tcontracts.WithLogLevel(contracts.InfoLevel),\n\tcontracts.WithMIDIEventFilter(contracts.MIDIEventFilter{\n\t\tCommands: []contracts.MIDICommand{contracts.NoteOn, contracts.NoteOff},\n\t}),\n)\n```\n\n## Contribution\n\nContributions are welcome! To contribute to the project, please follow these steps:\n\n1. **Fork the repository**.\n2. **Create a new branch** for your feature or fix:\n   ```bash\n   git checkout -b feature-your-feature-name\n   ```\n3. **Make your changes** and commit:\n   ```bash\n   git commit -m \"Adds new feature\"\n   ```\n4. **Push your changes to the remote repository**:\n   ```bash\n   git push origin feature-your-feature-name\n   ```\n5. **Create a Pull Request**.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrodaf%2Fmidi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleandrodaf%2Fmidi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleandrodaf%2Fmidi/lists"}