Match voice conversion pitch to reference with optional CPU correction

This commit is contained in:
Mikei386 committed 2026-10-19 14:45:44 +02:00
1 parent 04cd46e3e6
commit 369cb2ffe5
16 files changed
+408 -19

No files matched your search

+38
View File
@@ -75,3 +75,41 @@ recipe has not been accepted as a full fresh-Debian-host restore.
CC BY4.0 applies to LAION additions/weights; upstream Chatterbox MIT notices are
retained in the downloaded model's NOTICE. Dependencies keep their own licences.
## Optional reference pitch matching (Deck extension)
Stimmatelier defaults to **Tonhöhe automatisch an Referenz anpassen** and an
additional -12..+12 semitone slider (0.5 steps). The service API is backwards
compatible: omitted options disable correction. Optional multipart fields are
`pitch_auto=true|false` and `pitch_semitones=-12..12` (finite decimal).
Automatic correction compares the voiced median F0 of the reference and the
**converted output**, not gender labels or a fixed female pitch. A constant
semitone shift then changes the output's pitch, preserving its relative contour.
Manual shift is added to the automatic value; the total is clamped to ±12.
Own helper `humaneness_pitch.py` runs CPU-only in the already pinned Humaneness
venv. pYIN (librosa1.0.0,16kHz,60–650Hz,1024/256 samples) uses the RMS-filtered voiced HMM track for the median, with at least12
frames of posterior≥0.1 as a separate confidence gate (to avoid vowel-selection
bias from retaining only high-posterior frames). Unreliable
or silent clips produce a visible warning and skip only the automatic part.
FFmpeg `rubberband=tempo=1:formant=preserved:pitchq=quality` applies the change;
`apad,atrim` and an exact frame-count check preserve the converted WAV length.
No extra GPU, models, container or network service. An isolated Numba cache in
`humaneness-runtime/numba-cache` is reconstructible. The first run can take longer.
Correction is separately cancellable as part of the same job (180s CPU deadline).
Native Debian: install the distribution's `ffmpeg` package with librubberband
support (`ffmpeg -hide_banner -filters | grep rubberband`); the pinned Python
runtime already includes librosa, numba, numpy and soundfile. Missing filter or
worker errors fail the requested corrected job explicitly rather than returning
an uncorrected file as success. No in-place modification of upstream inference
code or weights. Job metadata includes measured F0, requested/applied shift and
warnings; `pitch.json` is included with the existing encrypted job backup.
Update/recovery: rebuild Deck and Stimmatelier from the saved revisions, rebuild
the venv from the lock if needed; old calls without options retain old behavior.
No new private configuration or credentials; raw reference/source cleanup remains.
Pitch matching is DSP, not a guarantee of perceived identity or perfect prosody.
RMS envelopes and word boundaries may change slightly; large shifts can sound
artificial. It preserves duration exactly, not every individual waveform sample
or silence edge. Only recorded acceptance below supports deployed measurements.
+1 -1
View File
@@ -15,7 +15,7 @@ import urllib.request
ROOT = Path(__file__).resolve().parent.parent
LABEL = 'de.casaderoll.athena-deck.standalone'
FILES = ['humaneness.py','humaneness_runtime.py','deploy/humaneness/bootstrap.py','deploy/humaneness/assets.json','deploy/humaneness/upstream-requirements.txt','deploy/humaneness/requirements.lock','deploy/humaneness/component-assets.json','deploy/humaneness/README.md','stimmatelier_proxy.py','qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
FILES = ['humaneness_pitch.py','humaneness.py','humaneness_runtime.py','deploy/humaneness/bootstrap.py','deploy/humaneness/assets.json','deploy/humaneness/upstream-requirements.txt','deploy/humaneness/requirements.lock','deploy/humaneness/component-assets.json','deploy/humaneness/README.md','stimmatelier_proxy.py','qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
FILES += ['soulx_singer.py','soulx_singer_runtime.py','soulx-singer-ui.js','deploy/prepare_soulx_singer.py']
+13
View File
@@ -149,3 +149,16 @@ WAV successfully. This is one controlled clip, not broad quality acceptance or
proof of identical prosody. Real user microphone acceptance remains pending.
Use **Letzte Umwandlung anzeigen** to recover the latest completed conversion
for the selected profile after reload; source/reference uploads are not restored.
### Automatic reference pitch and manual shift
Humaneness mode has **Tonhöhe automatisch an Referenz anpassen** (on by default)
and an additional ±12-semitone slider in0.5 steps. Deck measures voiced median
pitch in the target reference and converted output, then applies formant-preserving
Rubber Band on CPU. Automatic+manual total is capped at±12. Duration is unchanged;
large changes can cause artifacts and exact subjective voice identity is not
promised. Insufficient voiced speech produces a visible warning and leaves only
the manual adjustment active. The result panel reports the actual applied shift.
These controls use optional `pitch_auto`/`pitch_semitones` multipart API fields.
No new container or model; native dependency/restore details in Deck's runtime
recipe. No settings/recordings stored in browser persistent storage.
+4 -4
View File
@@ -3,7 +3,7 @@ const $=id=>document.getElementById(id);let profiles=[],sttId=null,busy=false,re
async function api(path,body){const opts=body?{method:'POST',headers:{'X-Athena-Deck':'1'},body:body instanceof FormData?body:JSON.stringify(body)}:{};if(body&&!(body instanceof FormData))opts.headers['Content-Type']='application/json';const r=await fetch('/api/v1/'+path,opts);if(r.status===401)throw Error('Bitte zuerst in Athena Deck anmelden und diese Seite neu laden.');const d=await r.json();if(!r.ok)throw Error(typeof d.error==='string'?d.error:d.error?.message||'Anfrage fehlgeschlagen.');return d;}
function error(e){$('error').textContent=e.message||String(e);$('error').hidden=false;}
function selected(){return profiles.find(p=>p.id===$('profile').value);}
function update(){const p=selected(),cpu=p?.kind==='audio',vc=p?.model?.repo==='laion/Humaneness-Voice-Converter';$('model-note').textContent=vc?'Echte Voice Conversion · GPU · Quelle und Zielstimme, ohne Transkription. Sprechweise bleibt möglichst erhalten; keine Garantie für jedes Detail. Quelle und Referenz jeweils 1–30 Sekunden. Strata wird bei Bedarf regulär entladen.':cpu?'0,6B Q8 · CPU · Strata kann geladen bleiben. Eigene Referenzen übernehmen die Stimmfarbe.':'1,7B Base · GPU · Deck entlädt Strata regulär vor der Ausgabe. Mit Referenztranskript kann Qwen auch die Sprechweise besser übernehmen.';$('latest').hidden=!vc;$('latest').disabled=busy||!!recording;if(!source)$('source-name').textContent=vc?'Bis 30 Sekunden':'Bis 120 Sekunden';$('reference-text').disabled=cpu||vc;$('reference-text').hidden=vc;$('reference-text').previousElementSibling.hidden=vc;$('text').hidden=vc;document.querySelector('label[for="text"]').hidden=vc;$('text').nextElementSibling.hidden=vc;$('text-tab').hidden=vc;$('transcribe').hidden=vc;$('generate').innerHTML=vc?'Stimme umwandeln <span>↗</span>':'Sprache erzeugen <span>↗</span>';if(vc){$('source-panel').hidden=false;$('audio-tab').setAttribute('aria-selected','true');$('text-tab').setAttribute('aria-selected','false');}$('source-panel').querySelector('.hint').textContent=vc?'Originalaufnahme hochladen oder einsprechen. Humaneness wandelt sie direkt in die Referenzstimme um; Text und STT werden nicht benötigt. Bis 30 Sekunden.':'WAV hochladen oder aufnehmen. Danach den erkannten Text prüfen. Timing und Betonung der Originalaufnahme werden nicht exakt übernommen.';$('reference-name').textContent=reference?reference.name:cpu?'Gespeicherte Standardstimme aus Deck':vc?'Bitte eine Zielreferenz hinzufügen':'Für 1,7B bitte eine Referenz hinzufügen';$('count').textContent=$('text').value.length+' / 1000';$('generate').disabled=busy||!!recording||!p||(vc?!source:(!$('text').value.trim()||$('text').value.length>1000))||(!cpu&&!reference);$('transcribe').disabled=busy||!!recording||!source||!sttId;$('profile').disabled=busy||!!recording||!profiles.length;}
function update(){const p=selected(),cpu=p?.kind==='audio',vc=p?.model?.repo==='laion/Humaneness-Voice-Converter';$('model-note').textContent=vc?'Echte Voice Conversion · GPU · Quelle und Zielstimme, ohne Transkription. Sprechweise bleibt möglichst erhalten; keine Garantie für jedes Detail. Quelle und Referenz jeweils 1–30 Sekunden. Strata wird bei Bedarf regulär entladen.':cpu?'0,6B Q8 · CPU · Strata kann geladen bleiben. Eigene Referenzen übernehmen die Stimmfarbe.':'1,7B Base · GPU · Deck entlädt Strata regulär vor der Ausgabe. Mit Referenztranskript kann Qwen auch die Sprechweise besser übernehmen.';$('pitch-controls').hidden=!vc;$('pitch-auto').disabled=busy||!!recording;$('pitch-semitones').disabled=busy||!!recording;$('latest').hidden=!vc;$('latest').disabled=busy||!!recording;if(!source)$('source-name').textContent=vc?'Bis 30 Sekunden':'Bis 120 Sekunden';$('reference-text').disabled=cpu||vc;$('reference-text').hidden=vc;$('reference-text').previousElementSibling.hidden=vc;$('text').hidden=vc;document.querySelector('label[for="text"]').hidden=vc;$('text').nextElementSibling.hidden=vc;$('text-tab').hidden=vc;$('transcribe').hidden=vc;$('generate').innerHTML=vc?'Stimme umwandeln <span>↗</span>':'Sprache erzeugen <span>↗</span>';if(vc){$('source-panel').hidden=false;$('audio-tab').setAttribute('aria-selected','true');$('text-tab').setAttribute('aria-selected','false');}$('source-panel').querySelector('.hint').textContent=vc?'Originalaufnahme hochladen oder einsprechen. Humaneness wandelt sie direkt in die Referenzstimme um; Text und STT werden nicht benötigt. Bis 30 Sekunden.':'WAV hochladen oder aufnehmen. Danach den erkannten Text prüfen. Timing und Betonung der Originalaufnahme werden nicht exakt übernommen.';$('reference-name').textContent=reference?reference.name:cpu?'Gespeicherte Standardstimme aus Deck':vc?'Bitte eine Zielreferenz hinzufügen':'Für 1,7B bitte eine Referenz hinzufügen';$('count').textContent=$('text').value.length+' / 1000';$('generate').disabled=busy||!!recording||!p||(vc?!source:(!$('text').value.trim()||$('text').value.length>1000))||(!cpu&&!reference);$('transcribe').disabled=busy||!!recording||!source||!sttId;$('profile').disabled=busy||!!recording||!profiles.length;}
function progress(message){$('error').hidden=true;$('empty').hidden=true;$('result').hidden=true;$('progress').hidden=false;$('status').textContent=message;}
function done(){busy=false;$('progress').hidden=true;if($('result').hidden)$('empty').hidden=false;update();}
async function poll(path,id){const deadline=Date.now()+1200000;while(Date.now()<deadline){await new Promise(r=>setTimeout(r,600));const d=await api(path),j=d.job;if(!j||j.id!==id)throw Error('Dieser Auftrag ist nicht mehr aktuell. Ein anderer Auftrag hat den Status ersetzt.');$('status').textContent=j.phase||'Athena arbeitet …';if(j.state==='complete')return j;if(j.state!=='running')throw Error(j.phase||'Auftrag beendet.');}throw Error('Zeitlimit überschritten. Den Auftrag in Deck prüfen.');}
@@ -12,11 +12,11 @@ async function setAudio(kind,blob){const audio=await normalize(blob,kind==='refe
for(const kind of ['reference','source']){$(kind+'-file').onchange=async e=>{try{if(e.target.files[0])await setAudio(kind,e.target.files[0]);}catch(e){error(e);}};$(kind+'-record').onclick=async()=>{try{if(recording){if(recording.kind===kind)recording.recorder.stop();return;}if(busy)return;if(!window.isSecureContext||!navigator.mediaDevices?.getUserMedia)throw Error('Mikrofon benötigt HTTPS. Bitte das Studio über Athena Deck öffnen.');const stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:false,noiseSuppression:false,autoGainControl:false}});const type=['audio/webm;codecs=opus','audio/mp4'].find(t=>MediaRecorder.isTypeSupported(t));const recorder=new MediaRecorder(stream,type?{mimeType:type}:{}),chunks=[];recording={kind,recorder};const label=$(kind+'-record').textContent;$(kind+'-record').textContent='■ Aufnahme stoppen';let timer;recorder.ondataavailable=e=>{if(e.data.size)chunks.push(e.data);};recorder.onerror=()=>{stream.getTracks().forEach(t=>t.stop());clearTimeout(timer);recording=null;$(kind+'-record').textContent=label;error(Error('Aufnahme fehlgeschlagen.'));update();};recorder.onstop=async()=>{clearTimeout(timer);stream.getTracks().forEach(t=>t.stop());recording=null;$(kind+'-record').textContent=label;try{await setAudio(kind,new Blob(chunks,{type:recorder.mimeType}));}catch(e){error(e);}update();};recorder.start();timer=setTimeout(()=>{if(recorder.state==='recording')recorder.stop();},(kind==='reference'||selected()?.model?.repo==='laion/Humaneness-Voice-Converter'?29:119)*1000);update();}catch(e){error(e);}};}
$('reference-reset').onclick=()=>{if(busy)return;reference=null;$('reference-file').value='';$('reference-preview').hidden=true;$('reference-reset').hidden=true;update();};
for(const [id,show] of [['text-tab',false],['audio-tab',true]])$(id).onclick=()=>{$('text-tab').setAttribute('aria-selected',String(!show));$('audio-tab').setAttribute('aria-selected',String(show));$('source-panel').hidden=!show;};
$('profile').onchange=update;$('text').oninput=update;
$('pitch-semitones').oninput=()=>{$('pitch-value').textContent=(Number($('pitch-semitones').value)>0?'+':'')+$('pitch-semitones').value;};$('profile').onchange=update;$('text').oninput=update;
$('transcribe').onclick=async()=>{busy=true;update();progress('Aufnahme wird lokal transkribiert …');try{const f=new FormData();f.set('file',source,'aufnahme.wav');f.set('profile_id',sttId);f.set('language','de');const j=await api('stt/start',f),r=await poll('stt',j.id);$('text').value=r.text||'';if($('text').value.length>1000)throw Error('Das Transkript ist länger als 1000 Zeichen. Bitte den Text vor der Ausgabe kürzen.');}catch(e){error(e);}finally{done();}};
async function waveform(blob){const ctx=new AudioContext();try{const b=await ctx.decodeAudioData(await blob.arrayBuffer()),a=b.getChannelData(0),canvas=$('waveform'),c=canvas.getContext('2d');c.clearRect(0,0,600,120);c.strokeStyle='#bd5433';c.lineWidth=2;for(let x=0;x<300;x++){const start=Math.floor(x*a.length/300),end=Math.floor((x+1)*a.length/300);let peak=0;for(let i=start;i<end;i++)peak=Math.max(peak,Math.abs(a[i]));c.beginPath();c.moveTo(x*2,60-peak*52);c.lineTo(x*2,60+peak*52);c.stroke();}}finally{await ctx.close();}}
async function showResult(path,j,p){const url='/api/v1/'+path+'/audio?id='+encodeURIComponent(j.id);const response=await fetch(url);if(!response.ok)throw Error('Die fertige Ausgabe konnte nicht geladen werden.');const blob=await response.blob();if(outputUrl)URL.revokeObjectURL(outputUrl);outputUrl=URL.createObjectURL(blob);$('output').src=outputUrl;$('download').href=url;$('result-meta').textContent=p.name+' · '+(j.source_duration?'Quelle '+Number(j.source_duration).toFixed(2)+'s · Ausgabe ':'')+(j.duration?Number(j.duration).toFixed(j.source_duration?2:1)+' Sekunden · ':'')+'WAV';$('result').hidden=false;await waveform(blob);}
async function showResult(path,j,p){const url='/api/v1/'+path+'/audio?id='+encodeURIComponent(j.id);const response=await fetch(url);if(!response.ok)throw Error('Die fertige Ausgabe konnte nicht geladen werden.');const blob=await response.blob();if(outputUrl)URL.revokeObjectURL(outputUrl);outputUrl=URL.createObjectURL(blob);$('output').src=outputUrl;$('download').href=url;$('result-meta').textContent=p.name+' · '+(j.source_duration?'Quelle '+Number(j.source_duration).toFixed(2)+'s · Ausgabe ':'')+(j.duration?Number(j.duration).toFixed(j.source_duration?2:1)+' Sekunden · ':'')+'WAV'+(j.pitch?' · Tonhöhe '+(j.pitch.applied_semitones>0?'+':'')+j.pitch.applied_semitones+' Halbtöne':'');if(j.pitch?.warnings?.length)error(Error(j.pitch.warnings.join(' ')));$('result').hidden=false;await waveform(blob);}
$('latest').onclick=async()=>{busy=true;update();progress('Letzte Umwandlung wird geladen …');try{const j=(await api('conversion')).job,p=selected();if(!j||j.profile_id!==p.id||j.state!=='complete')throw Error('Keine fertige Umwandlung für dieses Profil verfügbar.');await showResult('conversion',j,p);}catch(e){error(e);}finally{done();}};
$('generate').onclick=async()=>{busy=true;update();progress('Deine Stimme wird vorbereitet …');const p=selected(),cpu=p.kind==='audio',vc=p.model.repo==='laion/Humaneness-Voice-Converter',path=vc?'conversion':cpu?'qwen-native':'voice';try{const f=new FormData();f.set('profile_id',p.id);if(vc){f.set('source',source,'source.wav');f.set('reference',reference,'reference.wav');}else{f.set('text',$('text').value);f.set('language','German');if(reference)f.set('file',reference,'reference.wav');}if(cpu)f.set('speaker','default');else if(!vc){f.set('device','3060');f.set('reference_text',$('reference-text').value);}const j=await api(path+'/start',f),r=await poll(path,j.id);await showResult(path,r,p);}catch(e){error(e);}finally{done();}};
$('generate').onclick=async()=>{busy=true;update();progress('Deine Stimme wird vorbereitet …');const p=selected(),cpu=p.kind==='audio',vc=p.model.repo==='laion/Humaneness-Voice-Converter',path=vc?'conversion':cpu?'qwen-native':'voice';try{const f=new FormData();f.set('profile_id',p.id);if(vc){f.set('pitch_auto',String($('pitch-auto').checked));f.set('pitch_semitones',$('pitch-semitones').value);f.set('source',source,'source.wav');f.set('reference',reference,'reference.wav');}else{f.set('text',$('text').value);f.set('language','German');if(reference)f.set('file',reference,'reference.wav');}if(cpu)f.set('speaker','default');else if(!vc){f.set('device','3060');f.set('reference_text',$('reference-text').value);}const j=await api(path+'/start',f),r=await poll(path,j.id);await showResult(path,r,p);}catch(e){error(e);}finally{done();}};
async function init(){try{const [d,policy]=await Promise.all([api('profiles'),api('audio-policy')]);profiles=d.profiles.filter(p=>p.runnable&&(p.model?.repo==='laion/Humaneness-Voice-Converter'||(p.kind==='audio'&&p.model?.repo==='Serveurperso/Qwen3-TTS-GGUF')||(p.kind==='voice'&&p.model?.repo==='Qwen/Qwen3-TTS-12Hz-1.7B-Base'))).sort((a,b)=>(a.kind==='audio'?-1:1)-(b.kind==='audio'?-1:1));const stts=d.profiles.filter(p=>p.kind==='stt'&&p.runnable);sttId=stts.find(p=>p.id===policy.settings.stt.profile_id)?.id||stts[0]?.id;$('profile').replaceChildren(...profiles.map(p=>new Option(p.name,p.id)));if(!profiles.length)throw Error('Kein ausführbares Qwen-Profil gefunden. Bitte in Deck einrichten.');update();}catch(e){error(e);}}
init();
+1 -1
View File
@@ -2,5 +2,5 @@
<header><a href="/#services" class="back">← Athena Deck</a><span class="tag">QWEN & VOICE CONVERSION</span><span class="privacy">● Lokal auf Athena</span></header>
<main><div class="hero"><div><p class="eyebrow">DEINE WORTE. DEINE ZIELSTIMME.</p><h1>Stimmatelier<span>.</span></h1><p class="intro">Texte sprechen lassen. Deine Aufnahmen mit neuer Stimme hören.</p></div><div class="soundmark" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div></div>
<div class="layout"><section class="inputs"><article class="card"><div class="section-title"><span class="number">01</span><h2>Modell & Zielstimme</h2></div><label for="profile">Stimmprofil</label><select id="profile" disabled><option>Profile werden geladen …</option></select><p id="model-note" class="hint"></p><div class="reference"><div class="row"><h3>Referenzstimme</h3><span class="badge">WAV · 1–30 Sekunden</span></div><p class="hint">Eine klare, ruhige Aufnahme der gewünschten Stimme. Sie bestimmt den Klang, nicht den zu sprechenden Text.</p><label class="upload" for="reference-file">Referenz-WAV auswählen<input id="reference-file" type="file" accept=".wav,audio/wav"></label><div class="mic-row"><button id="reference-record" type="button" class="secondary">● Referenz aufnehmen</button><span id="reference-name" class="hint">Gespeicherte Standardstimme aus Deck</span></div><audio id="reference-preview" controls hidden></audio><button id="reference-reset" class="text-button" type="button" hidden>Referenz entfernen</button><label for="reference-text">Transkript der Referenz <span class="muted">optional · für 1,7B</span></label><textarea id="reference-text" rows="2" placeholder="Was wird in deiner Referenzaufnahme gesagt?"></textarea></div></article>
<article class="card"><div class="section-title"><span class="number">02</span><h2>Was soll gesprochen werden?</h2></div><div class="tabs" role="tablist" aria-label="Quelle"><button role="tab" id="text-tab" aria-selected="true">Text schreiben</button><button role="tab" id="audio-tab" aria-selected="false">Aufnahme verwenden</button></div><div id="source-panel" hidden><p class="hint">WAV hochladen oder aufnehmen. Danach den erkannten Text prüfen. Timing und Betonung der Originalaufnahme werden nicht exakt übernommen.</p><label class="upload" for="source-file">Sprach-WAV auswählen<input id="source-file" type="file" accept=".wav,audio/wav"></label><div class="mic-row"><button id="source-record" type="button" class="secondary">● Sprache aufnehmen</button><span id="source-name" class="hint">Bis 120 Sekunden</span></div><audio id="source-preview" controls hidden></audio><button id="transcribe" type="button" class="secondary" disabled>Aufnahme in Text umwandeln</button></div><label for="text">Text für die Ausgabe</label><textarea id="text" rows="7" maxlength="1000" placeholder="Schreibe hier deinen Text oder übernimm ihn aus einer Aufnahme …"></textarea><div class="row"><span class="hint">Deutsch · Ausgabe als WAV</span><span id="count" class="hint">0 / 1000</span></div><button id="generate" class="primary" disabled>Sprache erzeugen <span>↗</span></button><button id="latest" type="button" class="secondary" hidden>Letzte Umwandlung anzeigen</button><p id="error" role="alert" class="error" hidden></p></article></section>
<article class="card"><div class="section-title"><span class="number">02</span><h2>Was soll gesprochen werden?</h2></div><div class="tabs" role="tablist" aria-label="Quelle"><button role="tab" id="text-tab" aria-selected="true">Text schreiben</button><button role="tab" id="audio-tab" aria-selected="false">Aufnahme verwenden</button></div><div id="source-panel" hidden><p class="hint">WAV hochladen oder aufnehmen. Danach den erkannten Text prüfen. Timing und Betonung der Originalaufnahme werden nicht exakt übernommen.</p><label class="upload" for="source-file">Sprach-WAV auswählen<input id="source-file" type="file" accept=".wav,audio/wav"></label><div class="mic-row"><button id="source-record" type="button" class="secondary">● Sprache aufnehmen</button><span id="source-name" class="hint">Bis 120 Sekunden</span></div><audio id="source-preview" controls hidden></audio><button id="transcribe" type="button" class="secondary" disabled>Aufnahme in Text umwandeln</button></div><label for="text">Text für die Ausgabe</label><textarea id="text" rows="7" maxlength="1000" placeholder="Schreibe hier deinen Text oder übernimm ihn aus einer Aufnahme …"></textarea><div class="row"><span class="hint">Deutsch · Ausgabe als WAV</span><span id="count" class="hint">0 / 1000</span></div><div id="pitch-controls" hidden><label class="pitch-toggle"><input id="pitch-auto" type="checkbox" checked> Tonhöhe automatisch an Referenz anpassen</label><label for="pitch-semitones">Zusätzliche Tonhöhe: <output id="pitch-value">0</output> Halbtöne</label><input id="pitch-semitones" type="range" min="-12" max="12" step="0.5" value="0"><p class="hint">Automatik gleicht die mittlere Tonhöhe an die Zielstimme an. Der Regler verschiebt zusätzlich nach oben oder unten. Dauer und Tempo bleiben gleich; die Gesamtkorrektur ist auf ±12 Halbtöne begrenzt. Große Änderungen können künstlich klingen.</p></div><button id="generate" class="primary" disabled>Sprache erzeugen <span>↗</span></button><button id="latest" type="button" class="secondary" hidden>Letzte Umwandlung anzeigen</button><p id="error" role="alert" class="error" hidden></p></article></section>
<aside><article class="card output"><div class="section-title"><span class="number">03</span><h2>Deine Ausgabe</h2></div><div id="empty"><div class="empty-icon" aria-hidden="true">◉</div><h3>Hier bekommt dein Text eine Stimme.</h3><p>Wähle ein Profil, ergänze deine Zielstimme und starte die Erzeugung.</p></div><div id="progress" hidden><span class="spinner"></span><p id="status" role="status">Wird vorbereitet …</p><small>Du kannst diese Seite geöffnet lassen. Athena verarbeitet den Auftrag lokal.</small></div><div id="result" hidden><span class="success">FERTIG ZUM ANHÖREN</span><canvas id="waveform" width="600" height="120" aria-label="Wellenform der erzeugten Sprache"></canvas><audio id="output" controls></audio><a id="download" class="download" download="stimmatelier.wav">WAV herunterladen ↓</a><p id="result-meta" class="hint"></p></div></article><p class="footnote">Referenzaufnahmen werden nur für den Auftrag an Deck übertragen und anschließend aus dessen Arbeitsdateien entfernt. Ausgaben bleiben in Deck verfügbar. Keine Cloud-Dienste, keine zusätzlichen Modellkopien.</p></aside></div></main><footer>STIMMATELIER <span>Deine Worte. Deine Sprechweise. Deine Zielstimme.</span></footer></body></html>
+2
View File
@@ -1 +1,3 @@
:root{color-scheme:light;--bg:#f4f2ec;--ink:#252b28;--muted:#6f7770;--accent:#bd5433;--line:#dedfd5;--green:#48755c}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}header,main,footer{max-width:1240px;margin:auto}header{display:flex;align-items:center;gap:22px;padding:28px 36px;border-bottom:1px solid var(--line)}a{color:inherit;text-decoration:none}.back{font-size:13px;color:var(--muted)}.tag,.eyebrow,.success{font-size:10px;font-weight:750;letter-spacing:2px}.tag{border-left:1px solid var(--line);padding-left:22px}.privacy{margin-left:auto;color:var(--green);font-size:12px}.hero{display:flex;align-items:center;justify-content:space-between;padding:48px 0 38px}.eyebrow{color:var(--accent);margin:0 0 10px}h1{font:clamp(45px,6vw,75px)/1.05 Georgia,serif;letter-spacing:-3px;margin:0 0 18px}h1 span{color:var(--accent)}.intro{color:var(--muted);max-width:500px;margin:0}.soundmark{display:flex;gap:8px;align-items:center;padding:10px 40px}.soundmark i{display:block;width:7px;height:28px;background:#c5cbbd;border-radius:20px}.soundmark i:nth-child(2n){height:62px}.soundmark i:nth-child(3n){height:100px;background:#b9c4b1}.soundmark i:nth-child(5){height:125px;background:var(--accent)}main{padding:0 36px 42px}.layout{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.85fr);gap:24px}.inputs{display:grid;gap:22px}.card{background:#fdfdf9;border:1px solid var(--line);border-radius:18px;padding:26px;box-shadow:0 4px 18px #222b2104}.section-title{display:flex;gap:12px;align-items:center;margin-bottom:22px}.number{border:1px solid #dedfd5;border-radius:50%;width:30px;height:30px;display:grid;place-items:center;font-size:11px;color:var(--muted)}h2{font-size:17px;font-weight:650;margin:0}h3{font-size:14px;font-weight:600;margin:0}label{display:block;font-size:12px;font-weight:600;margin:15px 0 8px}select,textarea{display:block;width:100%;background:#f7f8f2;border:1px solid #d9ddd2;border-radius:10px;padding:12px;color:var(--ink);font:inherit}textarea{resize:vertical;font-size:14px;line-height:1.6}textarea::placeholder{color:#959c93}select:focus,textarea:focus,button:focus-visible,a:focus-visible{outline:2px solid #bd543380;outline-offset:3px}.hint,.footnote,small{font-size:12px;color:var(--muted)}.reference{border-top:1px solid var(--line);margin-top:22px;padding-top:20px}.row,.mic-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.badge{font-size:10px;color:var(--muted);white-space:nowrap}.muted{color:var(--muted);font-weight:400}.upload{border:1px dashed #bfc8b8;border-radius:10px;padding:14px;text-align:center;background:#f6f8f1;cursor:pointer;font-size:12px}.upload input{display:block;margin:8px auto 0;max-width:100%;font-size:11px;font-weight:400}button{cursor:pointer;border:0;font:inherit}button:disabled{opacity:.45;cursor:not-allowed}.secondary{padding:9px 12px;border:1px solid #d8ddd1;border-radius:8px;background:#f6f8f1;font-size:12px;font-weight:550}.mic-row{justify-content:flex-start;flex-wrap:wrap;margin:12px 0}.text-button{background:none;color:var(--muted);padding:4px 0;font-size:11px;text-decoration:underline}audio{width:100%;height:42px;margin:12px 0}.tabs{display:flex;gap:4px;background:#edf0e7;border-radius:10px;padding:4px;margin-bottom:20px}.tabs button{flex:1;border-radius:7px;background:transparent;padding:10px;font-size:12px}.tabs [aria-selected=true]{background:#fff;box-shadow:0 1px 5px #0001}.primary{display:flex;align-items:center;justify-content:space-between;background:var(--ink);color:#fff;border-radius:10px;padding:16px 18px;width:100%;margin-top:20px;font-weight:600;font-size:13px}.primary span{font-size:20px;color:#e1b093}.error{color:#a13e30;background:#fff0ea;padding:12px;border-radius:8px;font-size:13px}.output{position:sticky;top:22px;min-height:350px}#empty{text-align:center;padding:42px 12px 25px;color:var(--muted)}.empty-icon{font-size:44px;color:#aab99e;margin-bottom:22px}#empty h3{font-family:Georgia,serif;font-size:21px;font-weight:400;color:var(--ink)}#empty p{font-size:13px;max-width:250px;margin:14px auto}.footnote{padding:0 14px;line-height:1.7}.success{color:var(--green)}canvas{width:100%;height:100px;margin-top:25px}.download{display:block;border:1px solid #ccd6c5;background:#edf3e7;border-radius:9px;text-align:center;padding:12px;font-size:12px;font-weight:650}.spinner{display:block;width:30px;height:30px;border:2px solid #e6e8de;border-top-color:var(--accent);border-radius:50%;animation:spin 1s linear infinite;margin:45px auto 20px}#progress{text-align:center}#status{font-size:14px}footer{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding:24px 36px;font-size:10px;letter-spacing:2px;color:var(--muted)}footer span{letter-spacing:0}[hidden]{display:none!important}@keyframes spin{to{transform:rotate(360deg)}}@media(max-width:750px){header{padding:20px}.tag{display:none}main{padding:0 18px 30px}.hero{padding:30Line truncated
#pitch-controls{margin:1.3rem 0;padding:1rem;border:1px solid var(--line,#ddd);border-radius:12px}#pitch-controls .pitch-toggle{display:flex;align-items:center;gap:.6rem}#pitch-auto{width:auto;accent-color:#bd5433}#pitch-semitones{width:100%;accent-color:#bd5433}