mirror of
https://github.com/w-okada/voice-changer.git
synced 2025-02-02 16:23:58 +03:00
WIP: support v1.5.x, add recording output function 2
This commit is contained in:
parent
449f5a55d1
commit
305dac7e38
2
client/demo/dist/index.js
vendored
2
client/demo/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -7,7 +7,6 @@ import { BufferSize, DefaultVoiceChangerClientSetting, Protocol, ServerSettingKe
|
||||
import MicrophoneStream from "microphone-stream";
|
||||
import { AudioStreamer, Callbacks, AudioStreamerListeners } from "./AudioStreamer";
|
||||
import { ServerConfigurator } from "./ServerConfigurator";
|
||||
import { VoiceChangerWorkletProcessorRequest } from "./@types/voice-changer-worklet-processor";
|
||||
|
||||
// オーディオデータの流れ
|
||||
// input node(mic or MediaStream) -> [vf node] -> microphne stream -> audio streamer ->
|
||||
@ -41,15 +40,7 @@ export class VoiceChangerClient {
|
||||
onVoiceReceived: (voiceChangerMode: VoiceChangerMode, data: ArrayBuffer): void => {
|
||||
// console.log(voiceChangerMode, data)
|
||||
if (voiceChangerMode === "realtime") {
|
||||
const req: VoiceChangerWorkletProcessorRequest = {
|
||||
requestType: "voice",
|
||||
voice: data,
|
||||
numTrancateTreshold: 0,
|
||||
volTrancateThreshold: 0,
|
||||
volTrancateLength: 0
|
||||
}
|
||||
|
||||
this.vcNode.postReceivedVoice(req)
|
||||
this.vcNode.postReceivedVoice(data)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,15 @@ export class VoiceChangerWorkletNode extends AudioWorkletNode {
|
||||
console.log(`[worklet_node][voice-changer-worklet-processor] created.`);
|
||||
}
|
||||
|
||||
postReceivedVoice = (req: VoiceChangerWorkletProcessorRequest) => {
|
||||
this.port.postMessage({
|
||||
request: req
|
||||
}, [req.voice]);
|
||||
postReceivedVoice = (data: ArrayBuffer) => {
|
||||
const req: VoiceChangerWorkletProcessorRequest = {
|
||||
requestType: "voice",
|
||||
voice: data,
|
||||
numTrancateTreshold: 0,
|
||||
volTrancateThreshold: 0,
|
||||
volTrancateLength: 0
|
||||
}
|
||||
this.port.postMessage(req)
|
||||
}
|
||||
|
||||
handleMessage(event: any) {
|
||||
|
@ -60,7 +60,7 @@ class VoiceChangerWorkletProcessor extends AudioWorkletProcessor {
|
||||
}
|
||||
|
||||
handleMessage(event: any) {
|
||||
const request = event.data.request as VoiceChangerWorkletProcessorRequest
|
||||
const request = event.data as VoiceChangerWorkletProcessorRequest
|
||||
if (request.requestType === "config") {
|
||||
this.numTrancateTreshold = request.numTrancateTreshold
|
||||
this.volTrancateLength = request.volTrancateLength
|
||||
|
Loading…
Reference in New Issue
Block a user