Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Simplest way to send parameters from html form to node.js script on same server

Do I need express or is there a simpler way I can pass these 3 values to my node.js script on the same server? Please use examples to explain as I am completely new to programming.

<head>
  <script type="text/javascript" src="ttsForm.js"></script>
</head>
<body>
  <form name="ttsForm" action="javascript:ttsForm()">
      <p>Filename: <input type="text" name="filename" value="">.wav</p>
      <p>
          <select name="voice">
              <option value="en-US-AmberNeural">Amber</option>
              <option value="en-US-AriaNeural">Aria</option>
          </select>
      </p>
      <p><textarea type="text" name="script" rows="20" cols="100"></textarea></p>
      <input type="submit" value="Send" />
  </form>
</body>

This is going to Azure to translate from text to speech:

function ttsForm() {
    const sdk = require("microsoft-cognitiveservices-speech-sdk");
    const key = 'somekey';
    const region = 'myregion';
//    var filename = document.getElementsByName('filename')[0].value;
//    var voice = document.getElementsByName('voice')[0].value;
//    var script = document.getElementsByName('script')[0].value;
    var audioConfig = sdk.AudioConfig.fromAudioFileOutput(filename);
    const speechConfig = sdk.SpeechConfig.fromSubscription(key, region);
//    speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
    var synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);
    synthesizer.speakTextAsync(script,
        function (result) {
      if (result.reason === sdk.ResultReason.SynthesizingAudioCompleted) {
        console.log("synthesis finished.");
      } else {
        console.error("Speech synthesis canceled, " + result.errorDetails);
      }
      synthesizer.close();
      synthesizer = undefined;
    },
        function (err) {
      console.trace("err - " + err);
      synthesizer.close();
      synthesizer = undefined;
    });
    console.log("Now synthesizing to: " + filename);
};
ttsForm();
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!