Compare commits

...

10 Commits

Author SHA1 Message Date
hexahigh
872f323226 Github Action: Updated torrent file 2023-09-11 12:32:06 +00:00
hexahigh
0cedb583a1 Merge branch 'main' of https://github.com/hexahigh/games 2023-09-11 14:30:45 +02:00
hexahigh
b96870d7ed fix audio? 2023-09-11 14:30:43 +02:00
hexahigh
1028dd5a3e Github Action: Automatic sitemap update. 2023-09-11 12:29:50 +00:00
hexahigh
b720850abe Merge branch 'main' of https://github.com/hexahigh/games 2023-09-11 14:28:31 +02:00
hexahigh
2f2bc039eb tested a solar system map 2023-09-11 14:28:29 +02:00
hexahigh
e968743c16 Github Action: Automatic sitemap update. 2023-09-11 10:26:49 +00:00
Boof
12588fc65f
updated ai model 2023-09-11 12:25:24 +02:00
hexahigh
2fe5b26692 Github Action: Automatic sitemap update. 2023-09-11 09:41:52 +00:00
Boof
c59e376fe5
fixed model? 2023-09-11 11:40:58 +02:00
20 changed files with 153 additions and 55 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

23
other/ow-map/index.css Normal file
View File

@ -0,0 +1,23 @@
.object {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
/* More styles here */
}
.planet {
/* Styles for planets here */
}
.p-orbit {
/* Styles for orbits here */
}
#solar-system {
position: relative;
width: 100%;
height: 100vh;
}

21
other/ow-map/index.html Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Outer wilds solar system</title>
<script src="index.js" defer></script>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div id="solar-system">
<div class="object p-orbit"></div>
<img class="object" src="images/sun.webp" alt="" id="sun">
<img class="object planet" src="images/station.webp" alt="" id="station">
<img class="object planet" src="images/ash.webp" alt="" id="ash">
</div>
</body>
</html>

10
other/ow-map/index.js Normal file
View File

@ -0,0 +1,10 @@
const planets = document.querySelectorAll('.planet')
let radians = new Array(planets.length).fill(0)
setInterval(() => {
planets.forEach((planet, index) => {
let x = Math.cos(radians[index]) * 100; // 100 is the radius of the orbit
let y = Math.sin(radians[index]) * 100; // 100 is the radius of the orbit
planet.style.transform = `translate(${x}px, ${y}px)`;
radians[index] += 0.02 // Adjust this value to change speed
})
}, 1000/60)

View File

@ -3,13 +3,15 @@
<head>
<title>Audio Classification</title>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.8.4/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/speech-commands@0.4.0/dist/speech-commands.min.js"></script>
<script src="script.js" defer></script>
</head>
<body>
<div>Audio Model</div>
<button type="button" onclick="init()">Start</button>
<div id="label-container"></div>
<h1>Audio Classification</h1>
<form>
<input type="file" id="audioFile" name="audioFile"/>
<button type="submit">Upload</button>
</form>
<section id="result"></section>
</body>
</html>

View File

@ -1,50 +1,63 @@
// more documentation available at
// https://github.com/tensorflow/tfjs-models/tree/master/speech-commands
// Load the TensorFlow.js model
async function loadModel() {
const model = await tf.loadLayersModel("model/model.json");
return model;
}
// the link to your model provided by Teachable Machine export panel
const URL = "./model/";
function preprocessAudio(filename) {
// Load audio file
const audio = new Audio(filename);
async function createModel() {
const checkpointURL = URL + "model.json"; // model topology
const metadataURL = URL + "metadata.json"; // model metadata
// Generate a Mel-scaled spectrogram
const spectrogram = tf.tidy(() => {
const audioTensor = tf.browser.Audio(audio);
const sampleRate = audioTensor.sampleRate();
const melSpectrogram = tf.signal.melSpectrogram(audioTensor, {
sampleRate: sampleRate,
hopLength: 512,
nMels: 128,
fMin: 0,
fMax: 8000
});
const logMelSpectrogram = tf.math.log(melSpectrogram.add(1e-6));
const normalizedSpectrogram = logMelSpectrogram.div(tf.max(logMelSpectrogram));
return normalizedSpectrogram;
});
const recognizer = speechCommands.create(
"BROWSER_FFT", // fourier transform type, not useful to change
undefined, // speech commands vocabulary feature, not useful for your models
checkpointURL,
metadataURL);
return spectrogram;
}
// check that model and metadata are loaded via HTTPS requests.
await recognizer.ensureModelLoaded();
return recognizer;
}
// Classify the audio using the loaded model
async function classifyAudio(model, audioData) {
const preprocessedData = preprocessAudio(audioData);
const audioTensor = tf.tensor(preprocessedData);
const predictions = model.predict(audioTensor);
const predictedClass = predictions.argMax().dataSync()[0];
return predictedClass;
}
async function init() {
const recognizer = await createModel();
const classLabels = recognizer.wordLabels(); // get class labels
const labelContainer = document.getElementById("label-container");
for (let i = 0; i < classLabels.length; i++) {
labelContainer.appendChild(document.createElement("div"));
}
// Handle form submission
document.querySelector("form").addEventListener("submit", async function(event) {
event.preventDefault();
const fileInput = document.getElementById("audioFile");
const file = fileInput.files[0];
const fileReader = new FileReader();
// listen() takes two arguments:
// 1. A callback function that is invoked anytime a word is recognized.
// 2. A configuration object with adjustable fields
recognizer.listen(result => {
const scores = result.scores; // probability of prediction for each class
// render the probability scores per class
for (let i = 0; i < classLabels.length; i++) {
const classPrediction = classLabels[i] + ": " + result.scores[i].toFixed(2);
labelContainer.childNodes[i].innerHTML = classPrediction;
}
}, {
includeSpectrogram: true, // in case listen should return result.spectrogram
probabilityThreshold: 0.75,
invokeCallbackOnNoiseAndUnknown: true,
overlapFactor: 0.50 // probably want between 0.5 and 0.75. More info in README
});
fileReader.onload = async function(event) {
const audioData = event.target.result;
// Stop the recognition in 5 seconds.
// setTimeout(() => recognizer.stopListening(), 5000);
}
// Load the model
const model = await loadModel();
// Classify the audio
const classificationResult = await classifyAudio(model, audioData);
// Display the classification result
const resultSection = document.getElementById("result");
resultSection.textContent = `Class: ${classificationResult}`;
};
// Read the uploaded audio file
fileReader.readAsArrayBuffer(file);
});

File diff suppressed because one or more lines are too long

View File

@ -183,6 +183,9 @@ https://boof.eu.org/other/lowband/
https://boof.eu.org/other/lowband/videos.html
https://boof.eu.org/other/lowband/vsauce.html
https://boof.eu.org/other/nostalgia/
https://boof.eu.org/other/ow-map/
https://boof.eu.org/other/ow-map/index.css
https://boof.eu.org/other/ow-map/index.js
https://boof.eu.org/other/urls to array/
https://boof.eu.org/other/urls to array/index.js
https://boof.eu.org/tools/Base64/
@ -4958,8 +4961,22 @@ https://boof.eu.org/other/csv-merge/files/random strings sha256.txt
https://boof.eu.org/other/csv-merge/files/random strings.txt
https://boof.eu.org/other/nostalgia/old games/
https://boof.eu.org/other/nostalgia/old movies and videos/
https://boof.eu.org/other/ow-map/images/ash.webp
https://boof.eu.org/other/ow-map/images/attlerock.webp
https://boof.eu.org/other/ow-map/images/brittle.webp
https://boof.eu.org/other/ow-map/images/dark.webp
https://boof.eu.org/other/ow-map/images/ember.webp
https://boof.eu.org/other/ow-map/images/eye.webp
https://boof.eu.org/other/ow-map/images/giant.webp
https://boof.eu.org/other/ow-map/images/inter.webp
https://boof.eu.org/other/ow-map/images/station.webp
https://boof.eu.org/other/ow-map/images/sun.webp
https://boof.eu.org/other/ow-map/images/timber.webp
https://boof.eu.org/other/ow-map/images/white.webp
https://boof.eu.org/other/school/presentation 1/
https://boof.eu.org/other/school/presentation 1/style.css
https://boof.eu.org/other/tensor/test1/
https://boof.eu.org/other/tensor/test1/script.js
https://boof.eu.org/tools/Btorrent/views/download.html
https://boof.eu.org/tools/Btorrent/views/full.html
https://boof.eu.org/tools/Btorrent/views/view.html
@ -5278,6 +5295,13 @@ https://boof.eu.org/Games/sm64/assets/images/MrIncredible.jpg
https://boof.eu.org/other/nostalgia/old movies and videos/karius/
https://boof.eu.org/other/nostalgia/old movies and videos/karius/index.js
https://boof.eu.org/other/nostalgia/old movies and videos/karius/torrent.js
https://boof.eu.org/other/tensor/test1/model/group1-shard1of6.bin
https://boof.eu.org/other/tensor/test1/model/group1-shard2of6.bin
https://boof.eu.org/other/tensor/test1/model/group1-shard3of6.bin
https://boof.eu.org/other/tensor/test1/model/group1-shard4of6.bin
https://boof.eu.org/other/tensor/test1/model/group1-shard5of6.bin
https://boof.eu.org/other/tensor/test1/model/group1-shard6of6.bin
https://boof.eu.org/other/tensor/test1/model/model.json
https://boof.eu.org/Games/Hextris/style/fa/css/font-awesome.css
https://boof.eu.org/Games/Hextris/style/fa/css/font-awesome.min.css
https://boof.eu.org/Games/Hextris/style/fa/fonts/FontAwesome.otf

View File

@ -245,6 +245,10 @@
<lastmod>2023-04-16T01:13:54+02:00</lastmod>
</url>
<url>
<loc>https://boof.eu.org/other/ow-map/</loc>
<lastmod>2023-09-11T14:28:29+02:00</lastmod>
</url>
<url>
<loc>https://boof.eu.org/other/urls to array/</loc>
<lastmod>2023-04-28T10:24:18+02:00</lastmod>
</url>
@ -361,6 +365,10 @@
<lastmod>2023-04-24T13:26:24+02:00</lastmod>
</url>
<url>
<loc>https://boof.eu.org/other/tensor/test1/</loc>
<lastmod>2023-09-11T12:25:24+02:00</lastmod>
</url>
<url>
<loc>https://boof.eu.org/tools/Btorrent/views/download.html</loc>
<lastmod>2022-11-03T08:09:58+01:00</lastmod>
</url>