This commit is contained in:
wataru 2022-08-29 20:04:07 +09:00
parent b0c61de44a
commit a6e5d51597
5 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@
"voice_changer_server_url": "http://localhost:8080/test",
"sample_rate": 48000,
"buffer_size": 1024,
"prefix_chunk_size": 24,
"chunk_size": 24,
"speaker_ids": [100, 107, 101, 102, 103],
"speaker_names": ["ずんだもん", "user", "そら", "めたん", "つぐみ"],

1
docs/audiolet/index.js Executable file
View File

@ -0,0 +1 @@
(()=>{"use strict";class e extends AudioWorkletProcessor{initialized=!1;playBuffer=[];deltaChunkSize=24;bufferSize=1024;constructor(){super(),this.initialized=!0,this.port.onmessage=this.handleMessage.bind(this)}prevF32Data=null;handleMessage(e){if(e.data.deltaSize)return void(this.deltaChunkSize=e.data.deltaSize);const t=e.data.data,l=new Int16Array(t),n=new Float32Array(l.length);l.forEach(((e,t)=>{const l=e>=32768?-(65536-e)/32768:e/32767;n[t]=l}));let s=this.prevF32Data?this.prevF32Data.slice(this.prevF32Data.length-this.deltaChunkSize*this.bufferSize/2):null;const h=n.slice(n.length-this.deltaChunkSize*this.bufferSize*2/2,n.length-this.deltaChunkSize*this.bufferSize/2);if(s?.length!==h.length&&(s=null),s)for(let e=0;e<s.length;e++){let t=0;if(e<s.length/3)t=0;else if(e>s.length/3*2)t=1;else{const l=e-s.length/3;t=Math.min(l/(s.length/3),1)}const l=s[e]*(1-t),n=h[e]*t;h[e]=l+n}if(this.playBuffer.length>50)for(console.log("Buffer truncated");this.playBuffer.length>2;)this.playBuffer.shift();let i;for(let e=0;e<h.length;e++){const t=2*e%128;0===t&&(i=new Float32Array(128));const l=h[e],n=e+1<h.length?h[e+1]:h[e];i[t]=l,i[t+1]=(l+n)/2,i.length===t+2&&this.playBuffer.push(i)}this.prevF32Data=n}handleMessage_(e){const t=e.data.data,l=new Int16Array(t),n=new Float32Array(l.length);l.forEach(((e,t)=>{const l=e>=32768?-(65536-e)/32768:e/32767;n[t]=l}));let s=this.prevF32Data?this.prevF32Data.slice(this.prevF32Data.length/2):null;const h=n.slice(0,n.length/2);if(s?.length!==h.length&&(s=null),s)for(let e=0;e<s.length;e++){let t=0;if(e<s.length/3)t=0;else if(e>s.length/3*2)t=1;else{const l=e-s.length/3;t=Math.min(l/(s.length/100),1)}const l=s[e]*(1-t),n=h[e]*t;h[e]=l+n}if(this.playBuffer.length>100)for(console.log("Buffer truncated");this.playBuffer.length>2;)this.playBuffer.shift();let i;for(let e=0;e<h.length;e++){const t=2*e%128;0===t&&(i=new Float32Array(128));const l=h[e],n=e+1<h.length?h[e+1]:h[e];i[t]=l,i[t+1]=(l+n)/2,i.length===t+2&&this.playBuffer.push(i)}this.prevF32Data=n}process(e,t,l){if(!this.initialized)return console.log("worklet_process not ready"),!0;if(0===this.playBuffer.length)return console.log("no play buffer"),!0;const n=this.playBuffer.shift();return t[0][0].set(n),!0}}registerProcessor("voice-player-worklet-processor",e)})();

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
# 参考:https://programwiz.org/2022/03/22/how-to-write-shell-script-for-option-parsing/
DOCKER_IMAGE=dannadori/voice-changer:20220829_110113
DOCKER_IMAGE=dannadori/voice-changer:20220829_195844
TENSORBOARD_PORT=6006
VOICE_CHANGER_PORT=8080

View File

@ -1,4 +1,4 @@
FROM dannadori/voice-changer-internal:20220829_105932 as front
FROM dannadori/voice-changer-internal:20220829_195653 as front
FROM debian:bullseye-slim as base
ARG DEBIAN_FRONTEND=noninteractive