-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsynth.html
More file actions
102 lines (98 loc) · 3.54 KB
/
synth.html
File metadata and controls
102 lines (98 loc) · 3.54 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<!--
Document Type Declaration: This is the document type declaration, indicating that this is an HTML document.
-->
<html lang="en">
<!--
HTML Document: This is the root element of the HTML document, specifying the language as English.
-->
<head>
<!--
Meta Tags: These tags provide metadata about the document, such as character encoding and viewport settings.
-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
Title: This sets the title of the page, which appears in the browser's title bar and in search engine results.
-->
<title>Sound Synthesis</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<!--
Stylesheet Link: This links to an external stylesheet, which defines the visual styling of the document.
-->
<link rel="stylesheet" href="styles.css">
</head>
<!--
Body: This is the main content of the HTML document.
-->
<body>
<!-- Navigation Bar -->
<nav class="main-nav">
<div class="nav-container">
<div class="nav-logo">
<a href="index.html">Music Programming</a>
</div>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="synth.html" class="active">Synthesizer</a></li>
<li><a href="oscillation.html">Audio Effects</a></li>
<li><a href="e-sitar.html">E-Sitar</a></li>
</ul>
</div>
</nav>
<!--
Main Element: This is the main content area of the page.
-->
<main>
<!--
Heading: This is the main heading of the page.
-->
<h1>Sound Synthesis</h1>
<!--
Paragraph: This is a paragraph of text that provides a brief introduction to the page.
-->
<p>Use the controls below to set the frequency and create custom trigonometric wave functions.</p>
<!--
Controls Div: This div contains the controls for the sound synthesis.
-->
<div class="controls">
<div class="slider-container">
<label for="frequency">Frequency (Hz):</label>
<input type="range" id="frequency" min="20" max="9000" step="10" value="440">
<span id="freqValue">440 Hz</span>
</div>
<h3>Customize Wave Function</h3>
<div class="slider-container">
<label for="ampSine">Amplitude of Sine:</label>
<input type="range" id="ampSine" min="0" max="1" step="0.1" value="1">
</div>
<div class="slider-container">
<label for="ampCosine">Amplitude of Cosine:</label>
<input type="range" id="ampCosine" min="0" max="1" step="0.1" value="0">
</div>
<div class="slider-container">
<label for="ampTangent">Amplitude of Tangent:</label>
<input type="range" id="ampTangent" min="0" max="1" step="0.1" value="0">
</div>
<div class="button-container">
<button id="playBtn">Play Sound</button>
<button id="stopBtn">Stop Sound</button>
</div>
</div>
</main>
<!--
Script Tags: These tags link to external JavaScript files that provide additional functionality to the page.
-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/p5@1.4.0/lib/addons/p5.sound.min.js"></script>
<script src="synth.js"></script>
<script>
// Update frequency value display
const frequencyInput = document.getElementById('frequency');
const freqValueSpan = document.getElementById('freqValue');
frequencyInput.addEventListener('input', () => {
freqValueSpan.textContent = `${frequencyInput.value} Hz`;
});
</script>
</body>
</html>