mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 05:50:52 +02:00
Add separate bar/peak decays
This commit is contained in:
parent
4d273f085b
commit
efda5ce7f2
1 changed files with 14 additions and 3 deletions
17
index.html
17
index.html
|
|
@ -194,13 +194,20 @@ footer .footer-track { flex: 1; min-width: 0; white-space: nowrap; overflow: hid
|
|||
<option value="kaiser">Kaiser</option>
|
||||
<option value="flatTop">Flat Top</option>
|
||||
</select>
|
||||
<span style="font-size:11px;color:#555">Decay:</span>
|
||||
<span style="font-size:11px;color:#555">Peak Decay:</span>
|
||||
<select id="decaySelect">
|
||||
<option value="0.995">Slow</option>
|
||||
<option value="0.985" selected>Medium</option>
|
||||
<option value="0.97">Fast</option>
|
||||
<option value="0.94">Very Fast</option>
|
||||
</select>
|
||||
<span style="font-size:11px;color:#555;margin-left:8px">Bar Decay:</span>
|
||||
<select id="barDecaySelect">
|
||||
<option value="0.99">Slow</option>
|
||||
<option value="0.96" selected>Medium</option>
|
||||
<option value="0.9">Fast</option>
|
||||
<option value="0.8">Very Fast</option>
|
||||
</select>
|
||||
<span style="font-size:11px;color:#555;margin-left:8px">Crossfade:</span>
|
||||
<select id="crossfadeSelect">
|
||||
<option value="0" selected>Off</option>
|
||||
|
|
@ -275,6 +282,8 @@ let sortField = 'idx';
|
|||
let sortAsc = true;
|
||||
let windowType = 'hanning';
|
||||
let peakDecay = 0.985;
|
||||
let barDecay = 0.96;
|
||||
|
||||
|
||||
function initAudioCtx() {
|
||||
if (audioCtx) return;
|
||||
|
|
@ -459,7 +468,7 @@ function drawSpectrum() {
|
|||
grad.addColorStop(0, '#4a9dff');
|
||||
grad.addColorStop(0.4, '#1a6df5');
|
||||
grad.addColorStop(1, '#0a1a3e');
|
||||
const smoothFactor = 0.96;
|
||||
const smoothFactor = barDecay;
|
||||
const barW = Math.max(1, Math.floor(w / NUM_BARS * 0.75));
|
||||
const gap = Math.max(1, Math.floor(w / NUM_BARS * 0.25));
|
||||
const totalBar = barW + gap;
|
||||
|
|
@ -590,6 +599,7 @@ const audioInfo = document.getElementById('audioInfo');
|
|||
const errorEl = document.getElementById('error');
|
||||
const windowSelect = document.getElementById('windowSelect');
|
||||
const decaySelect = document.getElementById('decaySelect');
|
||||
const barDecaySelect = document.getElementById('barDecaySelect');
|
||||
const crossfadeSelect = document.getElementById('crossfadeSelect');
|
||||
|
||||
const AUDIO_EXTS = new Set(['.mp3','.wav','.ogg','.flac','.m4a','.aac','.wma','.aiff','.alac','.opus']);
|
||||
|
|
@ -979,6 +989,7 @@ function deleteTrack() {
|
|||
const playingTrack = currentIndex >= 0 ? tracks[currentIndex] : null;
|
||||
for (const idx of sortedSel) URL.revokeObjectURL(tracks[idx].url);
|
||||
for (let j = sortedSel.length - 1; j >= 0; j--) tracks.splice(sortedSel[j], 1);
|
||||
selectedIndices.clear();
|
||||
if (willDeleteCurrent) {
|
||||
if (tracks.length > 0) {
|
||||
currentIndex = Math.min(sortedSel[0], tracks.length - 1);
|
||||
|
|
@ -992,7 +1003,6 @@ function deleteTrack() {
|
|||
currentIndex -= removedBefore;
|
||||
renderTracks();
|
||||
}
|
||||
selectedIndices.clear();
|
||||
}
|
||||
|
||||
function getSortFn(field) {
|
||||
|
|
@ -1305,6 +1315,7 @@ sortSelect.addEventListener('change', () => {
|
|||
|
||||
windowSelect.addEventListener('change', () => { windowType = windowSelect.value; });
|
||||
decaySelect.addEventListener('change', () => { peakDecay = parseFloat(decaySelect.value); });
|
||||
barDecaySelect.addEventListener('change', () => { barDecay = parseFloat(barDecaySelect.value); });
|
||||
crossfadeSelect.addEventListener('change', () => { crossfadeDuration = parseFloat(crossfadeSelect.value); });
|
||||
crossfadeDuration = parseFloat(crossfadeSelect.value);
|
||||
repeatSelect.addEventListener('change', () => { repeatMode = repeatSelect.value; });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue