spessasynth_lib 3.16.2 → 3.16.3

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.
Files changed (87) hide show
  1. package/@types/index.d.ts +0 -2
  2. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +29 -0
  3. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +76 -0
  4. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +82 -0
  5. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +80 -0
  6. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +42 -0
  7. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +18 -0
  8. package/@types/soundfont/{read → basic_soundfont}/riff_chunk.d.ts +2 -1
  9. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +6 -0
  10. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +6 -0
  11. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +6 -0
  12. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +6 -0
  13. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +6 -0
  14. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +6 -0
  15. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +6 -0
  16. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +6 -0
  17. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +11 -0
  18. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +8 -0
  19. package/@types/soundfont/{write → basic_soundfont/write_sf2}/write.d.ts +2 -2
  20. package/@types/soundfont/{read → read_sf2}/generators.d.ts +2 -1
  21. package/@types/soundfont/{read → read_sf2}/instruments.d.ts +3 -24
  22. package/@types/soundfont/read_sf2/presets.d.ts +28 -0
  23. package/@types/soundfont/read_sf2/samples.d.ts +56 -0
  24. package/@types/soundfont/{read → read_sf2}/zones.d.ts +11 -53
  25. package/@types/soundfont/soundfont.d.ts +6 -67
  26. package/midi_parser/midi_loader.js +1 -1
  27. package/midi_parser/rmidi_writer.js +11 -11
  28. package/midi_parser/used_keys_loaded.js +1 -1
  29. package/package.json +1 -1
  30. package/soundfont/basic_soundfont/basic_instrument.js +73 -0
  31. package/soundfont/{read/presets.js → basic_soundfont/basic_preset.js} +54 -87
  32. package/soundfont/basic_soundfont/basic_sample.js +132 -0
  33. package/soundfont/basic_soundfont/basic_soundfont.js +193 -0
  34. package/soundfont/basic_soundfont/basic_zone.js +39 -0
  35. package/soundfont/basic_soundfont/basic_zones.js +47 -0
  36. package/soundfont/{read → basic_soundfont}/riff_chunk.js +8 -1
  37. package/soundfont/{write → basic_soundfont/write_sf2}/ibag.js +4 -4
  38. package/soundfont/{write → basic_soundfont/write_sf2}/igen.js +5 -5
  39. package/soundfont/{write → basic_soundfont/write_sf2}/imod.js +4 -4
  40. package/soundfont/{write → basic_soundfont/write_sf2}/inst.js +5 -5
  41. package/soundfont/{write → basic_soundfont/write_sf2}/pbag.js +4 -4
  42. package/soundfont/{write → basic_soundfont/write_sf2}/pgen.js +5 -5
  43. package/soundfont/{write → basic_soundfont/write_sf2}/phdr.js +5 -5
  44. package/soundfont/{write → basic_soundfont/write_sf2}/pmod.js +4 -4
  45. package/soundfont/{write → basic_soundfont/write_sf2}/sdta.js +5 -5
  46. package/soundfont/{write → basic_soundfont/write_sf2}/shdr.js +5 -5
  47. package/soundfont/{write → basic_soundfont/write_sf2}/soundfont_trimmer.js +5 -5
  48. package/soundfont/{write → basic_soundfont/write_sf2}/write.js +8 -9
  49. package/soundfont/{read → read_sf2}/generators.js +2 -1
  50. package/soundfont/{read → read_sf2}/instruments.js +4 -63
  51. package/soundfont/{read → read_sf2}/modulators.js +1 -1
  52. package/soundfont/read_sf2/presets.js +78 -0
  53. package/soundfont/{read → read_sf2}/samples.js +4 -138
  54. package/soundfont/{read → read_sf2}/zones.js +14 -60
  55. package/soundfont/soundfont.js +21 -188
  56. package/synthetizer/worklet_processor.min.js +6 -6
  57. package/synthetizer/worklet_system/message_protocol/message_sending.js +1 -1
  58. package/synthetizer/worklet_system/worklet_methods/data_entry.js +1 -1
  59. package/synthetizer/worklet_system/worklet_methods/note_off.js +1 -1
  60. package/synthetizer/worklet_system/worklet_methods/note_on.js +1 -1
  61. package/synthetizer/worklet_system/worklet_methods/program_control.js +1 -1
  62. package/synthetizer/worklet_system/worklet_methods/reset_controllers.js +1 -1
  63. package/synthetizer/worklet_system/worklet_methods/tuning_control.js +1 -1
  64. package/synthetizer/worklet_system/worklet_methods/voice_control.js +1 -1
  65. package/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +1 -1
  66. package/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js +2 -2
  67. package/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +1 -1
  68. package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +4 -4
  69. package/synthetizer/worklet_system/worklet_utilities/worklet_modulator.js +2 -2
  70. package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +1 -1
  71. package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +1 -1
  72. package/utils/buffer_to_wav.js +6 -6
  73. package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
  74. package/@types/soundfont/read/presets.d.ts +0 -88
  75. package/@types/soundfont/read/samples.d.ts +0 -138
  76. package/@types/soundfont/write/ibag.d.ts +0 -6
  77. package/@types/soundfont/write/igen.d.ts +0 -6
  78. package/@types/soundfont/write/imod.d.ts +0 -6
  79. package/@types/soundfont/write/inst.d.ts +0 -6
  80. package/@types/soundfont/write/pbag.d.ts +0 -6
  81. package/@types/soundfont/write/pgen.d.ts +0 -6
  82. package/@types/soundfont/write/phdr.d.ts +0 -6
  83. package/@types/soundfont/write/pmod.d.ts +0 -6
  84. package/@types/soundfont/write/sdta.d.ts +0 -11
  85. package/@types/soundfont/write/shdr.d.ts +0 -8
  86. package/@types/soundfont/write/soundfont_trimmer.d.ts +0 -6
  87. /package/@types/soundfont/{read → read_sf2}/modulators.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import { returnMessageType } from './worklet_message.js'
2
2
  import { NON_CC_INDEX_OFFSET } from '../worklet_utilities/worklet_processor_channel.js'
3
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
3
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
4
4
 
5
5
  /**
6
6
  * Calls synth event from the worklet side
@@ -5,7 +5,7 @@ import {
5
5
  dataEntryStates,
6
6
  NON_CC_INDEX_OFFSET,
7
7
  } from '../worklet_utilities/worklet_processor_channel.js'
8
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
8
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
9
9
  import { SpessaSynthInfo, SpessaSynthWarn } from '../../../utils/loggin.js'
10
10
 
11
11
  /**
@@ -1,4 +1,4 @@
1
- import { generatorTypes } from '../../../soundfont/read/generators.js'
1
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
2
2
  import { consoleColors } from '../../../utils/other.js'
3
3
  import { SpessaSynthInfo, SpessaSynthWarn } from '../../../utils/loggin.js'
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { getWorkletVoices } from '../worklet_utilities/worklet_voice.js'
2
- import { generatorTypes } from '../../../soundfont/read/generators.js'
2
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
3
3
  import { computeModulators } from '../worklet_utilities/worklet_modulator.js'
4
4
  import { recalculateVolumeEnvelope } from '../worklet_utilities/volume_envelope.js'
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { midiControllers } from '../../../midi_parser/midi_message.js'
2
2
  import { SoundFont2 } from '../../../soundfont/soundfont.js'
3
3
  import { clearSamplesList } from '../worklet_utilities/worklet_voice.js'
4
- import { generatorTypes } from '../../../soundfont/read/generators.js'
4
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
5
5
  import { returnMessageType } from '../message_protocol/worklet_message.js'
6
6
  import { SpessaSynthInfo } from '../../../utils/loggin.js'
7
7
  import { consoleColors } from '../../../utils/other.js'
@@ -7,7 +7,7 @@ import {
7
7
  NON_CC_INDEX_OFFSET,
8
8
  resetArray,
9
9
  } from '../worklet_utilities/worklet_processor_channel.js'
10
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
10
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
11
11
  import { SpessaSynthInfo } from '../../../utils/loggin.js'
12
12
 
13
13
  /**
@@ -1,6 +1,6 @@
1
1
  import { customControllers, NON_CC_INDEX_OFFSET } from '../worklet_utilities/worklet_processor_channel.js'
2
2
  import { consoleColors } from '../../../utils/other.js'
3
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
3
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
4
4
  import { computeModulators } from '../worklet_utilities/worklet_modulator.js'
5
5
  import { SpessaSynthInfo } from '../../../utils/loggin.js'
6
6
 
@@ -1,4 +1,4 @@
1
- import { generatorTypes } from '../../../soundfont/read/generators.js'
1
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
2
2
  import { absCentsToHz, decibelAttenuationToGain, timecentsToSeconds } from '../worklet_utilities/unit_converter.js'
3
3
  import { getLFOValue } from '../worklet_utilities/lfo.js'
4
4
  import { customControllers } from '../worklet_utilities/worklet_processor_channel.js'
@@ -1,4 +1,4 @@
1
- import { generatorTypes } from '../../../soundfont/read/generators.js'
1
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
2
2
  import { absCentsToHz, decibelAttenuationToGain } from './unit_converter.js'
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { timecentsToSeconds } from './unit_converter.js'
2
- import { generatorTypes } from '../../../soundfont/read/generators.js'
2
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
3
3
  import { getModulatorCurveValue } from './modulator_curves.js'
4
- import { modulatorCurveTypes } from '../../../soundfont/read/modulators.js'
4
+ import { modulatorCurveTypes } from '../../../soundfont/read_sf2/modulators.js'
5
5
 
6
6
  /**
7
7
  * modulation_envelope.js
@@ -1,4 +1,4 @@
1
- import { modulatorCurveTypes } from '../../../soundfont/read/modulators.js'
1
+ import { modulatorCurveTypes } from '../../../soundfont/read_sf2/modulators.js'
2
2
 
3
3
  /**
4
4
  * modulator_curves.js
@@ -1,5 +1,5 @@
1
1
  import { decibelAttenuationToGain, timecentsToSeconds } from './unit_converter.js'
2
- import { generatorTypes } from '../../../soundfont/read/generators.js'
2
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
3
3
 
4
4
  /**
5
5
  * volume_envelope.js
@@ -93,12 +93,12 @@ export function recalculateVolumeEnvelope(voice)
93
93
  // calculate the db attenuation at the time of release (not a constant because it can change (ex, volume set to 0, the sound should cut off)
94
94
  switch (env.state) {
95
95
  case 0:
96
- env.releaseStartDb = 0;
96
+ env.releaseStartDb = DB_SILENCE;
97
97
  break;
98
98
 
99
99
  case 1:
100
- // FIXME: this does not work
101
- // attack phase
100
+ // attack phase: get linear gain of the attack phase when release started
101
+ // and turn it into db as we're ramping the db up linearly (to make volume go down exponentially)
102
102
  // attack is linear (in gain) so we need to do get db from that
103
103
  let elapsed = 1 - ((env.attackEnd - voice.releaseStartTime) / env.attackDuration);
104
104
  // calculate the gain that the attack would have
@@ -1,8 +1,8 @@
1
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
1
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
2
2
  import { getModulatorCurveValue, MOD_PRECOMPUTED_LENGTH } from './modulator_curves.js'
3
3
  import { NON_CC_INDEX_OFFSET } from './worklet_processor_channel.js'
4
4
  import { recalculateVolumeEnvelope } from './volume_envelope.js'
5
- import { generatorTypes } from '../../../soundfont/read/generators.js'
5
+ import { generatorTypes } from '../../../soundfont/read_sf2/generators.js'
6
6
 
7
7
  /**
8
8
  * worklet_modulator.js
@@ -1,5 +1,5 @@
1
1
  import { midiControllers } from '../../../midi_parser/midi_message.js'
2
- import { modulatorSources } from '../../../soundfont/read/modulators.js'
2
+ import { modulatorSources } from '../../../soundfont/read_sf2/modulators.js'
3
3
  /**
4
4
  * @typedef {Object} WorkletProcessorChannel
5
5
  * @property {Int16Array} midiControllers - array of MIDI controller values + the values used by modulators as source (pitch bend, bend range etc.)
@@ -46,7 +46,7 @@
46
46
  * @property {number} currentPan - from 0 to 1
47
47
  */
48
48
 
49
- import { addAndClampGenerator, generatorTypes } from '../../../soundfont/read/generators.js'
49
+ import { addAndClampGenerator, generatorTypes } from '../../../soundfont/read_sf2/generators.js'
50
50
  import { SpessaSynthTable, SpessaSynthWarn } from '../../../utils/loggin.js'
51
51
  import { DEFAULT_WORKLET_VOLUME_ENVELOPE } from './volume_envelope.js'
52
52
  import { DEFAULT_WORKLET_LOWPASS_FILTER } from './lowpass_filter.js'
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { combineArrays, IndexedByteArray } from './indexed_array.js'
10
10
  import { getStringBytes } from './byte_functions/string.js'
11
- import { writeRIFFOddSize } from '../soundfont/read/riff_chunk.js'
11
+ import { writeRIFFOddSize } from '../soundfont/basic_soundfont/riff_chunk.js'
12
12
 
13
13
  /**
14
14
  *
@@ -35,30 +35,30 @@ export function audioBufferToWav(audioBuffer, normalizeAudio = true, channelOffs
35
35
  const encoder = new TextEncoder();
36
36
  const infoChunks = [
37
37
  getStringBytes("INFO"),
38
- writeRIFFOddSize("ICMT", encoder.encode("Created with SpessaSynth"))
38
+ writeRIFFOddSize("ICMT", encoder.encode("Created with SpessaSynth"), true)
39
39
  ];
40
40
  if(metadata.artist)
41
41
  {
42
42
  infoChunks.push(
43
- writeRIFFOddSize("IART", encoder.encode(metadata.artist))
43
+ writeRIFFOddSize("IART", encoder.encode(metadata.artist), true)
44
44
  );
45
45
  }
46
46
  if(metadata.album)
47
47
  {
48
48
  infoChunks.push(
49
- writeRIFFOddSize("IPRD", encoder.encode(metadata.album))
49
+ writeRIFFOddSize("IPRD", encoder.encode(metadata.album), true)
50
50
  );
51
51
  }
52
52
  if(metadata.genre)
53
53
  {
54
54
  infoChunks.push(
55
- writeRIFFOddSize("IGNR", encoder.encode(metadata.genre))
55
+ writeRIFFOddSize("IGNR", encoder.encode(metadata.genre), true)
56
56
  );
57
57
  }
58
58
  if(metadata.title)
59
59
  {
60
60
  infoChunks.push(
61
- writeRIFFOddSize("INAM", encoder.encode(metadata.title))
61
+ writeRIFFOddSize("INAM", encoder.encode(metadata.title), true)
62
62
  );
63
63
  }
64
64
  infoChunk = writeRIFFOddSize("LIST", combineArrays(infoChunks));
@@ -1,10 +0,0 @@
1
- /**
2
- * @param mid {MIDI}
3
- * @param soundfont {{getPreset: function(number, number): Preset}}
4
- * @returns {Object<string, Set<string>>}
5
- */
6
- export function getUsedProgramsAndKeys(mid: MIDI, soundfont: {
7
- getPreset: (arg0: number, arg1: number) => Preset;
8
- }): {
9
- [x: string]: Set<string>;
10
- };
@@ -1,88 +0,0 @@
1
- /**
2
- * Reads the presets
3
- * @param presetChunk {RiffChunk}
4
- * @param presetZones {PresetZone[]}
5
- * @returns {Preset[]}
6
- */
7
- export function readPresets(presetChunk: RiffChunk, presetZones: PresetZone[]): Preset[];
8
- /**
9
- * parses soundfont presets, also includes function for getting the generators and samples from midi note and velocity
10
- */
11
- export class Preset {
12
- /**
13
- * Creates a preset
14
- * @param presetChunk {RiffChunk}
15
- */
16
- constructor(presetChunk: RiffChunk);
17
- presetName: string;
18
- program: number;
19
- bank: number;
20
- presetZoneStartIndex: number;
21
- presetZonesAmount: number;
22
- /**
23
- * @type {PresetZone[]}
24
- */
25
- presetZones: PresetZone[];
26
- sampleIDOffset: number;
27
- /**
28
- * Stores already found getSamplesAndGenerators for reuse
29
- * @type {SampleAndGenerators[][][]}
30
- */
31
- foundSamplesAndGenerators: {
32
- instrumentGenerators: Generator[];
33
- presetGenerators: Generator[];
34
- modulators: Modulator[];
35
- sample: LoadedSample;
36
- sampleID: number;
37
- }[][][];
38
- library: number;
39
- genre: number;
40
- morphology: number;
41
- /**
42
- * Loads all the preset zones, given the amount
43
- * @param amount {number}
44
- * @param zones {PresetZone[]}
45
- */
46
- getPresetZones(amount: number, zones: PresetZone[]): void;
47
- deletePreset(): void;
48
- /**
49
- * @param index {number}
50
- */
51
- deleteZone(index: number): void;
52
- /**
53
- * Preloads all samples (async)
54
- */
55
- preload(keyMin: any, keyMax: any): void;
56
- /**
57
- * Preloads a specific key/velocity combo
58
- * @param key {number}
59
- * @param velocity {number}
60
- */
61
- preloadSpecific(key: number, velocity: number): void;
62
- /**
63
- * @typedef {{
64
- * instrumentGenerators: Generator[],
65
- * presetGenerators: Generator[],
66
- * modulators: Modulator[],
67
- * sample: LoadedSample,
68
- * sampleID: number,
69
- * }} SampleAndGenerators
70
- */
71
- /**
72
- * Returns generatorTranslator and generators for given note
73
- * @param midiNote {number}
74
- * @param velocity {number}
75
- * @returns {SampleAndGenerators[]}
76
- */
77
- getSamplesAndGenerators(midiNote: number, velocity: number): {
78
- instrumentGenerators: Generator[];
79
- presetGenerators: Generator[];
80
- modulators: Modulator[];
81
- sample: LoadedSample;
82
- sampleID: number;
83
- }[];
84
- }
85
- import { RiffChunk } from "./riff_chunk.js";
86
- import { PresetZone } from "./zones.js";
87
- import { Generator } from './generators.js';
88
- import { LoadedSample } from "./samples.js";
@@ -1,138 +0,0 @@
1
- /**
2
- * Reads the generatorTranslator from the shdr read
3
- * @param sampleHeadersChunk {RiffChunk}
4
- * @param smplChunkData {IndexedByteArray|Float32Array}
5
- * @param isSmplDataRaw {boolean}
6
- * @returns {LoadedSample[]}
7
- */
8
- export function readSamples(sampleHeadersChunk: RiffChunk, smplChunkData: IndexedByteArray | Float32Array, isSmplDataRaw?: boolean): LoadedSample[];
9
- /**
10
- * samples.js
11
- * purpose: parses soundfont samples, resamples if needed.
12
- * loads sample data, handles async loading of sf3 compressed samples
13
- */
14
- export class BasicSample {
15
- /**
16
- * The basic representation of a soundfont sample
17
- * @param sampleName {string}
18
- * @param sampleRate {number}
19
- * @param samplePitch {number}
20
- * @param samplePitchCorrection {number}
21
- * @param sampleLink {number}
22
- * @param sampleType {number}
23
- * @param loopStart {number} relative to sample start
24
- * @param loopEnd {number} relative to sample start
25
- */
26
- constructor(sampleName: string, sampleRate: number, samplePitch: number, samplePitchCorrection: number, sampleLink: number, sampleType: number, loopStart: number, loopEnd: number);
27
- /**
28
- * Sample's name
29
- * @type {string}
30
- */
31
- sampleName: string;
32
- /**
33
- * Sample rate in Hz
34
- * @type {number}
35
- */
36
- sampleRate: number;
37
- /**
38
- * Original pitch of the sample as a MIDI note number
39
- * @type {number}
40
- */
41
- samplePitch: number;
42
- /**
43
- * Pitch correction, in cents. Can be negative
44
- * @type {number}
45
- */
46
- samplePitchCorrection: number;
47
- /**
48
- * Sample link, currently unused.
49
- * @type {number}
50
- */
51
- sampleLink: number;
52
- /**
53
- * Type of the sample, an enum
54
- * @type {number}
55
- */
56
- sampleType: number;
57
- /**
58
- * Relative to start of the sample, bytes
59
- * @type {number}
60
- */
61
- sampleLoopStartIndex: number;
62
- /**
63
- * Relative to start of the sample, in bytes
64
- * @type {number}
65
- */
66
- sampleLoopEndIndex: number;
67
- /**
68
- * Indicates if the sample is compressed
69
- * @type {boolean}
70
- */
71
- isCompressed: boolean;
72
- /**
73
- * The compressed sample data if it was compressed by spessasynth
74
- * @type {Uint8Array}
75
- */
76
- compressedData: Uint8Array;
77
- /**
78
- * @returns {Uint8Array|IndexedByteArray}
79
- */
80
- getRawData(): Uint8Array | IndexedByteArray;
81
- /**
82
- * @param quality {number}
83
- * @param encodeVorbis {EncodeVorbisFunction}
84
- */
85
- compressSample(quality: number, encodeVorbis: EncodeVorbisFunction): void;
86
- /**
87
- * @returns {Float32Array}
88
- */
89
- getAudioData(): Float32Array;
90
- }
91
- export class LoadedSample extends BasicSample {
92
- /**
93
- * Creates a sample
94
- * @param sampleName {string}
95
- * @param sampleStartIndex {number}
96
- * @param sampleEndIndex {number}
97
- * @param sampleLoopStartIndex {number}
98
- * @param sampleLoopEndIndex {number}
99
- * @param sampleRate {number}
100
- * @param samplePitch {number}
101
- * @param samplePitchCorrection {number}
102
- * @param sampleLink {number}
103
- * @param sampleType {number}
104
- * @param smplArr {IndexedByteArray|Float32Array}
105
- * @param sampleIndex {number} initial sample index when loading the sfont
106
- * @param isDataRaw {boolean} if false, the data is decoded as float32.
107
- * Used for SF2Pack support
108
- */
109
- constructor(sampleName: string, sampleStartIndex: number, sampleEndIndex: number, sampleLoopStartIndex: number, sampleLoopEndIndex: number, sampleRate: number, samplePitch: number, samplePitchCorrection: number, sampleLink: number, sampleType: number, smplArr: IndexedByteArray | Float32Array, sampleIndex: number, isDataRaw: boolean);
110
- sampleStartIndex: number;
111
- sampleEndIndex: number;
112
- isSampleLoaded: boolean;
113
- sampleID: number;
114
- useCount: number;
115
- sampleLength: number;
116
- sampleDataArray: Float32Array | IndexedByteArray;
117
- sampleData: Float32Array;
118
- isDataRaw: boolean;
119
- /**
120
- * Get raw data, whether it's compressed or not as we simply write it to the file
121
- * @return {Uint8Array}
122
- */
123
- getRawData(): Uint8Array;
124
- /**
125
- * Decode binary vorbis into a float32 pcm
126
- */
127
- decodeVorbis(): void;
128
- /**
129
- * @returns {Float32Array}
130
- */
131
- loadUncompressedData(): Float32Array;
132
- /**
133
- * @returns {Float32Array}
134
- */
135
- getUncompressedReadyData(): Float32Array;
136
- }
137
- import { RiffChunk } from "./riff_chunk.js";
138
- import { IndexedByteArray } from "../../utils/indexed_array.js";
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getIBAG(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getIGEN(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getIMOD(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getINST(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getPBAG(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getPGEN(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getPHDR(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @returns {IndexedByteArray}
4
- */
5
- export function getPMOD(this: SoundFont2): IndexedByteArray;
6
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,11 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @param smplStartOffsets {number[]}
4
- * @param smplEndOffsets {number[]}
5
- * @param compress {boolean}
6
- * @param quality {number}
7
- * @param vorbisFunc {EncodeVorbisFunction}
8
- * @returns {IndexedByteArray}
9
- */
10
- export function getSDTA(this: SoundFont2, smplStartOffsets: number[], smplEndOffsets: number[], compress: boolean, quality: number, vorbisFunc: EncodeVorbisFunction): IndexedByteArray;
11
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,8 +0,0 @@
1
- /**
2
- * @this {SoundFont2}
3
- * @param smplStartOffsets {number[]}
4
- * @param smplEndOffsets {number[]}
5
- * @returns {IndexedByteArray}
6
- */
7
- export function getSHDR(this: SoundFont2, smplStartOffsets: number[], smplEndOffsets: number[]): IndexedByteArray;
8
- import { IndexedByteArray } from '../../utils/indexed_array.js';
@@ -1,6 +0,0 @@
1
- /**
2
- * @param soundfont {SoundFont2}
3
- * @param mid {MIDI}
4
- * @returns {Uint8Array}
5
- */
6
- export function trimSoundfont(soundfont: SoundFont2, mid: MIDI): Uint8Array;