Skip to content

Commit

Permalink
fix translation
Browse files Browse the repository at this point in the history
add small favicon (32x32 instead of 900x900)
fix contrabass in sgm
  • Loading branch information
spessasus committed Jun 11, 2024
1 parent 2829f5d commit 41bb7f7
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
Empty file removed .gitattributes
Empty file.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>SpessaSynth SoundFont MIDI Player</title>
<link rel="stylesheet" href='src/website/css/style.css'>
<link rel='icon' type='image/png' href='src/website/spessasynth_logo_rounded.png'>
<link rel='icon' type='image/png' href='src/website/favicon.ico'>
<link rel='manifest' href='src/website/manifest.json'>
<style>
#github_page{
Expand All @@ -34,7 +34,7 @@ <h1 id="title" translate-path='locale.demoTitleMessage'>SpessaSynth: Online Demo
<label id="file_upload" for='midi_file_input' translate-path='locale.midiUploadButton'>Upload your MIDI files</label>
<input type="file" accept=".mid" id="midi_file_input" multiple><br/>

<label id="sf_upload"> Upload the soundfont
<label id="sf_upload"> <p translate-path='locale.demoSoundfontUploadButton'>Upload the soundfont</p>
<input type="file" accept=".sf2,.sf3" id="sf_file_input"><br/>
</label>

Expand Down
Binary file modified soundfonts/SGM.sf3
Binary file not shown.
31 changes: 24 additions & 7 deletions src/spessasynth_lib/sequencer/sequencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,17 @@ export class Sequencer {
{
/**
* an array of 16 arrays (channels) and the notes are stored there
* @typedef {
* {
* notes: {
* @typedef {{
* midiNote: number,
* start: number,
* length: number,
* velocity: number,
* }[],
* }} NoteTime
*
* @typedef {{
* notes: NoteTime[],
* renderStartIndex: number
* }[]
* } NoteTimes
* }[]} NoteTimes
*/

/**
Expand All @@ -331,6 +331,7 @@ export class Sequencer {
let elapsedTime = 0;
let oneTickToSeconds = 60 / (120 * this.midiData.timeDivision);
let eventIndex = 0;
let unfinished = 0;
while(eventIndex < events.length)
{
const event = events[eventIndex];
Expand All @@ -346,6 +347,7 @@ export class Sequencer {
const time = elapsedTime - note.start;
note.length = (time < MIN_NOTE_TIME && channel === DEFAULT_PERCUSSION ? MIN_NOTE_TIME : time);
}
unfinished--;
}
// note on
else if(status === 0x9)
Expand All @@ -358,6 +360,7 @@ export class Sequencer {
const time = elapsedTime - note.start;
note.length = (time < MIN_NOTE_TIME && channel === DEFAULT_PERCUSSION ? MIN_NOTE_TIME : time);
}
unfinished--;
}
else {
noteTimes[event.messageStatusByte & 0x0F].notes.push({
Expand All @@ -366,6 +369,7 @@ export class Sequencer {
length: -1,
velocity: event.messageData[1] / 127
});
unfinished++;
}
}
// set tempo
Expand All @@ -379,7 +383,20 @@ export class Sequencer {
elapsedTime += oneTickToSeconds * (events[eventIndex].ticks - event.ticks);
}

console.info("%cFinished loading note times and ready to render the sequence!", consoleColors.info);
// finish the unfinished notes
if(unfinished > 0)
{
// for every channel, for every note that is unfinished (has -1 length)
noteTimes.forEach((channel, channelNumber) =>
channel.notes.filter(n => n.length === -1).forEach(note =>
{
const time = elapsedTime - note.start;
note.length = (time < MIN_NOTE_TIME && channelNumber === DEFAULT_PERCUSSION ? MIN_NOTE_TIME : time);
})
)
}

console.info(`%cFinished loading note times and ready to render the sequence!`, consoleColors.info);
this.renderer.connectSequencer(noteTimes, this);
}

Expand Down
10 changes: 9 additions & 1 deletion src/website/demo_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ async function loadLastSoundFontFromDatabase()
if(!result)
{
resolve(undefined);
return;
}
resolve(result.data);
}
Expand All @@ -93,7 +94,14 @@ async function demoInit()
{
console.info("Failed to load from db, fetching online instead");
loadedFromDb = false;
soundFontBuffer = await fetchFont(`soundfonts/${SF_NAME}`, percent => titleMessage.innerText = `Loading SF3: ${percent}%`);
const progressBar = document.getElementById("progress_bar");
titleMessage.innerText = "Loading bundled SoundFont, please wait.";
soundFontBuffer = await fetchFont(`soundfonts/${SF_NAME}`, percent =>
{
titleMessage.innerText = `Loading bundled SoundFont (${percent}%), please wait.`;
progressBar.style.width = `${(percent / 100) * titleMessage.offsetWidth}px`
});
progressBar.style.width = "0";
}
else
{
Expand Down
Binary file added src/website/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion src/website/local_edition_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SpessaSynth Local Edition</title>
<link rel="stylesheet" href='website/css/style.css'>
<link rel='icon' href='website/spessasynth_logo_rounded.png'>
<link rel='icon' href='website/favicon.ico'>
</head>
<body>
<div class='spessasynth_main'>
Expand Down
5 changes: 2 additions & 3 deletions src/website/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"lang": "en",
"icons": [
{
"src": "spessasynth_logo_rounded.png",
"type": "image/png",
"sizes": "930x930"
"src": "favicon.ico",
"sizes": "32x32"
}
],
"start_url": "../../index.html",
Expand Down
3 changes: 2 additions & 1 deletion src/website/ui/sequencer_ui/sequencer_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ export class SequencerUI{
// instantly append if lyrics and 100ms batches otherwise, to avoid that initial setup text spam (looking at you, touhou midis)
this.lyricsElement.text.innerText = this.text;
this.requiresTextUpdate = false;
this.lyricsElement.mainDiv.scrollTo(0, this.lyricsElement.text.scrollHeight);
}
this.lyricsElement.mainDiv.scrollTo(0, this.lyricsElement.text.scrollHeight);
}

this.seq.onTimeChange = () => {
Expand Down Expand Up @@ -465,6 +465,7 @@ export class SequencerUI{
if(this.requiresTextUpdate) {
this.lyricsElement.text.innerText = this.text;
this.requiresTextUpdate = false;
this.lyricsElement.mainDiv.scrollTo(0, this.lyricsElement.text.scrollHeight);
}
}, 100);
}
Expand Down

0 comments on commit 41bb7f7

Please sign in to comment.