Base64 인코딩 오디오 콘텐츠 디코딩
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
오디오 데이터는 바이너리 데이터입니다. gRPC 응답에서 직접 바이너리 데이터를 읽을 수 있지만 REST 요청에 응답할 때는 JSON이 사용됩니다. JSON은 바이너리 데이터를 직접 지원하지 않는 텍스트 형식이므로 Text-to-Speech가 Base64로 인코딩된 응답 문자열을 반환합니다. 기기에서 재생하려면 먼저 base64로 인코딩된 텍스트 데이터를 응답에서 바이너리로 변환해야 합니다.
Text-to-Speech의 JSON 응답은 base64로 인코딩된 오디오 콘텐츠를 audioContent
필드에 포함합니다. 예를 들면 다음과 같습니다.
{
"audioContent": "//NExAARqoIIAAhEuWAAAGNmBGMY4EBcxvABAXBPmPIAF//yAuh9Tn5CEap3/o..."
}
base64를 오디오 파일로 디코딩하려면 다음 안내를 따르세요.
Linux
base-64로 인코딩된 콘텐츠만 텍스트 파일에 복사합니다.
base64 명령줄 도구에서 -d
플래그를 사용하여 소스 텍스트 파일을 디코딩합니다.
$ base64 SOURCE_BASE64_TEXT_FILE -d > DESTINATION_AUDIO_FILE
Mac OSX
base-64로 인코딩된 콘텐츠만 텍스트 파일에 복사합니다.
base64 명령줄 도구를 사용하여 원본 텍스트 파일을 디코딩합니다.
$ base64 --decode -i SOURCE_BASE64_TEXT_FILE > DESTINATION_AUDIO_FILE
Windows
base-64로 인코딩된 콘텐츠만 텍스트 파일에 복사합니다.
certutil
명령어를 사용하여 원본 텍스트 파일을 디코딩합니다.
certutil -decode SOURCE_BASE64_TEXT_FILE DESTINATION_AUDIO_FILE
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-04(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Decode base64-encoded audio content\n\nAudio data is binary data. You can read the binary data directly from a gRPC\nresponse; however, JSON is used when responding to a REST request. Because JSON\nis a text format that does not directly support binary data,\nText-to-Speech returns a response string encoded in\n[Base64](https://en.wikipedia.org/wiki/Base64). You must convert the base64-encoded\ntext data from the response to binary before you can play it on a device.\n\nJSON responses from the Text-to-Speech include base64-encoded audio\ncontent in the `audioContent` field. For example: \n\n```json\n{\n \"audioContent\": \"//NExAARqoIIAAhEuWAAAGNmBGMY4EBcxvABAXBPmPIAF//yAuh9Tn5CEap3/o...\"\n}\n```\n\nTo decode base64 into an audio file: \n\n### Linux\n\n1. Copy only the base-64 encoded content into a text file.\n\n2. Decode the source text file using the base64 command line tool\n by using the `-d` flag:\n\n```bash\n $ base64 SOURCE_BASE64_TEXT_FILE -d \u003e DESTINATION_AUDIO_FILE\n```\n\n### Mac OSX\n\n1. Copy only the base-64 encoded content into a text file.\n\n2. Decode the source text file using the base64 command line tool:\n\n```bash\n $ base64 --decode -i SOURCE_BASE64_TEXT_FILE \u003e DESTINATION_AUDIO_FILE\n```\n\n### Windows\n\n1. Copy only the base-64 encoded content into a text file.\n\n2. Decode the source text file using the\n [`certutil`](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil) command.\n\n```bash\n certutil -decode SOURCE_BASE64_TEXT_FILE DESTINATION_AUDIO_FILE\n```"]]