{"id":20639079,"url":"https://github.com/korniichuk/google-speech","last_synced_at":"2025-08-24T06:33:36.251Z","repository":{"id":95417849,"uuid":"143721898","full_name":"korniichuk/google-speech","owner":"korniichuk","description":"QuickStart. Google Cloud Speech-to-Text API with Python","archived":false,"fork":false,"pushed_at":"2018-08-06T14:27:49.000Z","size":160,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T22:57:24.428Z","etag":null,"topics":["cloud-speech-api","gcp","google","google-cloud-platform","mp3","python","speech","speech-recognition","speech-to-text"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/korniichuk.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":"2018-08-06T11:55:45.000Z","updated_at":"2019-12-03T19:54:29.000Z","dependencies_parsed_at":"2023-03-13T16:49:43.132Z","dependency_job_id":null,"html_url":"https://github.com/korniichuk/google-speech","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/korniichuk/google-speech","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fgoogle-speech","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fgoogle-speech/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fgoogle-speech/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fgoogle-speech/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/korniichuk","download_url":"https://codeload.github.com/korniichuk/google-speech/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/korniichuk%2Fgoogle-speech/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271808430,"owners_count":24825483,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cloud-speech-api","gcp","google","google-cloud-platform","mp3","python","speech","speech-recognition","speech-to-text"],"created_at":"2024-11-16T15:22:19.696Z","updated_at":"2025-08-24T06:33:36.163Z","avatar_url":"https://github.com/korniichuk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QuickStart. Google Cloud Speech-to-Text API with Python\n## Check sample rate of audio (measured in Hz)\nYou must know sample rate of your audio files like 8000 Hz, 16000 Hz, etc.\u003cbr\u003e\nIn Ubuntu OS just click right button on your audio file and select `Properties--\u003eAudio--\u003eSample rate`. See image below:\n\n![file_properties.png](img/file_properties.png \"File properties\")\n\nExample: 8000 Hz sample rate of audio on image above.\n\n## Transcribe local audio file (1 minut max)\nSee [local.py](local.py) file or code below:\n```python\nimport io\n\nfrom google.cloud import speech_v1p1beta1 as speech\n\nspeech_file = 'example.mp3'\n# Encoding: https://cloud.google.com/\n# speech-to-text/docs/reference/rest/v1beta1/RecognitionConfig\nencoding=speech.enums.RecognitionConfig.AudioEncoding.AMR\nsample_rate_hertz=8000\n# Language: https://cloud.google.com/\n# speech-to-text/docs/languages\nlanguage_code='en-US'\n\nclient = speech.SpeechClient()\nwith io.open(speech_file, 'rb') as audio_file:\n    content = audio_file.read()\naudio = speech.types.RecognitionAudio(content=content)\nconfig = speech.types.RecognitionConfig(\n    encoding=encoding,\n    sample_rate_hertz=sample_rate_hertz,\n    language_code=language_code,\n    # Enhanced models are only available to projects that\n    # opt in for audio data collection.\n    use_enhanced=True,\n    # A model must be specified to use enhanced model.\n    model='phone_call',\n    profanity_filter=False,\n    enable_automatic_punctuation=True,\n    enable_word_confidence=True)\nresponse = client.recognize(config, audio)\nfor i, result in enumerate(response.results):\n    alternative = result.alternatives[0]\n    print('-' * 20)\n    print('First alternative of result {}'.format(i))\n    print('Transcript: {}'.format(alternative.transcript))\n```\n\n## Transcribe audio file from Google Storage (longer that 1 minute)\nSee [storage.py](storage.py) file or code below:\n```python\nfrom google.cloud import speech_v1p1beta1 as speech\n\nuri = 'gs://examplebucket/example.mp3'\n# Encoding: https://cloud.google.com/\n# speech-to-text/docs/reference/rest/v1beta1/RecognitionConfig\nencoding='AMR'\nsample_rate_hertz=8000\n# Language: https://cloud.google.com/\n# speech-to-text/docs/languages\nlanguage_code='en-US'\n\nclient = speech.SpeechClient()\noperation = client.long_running_recognize(\n        audio=speech.types.RecognitionAudio(uri=uri),\n        config=speech.types.RecognitionConfig(\n                encoding=encoding,\n                sample_rate_hertz=sample_rate_hertz,\n                language_code=language_code,\n                use_enhanced=True,\n                model='phone_call',\n                profanity_filter=False,\n                enable_automatic_punctuation=True,\n                enable_word_confidence=True))\nop_result = operation.result()\nfor result in op_result.results:\n    for alternative in result.alternatives:\n        print('=' * 20)\n        print(alternative.transcript)\n        print(alternative.confidence)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkorniichuk%2Fgoogle-speech","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkorniichuk%2Fgoogle-speech","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkorniichuk%2Fgoogle-speech/lists"}