@onjmin/dtm 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -12,18 +12,14 @@ declare function createAudioContext(): {
12
12
  drumGainNode: GainNode;
13
13
  };
14
14
  /**
15
- * SoundFontリストの取得
16
- */
17
- declare function fetchSoundFontList(ttl: string): Promise<string[]>;
18
- /**
19
- * 楽器名からキーへのマッピングを構築
15
+ * 楽器名からキーへのマッピングを構築(静的データから生成、外部fetchなし)
20
16
  */
21
17
  declare function buildNameToKeyMapping(): Promise<Record<string, string>>;
22
18
 
23
19
  /**
24
20
  * コード進行文字列を伴奏トラックのノート配置へ展開する。
25
21
  *
26
- * parseChord / parseChords は外部(rpgen3)実装を注入する想定。
22
+ * parseChord / parseChords は外部実装を注入する想定。
27
23
  * 旧 demo/index.html の applyChordProgression を移植・整理し、
28
24
  * 実際のノート追加を行わず配置(placement)の配列を返す純関数にした。
29
25
  */
@@ -1400,7 +1396,7 @@ declare const createSequencer: (options: SequencerOptions) => Sequencer;
1400
1396
  * createDtmStudio — 「import して関数1つ」で鳴る、全部入りスタジオ(Layer 3)。
1401
1397
  *
1402
1398
  * @onjmin/dtm 本体(mountDAW / mountMmlPlayer)は発音を持たない注入式設計で、
1403
- * 楽器・ドラムの実音は外部 SoundFont(rpgen3)に委ねる。デモ index.html では
1399
+ * 楽器・ドラムの実音は同梱の SoundFont エンジン(surikov / webaudiofont)に委ねる。デモ index.html では
1404
1400
  * その配線(AudioContext・SoundFontロード・歌声ワーカー・録音・MIDI/コード解析)を
1405
1401
  * 手書きしていたが、本モジュールはそれを丸ごと内包する。
1406
1402
  *
@@ -1408,7 +1404,7 @@ declare const createSequencer: (options: SequencerOptions) => Sequencer;
1408
1404
  * studio.mountEditor(editorEl, { initialMML }); // 編集UI(音・歌声込み)
1409
1405
  * studio.mountPlayer(playerEl, mml); // 再生専用UI(音・歌声込み)
1410
1406
  *
1411
- * 何も渡さなければ rpgen3 SoundFont を実行時にCDNから動的importし、歌声合成ワーカーは
1407
+ * 何も渡さなければ同梱の SoundFont エンジンを使い、歌声合成ワーカーは
1412
1408
  * パッケージ同梱の dist/voice-worker.js を用いる。エンジンやURLは options で差し替え可能。
1413
1409
  */
1414
1410
 
@@ -1669,4 +1665,4 @@ declare const createSynth: (ctx: AudioContext, destination?: AudioNode) => Synth
1669
1665
 
1670
1666
  declare const VOICE_IMAGES: Record<string, string>;
1671
1667
 
1672
- export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, fetchSoundFontList, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
1668
+ export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
package/dist/index.d.ts CHANGED
@@ -12,18 +12,14 @@ declare function createAudioContext(): {
12
12
  drumGainNode: GainNode;
13
13
  };
14
14
  /**
15
- * SoundFontリストの取得
16
- */
17
- declare function fetchSoundFontList(ttl: string): Promise<string[]>;
18
- /**
19
- * 楽器名からキーへのマッピングを構築
15
+ * 楽器名からキーへのマッピングを構築(静的データから生成、外部fetchなし)
20
16
  */
21
17
  declare function buildNameToKeyMapping(): Promise<Record<string, string>>;
22
18
 
23
19
  /**
24
20
  * コード進行文字列を伴奏トラックのノート配置へ展開する。
25
21
  *
26
- * parseChord / parseChords は外部(rpgen3)実装を注入する想定。
22
+ * parseChord / parseChords は外部実装を注入する想定。
27
23
  * 旧 demo/index.html の applyChordProgression を移植・整理し、
28
24
  * 実際のノート追加を行わず配置(placement)の配列を返す純関数にした。
29
25
  */
@@ -1400,7 +1396,7 @@ declare const createSequencer: (options: SequencerOptions) => Sequencer;
1400
1396
  * createDtmStudio — 「import して関数1つ」で鳴る、全部入りスタジオ(Layer 3)。
1401
1397
  *
1402
1398
  * @onjmin/dtm 本体(mountDAW / mountMmlPlayer)は発音を持たない注入式設計で、
1403
- * 楽器・ドラムの実音は外部 SoundFont(rpgen3)に委ねる。デモ index.html では
1399
+ * 楽器・ドラムの実音は同梱の SoundFont エンジン(surikov / webaudiofont)に委ねる。デモ index.html では
1404
1400
  * その配線(AudioContext・SoundFontロード・歌声ワーカー・録音・MIDI/コード解析)を
1405
1401
  * 手書きしていたが、本モジュールはそれを丸ごと内包する。
1406
1402
  *
@@ -1408,7 +1404,7 @@ declare const createSequencer: (options: SequencerOptions) => Sequencer;
1408
1404
  * studio.mountEditor(editorEl, { initialMML }); // 編集UI(音・歌声込み)
1409
1405
  * studio.mountPlayer(playerEl, mml); // 再生専用UI(音・歌声込み)
1410
1406
  *
1411
- * 何も渡さなければ rpgen3 SoundFont を実行時にCDNから動的importし、歌声合成ワーカーは
1407
+ * 何も渡さなければ同梱の SoundFont エンジンを使い、歌声合成ワーカーは
1412
1408
  * パッケージ同梱の dist/voice-worker.js を用いる。エンジンやURLは options で差し替え可能。
1413
1409
  */
1414
1410
 
@@ -1669,4 +1665,4 @@ declare const createSynth: (ctx: AudioContext, destination?: AudioNode) => Synth
1669
1665
 
1670
1666
  declare const VOICE_IMAGES: Record<string, string>;
1671
1667
 
1672
- export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, fetchSoundFontList, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
1668
+ export { type AddNoteOptions, type ApplyChordOptions, type ChordPatternType, type ChordPlacement, type ConsumedSyllable, type CoreEventHandlers, DAW_CSS, DEFAULT_BPM, DEFAULT_GATE, DEFAULT_PAN, DEFAULT_PLAYBACK_VELOCITY, DEFAULT_STEPS_PER_BAR, DEFAULT_VELOCITY, DEFAULT_VOCAL_VOLUME, DRUM_FONT, DRUM_KEYS, DRUM_PATTERNS, type DawInstance, type DawMode, type DawOptions, type DawViewState, type DrumPattern, type DtmStudio, type DtmStudioEngines, type DtmStudioOptions, type ExportMidiOptions, INSTRUMENT_PRESETS, type InstrumentPreset, KOE_BASE_URL, KOE_VOICEBANKS, KOE_VOICEBANK_LABELS, KOE_VOICEBANK_TERMS, type KoeVoiceOptions, LinkedList, type LoopConfig, type LoopPoint, type LyricSyllable, type LyricTrack, type LyricsConductor, MAX_VOCAL_VOLUME, MMLCore, type MMLDisplayToken, type MMLNotePlacement, MML_END_MARKER, type MidiExtraction, type MidiNotePlacement, type MidiTrackAnalysis, type MmlMeta, type MmlPlayback, type MmlPlayerInstance, type MmlPlayerOptions, type ModeSwitchInstance, type ModeSwitchOptions, type MountEditorOptions, type MountPlayerOptions, type Note, type NoteData, type NoteRemove, PITCH_MAP, PREWARM_NOTES, type ParseMMLOptions, type ParseMidiFn, type ParsedMML, type PianoRollInstance, type PianoRollOptions, type PitchToken, type PlayDrumEvent, type PlayMmlOptions, type PlayNoteEvent, type PlaySingingMmlOptions, type PlaybackCue, type PlaybackState, type PresetSelectInstance, type PresetSelectOptions, type PreviewSoundCallback, type RenderConfig, type Sequencer, type SequencerOptions, type SequencerTrack, type SingingVoices, type SingingVoicesOptions, type StreamPlaybackOptions, type StreamVoiceNote, type StreamVoiceTrack, type Synth, TRACKS_ADVANCED, TRACKS_SIMPLE, type ToolMode, type TrackConfig, VOICE_IMAGES, VOICE_IMAGE_KEY, type VoiceModel, type VoiceRegistry, analyzeMidiTracks, applyHarmonicFilter, applyMonophonic, buildChordPlacements, buildNameToKeyMapping, collectPitchTokens, createAudioContext, createDtmStudio, createKlattVoice, createKoeVoice, createLyricsConductor, createPianoRoll, createSequencer, createSingingVoices, createSynth, createVoiceRegistry, decodeMml, decomposeToMonophonic, drawGrid, drawHeader, drawKeyboard, drawNotes, drawSelectedNotes, drawSelectionRect, encodeMml, exportMIDI, extractMidiPlacements, extractMidiPlacementsByTrack, formatMmlMeta, freqFromPitch, generateRandomPattern, getDrawOffset, getGridCanvas, getGridContext, getGridPosition, getHeaderCanvas, getMidiBPM, getRenderConfig, getXY, icon, init, injectStyles, isChordHeavyTrack, koeUrl, mountDAW, mountMmlPlayer, normalizeLyrics, onClick, panToStereo, parseLyrics, parseMML, parseMmlMeta, playMML, playSingingMML, setDrawOffset, shiftNotes, stripLyrics, stripMmlMeta, vocalVolumeToGain };
package/dist/index.js CHANGED
@@ -74,7 +74,6 @@ __export(index_exports, {
74
74
  exportMIDI: () => exportMIDI,
75
75
  extractMidiPlacements: () => extractMidiPlacements,
76
76
  extractMidiPlacementsByTrack: () => extractMidiPlacementsByTrack,
77
- fetchSoundFontList: () => fetchSoundFontList,
78
77
  formatMmlMeta: () => formatMmlMeta,
79
78
  freqFromPitch: () => freqFromPitch,
80
79
  generateRandomPattern: () => generateRandomPattern,
@@ -118,22 +117,142 @@ function createAudioContext() {
118
117
  drumGainNode.connect(audioCtx.destination);
119
118
  return { audioCtx, gainNode, drumGainNode };
120
119
  }
121
- async function fetchSoundFontList(ttl) {
122
- const res = await fetch(`https://rpgen3.github.io/soundfont/list/${ttl}.txt`);
123
- const str = await res.text();
124
- return str.trim().split("\n");
125
- }
120
+ var FONT_NAME_SURIKOV = `0000 Acoustic Grand Piano
121
+ 0010 Bright Acoustic Piano
122
+ 0020 Electric Grand Piano
123
+ 0030 Honky-tonk Piano
124
+ 0040 Electric Piano 1
125
+ 0050 Electric Piano 2
126
+ 0060 Harpsichord
127
+ 0070 Clavinet
128
+ 0080 Celesta
129
+ 0090 Glockenspiel
130
+ 0100 Music Box
131
+ 0110 Vibraphone
132
+ 0120 Marimba
133
+ 0130 Xylophone
134
+ 0140 Tubular Bells
135
+ 0150 Dulcimer
136
+ 0160 Drawbar Organ
137
+ 0170 Percussive Organ
138
+ 0180 Rock Organ
139
+ 0190 Church Organ
140
+ 0200 Reed Organ
141
+ 0210 Accordion
142
+ 0220 Harmonica
143
+ 0230 Tango Accordion
144
+ 0240 Acoustic Guitar (nylon)
145
+ 0250 Acoustic Guitar (steel)
146
+ 0260 Electric Guitar (jazz)
147
+ 0270 Electric Guitar (clean)
148
+ 0280 Electric Guitar (muted)
149
+ 0290 Overdriven Guitar
150
+ 0300 Distortion Guitar
151
+ 0310 Guitar Harmonics
152
+ 0320 Acoustic Bass
153
+ 0330 Electric Bass (finger)
154
+ 0340 Electric Bass (pick)
155
+ 0350 Fretless Bass
156
+ 0360 Slap Bass 1
157
+ 0370 Slap Bass 2
158
+ 0380 Synth Bass 1
159
+ 0390 Synth Bass 2
160
+ 0400 Violin
161
+ 0410 Viola
162
+ 0420 Cello
163
+ 0430 Contrabass
164
+ 0440 Tremolo Strings
165
+ 0450 Pizzicato Strings
166
+ 0460 Orchestral Harp
167
+ 0470 Timpani
168
+ 0480 String Ensemble 1
169
+ 0490 String Ensemble 2
170
+ 0500 Synth Strings 1
171
+ 0510 Synth Strings 2
172
+ 0520 Choir Aahs
173
+ 0530 Voice Oohs
174
+ 0540 Synth Choir
175
+ 0550 Orchestra Hit
176
+ 0560 Trumpet
177
+ 0570 Trombone
178
+ 0580 Tuba
179
+ 0590 Muted Trumpet
180
+ 0600 French Horn
181
+ 0610 Brass Section
182
+ 0620 Synth Brass 1
183
+ 0630 Synth Brass 2
184
+ 0640 Soprano Sax
185
+ 0650 Alto Sax
186
+ 0660 Tenor Sax
187
+ 0670 Baritone Sax
188
+ 0680 Oboe
189
+ 0690 English Horn
190
+ 0700 Bassoon
191
+ 0710 Clarinet
192
+ 0720 Piccolo
193
+ 0730 Flute
194
+ 0740 Recorder
195
+ 0750 Pan Flute
196
+ 0760 Blown bottle
197
+ 0770 Shakuhachi
198
+ 0780 Whistle
199
+ 0790 Ocarina
200
+ 0800 Lead 1 (square)
201
+ 0810 Lead 2 (sawtooth)
202
+ 0820 Lead 3 (calliope)
203
+ 0830 Lead 4 (chiff)
204
+ 0840 Lead 5 (charang)
205
+ 0850 Lead 6 (voice)
206
+ 0860 Lead 7 (fifths)
207
+ 0870 Lead 8 (bass + lead)
208
+ 0880 Pad 1 (new age)
209
+ 0890 Pad 2 (warm)
210
+ 0900 Pad 3 (polysynth)
211
+ 0910 Pad 4 (choir)
212
+ 0920 Pad 5 (bowed)
213
+ 0930 Pad 6 (metallic)
214
+ 0940 Pad 7 (halo)
215
+ 0950 Pad 8 (sweep)
216
+ 0960 FX 1 (rain)
217
+ 0970 FX 2 (soundtrack)
218
+ 0980 FX 3 (crystal)
219
+ 0990 FX 4 (atmosphere)
220
+ 1000 FX 5 (brightness)
221
+ 1010 FX 6 (goblins)
222
+ 1020 FX 7 (echoes)
223
+ 1030 FX 8 (sci-fi)
224
+ 1040 Sitar
225
+ 1050 Banjo
226
+ 1060 Shamisen
227
+ 1070 Koto
228
+ 1080 Kalimba
229
+ 1090 Bagpipe
230
+ 1100 Fiddle
231
+ 1110 Shanai
232
+ 1120 Tinkle Bell
233
+ 1130 Agogo
234
+ 1140 Steel Drums
235
+ 1150 Woodblock
236
+ 1160 Taiko Drum
237
+ 1170 Melodic Tom
238
+ 1180 Synth Drum
239
+ 1190 Reverse Cymbal
240
+ 1200 Guitar Fret Noise
241
+ 1210 Breath Noise
242
+ 1220 Seashore
243
+ 1230 Bird Tweet
244
+ 1240 Telephone Ring
245
+ 1250 Helicopter
246
+ 1260 Applause
247
+ 1270 Gunshot`;
126
248
  async function buildNameToKeyMapping() {
127
249
  const nameToKey = {};
128
- try {
129
- const fontNames = await fetchSoundFontList("fontName_surikov");
130
- fontNames.forEach((line) => {
131
- const [key, ...nameParts] = line.split(" ");
132
- const name = nameParts.join(" ");
133
- nameToKey[name] = key;
134
- });
135
- } catch (e) {
136
- console.error("Failed to build name-to-key mapping:", e);
250
+ for (const line of FONT_NAME_SURIKOV.trim().split("\n")) {
251
+ const spaceIdx = line.indexOf(" ");
252
+ if (spaceIdx === -1) continue;
253
+ const key = line.slice(0, spaceIdx);
254
+ const name = line.slice(spaceIdx + 1);
255
+ nameToKey[name] = key;
137
256
  }
138
257
  return nameToKey;
139
258
  }
@@ -10761,7 +10880,6 @@ var createDtmStudio = async (options = {}) => {
10761
10880
  exportMIDI,
10762
10881
  extractMidiPlacements,
10763
10882
  extractMidiPlacementsByTrack,
10764
- fetchSoundFontList,
10765
10883
  formatMmlMeta,
10766
10884
  freqFromPitch,
10767
10885
  generateRandomPattern,
package/dist/index.mjs CHANGED
@@ -7,22 +7,142 @@ function createAudioContext() {
7
7
  drumGainNode.connect(audioCtx.destination);
8
8
  return { audioCtx, gainNode, drumGainNode };
9
9
  }
10
- async function fetchSoundFontList(ttl) {
11
- const res = await fetch(`https://rpgen3.github.io/soundfont/list/${ttl}.txt`);
12
- const str = await res.text();
13
- return str.trim().split("\n");
14
- }
10
+ var FONT_NAME_SURIKOV = `0000 Acoustic Grand Piano
11
+ 0010 Bright Acoustic Piano
12
+ 0020 Electric Grand Piano
13
+ 0030 Honky-tonk Piano
14
+ 0040 Electric Piano 1
15
+ 0050 Electric Piano 2
16
+ 0060 Harpsichord
17
+ 0070 Clavinet
18
+ 0080 Celesta
19
+ 0090 Glockenspiel
20
+ 0100 Music Box
21
+ 0110 Vibraphone
22
+ 0120 Marimba
23
+ 0130 Xylophone
24
+ 0140 Tubular Bells
25
+ 0150 Dulcimer
26
+ 0160 Drawbar Organ
27
+ 0170 Percussive Organ
28
+ 0180 Rock Organ
29
+ 0190 Church Organ
30
+ 0200 Reed Organ
31
+ 0210 Accordion
32
+ 0220 Harmonica
33
+ 0230 Tango Accordion
34
+ 0240 Acoustic Guitar (nylon)
35
+ 0250 Acoustic Guitar (steel)
36
+ 0260 Electric Guitar (jazz)
37
+ 0270 Electric Guitar (clean)
38
+ 0280 Electric Guitar (muted)
39
+ 0290 Overdriven Guitar
40
+ 0300 Distortion Guitar
41
+ 0310 Guitar Harmonics
42
+ 0320 Acoustic Bass
43
+ 0330 Electric Bass (finger)
44
+ 0340 Electric Bass (pick)
45
+ 0350 Fretless Bass
46
+ 0360 Slap Bass 1
47
+ 0370 Slap Bass 2
48
+ 0380 Synth Bass 1
49
+ 0390 Synth Bass 2
50
+ 0400 Violin
51
+ 0410 Viola
52
+ 0420 Cello
53
+ 0430 Contrabass
54
+ 0440 Tremolo Strings
55
+ 0450 Pizzicato Strings
56
+ 0460 Orchestral Harp
57
+ 0470 Timpani
58
+ 0480 String Ensemble 1
59
+ 0490 String Ensemble 2
60
+ 0500 Synth Strings 1
61
+ 0510 Synth Strings 2
62
+ 0520 Choir Aahs
63
+ 0530 Voice Oohs
64
+ 0540 Synth Choir
65
+ 0550 Orchestra Hit
66
+ 0560 Trumpet
67
+ 0570 Trombone
68
+ 0580 Tuba
69
+ 0590 Muted Trumpet
70
+ 0600 French Horn
71
+ 0610 Brass Section
72
+ 0620 Synth Brass 1
73
+ 0630 Synth Brass 2
74
+ 0640 Soprano Sax
75
+ 0650 Alto Sax
76
+ 0660 Tenor Sax
77
+ 0670 Baritone Sax
78
+ 0680 Oboe
79
+ 0690 English Horn
80
+ 0700 Bassoon
81
+ 0710 Clarinet
82
+ 0720 Piccolo
83
+ 0730 Flute
84
+ 0740 Recorder
85
+ 0750 Pan Flute
86
+ 0760 Blown bottle
87
+ 0770 Shakuhachi
88
+ 0780 Whistle
89
+ 0790 Ocarina
90
+ 0800 Lead 1 (square)
91
+ 0810 Lead 2 (sawtooth)
92
+ 0820 Lead 3 (calliope)
93
+ 0830 Lead 4 (chiff)
94
+ 0840 Lead 5 (charang)
95
+ 0850 Lead 6 (voice)
96
+ 0860 Lead 7 (fifths)
97
+ 0870 Lead 8 (bass + lead)
98
+ 0880 Pad 1 (new age)
99
+ 0890 Pad 2 (warm)
100
+ 0900 Pad 3 (polysynth)
101
+ 0910 Pad 4 (choir)
102
+ 0920 Pad 5 (bowed)
103
+ 0930 Pad 6 (metallic)
104
+ 0940 Pad 7 (halo)
105
+ 0950 Pad 8 (sweep)
106
+ 0960 FX 1 (rain)
107
+ 0970 FX 2 (soundtrack)
108
+ 0980 FX 3 (crystal)
109
+ 0990 FX 4 (atmosphere)
110
+ 1000 FX 5 (brightness)
111
+ 1010 FX 6 (goblins)
112
+ 1020 FX 7 (echoes)
113
+ 1030 FX 8 (sci-fi)
114
+ 1040 Sitar
115
+ 1050 Banjo
116
+ 1060 Shamisen
117
+ 1070 Koto
118
+ 1080 Kalimba
119
+ 1090 Bagpipe
120
+ 1100 Fiddle
121
+ 1110 Shanai
122
+ 1120 Tinkle Bell
123
+ 1130 Agogo
124
+ 1140 Steel Drums
125
+ 1150 Woodblock
126
+ 1160 Taiko Drum
127
+ 1170 Melodic Tom
128
+ 1180 Synth Drum
129
+ 1190 Reverse Cymbal
130
+ 1200 Guitar Fret Noise
131
+ 1210 Breath Noise
132
+ 1220 Seashore
133
+ 1230 Bird Tweet
134
+ 1240 Telephone Ring
135
+ 1250 Helicopter
136
+ 1260 Applause
137
+ 1270 Gunshot`;
15
138
  async function buildNameToKeyMapping() {
16
139
  const nameToKey = {};
17
- try {
18
- const fontNames = await fetchSoundFontList("fontName_surikov");
19
- fontNames.forEach((line) => {
20
- const [key, ...nameParts] = line.split(" ");
21
- const name = nameParts.join(" ");
22
- nameToKey[name] = key;
23
- });
24
- } catch (e) {
25
- console.error("Failed to build name-to-key mapping:", e);
140
+ for (const line of FONT_NAME_SURIKOV.trim().split("\n")) {
141
+ const spaceIdx = line.indexOf(" ");
142
+ if (spaceIdx === -1) continue;
143
+ const key = line.slice(0, spaceIdx);
144
+ const name = line.slice(spaceIdx + 1);
145
+ nameToKey[name] = key;
26
146
  }
27
147
  return nameToKey;
28
148
  }
@@ -10648,7 +10768,6 @@ export {
10648
10768
  exportMIDI,
10649
10769
  extractMidiPlacements,
10650
10770
  extractMidiPlacementsByTrack,
10651
- fetchSoundFontList,
10652
10771
  formatMmlMeta,
10653
10772
  freqFromPitch,
10654
10773
  generateRandomPattern,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "onjmin",
3
3
  "license": "MIT",
4
4
  "name": "@onjmin/dtm",
5
- "version": "0.1.34",
5
+ "version": "0.1.36",
6
6
  "description": "MMLを中間言語に用いた、モバイルファーストなDAW / ピアノロール打ち込みコンポーネント",
7
7
  "homepage": "https://onjmin.github.io/dtm",
8
8
  "repository": {