|
380 | 380 | display: none; |
381 | 381 | } |
382 | 382 |
|
| 383 | + .home-label { |
| 384 | + color: #ccc; |
| 385 | + text-align:center; |
| 386 | + } |
| 387 | + |
383 | 388 | .fx_icon_container { |
384 | 389 | display: flex; |
385 | 390 | justify-content: space-around; /* or space-evenly */ |
386 | 391 | width: 98%; |
387 | 392 | margin: 0 auto; |
388 | 393 | padding: 5px; |
389 | 394 | } |
| 395 | + |
| 396 | + .oscilloscope-container { |
| 397 | + display: flex; |
| 398 | + justify-content: center; |
| 399 | + align-items: center; |
| 400 | + width: 100%; |
| 401 | + height: 400px; |
| 402 | + } |
| 403 | + canvas { |
| 404 | + width: 100%; |
| 405 | + height: 300px; |
| 406 | + } |
390 | 407 | </style> |
391 | 408 |
|
392 | 409 | <script> |
|
793 | 810 | midiControlChangeAssociations.set(117, { param: "CABSIM BYPASS", value: { type: "TOGGLE" } }) |
794 | 811 | midiControlChangeAssociations.set(118, { param: "TEMPO SOURCE", value: { type: "TOGGLE" } }) |
795 | 812 | midiControlChangeAssociations.set(119, { param: "TUNING REFERENCE", value: { type: "RANGE" } }) |
| 813 | + midiControlChangeAssociations.set(122, { param: "GLOBAL VOLUME", value: { type: "RANGE" } }) |
796 | 814 |
|
797 | 815 | // tap tempo |
798 | 816 | let globalTapTempo = new TapTempo(); |
799 | 817 |
|
800 | 818 | // Init web socket when the page loads |
801 | 819 | window.addEventListener('load', onload); |
802 | 820 |
|
| 821 | + // waveform display |
| 822 | + let canvas = null; |
| 823 | + let ctx = null; |
| 824 | + |
| 825 | + // Canvas dimensions |
| 826 | + let width = 0; |
| 827 | + let height = 0; |
| 828 | + |
| 829 | + // Signal parameters |
| 830 | + let time = 0; |
| 831 | + let baseAmplitude = 50; // Base amplitude for the wave |
| 832 | + const baseFrequency = 0.06; // Base frequency for the wave |
| 833 | + const speed = 0.3; // Faster animation speed |
| 834 | + const noiseLevel = 5; // Subtle noise for audio-like randomness |
| 835 | + let variationTime = 2; // For amplitude/frequency variation |
| 836 | + |
803 | 837 | function onload(event) { |
804 | 838 | // Get the element with id="defaultOpen" and click on it |
805 | 839 | document.getElementById("defaultOpen").click(); |
|
824 | 858 | populateExternalFootswitches(); |
825 | 859 | populateInternalFootswitches(); |
826 | 860 | setEffectIcons(); |
| 861 | + |
| 862 | + // draw waveform |
| 863 | + canvas = document.getElementById('oscilloscopeCanvas'); |
| 864 | + ctx = canvas.getContext('2d'); |
| 865 | + width = canvas.width; |
| 866 | + height = canvas.height; |
| 867 | + drawSignal(); |
827 | 868 | } |
828 | 869 |
|
829 | 870 | function setEffectIcons() { |
|
2967 | 3008 | setToast('Ensure mDNS/Bonjour is<br>enabled on your router<br>before applying Station Mode!'); |
2968 | 3009 | } |
2969 | 3010 | } |
| 3011 | + |
| 3012 | + function drawSignal() { |
| 3013 | + // Clear the canvas |
| 3014 | + ctx.clearRect(0, 0, width, height); |
| 3015 | + |
| 3016 | + // Draw oscilloscope grid |
| 3017 | + ctx.beginPath(); |
| 3018 | + ctx.strokeStyle = 'rgba(48, 54, 61, 0.8)'; |
| 3019 | + ctx.lineWidth = 1; |
| 3020 | + |
| 3021 | + // Horizontal lines |
| 3022 | + const numHorizontal = 5; |
| 3023 | + const horizontalSpacing = height / (numHorizontal - 1); |
| 3024 | + for (let i = 0; i < numHorizontal; i++) { |
| 3025 | + const y = i * horizontalSpacing; |
| 3026 | + ctx.moveTo(0, y); |
| 3027 | + ctx.lineTo(width, y); |
| 3028 | + } |
| 3029 | + |
| 3030 | + // Vertical lines |
| 3031 | + const numVertical = 10; |
| 3032 | + const verticalSpacing = width / (numVertical - 1); |
| 3033 | + for (let i = 0; i < numVertical; i++) { |
| 3034 | + const x = i * verticalSpacing; |
| 3035 | + ctx.moveTo(x, 0); |
| 3036 | + ctx.lineTo(x, height); |
| 3037 | + } |
| 3038 | + |
| 3039 | + ctx.stroke(); |
| 3040 | + |
| 3041 | + // Calculate varying amplitude and frequency |
| 3042 | + const amplitude = baseAmplitude * (0.5 + 0.5 * Math.sin(variationTime * 0.1)); |
| 3043 | + const frequency = baseFrequency * (0.8 + 0.4 * Math.cos(variationTime * 0.1)); |
| 3044 | + |
| 3045 | + // Draw the oscilloscope signal with fewer samples |
| 3046 | + ctx.beginPath(); |
| 3047 | + ctx.strokeStyle = '#FB9230'; // Vibrant orange waveform |
| 3048 | + ctx.lineWidth = 2; |
| 3049 | + |
| 3050 | + for (let x = 0; x < width; x += 5) { // Fewer samples with larger step size |
| 3051 | + // Combine multiple sine waves with noise for audio-like effect |
| 3052 | + const y = height / 2 + amplitude * ( |
| 3053 | + 0.6 * Math.sin(frequency * x + time) + |
| 3054 | + 0.3 * Math.sin(frequency * 2 * x + time * 0.5) + |
| 3055 | + 0.1 * Math.sin(frequency * 4 * x + time * 0.2) |
| 3056 | + ) + (Math.random() - 0.5) * noiseLevel; |
| 3057 | + ctx.lineTo(x, y); |
| 3058 | + } |
| 3059 | + |
| 3060 | + ctx.stroke(); |
| 3061 | + |
| 3062 | + // Update time for animation |
| 3063 | + time += speed; |
| 3064 | + variationTime += 0.6; // Faster variation |
| 3065 | + |
| 3066 | + // Reset amplitude periodically to simulate new audio input |
| 3067 | + if (variationTime % 100 === 0) { |
| 3068 | + baseAmplitude = 30 + Math.random() * 40; // Random amplitude between 30 and 70 |
| 3069 | + } |
| 3070 | + |
| 3071 | + // Loop the animation |
| 3072 | + requestAnimationFrame(drawSignal); |
| 3073 | + } |
2970 | 3074 | </script> |
2971 | 3075 |
|
2972 | 3076 | <nav class="navbar navbar-dark bg-dark"> |
|
2991 | 3095 | </div> |
2992 | 3096 |
|
2993 | 3097 | <div class="tab" id="MainMenu"> |
2994 | | - <button class="tablinks" onclick="openTab(event, 'NoiseGate')" id="defaultOpen">Gate</button> |
| 3098 | + <button class="tablinks" onclick="openTab(event, 'Home')" id="defaultOpen">Home</button> |
| 3099 | + <button class="tablinks" onclick="openTab(event, 'NoiseGate')">Gate</button> |
2995 | 3100 | <button class="tablinks" onclick="openTab(event, 'Compressor')">Comp</button> |
2996 | 3101 | <button class="tablinks" onclick="openTab(event, 'Equalisation')">EQ</button> |
2997 | 3102 | <button class="tablinks" onclick="openTab(event, 'Reverb')">Reverb</button> |
|
3008 | 3113 | <button class="tablinks" onclick="openTab(event, 'Miscellaneous')">Misc</button> |
3009 | 3114 | </div> |
3010 | 3115 |
|
| 3116 | + <div id="Home" class="tabcontent"> |
| 3117 | + <div class="col py-3 text-white"> |
| 3118 | + <div class="container" style="text-align: center;"> |
| 3119 | + <label class="home-label">Tonex One and Tonex Pedal Controller</label> |
| 3120 | + </div> |
| 3121 | + <div class="container" style="text-align: center;"> |
| 3122 | + <label class="home-label">Version V2.0.0.2</label> |
| 3123 | + </div> |
| 3124 | + <br> |
| 3125 | + <div class="container" style="text-align: center; color:#FB9230;"> |
| 3126 | + <label>https://github.com/Builty/TonexOneController</label> |
| 3127 | + </div> |
| 3128 | + <div class="oscilloscope-container"> |
| 3129 | + <canvas id="oscilloscopeCanvas"></canvas> |
| 3130 | + </div> |
| 3131 | + |
| 3132 | + <div class="container" style="text-align: center; color:#777;"> |
| 3133 | + <label>TONEX is a registered trademark of IK Multimedia Production Srl</label> |
| 3134 | + </div> |
| 3135 | + </div> |
| 3136 | + </div> |
| 3137 | + |
3011 | 3138 | <div id="NoiseGate" class="tabcontent"> |
3012 | | - <div class="col py-3 text-white"> |
| 3139 | + <div class="col py-3 text-white"> |
3013 | 3140 | <h5 class="selected_text">Noise Gate</h5> |
3014 | 3141 | <p class="lead"> |
3015 | 3142 | <div class="container"> |
|
0 commit comments