Compare commits
6 commits
eda2a948d9
...
c06273269e
Author | SHA1 | Date | |
---|---|---|---|
c06273269e | |||
d55deee33a | |||
76e81c1f60 | |||
2d44469d0e | |||
2ac8cf0e7c | |||
a00f2091e5 |
17 changed files with 365 additions and 35 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,6 @@
|
||||||
|
assets/generated/*
|
||||||
|
!assets/generated/.gitkeep
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
/build
|
/build
|
||||||
|
|
81
Earthfile
81
Earthfile
|
@ -1,6 +1,30 @@
|
||||||
VERSION 0.7
|
VERSION 0.7
|
||||||
FROM node:lts
|
FROM node:lts
|
||||||
|
|
||||||
|
site:
|
||||||
|
RUN npm install -g pnpm
|
||||||
|
COPY package.json pnpm-lock.yaml /site
|
||||||
|
WORKDIR /site
|
||||||
|
CACHE --id=pnpm $HOME/.local/share/pnpm
|
||||||
|
RUN pnpm install --frozen-lockfile --prod
|
||||||
|
COPY . /site
|
||||||
|
COPY +assets-generated/* /site/assets/generated
|
||||||
|
RUN pnpm build
|
||||||
|
SAVE ARTIFACT build AS LOCAL build
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
FROM alpine
|
||||||
|
RUN apk add openssh-client rsync
|
||||||
|
RUN --secret SSH_CONFIG --secret SSH_UPLOAD_KEY --secret SSH_KNOWN_HOSTS \
|
||||||
|
mkdir -p $HOME/.ssh && \
|
||||||
|
echo "$SSH_CONFIG" > $HOME/.ssh/config && \
|
||||||
|
echo "$SSH_UPLOAD_KEY" > $HOME/.ssh/id_rsa && \
|
||||||
|
echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts && \
|
||||||
|
chmod 600 $HOME/.ssh/*
|
||||||
|
COPY +site/build /build
|
||||||
|
RUN --secret SSH_TARGET --push rsync -cvrz --delete /build/ $SSH_TARGET
|
||||||
|
|
||||||
|
|
||||||
avsync-video-components:
|
avsync-video-components:
|
||||||
# https://pptr.dev/troubleshooting
|
# https://pptr.dev/troubleshooting
|
||||||
RUN apt-get update && apt-get -y install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get -y install libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 && rm -rf /var/lib/apt/lists/*
|
||||||
|
@ -11,18 +35,22 @@ avsync-video-components:
|
||||||
WORKDIR /site
|
WORKDIR /site
|
||||||
CACHE --id=pnpm /home/pptruser/.local/share/pnpm
|
CACHE --id=pnpm /home/pptruser/.local/share/pnpm
|
||||||
RUN pnpm install --frozen-lockfile
|
RUN pnpm install --frozen-lockfile
|
||||||
COPY . /site
|
COPY av-sync av-sync
|
||||||
ARG FPS=60
|
ARG FPS=60
|
||||||
ARG CYCLES=16
|
ARG CYCLES=16
|
||||||
ARG SIZE=1200
|
ARG SIZE=1200
|
||||||
RUN pnpm av:render:video --fps $FPS --cycles 1 --size $SIZE --output /var/tmp/frames
|
RUN pnpm av:render:video --fps $FPS --cycles 1 --size $SIZE --output /var/tmp/frames
|
||||||
RUN pnpm av:render:audio -i beep.wav -o /var/tmp/track.wav --repeats $CYCLES
|
|
||||||
SAVE ARTIFACT /var/tmp/frames
|
SAVE ARTIFACT /var/tmp/frames
|
||||||
|
RUN pnpm av:render:audio -i beep.wav -o /var/tmp/track.wav --repeats $CYCLES
|
||||||
SAVE ARTIFACT /var/tmp/track.wav
|
SAVE ARTIFACT /var/tmp/track.wav
|
||||||
|
|
||||||
avsync-video:
|
aux-media:
|
||||||
FROM debian:bookworm
|
FROM debian:bookworm
|
||||||
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y ffmpeg sox && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
avsync-video:
|
||||||
|
FROM +aux-media
|
||||||
|
RUN apt-get update && apt-get install -y ffmpeg sox && rm -rf /var/lib/apt/lists/*
|
||||||
COPY +avsync-video-components/track.wav /track.wav
|
COPY +avsync-video-components/track.wav /track.wav
|
||||||
COPY +avsync-video-components/frames /frames
|
COPY +avsync-video-components/frames /frames
|
||||||
RUN find frames -type f | sort | xargs -I {} sh -c 'echo "file {}" >> /frames.txt'
|
RUN find frames -type f | sort | xargs -I {} sh -c 'echo "file {}" >> /frames.txt'
|
||||||
|
@ -33,11 +61,12 @@ avsync-video:
|
||||||
SAVE ARTIFACT avsync.webm
|
SAVE ARTIFACT avsync.webm
|
||||||
|
|
||||||
audio-channel-tracks:
|
audio-channel-tracks:
|
||||||
FROM debian:bookworm
|
FROM +aux-media
|
||||||
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
|
RUN mkdir -p /input /output
|
||||||
RUN mkdir -p /output
|
COPY assets/audio/channels /raw
|
||||||
COPY assets/audio/channels /channels
|
WORKDIR /raw
|
||||||
WORKDIR /channels
|
RUN for file in *.wav; do sox $file /input/$file silence 1 0.1 0.1% reverse silence 1 0.1 0.1% reverse; done
|
||||||
|
WORKDIR /input
|
||||||
RUN mkdir -p /output/wav/stereo /output/wav/5.1 /output/wav/7.1
|
RUN mkdir -p /output/wav/stereo /output/wav/5.1 /output/wav/7.1
|
||||||
RUN ffmpeg -i Left.wav -af "pan=stereo|FL=c0" /output/wav/stereo/Left.wav -hide_banner -loglevel error && \
|
RUN ffmpeg -i Left.wav -af "pan=stereo|FL=c0" /output/wav/stereo/Left.wav -hide_banner -loglevel error && \
|
||||||
ffmpeg -i Right.wav -af "pan=stereo|FR=c0" /output/wav/stereo/Right.wav -hide_banner -loglevel error && \
|
ffmpeg -i Right.wav -af "pan=stereo|FR=c0" /output/wav/stereo/Right.wav -hide_banner -loglevel error && \
|
||||||
|
@ -58,37 +87,25 @@ audio-channel-tracks:
|
||||||
ffmpeg -i Side_Right.wav -af "pan=7.1|SR=c0" /output/wav/7.1/Side_Right.wav -hide_banner -loglevel error && \
|
ffmpeg -i Side_Right.wav -af "pan=7.1|SR=c0" /output/wav/7.1/Side_Right.wav -hide_banner -loglevel error && \
|
||||||
ffmpeg -i Rear_Left.wav -af "pan=7.1|BL=c0" /output/wav/7.1/Rear_Left.wav -hide_banner -loglevel error && \
|
ffmpeg -i Rear_Left.wav -af "pan=7.1|BL=c0" /output/wav/7.1/Rear_Left.wav -hide_banner -loglevel error && \
|
||||||
ffmpeg -i Rear_Right.wav -af "pan=7.1|BR=c0" /output/wav/7.1/Rear_Right.wav -hide_banner -loglevel error
|
ffmpeg -i Rear_Right.wav -af "pan=7.1|BR=c0" /output/wav/7.1/Rear_Right.wav -hide_banner -loglevel error
|
||||||
SAVE ARTIFACT /output/wav
|
SAVE ARTIFACT /output/wav/
|
||||||
|
|
||||||
|
audio-channel-tracks-ogg:
|
||||||
|
FROM +audio-channel-tracks
|
||||||
RUN mkdir -p /output/ogg/stereo /output/ogg/5.1 /output/ogg/7.1
|
RUN mkdir -p /output/ogg/stereo /output/ogg/5.1 /output/ogg/7.1
|
||||||
RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/stereo/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \
|
RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/stereo/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \
|
||||||
for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/5.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \
|
for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/5.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done && \
|
||||||
for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/7.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done
|
for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libvorbis /output/ogg/7.1/$(basename $file .wav).ogg -hide_banner -loglevel error; done
|
||||||
SAVE ARTIFACT /output/ogg
|
SAVE ARTIFACT /output/ogg
|
||||||
|
|
||||||
|
audio-channel-tracks-mp3:
|
||||||
|
FROM +audio-channel-tracks
|
||||||
RUN mkdir -p /output/mp3/stereo /output/mp3/5.1 /output/mp3/7.1
|
RUN mkdir -p /output/mp3/stereo /output/mp3/5.1 /output/mp3/7.1
|
||||||
RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/stereo/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \
|
RUN for file in /output/wav/stereo/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/stereo/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \
|
||||||
for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/5.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \
|
for file in /output/wav/5.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/5.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done && \
|
||||||
for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/7.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done
|
for file in /output/wav/7.1/*.wav; do ffmpeg -i $file -c:a libmp3lame /output/mp3/7.1/$(basename $file .wav).mp3 -hide_banner -loglevel error; done
|
||||||
SAVE ARTIFACT /output/mp3
|
SAVE ARTIFACT /output/mp3
|
||||||
|
|
||||||
site:
|
assets-generated:
|
||||||
RUN npm install -g pnpm
|
COPY +avsync-video/avsync.webm /assets/avsync.webm
|
||||||
COPY package.json pnpm-lock.yaml /site
|
COPY +audio-channel-tracks-mp3/mp3 /assets/audio/
|
||||||
WORKDIR /site
|
SAVE ARTIFACT /assets/* AS LOCAL assets/generated/
|
||||||
CACHE --id=pnpm $HOME/.local/share/pnpm
|
|
||||||
RUN pnpm install --frozen-lockfile --prod
|
|
||||||
COPY . /site
|
|
||||||
RUN pnpm build
|
|
||||||
SAVE ARTIFACT build AS LOCAL build
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
FROM alpine
|
|
||||||
RUN apk add openssh-client rsync
|
|
||||||
RUN --secret SSH_CONFIG --secret SSH_UPLOAD_KEY --secret SSH_KNOWN_HOSTS \
|
|
||||||
mkdir -p $HOME/.ssh && \
|
|
||||||
echo "$SSH_CONFIG" > $HOME/.ssh/config && \
|
|
||||||
echo "$SSH_UPLOAD_KEY" > $HOME/.ssh/id_rsa && \
|
|
||||||
echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts && \
|
|
||||||
chmod 600 $HOME/.ssh/*
|
|
||||||
COPY +site/build /build
|
|
||||||
RUN --secret SSH_TARGET --push rsync -cvrz --delete /build/ $SSH_TARGET
|
|
||||||
|
|
||||||
|
|
0
assets/generated/.gitkeep
Normal file
0
assets/generated/.gitkeep
Normal file
|
@ -10,6 +10,7 @@
|
||||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
"lint": "prettier --check . && eslint .",
|
"lint": "prettier --check . && eslint .",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
|
"generate-assets": "earthly +assets-generated",
|
||||||
"av:dev": "cd av-sync && vite",
|
"av:dev": "cd av-sync && vite",
|
||||||
"av:render:video": "cd av-sync && concurrently -P -k -s command-1 \"vite --port 8626\" \"wait-on http://localhost:8626 && node render-video.js --url http://localhost:8626 {@}\" --",
|
"av:render:video": "cd av-sync && concurrently -P -k -s command-1 \"vite --port 8626\" \"wait-on http://localhost:8626 && node render-video.js --url http://localhost:8626 {@}\" --",
|
||||||
"av:render:audio": "cd av-sync && node render-audio.js"
|
"av:render:audio": "cd av-sync && node render-audio.js"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
<TestCard full={onlyCard} on:focus={() => goto('/card')} />
|
<TestCard full={onlyCard} on:focus={() => goto('/card')} />
|
||||||
<main class:content={!onlyCard} class:sub={$page.url.pathname !== '/' && !onlyCard}>
|
<main class:content={!onlyCard} class:sub={$page.url.pathname !== '/' && !onlyCard}>
|
||||||
<a href="/" class="button button-back"><i class="ti ti-arrow-back" />Back</a>
|
<a href=".." class="button button-back"><i class="ti ti-arrow-back" />Back</a>
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { version } from '../../package.json';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
|
@ -9,10 +10,14 @@
|
||||||
<i class="ti ti-device-desktop"></i>
|
<i class="ti ti-device-desktop"></i>
|
||||||
Screen
|
Screen
|
||||||
</a>
|
</a>
|
||||||
<a href="audio" class="disabled">
|
<a href="audio">
|
||||||
<i class="ti ti-volume"></i>
|
<i class="ti ti-volume"></i>
|
||||||
Audio
|
Audio
|
||||||
</a>
|
</a>
|
||||||
|
<a href="av-sync" class="disabled">
|
||||||
|
<i class="ti ti-time-duration-off"></i>
|
||||||
|
AV Sync
|
||||||
|
</a>
|
||||||
<a href="keyboard">
|
<a href="keyboard">
|
||||||
<i class="ti ti-keyboard"></i>
|
<i class="ti ti-keyboard"></i>
|
||||||
Keyboard
|
Keyboard
|
||||||
|
@ -39,6 +44,7 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
<footer><a href="https://git.thm.place/thm/test-card">testcard v{version}</a></footer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
h1 {
|
h1 {
|
||||||
|
@ -69,4 +75,13 @@
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0.6;
|
||||||
|
margin-top: 1rem;
|
||||||
|
& a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
5
src/routes/audio/+layout.svelte
Normal file
5
src/routes/audio/+layout.svelte
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<script lang="ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2><i class="ti ti-volume"></i> Audio test</h2>
|
||||||
|
<slot />
|
1
src/routes/audio/+layout.ts
Normal file
1
src/routes/audio/+layout.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const trailingSlash = 'always';
|
|
@ -0,0 +1,20 @@
|
||||||
|
<h3>Channel tests</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="channels/stereo">Stereo</a></li>
|
||||||
|
<li><a href="channels/5.1">5.1 Surround</a></li>
|
||||||
|
<li><a href="channels/7.1">7.1 Surround</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
82
src/routes/audio/channels/+layout.svelte
Normal file
82
src/routes/audio/channels/+layout.svelte
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { onDestroy } from 'svelte';
|
||||||
|
|
||||||
|
let channelsEl: HTMLDivElement;
|
||||||
|
|
||||||
|
let cycling = false;
|
||||||
|
async function cycleChannels() {
|
||||||
|
cycling = true;
|
||||||
|
const buttons = channelsEl.querySelectorAll('button');
|
||||||
|
buttons.forEach((button) => (button.disabled = true));
|
||||||
|
const channels = channelsEl.querySelectorAll('audio');
|
||||||
|
while (cycling) {
|
||||||
|
for (const channel of channels) {
|
||||||
|
await channel.play();
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
channel.onended = resolve;
|
||||||
|
});
|
||||||
|
if (!cycling) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buttons.forEach((button) => (button.disabled = false));
|
||||||
|
}
|
||||||
|
|
||||||
|
function startCycle() {
|
||||||
|
cycling = !cycling;
|
||||||
|
if (cycling) {
|
||||||
|
cycleChannels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
cycling = false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="channels" bind:this={channelsEl}>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<button on:click={startCycle}>Cycle all</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.channels {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
font-size: 2rem;
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.channels .row) {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
text-align: center;
|
||||||
|
margin: 2rem 0;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.channels .center) {
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(.channels .label) {
|
||||||
|
opacity: 0.33;
|
||||||
|
font-size: 6rem;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
</style>
|
8
src/routes/audio/channels/+page.svelte
Normal file
8
src/routes/audio/channels/+page.svelte
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
goto('..');
|
||||||
|
});
|
||||||
|
</script>
|
24
src/routes/audio/channels/5.1/+page.svelte
Normal file
24
src/routes/audio/channels/5.1/+page.svelte
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Speaker from '../speaker.svelte';
|
||||||
|
import frontLeftUrl from '@assets/audio/5.1/Front_Left.mp3';
|
||||||
|
import frontCenterUrl from '@assets/audio/5.1/Front_Center.mp3';
|
||||||
|
import frontRightUrl from '@assets/audio/5.1/Front_Right.mp3';
|
||||||
|
import rearLeftUrl from '@assets/audio/5.1/Rear_Left.mp3';
|
||||||
|
import rearRightUrl from '@assets/audio/5.1/Rear_Right.mp3';
|
||||||
|
import LfeUrl from '@assets/audio/5.1/LFE_Noise.mp3';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={frontLeftUrl} left>Front Left</Speaker>
|
||||||
|
<div class="center">
|
||||||
|
<Speaker src={frontCenterUrl} center>Front Center</Speaker>
|
||||||
|
</div>
|
||||||
|
<Speaker src={frontRightUrl} right>Front Right</Speaker>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={rearLeftUrl} left>Rear Left</Speaker>
|
||||||
|
<Speaker src={rearRightUrl} right>Rear Right</Speaker>
|
||||||
|
</div>
|
||||||
|
<Speaker src={LfeUrl} lfe>LFE</Speaker>
|
||||||
|
|
||||||
|
<div class="label">5.1</div>
|
31
src/routes/audio/channels/7.1/+page.svelte
Normal file
31
src/routes/audio/channels/7.1/+page.svelte
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Speaker from '../speaker.svelte';
|
||||||
|
import frontLeftUrl from '@assets/audio/7.1/Front_Left.mp3';
|
||||||
|
import frontCenterUrl from '@assets/audio/7.1/Front_Center.mp3';
|
||||||
|
import frontRightUrl from '@assets/audio/7.1/Front_Right.mp3';
|
||||||
|
import sideLeftUrl from '@assets/audio/7.1/Side_Left.mp3';
|
||||||
|
import sideRightUrl from '@assets/audio/7.1/Side_Right.mp3';
|
||||||
|
import rearLeftUrl from '@assets/audio/7.1/Rear_Left.mp3';
|
||||||
|
import rearRightUrl from '@assets/audio/7.1/Rear_Right.mp3';
|
||||||
|
import LfeUrl from '@assets/audio/7.1/LFE_Noise.mp3';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={frontLeftUrl} left>Front Left</Speaker>
|
||||||
|
<div class="center">
|
||||||
|
<Speaker src={frontCenterUrl} center>Front Center</Speaker>
|
||||||
|
</div>
|
||||||
|
<Speaker src={frontRightUrl} right>Front Right</Speaker>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={sideLeftUrl} left>Side Left</Speaker>
|
||||||
|
<Speaker src={sideRightUrl} right>Side Right</Speaker>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={rearLeftUrl} left>Rear Left</Speaker>
|
||||||
|
<Speaker src={rearRightUrl} right>Rear Right</Speaker>
|
||||||
|
</div>
|
||||||
|
<Speaker src={LfeUrl} lfe>LFE</Speaker>
|
||||||
|
|
||||||
|
<div class="label">7.1</div>
|
68
src/routes/audio/channels/speaker.svelte
Normal file
68
src/routes/audio/channels/speaker.svelte
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import { createEventDispatcher, onMount } from 'svelte';
|
||||||
|
const dispatch = createEventDispatcher<{ end: void }>();
|
||||||
|
|
||||||
|
export let src: string;
|
||||||
|
export let left = false;
|
||||||
|
export let center = false;
|
||||||
|
export let right = false;
|
||||||
|
export let lfe = false;
|
||||||
|
|
||||||
|
let currentTime = 0;
|
||||||
|
let paused = true;
|
||||||
|
function play() {
|
||||||
|
currentTime = 0;
|
||||||
|
paused = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="speaker"
|
||||||
|
class:left
|
||||||
|
class:right
|
||||||
|
class:center
|
||||||
|
class:lfe
|
||||||
|
class:playing={!paused}
|
||||||
|
on:click={play}
|
||||||
|
>
|
||||||
|
{#if !lfe}
|
||||||
|
<i class="ti ti-volume"></i>
|
||||||
|
{:else}
|
||||||
|
<i class="ti ti-wave-sine"></i>
|
||||||
|
{/if}
|
||||||
|
<label><slot /></label>
|
||||||
|
<audio bind:currentTime bind:paused {src}></audio>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.speaker {
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
& .ti {
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right .ti {
|
||||||
|
display: block;
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.center .ti {
|
||||||
|
display: block;
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.33;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.playing {
|
||||||
|
opacity: 0.66;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
14
src/routes/audio/channels/stereo/+page.svelte
Normal file
14
src/routes/audio/channels/stereo/+page.svelte
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import Speaker from '../speaker.svelte';
|
||||||
|
import leftUrl from '@assets/audio/stereo/Left.mp3';
|
||||||
|
import centerUrl from '@assets/audio/stereo/Center.mp3';
|
||||||
|
import rightUrl from '@assets/audio/stereo/Right.mp3';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<Speaker src={leftUrl} left>Left</Speaker>
|
||||||
|
<div class="center">
|
||||||
|
<Speaker src={centerUrl} center>Center</Speaker>
|
||||||
|
</div>
|
||||||
|
<Speaker src={rightUrl} right>Right</Speaker>
|
||||||
|
</div>
|
30
src/routes/av-sync/+page.svelte
Normal file
30
src/routes/av-sync/+page.svelte
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import videoUrl from '@assets/avsync.webm';
|
||||||
|
let paused = true;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h2><i class="ti ti-time-duration-off"></i> Audio/Video Synchronization</h2>
|
||||||
|
<!-- svelte-ignore a11y-media-has-caption -->
|
||||||
|
<video
|
||||||
|
class:playing={!paused}
|
||||||
|
autoplay
|
||||||
|
loop
|
||||||
|
bind:paused
|
||||||
|
src={videoUrl}
|
||||||
|
on:click={() => (paused = false)}
|
||||||
|
></video>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
video {
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
|
&:not(.playing) {
|
||||||
|
opacity: 0.5;
|
||||||
|
filter: grayscale(0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
transition:
|
||||||
|
opacity 0.3s,
|
||||||
|
filter 0.3s;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,6 +1,17 @@
|
||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [sveltekit()]
|
plugins: [sveltekit()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@assets': path.join(__dirname, 'assets/generated')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
fs: {
|
||||||
|
allow: [path.join(__dirname, 'assets/generated'), path.join(__dirname, 'package.json')]
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue