EdmundC

frontend

Oct 11th, 2024
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.26 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <meta charset="UTF-8">
  5.   <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.   <title>Synth App</title>
  7.   <script>
  8.     function sendForm() {
  9.       const title = document.getElementById("title").value;
  10.       const bpm = document.getElementById("bpm").value;
  11.       const voicePath = document.getElementById("voice-path").value;
  12.       const melody = document.getElementById("melody").value;
  13.       const microtones = document.getElementById("microtones").value;
  14.       const data = { title, bpm, voicePath, melody, microtones };
  15.  
  16.       fetch('/submit', {
  17.         method: 'POST',
  18.         headers: { 'Content-Type': 'application/json' },
  19.         body: JSON.stringify(data)
  20.       }).then(response => response.json()).then(result => {
  21.         console.log(result);
  22.       });
  23.     }
  24.  
  25.     function downloadVoice() {
  26.       const url = document.getElementById("voice-url").value;
  27.       const link = document.createElement("a");
  28.       link.href = url;
  29.       link.download = url.split('/').pop();
  30.       link.click();
  31.     }
  32.   </script>
  33. </head>
  34. <body>
  35.   <h1>Welcome to Synth App</h1>
  36.  
  37.   <!-- Title input -->
  38.   <label for="title">Piece Title:</label>
  39.   <input type="text" id="title" placeholder="Enter title">
  40.   <br>
  41.  
  42.   <!-- BPM input -->
  43.   <label for="bpm">BPM:</label>
  44.   <input type="text" id="bpm" placeholder="Enter BPM">
  45.   <br>
  46.  
  47.   <!-- Voice file download -->
  48.   <label for="voice-url">Voice Download URL:</label>
  49.   <input type="text" id="voice-url" placeholder="Enter URL to download voice">
  50.   <button onclick="downloadVoice()">Download Voice</button>
  51.   <br>
  52.  
  53.   <!-- Voice file path -->
  54.   <label for="voice-path">Voice File Path:</label>
  55.   <input type="text" id="voice-path" placeholder="Enter voice file path">
  56.   <br>
  57.  
  58.   <!-- Melody input -->
  59.   <label for="melody">Melody:</label>
  60.   <input type="text" id="melody" placeholder="Enter melody (e.g., Bb 1/4 C 1/4)">
  61.   <br>
  62.  
  63.   <!-- Microtones input -->
  64.   <label for="microtones">Microtones:</label>
  65.   <input type="text" id="microtones" placeholder="e.g., 300hz 1/8">
  66.   <br>
  67.  
  68.   <!-- Submit button -->
  69.   <button onclick="sendForm()">Submit</button>
  70.  
  71.   <h2>Options</h2>
  72.   <button>Add Voice</button>
  73.   <button>Edit Melody</button>
  74. </body>
  75. </html>
  76.  
Add Comment
Please, Sign In to add comment