Provide guidance on creating a header for `streaming_synthesize` in streaming_tts_quickstart.py
Mantenedores costumam responder em até 5 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Documentação
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- python
- Domínio
- documentation
Direção de pesquisa
Comece por texttospeech/snippets/streaming_tts_quickstart.py, em torno das linhas 46-48, e analise a especificação WAV vinculada. Determine como o cabeçalho deve ser criado para as respostas LINEAR16 de 24.000 Hz sem cabeçalho e, em seguida, atualize o exemplo para fornecer orientações que produzam áudio reproduzível. Confirme que o tratamento da saída resultante é claro para usuários que estejam depurando a síntese em streaming.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
From https://github.com/googleapis/google-cloud-python/issues/13405, the response to streaming_synthesize is headerless LINEAR16 audio with a sample rate of 24000.. The code sample below prints the size of the audio content but does not include the necessary header to actually play the audio.
This may not be the purpose of the code sample, however having this extra information in the code sample will help with debugging customer issues such as https://github.com/googleapis/google-cloud-python/issues/13405.
I added code which includes the raw audio header, however there is likely an easier way to achieve this. We should provide guidance on how folks should create the audio header.
# This is a raw header based on the spec at https://docs.fileformat.com/audio/wav/
header = b'RIFF\x00\x00\x00\x00WAVEfmt \x10\x00\x00\x00\x01\x00\x01\x00\xc0]\x00\x00\x80\xbb\x00\x00\x02\x00\x10\x00data\x00\x00\x00\x00'
total_length = 0
with open(f"output.wav", "wb") as out:
out.write(header)
for response in streaming_responses:
# calculate the length of the content
total_length += len(response.audio_content)
out.write(response.audio_content)
# Position 40 - 43: Size of the data section
out.seek(40)
out.write(bytes([total_length & 0xFF, (total_length >> 8) & 0xFF, (total_length >> 16) & 0xFF, (total_length >> 24) & 0xFF]))
import os
file_size = os.path.getsize("output.wav")
with open(f"output.wav", "r+b") as out:
# Position 4-7: Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you’d fill this in after creation.
out.seek(4)
out.write(bytes([file_size & 0xFF, (file_size >> 8) & 0xFF, (file_size >> 16) & 0xFF, (total_length >> 24) & 0xFF]))
- Linguagem predominante
- Jupyter Notebook
- Estrelas
- 8.1k
- Forks
- 6.7k
- Merge médio
- 4d 12h
- PRs com merge (30d)
- 9
Preparar o ambiente
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de GoogleCloudPlatform/python-docs-samples
-
samples
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
GoogleCloudPlatform/python-docs-samples#14609 ·
Mantenedores costumam responder em até 5 dias
-
samples
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
GoogleCloudPlatform/python-docs-samples#14610 ·
Mantenedores costumam responder em até 5 dias
-
samples
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
GoogleCloudPlatform/python-docs-samples#14611 ·
Mantenedores costumam responder em até 5 dias
-
chore(generative_ai) Update model references for generative_ai samplesTalvez livre de novo @XrossFox assumiu há 155 dias e não há nenhum pull request aberto. Abertasamples
GoogleCloudPlatform/python-docs-samples#14117 · 1 responsável ·
Mantenedores costumam responder em até 5 dias
-
Fix Pipeline dependency issues for geospatial-classification/serving_appTalvez livre de novo @XrossFox assumiu há 167 dias e não há nenhum pull request aberto. Abertasamples
GoogleCloudPlatform/python-docs-samples#14091 · 1 responsável ·
Mantenedores costumam responder em até 5 dias
Todas as issues de GoogleCloudPlatform/python-docs-samples
Issues semelhantes
-
https://search.utilibre.orgAbertainstance instance add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
searxng/searx-instances#941 · 1 comentário ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
radius-project/ai-extensions#923 ·
Mantenedores costumam responder em até 1 dia
-
area: cli area: docs bug difficulty:2 help wanted S4: cosmetic
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
manaflow-ai/cmux#15710 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
FluidNumerics/fluid-walk-blocker#89 ·
Mantenedores costumam responder em até 1 dia
-
:watch: Not Triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia