Skip to content

Commit

Permalink
Major Wiki Updates and Export options
Browse files Browse the repository at this point in the history
Fixed offset in DLS banks, added DLS compression
  • Loading branch information
spessasus committed Aug 26, 2024
1 parent 895bada commit 28f536c
Show file tree
Hide file tree
Showing 21 changed files with 156 additions and 102 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ npm install --save spessasynth_lib
- **`Web MIDI API` support:** Use your physical MIDI devices!
- [WebMidiLink](https://www.g200kg.com/en/docs/webmidilink/) support
- **Numerous exporting options:**
- - Render the MIDI file (modified or unmodified) to .wav
- - Render each channel as a separate .wav file
- - Export the modified MIDI file to .mid
- - Export the trimmed SoundFont to .sf2
- - Or compress it as .sf3!
- - Bundle both as .rmi with metadata such as album cover!
- Render the MIDI file (modified or unmodified) to .wav
- Render each channel as a separate .wav file
- Export the modified MIDI file to .mid
- Export the trimmed SoundFont to .sf2
- Or compress it as .sf3!
- Bundle both as .rmi with metadata such as album cover!
- Comes bundled with a compressed [SGM](https://web.archive.org/web/20130616094125/http://www.geocities.jp/shansoundfont/) SoundFont to get you started
- No additional dependencies!

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</svg>
</noscript>
</div>
<noscript><h1>Spessasynth requires JavaScript to work.</h1></noscript>
<noscript><h1>Spessasynth requires JavaScript to work. Please turn it on.</h1></noscript>
<h1 id='loading_message'>Loading...</h1>
</div>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SpessaSynth",
"version": "3.20.0",
"version": "3.20.1",
"type": "module",
"scripts": {
"start": "node src/website/server/server.js"
Expand Down
2 changes: 1 addition & 1 deletion src/spessasynth_lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ document.getElementById("button").onclick = async () => {
- **Easy MIDI editing:** Use [helper functions](https://github.com/spessasus/SpessaSynth/wiki/Writing-MIDI-Files#modifymidi) to modify the song to your needs!
- **Loop detection:** Automatically detects loops in MIDIs (e.g., from _Touhou Project_)
- **First note detection:** Skip unnecessary silence at the start by jumping to the first note!
- **[Write MIDI files from scratch](https://github.com/spessasus/SpessaSynth/wiki/Creating-MIDI-Files.md)**
- **[Write MIDI files from scratch](https://github.com/spessasus/SpessaSynth/wiki/Creating-MIDI-Files)**
- **Easy saving:** Save with just [one function!](https://github.com/spessasus/SpessaSynth/wiki/Writing-MIDI-Files#writemidifile)

#### Read and write [RMID files with embedded SF2 soundfonts](https://github.com/spessasus/sf2-rmidi-specification#readme)
Expand Down
3 changes: 2 additions & 1 deletion src/spessasynth_lib/external_midi/web_midi_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export class WebMidiLinkHandler
/**
* @param synth {Synthetizer} the synth to play to
*/
constructor(synth) {
constructor(synth)
{

window.addEventListener("message", msg => {
if(typeof msg.data !== "string")
Expand Down
8 changes: 8 additions & 0 deletions src/spessasynth_lib/soundfont/dls/dls_sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ export class DLSSample extends BasicSample

getRawData()
{
if(this.isCompressed)
{
if (!this.compressedData)
{
throw new Error("Compressed but no data??")
}
return this.compressedData;
}
const uint8 = new Uint8Array(this.sampleData.length * 2);
for (let i = 0; i < this.sampleData.length; i++)
{
Expand Down
6 changes: 4 additions & 2 deletions src/spessasynth_lib/soundfont/dls/dls_zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export class DLSZone extends BasicInstrumentZone
{
const fine = diffStart % 32768;
this.generators.push(new Generator(generatorTypes.startloopAddrsOffset, fine));
const coarse = Math.round(diffStart / 32768);
// coarse generator uses 32768 samples per step
const coarse = (diffStart - fine) / 32768;
if(coarse !== 0)
{
this.generators.push(new Generator(generatorTypes.startloopAddrsCoarseOffset, fine));
Expand All @@ -56,7 +57,8 @@ export class DLSZone extends BasicInstrumentZone
{
const fine = diffEnd % 32768;
this.generators.push(new Generator(generatorTypes.endloopAddrsOffset, fine));
const coarse = Math.round(diffEnd / 32768);
// coarse generator uses 32768 samples per step
const coarse = (diffEnd - fine) / 32768;
if(coarse !== 0)
{
this.generators.push(new Generator(generatorTypes.endloopAddrsCoarseOffset, fine));
Expand Down
2 changes: 1 addition & 1 deletion src/spessasynth_lib/synthetizer/worklet_processor.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/website/css/notification/notification.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
animation-fill-mode: forwards;
box-shadow: #333 0 0 10px;
width: max-content;
max-width: 80%;
}

.notification.drop{
Expand All @@ -53,6 +52,9 @@
.notification_content{
margin: 1rem;
min-width: 90%;
display: flex;
flex-wrap: wrap;
flex-direction: column;
}

.notification .close_btn{
Expand Down
6 changes: 1 addition & 5 deletions src/website/demo_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,7 @@ demoInit(initLocale).then(() => {
],
999999,
true,
undefined,
{
"display": "flex",
"flex-direction": "column"
}
undefined
)
};
});
20 changes: 14 additions & 6 deletions src/website/locale/locale_files/locale_en/export_audio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const exportAudio = {
button: {
title: "Save audio",
description: "Save audio as WAV, MIDI, SF2 or RMI file"
title: "Save",
description: "Save the composition to various formats"
},

formats: {
title: "Choose format",
formats: {
wav: {
button: {
title: "WAV audio",
title: "WAV audio (.wav)",
description: "Export the song with modifications as a .wav audio file"
},
options: {
Expand Down Expand Up @@ -42,20 +42,24 @@ export const exportAudio = {

midi: {
button: {
title: "Modified MIDI",
title: "MIDI (.mid)",
description: "Export the MIDI file with the controller and instrument changes applied"
}
},

soundfont: {
button: {
title: "Trimmed soundfont",
description: "Export the soundfont trimmed to only use instruments and samples that the MIDI file uses"
title: "SoundFont (.sf2)",
description: "Export a SoundFont2 file"
},

options: {
title: "SF export options",
confirm: "Export",
trim: {
title: "Trim",
description: "Export the soundfont trimmed to only use instruments and samples that the MIDI file uses"
},
compress: {
title: "Compress",
description: "Compress samples with lossy Ogg Vorbis compression if uncompressed. Significantly reduces the file size." +
Expand Down Expand Up @@ -98,6 +102,10 @@ export const exportAudio = {
bankOffset: {
title: "Bank offset",
description: "The bank offset of the file. Value of 0 is recommended. Only change if you know what you're doing.",
},
adjust: {
title: "Adjust MIDI",
description: "Adjusts the MIDI file to the SoundFont. Leave this on unless you know what you're doing."
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/website/locale/locale_files/locale_en/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const localeEnglish = {

warnings: {
outOfMemory: "Your browser ran out of memory. Consider using Firefox or SF3 soundfont instead. (see console for error).",
noMidiSupport: "MIDI Inputs are not supported by this browser, this functionality will not be available. Consider using Chrome or Firefox.",
noMidiSupport: "No MIDI ports detected, this functionality will be disabled.",
chromeMobile: "SpessaSynth performs poorly on Chrome Mobile. Consider using Firefox Android instead.",
warning: "Warning"
},
Expand Down
48 changes: 30 additions & 18 deletions src/website/locale/locale_files/locale_ja/export_audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,76 @@ export const exportAudio = {
formats: {
wav: {
button: {
title: "WAV音声",
description: "変更を加えた曲を.wavファイルとしてエクスポートします"
title: "WAV音声 (.wav)",
description: "変更を加えた曲を.wavオーディオファイルとしてエクスポートします"
},
options: {
title: "音声エクスポートオプション",
title: "WAVエクスポートオプション",
confirm: "エクスポート",
normalizeVolume: {
title: "音量の正規化",
description: "MIDIの音量にかかわらず、音量を一定に保ちます。推奨設定です。",
},
additionalTime: {
title: "追加時間(秒)",
description: "音がフェードアウトするために曲の最後に追加する時間です。 (秒)",
description: "音がフェードアウトするために曲の最後に追加する時間です。(秒)",
},

separateChannels: {
title: "チャンネルを分割",
description: "各チャンネルを別々のファイルとして保存します。オシロスコープビューアなどに便利です。このオプションを使用するとリバーブやコーラスが無効になります。",
saving: {
title: "チャンネルファイル",
save: "チャンネル {0} を保存"
save: "チャンネル{0}を保存"
}
}
},
exportMessage: {
message: "音声をエクスポートしています...",
message: "WAV音声をエクスポートしています...",
estimated: "残り時間:",
convertWav: "WAVに変換中..."
convertWav: "WAVに変換中...",
}
},

midi: {
button: {
title: "変更されたMIDI",
title: "MIDI (.mid)",
description: "コントローラーと楽器の変更が適用されたMIDIファイルをエクスポートします"
}
},

soundfont: {
button: {
title: "トリミングされたサウンドフォント",
description: "MIDIファイルで使用されている楽器とサンプルだけにトリミングされたサウンドフォントをエクスポートします"
title: "サウンドフォント (.sf2)",
description: "SoundFont2ファイルをエクスポートします"
},

options: {
title: "SFエクスポートオプション",
confirm: "エクスポート",
trim: {
title: "トリミング",
description: "MIDIファイルで使用されている楽器とサンプルだけにトリミングされたサウンドフォントをエクスポートします"
},
compress: {
title: "圧縮",
description: "未圧縮のサンプルをOgg Vorbisのロス圧縮で圧縮します。ファイルサイズが大幅に削減されます。" +
"サウンドフォントがすでに圧縮されている場合は、このオプションを無効にしても再圧縮されることはありません"
description: "未圧縮の場合は、Ogg Vorbisのロス圧縮でサンプルを圧縮します。ファイルサイズが大幅に削減されます。" +
"サウンドフォントがすでに圧縮されている場合、このオプションを無効にしても再圧縮されることはありません"
},
quality: {
title: "圧縮品質",
description: "圧縮の品質です。高いほど良い"
description: "圧縮の品質です。高いほど良いです"
}
}
},

rmidi: {
button: {
title: "埋め込まれたMIDI (.rmi)",
description: "変更されたMIDIとトリミングされたサウンドフォントを1つのファイルに埋め込んでエクスポートします。 " +
title: "埋め込みMIDI (.rmi)",
description: "変更されたMIDIとトリミングされたサウンドフォントを1つのファイルに埋め込んでエクスポートします。" +
"この形式は広くサポートされていないことに注意してください"
},

progress: {
title: "埋め込まれたMIDIをエクスポート中...",
loading: "サウンドフォントとMIDIを読み込み中...",
Expand All @@ -80,6 +87,7 @@ export const exportAudio = {
saving: "RMIDIを保存中...",
done: "完了しました!"
},

options: {
title: "RMIDIエクスポートオプション",
confirm: "エクスポート",
Expand All @@ -89,11 +97,15 @@ export const exportAudio = {
},
quality: {
title: "圧縮品質",
description: "圧縮の品質です。高いほど良い"
description: "圧縮の品質です。高いほど良いです。"
},
bankOffset: {
title: "銀行の相殺",
description: "ファイルのバンク オフセット。値 0 が推奨されます。何をしているのかわかっている場合にのみ変更してください。",
title: "バンクオフセット",
description: "ファイルのバンクオフセットです。0の値が推奨されます。変更は慎重に行ってください。",
},
adjust: {
title: "MIDIを調整",
description: "MIDIファイルをサウンドフォントに合わせて調整します。特別な理由がない限り、このオプションはオンのままにしてください。"
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/website/locale/locale_files/locale_list.min.js

This file was deleted.

21 changes: 15 additions & 6 deletions src/website/locale/locale_files/locale_pl/export_audio.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const exportAudio = {
button: {
title: "Zapisz utwór",
description: "Zapisz utwór jako plik WAV, MIDI, SF2 lub RMI"
title: "Zapisz",
description: "Zapisz w różnych formatach"
},

formats: {
title: "Wybierz format",
formats: {
wav: {
button: {
title: "Audio WAV",
title: "Audio WAV (.wav)",
description: "Eksportuj utwór ze zmianami jako plik audio .wav"
},
options: {
Expand Down Expand Up @@ -41,20 +41,24 @@ export const exportAudio = {

midi: {
button: {
title: "Zmodyfikowane MIDI",
title: "MIDI (.mid)",
description: "Eksportuj plik MIDI wraz ze zmianami instrumentów i kontrolerów"
}
},

soundfont: {
button: {
title: "Zmniejszony soundfont",
description: "Eksportuj soundfont zawierający tylko klawisze użyte w MIDI"
title: "SoundFont (.sf2)",
description: "Eksportuj SoundFont"
},

options: {
title: "Opcje eksportu soundfonta",
confirm: "Eksportuj",
trim: {
title: "Zmniejsz",
description: "Zmniejsz SoundFont aby zawierał tylko klawisze użyte w MIDI"
},
compress: {
title: "Kompresuj",
description: "Zkompresuj próbki które nie są zkompresowane przy użyciu stratnego kodeka Ogg Vorbis. Znacznie zmniejsza rozmiar pliku." +
Expand Down Expand Up @@ -97,7 +101,12 @@ export const exportAudio = {
bankOffset: {
title: "Przesunięcie banku",
description: "Przesunięcie banku w pliku. Zalecane 0. Zmień tylko jeśli wiesz co robisz.",
},
adjust: {
title: "Adjust MIDI",
description: "Adjusts the MIDI file to the SoundFont. Leave this on unless you know what you're doing."
}

}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/website/locale/locale_files/locale_pl/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const localePolish = {

warnings: {
outOfMemory: "Twojej przeglądarce skończyła się pamięć. Rozważ użycie Firefoxa albo plików SF3. (Zobacz błąd w konsoli)",
noMidiSupport: "Twoja przeglądarka nie wspiera Web MIDI. Korzystanie z portów MIDI nie będzie dostępne. Rozważ użycie Chrome albo Firefoxa.",
noMidiSupport: "Nie wykryto MIDI. Korzystanie z portów MIDI nie będzie dostępne.",
chromeMobile: "SpessaSynth działa wolno na Chromie na telefon. Rozważ użycie Firefoxa Android.",
warning: "Uwaga"
},
Expand Down
Loading

0 comments on commit 28f536c

Please sign in to comment.