{"id":18918182,"url":"https://github.com/perfectmemory/azure_stt","last_synced_at":"2025-07-07T02:39:39.421Z","repository":{"id":38819204,"uuid":"377872148","full_name":"PerfectMemory/azure_stt","owner":"PerfectMemory","description":"API Wrapper for the Microsoft Azure Speech Services Speech-to-text REST API 3.1 (Cognitive Services).","archived":false,"fork":false,"pushed_at":"2023-05-10T12:49:20.000Z","size":232,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-26T20:07:37.138Z","etag":null,"topics":["azure","ruby","speech-to-text"],"latest_commit_sha":null,"homepage":"https://perfectmemory.github.io/azure_stt/","language":"Ruby","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/PerfectMemory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-17T15:09:20.000Z","updated_at":"2024-01-16T14:11:00.000Z","dependencies_parsed_at":"2023-02-09T02:45:37.215Z","dependency_job_id":null,"html_url":"https://github.com/PerfectMemory/azure_stt","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectMemory%2Fazure_stt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectMemory%2Fazure_stt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectMemory%2Fazure_stt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectMemory%2Fazure_stt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectMemory","download_url":"https://codeload.github.com/PerfectMemory/azure_stt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223668005,"owners_count":17182855,"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":["azure","ruby","speech-to-text"],"created_at":"2024-11-08T10:30:06.734Z","updated_at":"2024-11-08T10:30:08.407Z","avatar_url":"https://github.com/PerfectMemory.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# azure_stt\n\n[![Gem Version](https://badge.fury.io/rb/azure_stt.svg)](https://badge.fury.io/rb/azure_stt)\n[![CI](https://github.com/PerfectMemory/azure_stt/actions/workflows/ci.yml/badge.svg)](https://github.com/PerfectMemory/azure_stt/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/PerfectMemory/azure_stt/badge.svg)](https://coveralls.io/github/PerfectMemory/azure_stt)\n[![Maintainability](https://api.codeclimate.com/v1/badges/375190d3122da56a9fe1/maintainability)](https://codeclimate.com/github/PerfectMemory/azure_stt/maintainability)\n\nAPI Wrapper for the [Microsoft Azure Speech Services Speech-to-text REST API 3.1](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/rest-speech-to-text) (Cognitive Services).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'azure_stt'\n```\n\nAnd then execute:\n\n```bash\nbundle\n```\n\nOr install it yourself as:\n\n```bash\ngem install azure_stt\n```\n\n## Azure Speech-to-text Subscription key\n\nTo be able to use the gem, you must have a subscription key.\nYou can generate one on your Azure account.\n\n* If you don't have an Azure account, you can create one for free on [this page](https://azure.microsoft.com/en-us/free/).\n* Once logged on your [Azure portal](https://portal.azure.com/), subscribe to Speech in Microsoft Cognitive Services.\n* You will find two subscription keys available in 'RESOURCE MANAGEMENT \u003e Keys' ('KEY 1' and 'KEY 2').\n\n## Usage\n\n### Configuration\n\nTwo environment variables are used:\n\n- 'REGION': the region of your subscription\n\n- 'SUBSCRIPTION_KEY': the API key you can generate on your Azure account.\n\nYou can look at the file `env.sample` and change the values.\nIf you do not want to use environment variables, you can configure the values like so:\n\n```ruby\nAzureSTT.configure do |config|\n  config.region = 'your_region'\n  config.subscription_key = 'your_key'\nend\n```\n\nFinally, the class `AzureSTT::Session` uses by the default the values from the configuration, but you can initialize the session with custom values:\n\n```ruby\nsession = AzureSTT::Session.new(region: 'your_region', subscription_key: 'your_key')\n```\n\n### Start a transcription\n\n```ruby\nrequire 'azure_stt'\n\nproperties = {\n  \"diarizationEnabled\" =\u003e false,\n  \"wordLevelTimestampsEnabled\" =\u003e false,\n  \"punctuationMode\" =\u003e \"DictatedAndAutomatic\",\n  \"profanityFilterMode\" =\u003e \"Masked\"\n}\n\ncontent_urls = [ 'https://path.com/audio.ogg', 'https://path.com/audio1.ogg']\n\nsession = AzureSTT::Session.new\n\ntranscription = session.create_transcription(\n  content_urls: content_urls,\n  properties: properties,\n  locale: 'en-US',\n  display_name: 'The name of the transcription')\n\n# You can the retrieve the results of your transcription with the id\nputs transcription.id\n# Outputs 'your_transcription_id'\n\n```\n\n### Get a transcription\n\n```ruby\nrequire 'azure_stt'\n\nsession = AzureSTT::Session.new\n\ntranscription = session.get_transcription('your_transcription_id')\n\n# Returns\n# #\u003cAzureSTT::Transcription id=\"d35a802d-70ae-4358-a35d-b5faa0c75457\"\n# # model=\"\" properties={\"diarizationEnabled\"=\u003efalse,\n# # \"wordLevelTimestampsEnabled\"=\u003efalse, \"channels\"=\u003e[0, 1],\n# # \"punctuationMode\"=\u003e\"DictatedAndAutomatic\", \"profanityFilterMode\"=\u003e\"Masked\",\n# # \"duration\"=\u003e\"PT5M18S\"}\n# # links={\"files\"=\u003e\"https://uscentral.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/d35a802d-70ae-4358-a35d-b5faa0c75457/files\"}\n# # last_action_date_time=#\u003cDate: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)\u003e created_date_time=#\u003cDate: 2020-05-31 ((2459366j,0s,0n),+0s,2299161j)\u003e\n# # status=\"Succeeded\" locale=\"en-US\" display_name=\"Transcription name\" files=[]\u003e\n\nif transcription.succeeded?\n  # You can then access to the text, for instance :\n  result = transcription.results.first\n  puts result.text\nend\n```\n\n### Delete a transcription\n\n```ruby\nrequire 'azure_stt'\n\nsession = AzureSTT::Session.new\n\ntranscription = session.delete_transcription('your_transcription_id')\n```\n\nThe API doesn't seem to send 404 errors when the id is unknown, but always send a 204 response.\nSo the `Session#delete_transcription` returns `true` even when the transcription didn't exist.\n\n### Starting a transcription, fetching the results and deleting the transcription\n\n```ruby\nrequire 'azure_stt'\n\nsession = AzureSTT::Session.new\n\nproperties = {\n  \"diarizationEnabled\" =\u003e false,\n  \"wordLevelTimestampsEnabled\" =\u003e false,\n  \"punctuationMode\" =\u003e \"DictatedAndAutomatic\",\n  \"profanityFilterMode\" =\u003e \"Masked\"\n}\n\ncontent_urls = [ 'https://path.com/audio.ogg' ]\n\nsession = AzureSTT::Session.new\n\ntranscription = session.create_transcription(\n  content_urls: content_urls,\n  properties: properties,\n  locale: 'en-US',\n  display_name: 'The name of the transcription')\n\nid = transcription.id\n\nwhile(!transcription.finished?) do\n  sleep(30)\n  transcription = session.get_transcription(id)\nend\n\nif(transcription.succeeded?)\n  puts transcription.results.first.text\nend\n\nsession.delete_transcription(id)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/PerfectMemory/azure_stt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## Code of Conduct\n\nEveryone interacting in the AzureStt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/PerfectMemory/azure_stt/blob/master/CODE_OF_CONDUCT.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectmemory%2Fazure_stt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfectmemory%2Fazure_stt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectmemory%2Fazure_stt/lists"}