Hi everyone, i'm getting this warning when trying ...
# agents
a
Hi everyone, i'm getting this warning when trying to play a custom WAV as thinking sound and no sound is heard:
Copy code
{
  "message": "AudioMixer: stream <async_generator object BackgroundAudioPlayer._play_task.<locals>._gen_wrapper at 0x7fa9854a9e00> timeout, ignoring",
  "level": "WARNING",
  "name": "livekit",
  "room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_So2CP",
  "agent": "",
  "pid": 100,
  "job_id": "AJ_bQjNigvfFuLw",
  "timestamp": "2025-09-10T21:05:27.456500+00:00"
}
i've increased the timeout to 400ms though still happens, what could it be? the audio is 3sec long
r
What is the format of the audio in the wav?
a
Copy code
afinfo src/assets/thinking.wav                                                                                       
File:           src/assets/thinking.wav
File type ID:   WAVE
Num Tracks:     1
----
Data format:     1 ch,  24000 Hz, Int16
                no channel layout.
estimated duration: 3.612583 sec
audio bytes: 173404
audio packets: 86702
bit rate: 384000 bits per second
packet size upper bound: 2
maximum packet size: 2
audio data file offset: 78
optimized
source bit depth: I16
----
r
Can you resample to 48K and see if that helps
something like this
ffmpeg -i src/assets/thinking.wav -ar 48000 src/assets/thinking_48k.wav
a
trying that
still having the same issue
g
Does an mp3 do the same thing?
a
mp3 doesnt work neither, i tried a shorter wav too and same result 🥲
g
Hmm
r
What version of agents are you using?
pip list |grep livekit
a
Copy code
livekit                                  1.0.12
livekit-agents                           1.2.8
livekit-api                              1.0.5
livekit-blingfire                        1.0.0
livekit-plugins-noise-cancellation       0.2.5
livekit-plugins-openai                   1.2.8
livekit-protocol                         1.0.5
a
you mean playing that mp3? i can't use
session.say
because i use the openai realtime model
r
No I mean the entire example
a
im running it in dev mode but it throws
No such file or directory
, i need to fully deploy it to make it work?
r
Do you have the audio in same directory as the agent file?
a
yes
r
Can I see you logs
a
Copy code
uv run python src/pre_roll_audio_agent.py dev                                                                         ato-agent-livekit  system 17:38:10
2025-09-10 17:38:16,504 - DEBUG asyncio - Using selector: KqueueSelector 
2025-09-10 17:38:16,505 - DEV  livekit.agents - Watching /Users/sitokazu/Ato/ato-agent-livekit/src 
2025-09-10 17:38:17,138 - DEBUG asyncio - Using selector: KqueueSelector 
2025-09-10 17:38:17,142 - INFO livekit.agents - starting worker {"version": "1.2.8", "rtc-version": "1.0.12"}
2025-09-10 17:38:17,142 - INFO livekit.agents - starting inference executor 
2025-09-10 17:38:17,148 - INFO livekit.agents - initializing process {"pid": 31846, "inference": true}
2025-09-10 17:38:17,793 - DEBUG livekit.agents - initializing inference runner {"runner": "lk_end_of_utterance_multilingual", "pid": 31846, "inference": true}
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
2025-09-10 17:38:19,782 - DEBUG livekit.agents - inference runner initialized {"runner": "lk_end_of_utterance_multilingual", "elapsed_time": 1.9890908747911453, "pid": 31846, "inference": true}
2025-09-10 17:38:19,783 - INFO livekit.agents - process initialized {"pid": 31846, "inference": true, "elapsed_time": 2.63}
2025-09-10 17:38:19,782 - DEBUG asyncio - Using selector: KqueueSelector {"pid": 31846, "inference": true}
2025-09-10 17:38:20,332 - INFO livekit.agents - registered worker {"id": "AW_eF9DAyW4M8k2", "url": "wss://ato-wvgfdbfw.livekit.cloud", "region": "US East B", "protocol": 16}
2025-09-10 17:38:27,696 - INFO livekit.agents - received job request {"job_id": "AJ_rkj6NKbNuuMe", "dispatch_id": "", "room_name": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "agent_name": "", "resuming": false}
2025-09-10 17:38:27,802 - INFO livekit.agents - initializing process {"pid": 31876}
2025-09-10 17:38:29,041 - INFO livekit.agents - process initialized {"pid": 31876, "elapsed_time": 1.24}
2025-09-10 17:38:29,041 - DEBUG asyncio - Using selector: KqueueSelector {"pid": 31876}
2025-09-10 17:38:29,199 - DEBUG livekit.agents - input stream attached {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "participant": null, "source": "SOURCE_UNKNOWN", "accepted_sources": ["SOURCE_MICROPHONE"], "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:29,209 - ERROR livekit.agents - Error in _audio_forwarding_task
Traceback (most recent call last):
  File "/Users/sitokazu/Ato/ato-agent-livekit/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sitokazu/Ato/ato-agent-livekit/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py", line 284, in _audio_forwarding_task
    async for frame in tts_output:
    ...<23 lines>...
            out.first_frame_fut.set_result(None)
  File "/Users/sitokazu/Ato/ato-agent-livekit/src/pre_roll_audio_agent.py", line 61, in load_audio_file
    with open(file_path, "rb") as f:
         ~~~~^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'pre_roll_audio.mp3' {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:30,529 - DEBUG livekit.agents - using audio io: `RoomIO` -> `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:30,529 - DEBUG livekit.agents - using transcript io: `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:30,530 - DEBUG livekit.agents - start reading stream {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "participant": "device-492b0ce9-97d8-44cc-8d0b-a07d7a20214f", "source": "SOURCE_MICROPHONE", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:33,564 - WARNING livekit.agents - _SegmentSynchronizerImpl text marked as ended in capture text, rotating segment {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:33,591 - INFO livekit.agents - TTS metrics {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "ttfb": 1.3364082910120487, "audio_duration": 1.55, "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:34,820 - INFO livekit.agents - TTS metrics {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "ttfb": 1.125156749971211, "audio_duration": 2.94, "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
^C2025-09-10 17:38:40,912 - INFO livekit.agents - shutting down worker {"id": "AW_eF9DAyW4M8k2"}
2025-09-10 17:38:40,914 - INFO livekit.agents - process exiting {"reason": "", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:40,914 - DEBUG livekit.agents - shutting down job task {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "reason": "", "user_initiated": false, "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:40,916 - DEBUG livekit.agents - stream closed {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "participant": "device-492b0ce9-97d8-44cc-8d0b-a07d7a20214f", "source": "SOURCE_MICROPHONE", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
2025-09-10 17:38:41,024 - INFO basic-agent - Usage: UsageSummary(llm_prompt_tokens=0, llm_prompt_cached_tokens=0, llm_input_audio_tokens=0, llm_completion_tokens=0, llm_output_audio_tokens=0, tts_characters_count=64, tts_audio_duration=4.484, stt_audio_duration=0.0) {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_bYFMy", "pid": 31876, "job_id": "AJ_rkj6NKbNuuMe"}
r
I just tried the code with 1.2.8 and it is working fine for me
Oh! You are not in the directory with the python and audio files 🙂
uv run python src/pre_roll_audio_agent.py dev
This works for me:
Copy code
> ls 
closed.mp3		pre_roll_audio_agent.py	pre_roll_audio.mp3
(.venv) cwlk pre_roll_audio_file % python pre_roll_audio_agent.py dev
You can probably just move the audio files up one directory so they are in the folder you are running from
a
i've copied the files into my project and just installed the missing dependencies btw my folder structure is: -src/ -- pre_roll_audio_agent.py -- pre_roll_audio.mp3 -- closed.mp3
that's why i run it with:
uv run python src/pre_roll_audio_agent.py dev
am i breaking something by doing that?
r
the code is expecting audio files in current diretory
a
oh i get, there it works when cd-ing
src
r
Here is an updated version that is less sensitive to where you run from
a
so the issue is the folder of the assets?
aaa thank you will try that @refined-appointment-81829
r
Yes, this error was was saying it could not find the file:
FileNotFoundError: [Errno 2] No such file or directory: 'pre_roll_audio.mp3'
a
it worked 🙌 thank you @refined-appointment-81829
🎉 2