-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to stream pre-record audio file ? #10
Comments
Right now the source of the audio in the code is 60ms chunks of audio from the sound card here:
To send from a file, you'd probably want to instead use the Python wave module to read in the data from the file, and then iterate over it in 60 ms increments: First call For simplicity (least amount of code changes) you'd want the .wav file to be the same format and sampling rate as what the script is currently getting from the sound card - 16 bit mono at 16 kHz sampling rate. |
Can you provide some fully working code?
…On Sat, Jul 23, 2022, 09:59 Andy Knitt ***@***.***> wrote:
Right now the source of the audio in the code is 60ms chunks of audio from
the sound card here:
data = record(.06)
To send from a file, you'd probably want to instead use the Python wave
<https://docs.python.org/3/library/wave.html> module to read in the data
from the file, and then iterate over it in 60 ms increments:
First call zello_ws = create_zello_connection() and start_stream(zello_ws),
then iterate over the audiofile and in each iteration, encode the 60 ms
chunk to opus format and then send it using zello_ws.send_binary. Then
when done iterating over the file, call stop_stream and zello_ws.close().
For simplicity (least amount of code changes) you'd want the .wav file to
be the same format and sampling rate as what the script is currently
getting from the sound card - 16 bit mono at 16 kHz sampling rate.
—
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2F3IKJKSQCUPG546JFDRQTVVNNZZANCNFSM54MGZKCA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Thank you for wonderful code. It work perfectly. However I curious on how to let this code broadcast pre-recorded audio file?
The text was updated successfully, but these errors were encountered: