
    Pj0                    |   d Z ddlmZ ddlZddlZddlmZ ddlZddl	m
Z
 ej                  j                  d e ee      j                         j                   j                                 ee      j                         j                   j                   dz  ZdZdd	d
dddddddd
ZddZedk(  r e e             y)u  Generate the 5 mood reference clips Pocket TTS clones for [emotion] tags.

Jarvis can prefix a sentence with [calm]/[warm]/[excited]/[sad]/[dry]/… and have
it spoken in that tone. On the Mac (Pocket TTS) that works by *swapping the
voice-clone reference clip* per mood — but those clips have to exist. This script
renders them once with Chatterbox (which has a real emotion dial), cloning the
base Jarvis voice (voices/jarvis_ref.wav) at each mood's exaggeration level, and
writes voices/jarvis_<stem>.wav. Pocket picks them up automatically at startup.

WHERE TO RUN: the RTX/Windows box (CUDA) or this M4 (MPS) — anywhere Chatterbox
loads. It is NOT needed for tone *sensing* (that's pure-numpy, always on); it only
gives Jarvis's own spoken replies real mood on the Mac Pocket engine.

    VOICE_ENGINE=chatterbox python tools/make_mood_clips.py         # make missing
    VOICE_ENGINE=chatterbox FORCE=1 python tools/make_mood_clips.py # redo all

Stems mirror voice/tts_pocket.py:_TAG_TO_STEM. Chatterbox outputs float32 @ 24kHz.
    )annotationsN)Path)wavfilevoicesi]  zI[calm] Everything is under control, sir. There's no need to worry at all.zB[warm] Of course, sir. It's always a genuine pleasure to help you.uF   [excited] Brilliant news, sir — this is exactly what we'd hoped for!zC[sad] I'm terribly sorry, sir. I do wish I had better news for you.z9[dry] Oh, marvelous. Another meeting. How thrilling, sir.uK   [shocked] Good God, sir — you actually did it. I did not see that coming.uT   [curious] Now that is genuinely interesting. Tell me more, sir — how does it work?zF[amused] Ha. Oh, that's brilliant, sir. You really are something else.z=[annoyed] Sir. For the third time. It is not going to change.z;[tender] It's alright, sir. Take your time. I'm right here.)
calmwarmexcitedsaddryshockedcuriousamusedannoyedtenderc            	        t         j                  j                  dd       ddlm} m}  |       st        d       yt        dz  }|j                         st        d| d	       yt        j                  d
       t         j                  j                  d      dk(  } |        }d}t        j                         D ]*  \  }}t        d| dz  }|j                         r|st        d|j                   d       @|j                  |      }	|	t        |	      dk(  rt        d|j                   d       {t!        j"                  t!        j$                  |	t         j&                        dd      }	t)        j*                  t-        |      t.        |	dz  j1                  t         j2                               |dz  }t        d|j                   dt        |	      t.        z  dd       - t        d| dt         d       y)NVOICE_ENGINE
chatterboxr   )ChatterboxTTSloadablezwChatterbox can't load here (no CUDA/MPS headroom). Run this on the RTX box or an idle Mac with VOICE_ENGINE=chatterbox.   zjarvis_ref.wavzMissing base voice u    — clone Jarvis first.T)exist_okFORCE1jarvis_z.wavz  keep  z (exists; FORCE=1 to redo)z  FAIL  z (empty synth))dtypeg      g      ?i  z  wrote z  (z.1fzs)u
   
Done — z clip(s) written to z3. Restart Jarvis; Pocket TTS loads them at startup.)osenviron
setdefaultvoice.tts_chatterboxr   r   print_VOICESis_filemkdirget_MOODSitemsnamesynthlennpclipasarrayfloat32r   writestr_SRastypeint16)
r   r   refforcettsmadestemlineoutpcms
             tools/make_mood_clips.pymainr<   4   s   JJ.,7<: I 	J
$
$C;;=#C5(@ABMM4M JJNN7#s*E
/CDlln
d'$t,,;;=HSXXJ&@ABiio;#c(a-HSXXJn56ggbjjBJJ7sCc#hcEk%9%9"((%CD	
#c#hsl3%7r:; % 
Kv1' ;> > ?    __main__)returnint)__doc__
__future__r   r   syspathlibr   numpyr*   scipy.ior   pathinsertr/   __file__resolveparentr!   r0   r%   r<   __name__
SystemExit r=   r;   <module>rO      s   & # 	 
    3tH~--/66==> ?
x.
 
 
"
)
)
0
08
; \TXUK]fXOM
!H z
TV
 r=   