我想在Reactjs上从文本声音进行音频可视化,我已经使用speechSynthesis将文本转换为Speech。现在,我希望此语音以数据数组形式使用Canvas生成音频可视化栏。 请指导或您还有其他建议吗?
我已经使用voiceSynthesis将文本转换为语音,并使用来自麦克风源的阵列中的数据进行了音频可视化。现在我想要textToSpeech声音的arrayData。
//code to convert microphone audio to data array
this.audioContext = new (window.AudioContext ||
window.webkitAudioContext)();
this.analyser = this.audioContext.createAnalyser();
this.dataArray = new Uint8Array(this.analyser.frequencyBinCount);
this.source =
this.audioContext.createMediaStreamSource(this.props.audio);
this.source.connect(this.analyser);
this.rafId = requestAnimationFrame(this.tick);
//code to convert text to speech
var msg = new SpeechSynthesisUtterance();
var voices = window.speechSynthesis.getVoices();
msg.voice = voices[9];
msg.voiceURI = "native";
msg.volume = 1;
msg.rate = 1;
msg.pitch = 0.8;
msg.text = "Heloo world";
msg.lang = 'en-US';
this.setState({aud: speechSynthesis.speak(msg)})
speechSynthesis.speak(msg);
我想在数据数组中生成文本到语音的声音,以便可以制作音频 可视化。