This message was deleted.
# helpdesk
s
This message was deleted.
d
Example session id:
RM_4M8qLETVuMur
@boundless-energy-78552 hoping you can help 🙂
d
Hey @dazzling-processor-54786 , are you using the Python SDK? How are you publishing the track? You can ignore the STUN ping failures. The fact that you do see
TRACK_PUBLISH_REQUESTED
means the client is able to connect, but we did not receive any bytes for the tracks. For audio, you'd have to send us a bit of data for the server to be able to pick it up.
We are improving this requirement though.. so it won't be required in the future.. but if you can share a bit of code, that'd be helpful to see what's happening
d
Okay awesome, thanks @dry-elephant-14928. Yep using the Python SDK, I presume I'm just not enabling the microphone correctly / I'm configuring the track wrong. Here's some code! You can see I've commented out how I intuitively thought the API would work, but couldn't find a good example in the docs. How do I actually enable the microphone and stream out the audio using the python SDK once connected?
p
maybe you need to do run_until_complete?
Copy code
asyncio.get_event_loop().run_until_complete(handle_join_room())
hard to say without seeing the full code
d
@dazzling-processor-54786 are you trying to have it publish the microphone on the user's device? I'm afraid we haven't added media device support yet. Currently the Python SDK is being used for publishing synthesized audio.
👍 3
d
Sorted, thank you! I just needed to actually handle the publishing of frames with this code from one of your examples:
Copy code
sync def publish_frames(source: rtc.AudioSource, frequency: int):
    print('publishing frames')
    amplitude = 32767  # for 16-bit audio
    samples_per_channel = 480  # 10ms at 48kHz
    time = np.arange(samples_per_channel) / SAMPLE_RATE
    total_samples = 0
    audio_frame = rtc.AudioFrame.create(SAMPLE_RATE, NUM_CHANNELS, samples_per_channel)
    audio_data = np.frombuffer(audio_frame.data, dtype=np.int16)
    while True:
        time = (total_samples + np.arange(samples_per_channel)) / SAMPLE_RATE
        sine_wave = (amplitude * np.sin(2 * np.pi * frequency * time)).astype(np.int16)
        np.copyto(audio_data, sine_wave)
        await source.capture_frame(audio_frame)
        total_samples += samples_per_channel
🙌 1
I'm afraid we haven't added media device support yet. Currently the Python SDK is being used for publishing synthesized audio.
Just to confirm -- this means I would need to use something like PyAudio to read the audio and then pipe that into AudioFrames?
👍 1
b
Yes exactly
👍 1
d
Perf, you don't happen to have an example handy do you? Getting an input overflow error with my implementation, no stress if not I can debug 🙂
b
No sorry I don’t have one, maybe @powerful-garage-56223 ?
p
nope but can you share what you’ve got and we can see if there’s anyhing obvious
d
message has been deleted
This is the error:
Copy code
line 570, in read
    return pa.read_stream(self._stream, num_frames,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno -9981] Input overflowed
b
Are you using the remix_and_resample fnc?
d
Nope, should I be?
Okay, I think I've solved the overflow problem. Still working through some other issues so might reply here in a bit, appreciate the help 🙌
Theo sorted me, thanks 🚀
❤️ 1