smplr 0.11.0 → 0.11.1
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/README.md +4 -4
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ You can import directly from the browser. For example:
|
|
|
68
68
|
<button id="btn">play</button>
|
|
69
69
|
</body>
|
|
70
70
|
<script type="module">
|
|
71
|
-
import { SplendidGrandPiano } from "https://unpkg.com/smplr
|
|
71
|
+
import { SplendidGrandPiano } from "https://unpkg.com/smplr/dist/index.mjs"; // needs to be a url
|
|
72
72
|
const context = new AudioContext(); // create the audio context
|
|
73
73
|
const marimba = new SplendidGrandPiano(context); // create and load the instrument
|
|
74
74
|
|
|
@@ -112,6 +112,8 @@ Since the promise returns the instrument instance, you can create and wait in a
|
|
|
112
112
|
const piano = await new SplendidGrandPiano(context).load;
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
⚠️ In versions lower than 0.8.0 a `loaded()` function was exposed instead.
|
|
116
|
+
|
|
115
117
|
#### Shared configuration options
|
|
116
118
|
|
|
117
119
|
All instruments share some configuration options that are passed as second argument of the constructor. As it name implies, all fields are optional:
|
|
@@ -119,13 +121,11 @@ All instruments share some configuration options that are passed as second argum
|
|
|
119
121
|
- `volume`: A number from 0 to 127 representing the instrument global volume. 100 by default
|
|
120
122
|
- `destination`: An `AudioNode` that is the output of the instrument. `AudioContext.destination` is used by default
|
|
121
123
|
- `volumeToGain`: a function to convert the volume to gain. It uses MIDI standard as default.
|
|
122
|
-
- `scheduleLookaheadMs`: the lookahead of the scheduler. If the start time of the note is less than current time plus this lookahead time, the note will be started.
|
|
124
|
+
- `scheduleLookaheadMs`: the lookahead of the scheduler. If the start time of the note is less than current time plus this lookahead time, the note will be started. 200ms by default.
|
|
123
125
|
- `scheduleIntervalMs`: the interval of the scheduler. 50ms by default.
|
|
124
126
|
- `onStart`: a function that is called when starting a note. It receives the note started as parameter. Bear in mind that the time this function is called is not precise, and it's determined by lookahead.
|
|
125
127
|
- `onEnded`: a function that is called when the note ends. It receives the started note as parameter.
|
|
126
128
|
|
|
127
|
-
⚠️ In versions lower than 0.8.0 a `loaded()` function was exposed instead.
|
|
128
|
-
|
|
129
129
|
### Play
|
|
130
130
|
|
|
131
131
|
#### Start and stop notes
|
package/dist/index.js
CHANGED
|
@@ -1127,6 +1127,7 @@ function findSampleInRegion(midi, seqNum, sample, region, defaults) {
|
|
|
1127
1127
|
name: region.sampleName,
|
|
1128
1128
|
note: midi,
|
|
1129
1129
|
onEnded: sample.onEnded,
|
|
1130
|
+
onStart: sample.onStart,
|
|
1130
1131
|
stopId: sample.name,
|
|
1131
1132
|
time: sample.time,
|
|
1132
1133
|
velocity: velocity == void 0 ? void 0 : velocity
|