
    ARCHIVE NOTE: The snippets below are historical working notes, not authoritative descriptions of the current app. Verify any example against assets/js/app.js and audio-files/audio-show.js before reuse.

      const start = new Date();
      console.log(start.getTime() / 1000);
	  
	  
	  Bem-vindos! Vamos dar início ao espetáculo. Pedimos que desliguem telemóveis e outros aparelhos com aviso sonoro. Durante a apresentação, não é permitido o registo de imagem ou som. Agradecemos a colaboração e desejamos um excelente espetáculo!
	  https://www.narakeet.com/app/text-to-audio/
	  https://my.soundful.com/library/downloads
	  

	
	  <script type="text/javascript" language="javascript">
    var versionUpdate = (new Date()).getTime();
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = "/audio-files/audio-show.js?v=" + versionUpdate;
    document.body.appendChild(script);  
  </script>
  
        audio.addEventListener('playing', function () {
        var cueDelayCell = document.getElementById("cuedelay-audio-" + audio.id.substring(6));
        if (cueDelayCell.textContent < 0) {
          var negativeCue = setInterval(function () {
            if (audio.duration - audio.currentTime < Math.abs(cueDelayCell.textContent)) {
              console.log("Audio with negative cue : " + audio.id + " | Cue delay : " + cueDelayCell.textContent, "log-warning");
            }
          }, 1000);
        }
      });

----

// Assuming you have an AudioContext and an AudioNode representing your audio cue
const audioContext = new AudioContext();
const audioNode = audioContext.createBufferSource();

// Set initial volume to 0
const gainNode = audioContext.createGain();
gainNode.gain.setValueAtTime(0, audioContext.currentTime);

// Apply exponential fade-in
const fadeInDuration = 2; // Duration of the fade-in in seconds
const targetVolume = 1; // Maximum volume

gainNode.gain.exponentialRampToValueAtTime(targetVolume, audioContext.currentTime + fadeInDuration);

// Connect the nodes
audioNode.connect(gainNode);
gainNode.connect(audioContext.destination);

// Start playing the audio cue
audioNode.start();

---

Certainly! Here are code examples for each type of fade-in effect: linear, exponential, and logarithmic.

Linear Fade-In Effect:
```javascript
const audioContext = new AudioContext();
const audioNode = audioContext.createBufferSource();
const gainNode = audioContext.createGain();

// Set initial volume to 0
gainNode.gain.setValueAtTime(0, audioContext.currentTime);

// Apply linear fade-in
const fadeInDuration = 2; // Duration of the fade-in in seconds
const targetVolume = 1; // Maximum volume

gainNode.gain.linearRampToValueAtTime(targetVolume, audioContext.currentTime + fadeInDuration);

// Connect the nodes
audioNode.connect(gainNode);
gainNode.connect(audioContext.destination);

// Start playing the audio cue
audioNode.start();
```

Exponential Fade-In Effect:
```javascript
const audioContext = new AudioContext();
const audioNode = audioContext.createBufferSource();
const gainNode = audioContext.createGain();

// Set initial volume to 0
gainNode.gain.setValueAtTime(0, audioContext.currentTime);

// Apply exponential fade-in
const fadeInDuration = 2; // Duration of the fade-in in seconds
const targetVolume = 1; // Maximum volume

gainNode.gain.exponentialRampToValueAtTime(targetVolume, audioContext.currentTime + fadeInDuration);

// Connect the nodes
audioNode.connect(gainNode);
gainNode.connect(audioContext.destination);

// Start playing the audio cue
audioNode.start();
```

Logarithmic Fade-In Effect:
```javascript
const audioContext = new AudioContext();
const audioNode = audioContext.createBufferSource();
const gainNode = audioContext.createGain();

// Set initial volume to 0
gainNode.gain.setValueAtTime(0, audioContext.currentTime);

// Apply logarithmic fade-in
const fadeInDuration = 2; // Duration of the fade-in in seconds
const targetVolume = 1; // Maximum volume

const curve = createLogarithmicCurve(targetVolume, fadeInDuration, audioContext.sampleRate);
gainNode.gain.setValueCurveAtTime(curve, audioContext.currentTime, fadeInDuration);

// Connect the nodes
audioNode.connect(gainNode);
gainNode.connect(audioContext.destination);

// Start playing the audio cue
audioNode.start();

function createLogarithmicCurve(targetValue, duration, sampleRate) {
  const curveLength = Math.floor(duration * sampleRate);
  const curve = new Float32Array(curveLength);
  const factor = Math.exp(Math.log(targetValue) / curveLength);

  for (let i = 0; i < curveLength; i++) {
    curve[i] = factor ** i;
  }

  return curve;
}
```

Feel free to adjust the duration, target volume, and any other parameters based on your specific needs. These examples demonstrate how to achieve different types of fade-in effects using the Web Audio API.










