
No logro que funcione este ejemplo de generador de sonido
Publicado por José (8 intervenciones) el 22/04/2023 11:33:48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<html>
<head>
<script>
let sonidos= [131,139,147,156,165,175,185,196,208,220,233,247,262,277,294,311,330,349,370,392,415,440,466,494,523,554,587,622,659,698,740,784,831,880,932,988,1068,1119];
var context= new AudioContext();
function jsNota(frecuencia){
var o= context.createOscillator();
g=context.createGain();
o.connect(g);
o.type="sawtooth";
o.frequency.value=frecuencia;
g.connect(context.destination);
o.start(0);
g.gain.exponentialRampToValueAtTime(0.00001,context.currentTime +1.5);
}
function miSon(){
for (var i = 0; i < 39; i++) {
jsNota(sonidos[i]);
console.log(sonidos[i]);
}
}
</script>
</head>
<body onload="miSon;">
<p></p>
</body>
</html>
Valora esta pregunta


0