Skip to content

Commit 548e1ee

Browse files
committed
Merge branch 'master' of github.com:processing/p5.js-sound into oscillator
2 parents a22f3b3 + 374d306 commit 548e1ee

File tree

10 files changed

+24
-30
lines changed

10 files changed

+24
-30
lines changed

examples/peakDetect/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function setup() {
3131

3232
src_length = source_file.duration();
3333
source_file.playMode('restart');
34-
println("source duration: " +src_length);
34+
console.log("source duration: " +src_length);
3535

3636
// draw the waveform to an off-screen graphic
3737
var peaks = source_file.getPeaks(); // get an array of peaks

examples/peakDetection_offline/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function setup() {
1717

1818
src_length = source_file.duration();
1919
source_file.playMode('restart');
20-
println("source duration: " +src_length);
20+
console.log("source duration: " + src_length);
2121

2222
// find beat preprocessing the source file with lowpass
2323
var beats = source_file.processPeaks(onComplete);

src/audioin.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ define(function (require) {
261261

262262
/**
263263
* Returns a list of available input sources. This is a wrapper
264-
* for <a title="MediaDevices.enumerateDevices() - Web APIs | MDN" target="_blank" href=
265-
* "https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices"
266-
* > and it returns a Promise.
264+
* for [MediaDevices.enumerateDevices() - Web APIs | MDN](https://developer.mozilla.org/
265+
* en-US/docs/Web/API/MediaDevices/enumerateDevices)
266+
* and it returns a Promise.
267267
*
268268
* @method getSources
269269
* @for p5.AudioIn
@@ -321,9 +321,8 @@ define(function (require) {
321321
* Set the input source. Accepts a number representing a
322322
* position in the array returned by getSources().
323323
* This is only available in browsers that support
324-
* <a title="MediaDevices.enumerateDevices() - Web APIs | MDN" target="_blank" href=
325-
* "https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices"
326-
* >navigator.mediaDevices.enumerateDevices()</a>.<br/>
324+
* [navigator.mediaDevices.enumerateDevices()](https://developer.mozilla.org/
325+
* en-US/docs/Web/API/MediaDevices/enumerateDevices)
327326
*
328327
* @method setSource
329328
* @for p5.AudioIn

src/envelope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ define(function (require) {
707707
* @param {Object} unit p5.sound Object or Web Audio Param
708708
* @param {Number} secondsFromNow When to trigger the ramp
709709
* @param {Number} v Target value
710-
* @param {Number} [v2] Second target value (optional)
710+
* @param {Number} [v2] Second target value
711711
* @example
712712
* <div><code>
713713
* let env, osc, amp;

src/fft.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ define(function(require) {
395395
*
396396
* @method getCentroid
397397
* @for p5.FFT
398-
* @return {Number} Spectral Centroid Frequency Frequency of the spectral centroid in Hz.
398+
* @return {Number} Spectral Centroid Frequency of the spectral centroid in Hz.
399399
*
400400
*
401401
* @example

src/panner3d.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define(function (require) {
2020
* @class p5.Panner3D
2121
* @constructor
2222
*/
23+
2324
p5.Panner3D = function() {
2425
Effect.call(this);
2526

@@ -28,13 +29,11 @@ define(function (require) {
2829
* "https://developer.mozilla.org/en-US/docs/Web/API/PannerNode">
2930
* Web Audio Spatial Panner Node</a>
3031
*
31-
* Properties include
32-
* - <a title="w3 spec for Panning Model"
33-
* href="https://www.w3.org/TR/webaudio/#idl-def-PanningModelType"
34-
* >panningModel</a>: "equal power" or "HRTF"
35-
* - <a title="w3 spec for Distance Model"
36-
* href="https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType"
37-
* >distanceModel</a>: "linear", "inverse", or "exponential"
32+
* Properties include<br>
33+
* [Panning Model](https://www.w3.org/TR/webaudio/#idl-def-PanningModelType)
34+
* : "equal power" or "HRTF"<br>
35+
* [DistanceModel](https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType)
36+
* : "linear", "inverse", or "exponential"
3837
*
3938
* @property {AudioNode} panner
4039
*

src/signal.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define(function (require) {
1313
* <p>p5.Signal is a constant audio-rate signal used by p5.Oscillator
1414
* and p5.Envelope for modulation math.</p>
1515
*
16-
* <p>This is necessary because Web Audio is processed on a seprate clock.
16+
* <p>This is necessary because Web Audio is processed on a separate clock.
1717
* For example, the p5 draw loop runs about 60 times per second. But
1818
* the audio clock must process samples 44100 times per second. If we
1919
* want to add a value to each of those samples, we can't do it in the
@@ -31,6 +31,7 @@ define(function (require) {
3131
* @example
3232
* <div><code>
3333
* let carrier, modulator;
34+
* let hasStarted = false;
3435
*
3536
* function setup() {
3637
* let cnv = createCanvas(100, 100);
@@ -39,7 +40,6 @@ define(function (require) {
3940
* text('tap to play', 20, 20);
4041
*
4142
* carrier = new p5.Oscillator('sine');
42-
* carrier.start();
4343
* carrier.amp(1); // set amplitude
4444
* carrier.freq(220); // set frequency
4545
*
@@ -58,6 +58,10 @@ define(function (require) {
5858
* function canvasPressed() {
5959
* userStartAudio();
6060
* carrier.amp(1.0);
61+
* if(!hasStarted){
62+
* carrier.start();
63+
* hasStarted = true;
64+
* }
6165
* }
6266
*
6367
* function mouseReleased() {

src/soundLoop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ define(function (require) {
144144

145145

146146
/**
147-
* Synchronize loops. Use this method to start two more more loops in synchronization
147+
* Synchronize loops. Use this method to start two or more loops in synchronization
148148
* or to start a loop in synchronization with a loop that is already playing
149149
* This method will schedule the implicit loop in sync with the explicit master loop
150150
* i.e. loopToStart.syncedStart(loopToSyncWith)

src/soundfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ define(function (require) {
17241724
/**
17251725
* Save a p5.SoundFile as a .wav file. The browser will prompt the user
17261726
* to download the file to their device. To upload a file to a server, see
1727-
* <a href="/docs/reference/#/p5.SoundFile/getBlob">getBlob</a>
1727+
* <a href="/reference/#/p5.SoundFile/getBlob">getBlob</a>
17281728
*
17291729
* @method save
17301730
* @for p5.SoundFile
@@ -1756,7 +1756,7 @@ define(function (require) {
17561756
* .wav-encoded audio data as a "<a target="_blank" title="Blob reference at
17571757
* MDN" href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>".
17581758
* A Blob is a file-like data object that can be uploaded to a server
1759-
* with an <a href="/docs/reference/#/p5/httpDo">http</a> request. We'll
1759+
* with an <a href="/reference/#/p5/httpDo">http</a> request. We'll
17601760
* use the `httpDo` options object to send a POST request with some
17611761
* specific options: we encode the request as `multipart/form-data`,
17621762
* and attach the blob as one of the form values using `FormData`.

test/tests/p5.SoundFile.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ define(['chai'], function(chai) {
6868
}, 100);
6969
});
7070

71-
it('can getLevel', function(done) {
72-
expect( sf.isPlaying() ).to.equal(true);
73-
setTimeout(function() {
74-
expect(sf.getLevel()).not.equal(0.0);
75-
done();
76-
}, 100);
77-
});
78-
7971
var peaks, firstPeak;
8072
it('can get peaks', function() {
8173
peaks = sf.getPeaks(sf.buffer.length);

0 commit comments

Comments
 (0)