DJ automation, that uses ChatGPT to generate a DJ intro

I miss the good old radio DJs from my youth. So I made one

alias: Privative Radio God
description: PRG a radio DJ that uses AI to announce current song
trigger:
  - platform: state
    entity_id:
      - media_player.living_room_speakers_2
    attribute: media_title
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - action: conversation.process
    metadata: {}
    data:
      agent_id: conversation.chatgpt
      conversation_id: PrimativeRadioGod
      text: >-
        You are a radio dj. In 60 words or less, Please announce the next song
        and give some interesting facts about the song. The next song is
        {{state_attr('media_player.living_room_speakers_2', 'media_title')}} by
        {{state_attr('media_player.living_room_speakers_2', 'media_artist')}}
    response_variable: PrimativeRadioGod
  - action: tts.speak
    metadata: {}
    data:
      cache: true
      media_player_entity_id: media_player.living_room_speakers_2
      message: "{{PrimativeRadioGod.response.speech.plain.speech}}"
    target:
      entity_id: tts.piper
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
mode: single

I would like to figure out how to cross fade into songs, and perhaps even play the DJ over the last 10 seconds of the previous song. So it all feels more natural and seamless.

Media players are all Music Assistant, TTS is using Piper, and Conversation agent is ChatGPT 4.0

Oh I also toggle the automation with a Aqara cube :slight_smile:

1 Like