{"id":16473686,"url":"https://github.com/guumaster/go-tts","last_synced_at":"2025-03-01T10:31:17.538Z","repository":{"id":52379211,"uuid":"244190339","full_name":"guumaster/go-tts","owner":"guumaster","description":"A golang CLI wrapper over Google Translate TTS service.","archived":false,"fork":false,"pushed_at":"2022-08-13T12:28:12.000Z","size":20,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T12:27:27.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/guumaster.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":"2020-03-01T17:11:59.000Z","updated_at":"2023-08-23T13:01:38.000Z","dependencies_parsed_at":"2022-08-26T03:32:03.539Z","dependency_job_id":null,"html_url":"https://github.com/guumaster/go-tts","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fgo-tts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fgo-tts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fgo-tts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guumaster%2Fgo-tts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guumaster","download_url":"https://codeload.github.com/guumaster/go-tts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":220040692,"owners_count":16587225,"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-10-11T12:27:52.351Z","updated_at":"2024-10-17T10:57:47.951Z","avatar_url":"https://github.com/guumaster.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub Release](https://img.shields.io/github/release/guumaster/go-tts.svg?logo=github\u0026labelColor=262b30)](https://github.com/guumaster/go-tts/releases)\n[![Go Report Card](https://goreportcard.com/badge/github.com/guumaster/go-tts)](https://goreportcard.com/report/github.com/guumaster/go-tts)\n[![License](https://img.shields.io/github/license/guumaster/go-tts)](https://github.com/guumaster/go-tts/LICENSE)\n\n# Go-TTS\n\nThis CLI is just a wrapper on Google Translate that can play TTS audio files in all languages that are supported on the web.\n\nSome languages are available for translation but not for TTS, so those would fail. Don't now which ones, I didn't go through the whole list.\n\nAlthough it didn't fail while it was under development, it may fail randomly if you abuse it.\n\n* [Module docs](https://pkg.go.dev/github.com/guumaster/go-tts@v1.0.0/pkg/tts?tab=doc)\n\n## Prerequisites\n\nThis program should be cross-platform. Uses [hajimehoshi/oto](https://github.com/hajimehoshi/oto) to play sounds, so it has the same requirements:\n\n * _macOS_: `AudioToolbox.framework` required (automatically linked).\n * _Linux_: libasound2-dev required. (`apt install libasound2-dev`)\n * _FreeBSD_: OpenAL required. (`pkg install openal-soft`)\n * _OpenBSD_: OpenAL required. (`pkg_add -r openal`)\n\nI've only tested on Linux. Open [an issue](https://github.com/guumaster/go-tts/issues/new) if you found any.\n\n\n## Installation\n\n### Install binary directly\n\n**IMPORTANT NOTE**: _Binaries are compiled manually for linux. I cannot make `goreleaser` work with CGO_ENABLED.\n\nFeel free to change the path from `/usr/local/bin`, just make sure `go-tts` is available on your `$PATH` (check with `go-tts -h`).\n\n#### Linux\n\n```\n$ curl -sfL https://raw.githubusercontent.com/guumaster/go-tts/master/install.sh | bash -s -- -b /usr/local/bin\n```\n\nDepending on the path you choose, it may need `sudo`\n```\n$ curl -sfL https://raw.githubusercontent.com/guumaster/go-tts/master/install.sh | sudo bash -s -- -b /usr/local/bin\n```\n\n\n### Release page download\n\nGo to the [Release page](https://github.com/guumaster/go-tts/releases) and pick one.\n\n\n### With Go tools\n```\ngo get -u github.com/guumaster/go-tts\n\n```\n\n## Module Usage\n\n```\n    package main\n\n    import (\n        \"fmt\"\n        \"github.com/guumaster/go-tts/pkg/tts\"\n    )\n\n    func main() {\n        t := tts.NewGoogleTTS()\n        opts := *SayOptions{}\n\n        defer t.Close()\n\n        err := t.Say(\"it\" \"questo programma è fantastico\", opts)\n        if err != nil {\n            panic(err)\n        }\n\n        // Other languages and options examples:\n\n        t.MustSay(\"zh-CN\", \"我喜欢它\", \u0026tts.SayOptions{Slow: true})\n        t.MustSay(\"my\", \"ကိုယ်ကြိုက်တယ်\", opts)\n        t.MustSay(\"bn\", \"আমি এটা ভালোবাসি\", opts)\n        t.MustSay(\"de\", \"ich liebe es\", opts)\n        t.MustSay(\"ar\", \"احب هذا\", opts)\n        t.MustSay(\"en\", \"I love it\", opts)\n        t.MustSay(\"ja\", \"大好きです\", opts)\n        t.MustSay(\"tr\", \"onu seviyorum\", opts)\n        t.MustSay(\"es\", \"Me encanta\", \u0026tts.SayOptions{Slow: true})\n        t.MustSay(\"it\", \"Lo adoro\", opts)\n\n        // Save a specific translation\n        err := tts.Save(\"en\", \"A locally saved file\", \"/tmp/myfile.mp3\", opts)\n        if err != nil {\n            panic(err)\n        }\n    }\n\n    // Output:\n    // will play audios for every string you pass to Say() or MustSay() and a\n    // file called /tmp/myfile.mp3 will be created.\n\n```\n\n## CLI Usage\n\nYou can pass arguments:\n\n```\n$\u003e go-tts --slow --lang \"it\" \"questo programma è fantastico\"\n// Output:\n// will play an audio for \"this program is amazing\" in italian\n```\n\nOr echo from other commands:\n```\n$\u003e echo \"che! esto es buenísimo pibe\\!\" | go-tts --lang \"es-AR\"\n// Output:\n// will play an audio for \"hey! this is great dude!\" in argentinian\n```\n\n\n## CLI Options\n\n```\n\tUSAGE:\n\t   go-tts \u003cTEXT_TO_SAY\u003e\n\t   echo \"TEXT_TO_SAY\" | go-tts\n\n\tVERSION:\n\t   dev\n\n\tAUTHOR:\n\t   guumaster \u003cguuweb@gmail.com\u003e\n\n\tCOMMANDS:\n\t   help, h  Shows a list of commands or help for one command\n\n\tGLOBAL OPTIONS:\n\t   --slow, -s     play audio slower (default: false)\n\t   --no-cache     don't use file cache (default: false)\n\t   --help, -h     show help (default: false)\n\t   --version, -v  print the version (default: false)\n```\n\n ## Languages\n\n The language parameter must be a `ISO-639` compilant string. Ex: \"es\", \"en\", \"kn\", \"zh-CN\", etc.\n If you use an unknown language, it will fail:\n\n ```\n$\u003e go-tts --lang \"klingon\" \"hello unknown world?\"\n// Output:\nlanguage: tag is not well-formed\n```\n\n\n## Dependencies\n\n * Uses [gosimple/slug](https://github.com/gosimple/slug) to calc cache key\n * Uses [hajimehoshi/oto](https://github.com/hajimehoshi/oto) to play audio files\n * Uses [tosone/minimp3](https://github.com/tosone/minimp3) to decode MP3 files\n * Uses [urfave/cli/v2](https://github.com/urfave/cli/v2) to run as CLI\n\n\n## Acknowledgements\n\nThis is loosely based on [hegedustibor/htgo-tts](https://github.com/hegedustibor/htgo-tts), but without depending on mplayer, and with a better cache implementation.\n\n\n## License\n\n[MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguumaster%2Fgo-tts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguumaster%2Fgo-tts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguumaster%2Fgo-tts/lists"}