Skip to content

Commit 14edf09

Browse files
committed
added inline examples
1 parent ef5fc02 commit 14edf09

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/monosynth.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@ define(function (require) {
1616
*
1717
* @class p5.MonoSynth
1818
* @constructor
19+
* @example
20+
* <div><code>
21+
* var monosynth;
22+
* var x;
1923
*
24+
* function setup() {
25+
* monosynth = new p5.MonoSynth();
26+
* monosynth.loadPreset('simpleBass');
27+
* monosynth.play(45,1,x=0,1);
28+
* monosynth.play(49,1,x+=1,0.25);
29+
* monosynth.play(50,1,x+=0.25,0.25);
30+
* monosynth.play(49,1,x+=0.5,0.25);
31+
* monosynth.play(50,1,x+=0.25,0.25);
32+
* }
33+
* </code></div>
2034
**/
2135

2236
p5.MonoSynth = function () {
@@ -25,7 +39,6 @@ define(function (require) {
2539
this.oscillator = new p5.Oscillator();
2640
this.oscillator.disconnect();
2741

28-
2942
this.env = new p5.Env();
3043
this.env.setRange(1, 0);
3144
this.env.setExp(true);

src/polysynth.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ define(function (require) {
1919
* the AudioVoice class. Defaults ot p5.MonoSynth
2020
*
2121
* @param {Number} [polyValue] Number of voices, defaults to 8;
22+
*
23+
*
24+
*
25+
* @example
26+
* <div><code>
27+
* var polysynth;
28+
* function setup() {
29+
* polysynth = new p5.PolySynth();
30+
* polysynth.play(53,1,0,3);
31+
* polysynth.play(60,1,0,2.9);
32+
* polysynth.play(69,1,0,3);
33+
* polysynth.play(71,1,0,3);
34+
* polysynth.play(74,1,0,3);
35+
* }
36+
* </code></div>
37+
*
2238
**/
2339
p5.PolySynth = function(audioVoice, polyValue) {
2440
//audiovoices will contain polyValue many monophonic synths

0 commit comments

Comments
 (0)