-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
123 lines (113 loc) · 5 KB
/
Copy pathindex.html
File metadata and controls
123 lines (113 loc) · 5 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PCM</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body data-theme="light">
<div class="container">
<header class="app-header">
<h1>Real-Time Pulse Code Modulation Visualizer</h1>
<div class="theme-switcher">
<span id="theme-icon">☀️</span> <!-- Icon changes with theme -->
<input type="checkbox" id="themeToggle" aria-label="Toggle dark mode">
<label for="themeToggle" class="toggle-label"></label>
</div>
</header>
<form id="pcm-form" class="controls-grid">
<fieldset class="control-group">
<legend>Signal Parameters</legend>
<div class="input-group">
<label for="frequency">Frequency (Hz):</label>
<input type="number" id="frequency" value="1" min="0.1" step="0.1" required>
</div>
<div class="input-group">
<label for="amplitude">Amplitude:</label>
<input type="number" id="amplitude" value="4" min="0.1" step="0.1" required>
</div>
<!-- Replaced Wave Type with Phase -->
<div class="input-group">
<label for="phase">Phase (deg):</label>
<input type="number" id="phase" value="0" step="1" required>
<!-- Allow any degree, wrap in calculation -->
</div>
</fieldset>
<fieldset class="control-group">
<legend>PCM Parameters</legend>
<div class="input-group">
<label for="samplingRate">Sampling Rate (Hz):</label>
<input type="number" id="samplingRate" value="20" min="1" step="1" required>
</div>
<div class="input-group">
<label for="quantizationLevels">Quantization Levels:</label>
<input type="number" id="quantizationLevels" value="8" min="2" step="1" required>
</div>
</fieldset>
<fieldset class="control-group">
<legend>Time Range</legend>
<div class="input-group">
<label for="startTime">Start Time (s):</label>
<input type="number" id="startTime" value="0" min="0" step="0.1" required>
</div>
<div class="input-group">
<label for="endTime">End Time (s):</label>
<input type="number" id="endTime" value="2" min="0" step="0.1" required>
<!-- Default to 2 seconds -->
</div>
</fieldset>
<!-- Removed explicit button, update happens on input -->
<div id="error-message" class="error full-width-error"></div>
</form>
<section class="results-section">
<h2>Results</h2>
<div class="metrics">
<div id="snr-display">SNR: -- dB</div>
</div>
<div class="visualization-grid">
<!-- Charts -->
<div class="chart-container">
<canvas id="analogSampledChart"></canvas>
<!-- Titles will be set in JS options -->
</div>
<div class="chart-container">
<canvas id="quantizedChart"></canvas>
</div>
<div class="chart-container">
<canvas id="reconstructedChart"></canvas>
</div>
<div class="chart-container">
<canvas id="errorChart"></canvas>
</div>
<!-- PCM Data Table -->
<div class="output-container table-container">
<h3>PCM Data Table</h3>
<div class="table-wrapper">
<table id="pcm-data-table">
<thead>
<tr>
<th>#</th>
<th>Time</th>
<th>Sampled</th>
<th>Quantized</th>
<th>Error</th>
<th>Code</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<!-- PCM Encoded Output Sequence -->
<div class="output-container code-output-container">
<h3>PCM Encoded Output (Sequence)</h3>
<pre id="pcm-output"></pre>
</div>
</div>
</section>
</div>
<script src="script.js"></script>
</body>
</html>