0

I am performing Speech to Text translation with the help of deepgram in Angular with the use of WebSocket but unable to finad an option to mention the preferred language in which I want the transcription. Can anyone help me with it?

navigator.mediaDevices.getUserMedia({ audio: true }).then((stream: MediaStream) => {
      this.mediaRecorder = new MediaRecorder(stream, {
        mimeType: 'audio/webm',
      });
    });

    this.socket = new WebSocket('wss://api.deepgram.com/v1/listen', ['token', TOKEN_KEY]);

    this.socket.onopen = () => {
      this.mediaRecorder.addEventListener('dataavailable', (event: any) => {
        this.socket.send(event.data);
      })
      this.mediaRecorder.start(250);
      this.isLive = true;
      console.log('Connection Established');
    }

    this.socket.onmessage = (message: any) => {
      const recieved = JSON.parse(message.data);
      const is_final = recieved.is_final;
      const messageFinal = recieved.channel.alternatives[0].transcript;
    }

I tried to mention it while opening a new WebSocket Connection but it didn't work.

0 Answers0