{"id":16991795,"url":"https://github.com/akiyukiokayasu/osc","last_synced_at":"2026-05-19T15:16:47.324Z","repository":{"id":57533778,"uuid":"219424285","full_name":"AkiyukiOkayasu/osc","owner":"AkiyukiOkayasu","description":"OSC (Open Sound Control) package for Go.","archived":false,"fork":false,"pushed_at":"2020-08-01T16:00:27.000Z","size":119,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T04:34:30.936Z","etag":null,"topics":["go","golang","opensoundcontrol","osc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AkiyukiOkayasu.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}},"created_at":"2019-11-04T05:29:28.000Z","updated_at":"2021-06-25T02:52:51.000Z","dependencies_parsed_at":"2022-09-07T09:32:45.012Z","dependency_job_id":null,"html_url":"https://github.com/AkiyukiOkayasu/osc","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/AkiyukiOkayasu%2Fosc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiyukiOkayasu%2Fosc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiyukiOkayasu%2Fosc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiyukiOkayasu%2Fosc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AkiyukiOkayasu","download_url":"https://codeload.github.com/AkiyukiOkayasu/osc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902927,"owners_count":20529115,"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":["go","golang","opensoundcontrol","osc"],"created_at":"2024-10-14T03:27:22.380Z","updated_at":"2026-05-19T15:16:47.280Z","avatar_url":"https://github.com/AkiyukiOkayasu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# osc  \n\nOSC (Open Sound Control) package for Go.  \nA part of The [Open Sound Control 1.0 Specification](http://opensoundcontrol.org/spec-1_0) has been implemented in pure Go.  \nYou can work with OSC in macOS, Windows, Linux (also work with Raspberry Pi).  \n\n## Features  \n\n### Type  \nThese types are supported.  \n- int32  \n- float32  \n- string  \n\nThe other types are NOT supported.  \n\n### Message or Bundle  \nOnly OSC Message is implemented.  \nOSC Bundle is NOT supported.  \n\n## Install  \n\n```bash\ngo get github.com/AkiyukiOkayasu/osc\n```\n\n  \n## Usage example  \n\n### Send  \n```Go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/AkiyukiOkayasu/osc\"\n)\n\nconst (\n\tip      string = \"127.0.0.1\" // You can also use \"localhost\"\n\tport    int    = 8080\n\taddress string = \"/test\"\n)\n\nfunc main() {\n\tsender := osc.NewSender(ip, port)\n\tmessage := osc.NewMessage(address)\n\n\t// Add OSC arguments by type\n\tmessage.AddInt(123)\n\tmessage.AddFloat(3.14)\n\tmessage.AddString(\"foo\")\n\n\t// Send OSC\n\tif err := sender.Send(message); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}\n```\n\n### Receive  \n```Go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/AkiyukiOkayasu/osc\"\n)\n\nconst port int = 8080\n\nfunc main() {\n\t// context to cancel OSC receiving gorouting\n\tc := context.Background()\n\tctx, cancel := context.WithCancel(c)\n\n\t// OSC handler for /foo\n\tmux := osc.NewServeMux()\n\tmux.Handle(\"/foo\", func(m *osc.Message) {\n\t\tfmt.Println(\"OSC Address: \" + m.Address())\n\t\tfor _, a := range m.Arguments {\n\t\t\tswitch a.Type() {\n\t\t\tcase 'i':\n\t\t\t\tif v, ok := a.Int(); ok {\n\t\t\t\t\tfmt.Printf(\"Foo Int: %d\\n\", v)\n\t\t\t\t}\n\t\t\tcase 'f':\n\t\t\t\tif v, ok := a.Float(); ok {\n\t\t\t\t\tfmt.Printf(\"Foo Float: %3f\\n\", v)\n\t\t\t\t}\n\t\t\tcase 's':\n\t\t\t\tif v, ok := a.String(); ok {\n\t\t\t\t\tfmt.Println(\"Foo String: \" + v)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"Unexpected type: %v\\n\", a.Type())\n\t\t\t}\n\t\t}\n\t})\n\n\t// Another OSC handler for /bar\n\tmux.Handle(\"/bar\", func(m *osc.Message) {\n\t\tfmt.Println(\"OSC Address: \" + m.Address())\n\t\tfor _, a := range m.Arguments {\n\t\t\tswitch a.Type() {\n\t\t\tcase 'i':\n\t\t\t\tif v, ok := a.Int(); ok {\n\t\t\t\t\tfmt.Printf(\"Bar Int: %d\\n\", v)\n\t\t\t\t}\n\t\t\tcase 'f':\n\t\t\t\tif v, ok := a.Float(); ok {\n\t\t\t\t\tfmt.Printf(\"Bar Float: %3f\\n\", v)\n\t\t\t\t}\n\t\t\tcase 's':\n\t\t\t\tif v, ok := a.String(); ok {\n\t\t\t\t\tfmt.Println(\"Bar String: \" + v)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"Unexpected type: %v\\n\", a.Type())\n\t\t\t}\n\t\t}\n\t})\n\n\tr := osc.NewReceiver(port, *mux)\n\tgo r.Receive(ctx) // Start OSC receiving\n\n\t// Something to do...\n\ttime.Sleep(30 * time.Second) // Sleep 30 seconds\n\n\tcancel() // Stop receiving OSC\n}\n```\n\n## Command line OSC tool  \n\ngosc is a command line tool to send OSC.  \n\n### Send  \n```bash\ngosc send localhost 8080 /test 123 3.14 foo\n```\nAny number of OSC arguments can be added.  \nType is automatically determined (int32, float32, string only).  \n\n## Contribution  \n\nContributions are welcome.  \nPlease send a pull request if you have any ideas.  \n\n## LICENSE  \n\nApache 2.0  \n[LICENSE](LICENSE)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiyukiokayasu%2Fosc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakiyukiokayasu%2Fosc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakiyukiokayasu%2Fosc/lists"}