tone 15.2.10 → 15.2.12
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/Tone/instrument/MembraneSynth.test.ts +32 -2
- package/Tone/instrument/MembraneSynth.ts +4 -4
- package/Tone/version.ts +1 -1
- package/build/Tone.js +1 -1
- package/build/Tone.js.map +1 -1
- package/build/esm/instrument/MembraneSynth.js +4 -4
- package/build/esm/instrument/MembraneSynth.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/package.json +3 -3
|
@@ -52,13 +52,43 @@ describe("MembraneSynth", () => {
|
|
|
52
52
|
|
|
53
53
|
it("can get and set the octaves and pitch decay", () => {
|
|
54
54
|
const drumSynth = new MembraneSynth();
|
|
55
|
-
drumSynth.octaves =
|
|
55
|
+
drumSynth.octaves = 8;
|
|
56
56
|
drumSynth.pitchDecay = 0.2;
|
|
57
57
|
expect(drumSynth.pitchDecay).to.equal(0.2);
|
|
58
|
-
expect(drumSynth.octaves).to.equal(
|
|
58
|
+
expect(drumSynth.octaves).to.equal(8);
|
|
59
59
|
drumSynth.dispose();
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
+
it("validates octaves range", () => {
|
|
63
|
+
const drumSynth = new MembraneSynth();
|
|
64
|
+
// Test minimum boundary
|
|
65
|
+
drumSynth.octaves = 0.5;
|
|
66
|
+
expect(drumSynth.octaves).to.equal(0.5);
|
|
67
|
+
// Test maximum boundary
|
|
68
|
+
drumSynth.octaves = 8;
|
|
69
|
+
expect(drumSynth.octaves).to.equal(8);
|
|
70
|
+
drumSynth.dispose();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("validates pitchDecay range", () => {
|
|
74
|
+
const drumSynth = new MembraneSynth();
|
|
75
|
+
drumSynth.pitchDecay = 0;
|
|
76
|
+
expect(drumSynth.pitchDecay).to.equal(0);
|
|
77
|
+
drumSynth.pitchDecay = 0.5;
|
|
78
|
+
expect(drumSynth.pitchDecay).to.equal(0.5);
|
|
79
|
+
drumSynth.dispose();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("Finds correct maximum note frequency", () => {
|
|
83
|
+
const drumSynth = new MembraneSynth();
|
|
84
|
+
const hertz = 65.4; // C2
|
|
85
|
+
drumSynth.octaves = 8;
|
|
86
|
+
const maxNote = hertz * Math.pow(2, drumSynth.octaves);
|
|
87
|
+
expect(maxNote).to.equal(16742.4); // C2 + 8 octaves
|
|
88
|
+
drumSynth.dispose();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
|
|
62
92
|
it("can be constructed with an options object", () => {
|
|
63
93
|
const drumSynth = new MembraneSynth({
|
|
64
94
|
envelope: {
|
|
@@ -32,7 +32,7 @@ export class MembraneSynth extends Synth<MembraneSynthOptions> {
|
|
|
32
32
|
* @min 0.5
|
|
33
33
|
* @max 8
|
|
34
34
|
*/
|
|
35
|
-
@range(0)
|
|
35
|
+
@range(0.5, 8)
|
|
36
36
|
octaves: Positive;
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -40,7 +40,7 @@ export class MembraneSynth extends Synth<MembraneSynthOptions> {
|
|
|
40
40
|
* @min 0
|
|
41
41
|
* @max 0.5
|
|
42
42
|
*/
|
|
43
|
-
@timeRange(0)
|
|
43
|
+
@timeRange(0, 0.5)
|
|
44
44
|
pitchDecay: Time;
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -73,7 +73,7 @@ export class MembraneSynth extends Synth<MembraneSynthOptions> {
|
|
|
73
73
|
release: 1.4,
|
|
74
74
|
sustain: 0.01,
|
|
75
75
|
},
|
|
76
|
-
octaves:
|
|
76
|
+
octaves: 8,
|
|
77
77
|
oscillator: {
|
|
78
78
|
type: "sine",
|
|
79
79
|
},
|
|
@@ -86,7 +86,7 @@ export class MembraneSynth extends Synth<MembraneSynthOptions> {
|
|
|
86
86
|
const hertz = this.toFrequency(
|
|
87
87
|
note instanceof FrequencyClass ? note.toFrequency() : note
|
|
88
88
|
);
|
|
89
|
-
const maxNote = hertz * this.octaves;
|
|
89
|
+
const maxNote = hertz * Math.pow(2, this.octaves);
|
|
90
90
|
this.oscillator.frequency.setValueAtTime(maxNote, seconds);
|
|
91
91
|
this.oscillator.frequency.exponentialRampToValueAtTime(
|
|
92
92
|
hertz,
|
package/Tone/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version: string = "15.2.
|
|
1
|
+
export const version: string = "15.2.12";
|