{"id":22369869,"url":"https://github.com/zeozeozeo/gaudio","last_synced_at":"2026-02-14T03:18:09.504Z","repository":{"id":65373971,"uuid":"558491935","full_name":"zeozeozeo/gaudio","owner":"zeozeozeo","description":"Pure Go audio library with a simple and easy to use API.","archived":false,"fork":false,"pushed_at":"2022-10-27T16:59:57.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-15T13:21:55.462Z","etag":null,"topics":["audio","go","golang","library","pure-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeozeozeo.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":"2022-10-27T16:49:57.000Z","updated_at":"2025-06-06T11:17:28.000Z","dependencies_parsed_at":"2023-01-20T13:20:24.190Z","dependency_job_id":null,"html_url":"https://github.com/zeozeozeo/gaudio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zeozeozeo/gaudio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fgaudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fgaudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fgaudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fgaudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeozeozeo","download_url":"https://codeload.github.com/zeozeozeo/gaudio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeozeozeo%2Fgaudio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29433304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T02:20:56.896Z","status":"ssl_error","status_checked_at":"2026-02-14T02:11:29.478Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["audio","go","golang","library","pure-go"],"created_at":"2024-12-04T19:29:31.250Z","updated_at":"2026-02-14T03:18:09.472Z","avatar_url":"https://github.com/zeozeozeo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gaudio\n\nPure Go audio library with a simple and easy to use API (inspired by [pydub](https://github.com/jiaaro/pydub))\n\n```go\nimport \"github.com/zeozeozeo/gaudio\"\n```\n\n# Supported formats\n\nAudio formats:\n\n-   MP3 ([go-mp3](https://github.com/hajimehoshi/go-mp3))\n-   FLAC ([flac](https://github.com/mewkiz/flac))\n-   WAV ([go-dsp/wav](https://github.com/mjibson/go-dsp/tree/master/wav) and [go-wav](github.com/youpy/go-wav))\n\nTracker formats:\n\n-   MOD ([gomodplay](https://github.com/zeozeozeo/gomodplay) and [Gotracker](https://github.com/gotracker/playback))\n-   XM ([Gotracker](https://github.com/gotracker/playback))\n-   S3M ([Gotracker](https://github.com/gotracker/playback))\n-   IT ([Gotracker](https://github.com/gotracker/playback))\n\n# Examples\n\n## Create a segment from path\n\n```go\nimport (\n    \"github.com/zeozeozeo/gaudio\"\n)\n\n// Create a segment from path (see supported formats)\nsegment, err := gaudio.LoadAudioFromPath(\"audio.mp3\", gaudio.FormatMP3)\nif err != nil {\n    panic(err)\n}\n```\n\n## Create a segment from a reader\n\n```go\n// Open file\nfile, err := os.Open(\"song.mp3\")\nif err != nil {\n    panic(err)\n}\ndefer file.Close()\n\n// Create a segment (see supported formats)\nsegment, err := gaudio.LoadAudio(file, gaudio.FormatMP3)\nif err != nil {\n    panic(err)\n}\n```\n\n## Overlay segment2 over segment1 at the 3rd second\n\n```go\nsegment1.Overlay(segment2, 3)\n```\n\n## Clone a segment\n\n```go\nclone := segment.Clone()\n```\n\n## Concatenate segments\n\n```go\n// Concatenate segment at the start of another segment\nsegment1.ConcatenateStart(segment2)\n\n// Concatenate segment at the end of another segment\nsegment1.ConcatenateEnd(segment2)\n\n// Concatenate segment at the specified second of another segment (3.5th second)\nsegment1.ConcatenateAtSecond(segment2, 3.5)\n```\n\n## Detect and remove silence\n\n```go\nthreshold = 0.01 // Silence threshold\n\n// Get leading and trailing silence\nleading, trailing := segment.DetectSilence(threshold)\n\n// Get leading silence\nleading := segment.DetectSilenceStart(threshold)\n\n// Get trailing silence\ntrailing := segment.DetectSilenceEnd(threshold)\n\n// Remove silence\nsegment.RemoveStartAndEndSilence(threshold)\nsegment.RemoveStartSilence(threshold)\nsegment.RemoveEndSilence(threshold)\n```\n\n## Calculate BPM (warning: can be slow)\n\n```go\n// minBpm: the minimum BPM you expect (120)\n// maxBpm: the maximum BPM you expect (200)\n// steps: the amount of steps per interval (1024)\n// samplesPerBeat: the amount of samples used for a single beat (1024)\nbpm := segment.CalcBPM(120, 200, 1024, 1024)\n```\n\n## Apply echo effect\n\n```go\n// delay: delay between echo layers (0.05)\n// layers: amount of layer (2)\nsegment.EchoEffect(0.05, 2)\n```\n\n## Pitch to note note (needs testing)\n\n```go\n// Pitch formula: 2 ** (key / 12)\nsegment.ApplyNote(12)\n```\n\n## Export a segment to a file (only wav files are supported right now)\n\n```go\nfile, err := os.Create(\"output.wav\")\nif err != nil {\n    panic(err)\n}\ndefer file.Close()\n\nsegment.Export(file, gaudio.FormatWAVE)\n```\n\n## Apply fade in / fade out effect\n\n```go\n// start float64: the amount of fade-in seconds\n// end float64: the amount of fade-out seconds\nsegment.Fade(0.5, 1) // Fade in for 0.5 seconds, fade out for 1 second\n\n// This is equal to...\nsegment.FadeIn(0.5)\nsegment.FadeOut(1)\n```\n\n## Invert phase\n\n```go\nsegment.InvertPhase()\n```\n\n## Reverse\n\n```go\nsegment.Reverse()\n```\n\n## Repeat segment n times\n\n```go\nsegment.Repeat(5)\n```\n\n## Change speed (speedup, slowdown)\n\n```go\n// Change speed by two times\nsegment.SetSpeed(2)\n\n// Slow down\nsegment.SetSpeed(0.25)\n```\n\n## Take a slice out of a segment\n\n```go\n// Take a slice from the 1st second to the 2nd second (the length of the slice will be 1 second)\nslice := segment.Slice(1, 2)\n```\n\n## Trim (cut)\n\n```go\n// Remove everything between the first second and the 1.5th second\nsegment.Trim(1, 1.5)\n\n// Remove first 3 seconds\nsegment.TrimStart(3)\n\n// Remove last 2.3 seconds\nsegment.TrimEnd(2.3)\n```\n\n## Empty segment\n\n```go\n// Sample rate, channels\ngaudio.Empty(44100, 2)\n```\n\n## Silent segment\n\n```go\n// Returns a silent segment with the length of 5.5 seconds, 44100 sample rate, and two channels\ngaudio.Silent(5.5, 44100, 2)\n```\n\n## Raw data\n\nRaw data is stored in float32 in segment.Data, and is structured like that:\n\n`[channel 1 value, channel 2 value, channel 1 value, channel 2 value, ...]`\n\n## Audio formats\n\n```go\nconst (\n\tFormatFLAC AudioFormat = 1 // .flac\n\tFormatWAVE AudioFormat = 2 // .wav\n\tFormatMP3  AudioFormat = 3 // .mp3\n\tFormatRAW  AudioFormat = 4 // Custom format\n\n\t// Tracker formats\n\tFormatMOD          AudioFormat = 5 // ProTracker .mod, rendered with gomodplay. This is faster than gotracker, but less accurate.\n\tFormatGotrackerMod AudioFormat = 6 // ProTracker .mod, rendered with Gotracker. This is slower than gomodplay, but more accurate.\n\tFormatS3M          AudioFormat = 7 // ScreamTracker III .s3m, rendered with Gotracker\n\tFormatXM           AudioFormat = 8 // FastTracker II .xm, rendered with Gotracker\n\tFormatIT           AudioFormat = 9 // ImpulseTracker .it, rendered with Gotracker\n)\n```\n\n# TODO\n\n-   Tests, benchmarks, profiling\n-   Fix speed being rounded up to integers\n-   More effects\n-   Support more formats (while staying 100% Go)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeozeozeo%2Fgaudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeozeozeo%2Fgaudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeozeozeo%2Fgaudio/lists"}