diff --git a/examples/Compressor/sketch.js b/examples/Compressor/sketch.js
index 8a205275..b9ff2d11 100644
--- a/examples/Compressor/sketch.js
+++ b/examples/Compressor/sketch.js
@@ -50,7 +50,7 @@ function setup() {
compressor = new p5.Compressor();
- // Disconnect soundfile from master output.
+ // Disconnect soundfile from main output.
// Then, connect it to the filter, so that we only hear the filtered sound
soundFile.disconnect();
compressor.process(soundFile);
diff --git a/examples/FFT_frequency_spectrum/sketch.js b/examples/FFT_frequency_spectrum/sketch.js
index 546c5673..bbddff32 100644
--- a/examples/FFT_frequency_spectrum/sketch.js
+++ b/examples/FFT_frequency_spectrum/sketch.js
@@ -44,8 +44,7 @@ function setup() {
p = createP(description);
var p2 = createP('Draw the array returned by FFT.analyze( ). This represents the frequency spectrum, from lowest to highest frequencies.');
- // set the master volume;
- masterVolume(.5);
+ outputVolume(0.5);
}
function draw() {
diff --git a/examples/Filter_BandPass/sketch.js b/examples/Filter_BandPass/sketch.js
index 7791c00d..2fb87888 100644
--- a/examples/Filter_BandPass/sketch.js
+++ b/examples/Filter_BandPass/sketch.js
@@ -19,7 +19,7 @@ function setup() {
noise = new p5.Noise();
- noise.disconnect(); // Disconnect soundfile from master output...
+ noise.disconnect(); // Disconnect soundfile from main output...
filter.process(noise); // ...and connect to filter so we'll only hear BandPass.
noise.start();
@@ -58,4 +58,4 @@ function draw() {
function updateDescription() {
description = 'Playing! Press any key to pause. Filter Frequency = ' + filterFreq + ' Filter Width = ' + filterWidth;
p.html(description);
-}
\ No newline at end of file
+}
diff --git a/examples/Filter_LowPass/sketch.js b/examples/Filter_LowPass/sketch.js
index 97651c61..64eb2489 100644
--- a/examples/Filter_LowPass/sketch.js
+++ b/examples/Filter_LowPass/sketch.js
@@ -27,7 +27,7 @@ function setup() {
filter = new p5.LowPass();
- // Disconnect soundfile from master output.
+ // Disconnect soundFile from main output.
// Then, connect it to the filter, so that we only hear the filtered sound
soundFile.disconnect();
soundFile.connect(filter);
@@ -68,4 +68,4 @@ function draw() {
function updateDescription() {
description = 'Filter Frequency = ' + filterFreq + ' Filter Res = ' + filterRes;
p.html(description);
-}
\ No newline at end of file
+}
diff --git a/examples/Reverb_convolve/sketch.js b/examples/Reverb_convolve/sketch.js
index e572e1df..490c9565 100644
--- a/examples/Reverb_convolve/sketch.js
+++ b/examples/Reverb_convolve/sketch.js
@@ -30,7 +30,7 @@ function preload() {
}
function setup() {
- // disconnect from master output...
+ // disconnect from main output...
sound.disconnect();
// ... and process with cVerb so that we only hear the reverb
cVerb.process(sound);
@@ -53,4 +53,4 @@ function mousePressed() {
// display the current Impulse Response name (the filepath)
p.html('Convolution Impulse Response: ' + cVerb.impulses[currentIR].name);
-}
\ No newline at end of file
+}
diff --git a/examples/Reverb_convolve_FFT/sketch.js b/examples/Reverb_convolve_FFT/sketch.js
index 43afca8e..72cb64d2 100644
--- a/examples/Reverb_convolve_FFT/sketch.js
+++ b/examples/Reverb_convolve_FFT/sketch.js
@@ -36,7 +36,7 @@ function setup() {
createCanvas(710, 400);
rawImpulse = loadSound('../files/' + cVerb.impulses[currentIR].name);
- // disconnect from master output...
+ // disconnect from main output...
sound.disconnect();
// ... and process with cVerb
// so that we only hear the reverb
@@ -84,4 +84,4 @@ function mousePressed() {
function keyPressed() {
rawImpulse.play();
-}
\ No newline at end of file
+}
diff --git a/examples/amplitude_analysis/sketch.js b/examples/amplitude_analysis/sketch.js
index cab91aed..1f34be1e 100644
--- a/examples/amplitude_analysis/sketch.js
+++ b/examples/amplitude_analysis/sketch.js
@@ -79,10 +79,10 @@ function keyPressed(e) {
function mouseClicked() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
- if ( getMasterVolume() == 0) {
- masterVolume(0, 1);
+ if ( getOutputVolume() == 0) {
+ outputVolume(0, 1);
} else {
- masterVolume(0.1),1;
+ outputVolume(0.1),1;
}
}
}
diff --git a/examples/distortion/sketch.js b/examples/distortion/sketch.js
index d94ffd7c..865aacd8 100644
--- a/examples/distortion/sketch.js
+++ b/examples/distortion/sketch.js
@@ -17,7 +17,7 @@ function setup() {
env.setADSR(0.01, 0.2, 0.1, 0.3);
env.setRange(1.0, 0.0);
- osc = new p5.SawOsc(); // connects to master output by default
+ osc = new p5.SawOsc(); // connects to main output by default
osc.start(0);
osc.freq(220);
osc.amp(env);
diff --git a/examples/envAmpFreq/sketch.js b/examples/envAmpFreq/sketch.js
index 60e9a32a..537a4372 100644
--- a/examples/envAmpFreq/sketch.js
+++ b/examples/envAmpFreq/sketch.js
@@ -16,7 +16,7 @@ function setup() {
freqEnv.setRange(300, 5000);
- osc = new p5.Oscillator(); // connects to master output by default
+ osc = new p5.Oscillator(); // connects to main output by default
osc.start(0);
osc.freq(220);
// osc.freq(env.scale(0,1,800,300));
@@ -32,4 +32,4 @@ function mousePressed() {
function mouseReleased() {
env.triggerRelease();
freqEnv.triggerRelease();
-}
\ No newline at end of file
+}
diff --git a/examples/envExp/sketch.js b/examples/envExp/sketch.js
index 1613462d..b71ad1fa 100755
--- a/examples/envExp/sketch.js
+++ b/examples/envExp/sketch.js
@@ -47,7 +47,7 @@ function setup() {
myPart.start();
fft = new p5.FFT();
fft.setInput(osc);
- masterVolume(0);
+ outputVolume(0);
endPoint = width / numWaveforms;
noStroke();
background(20);
diff --git a/examples/envelopeMultipleSources/sketch.js b/examples/envelopeMultipleSources/sketch.js
index cb98b95d..78c4978e 100644
--- a/examples/envelopeMultipleSources/sketch.js
+++ b/examples/envelopeMultipleSources/sketch.js
@@ -43,7 +43,7 @@ function setup(){
trigger = millis();
- masterVolume(0.3);
+ outputVolume(0.3);
triOsc = new p5.TriOsc();
triOsc.amp(0);
@@ -92,10 +92,10 @@ function draw(){
function mouseClicked() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
- if ( getMasterVolume() == 0) {
- masterVolume(0.3, 0.5);
+ if ( getOutputVolume() == 0) {
+ outputVolume(0.3, 0.5);
} else {
- masterVolume(0, 0.5);
+ outputVolume(0, 0.5);
}
}
-}
\ No newline at end of file
+}
diff --git a/examples/graphical_eq/sketch.js b/examples/graphical_eq/sketch.js
index 42371640..e8b48a27 100644
--- a/examples/graphical_eq/sketch.js
+++ b/examples/graphical_eq/sketch.js
@@ -38,7 +38,7 @@ function setup() {
eqSize = 8;
eq = new p5.EQ(eqSize);
- // Disconnect soundFile from master output.
+ // Disconnect soundFile from main output.
// Then, connect it to the EQ, so that we only hear the EQ'd sound
soundFile.loop();
soundFile.disconnect();
diff --git a/examples/learningProcessingExamples/01a_loadSound_playback/sketch.js b/examples/learningProcessingExamples/01a_loadSound_playback/sketch.js
index dcbc2385..714b04c9 100644
--- a/examples/learningProcessingExamples/01a_loadSound_playback/sketch.js
+++ b/examples/learningProcessingExamples/01a_loadSound_playback/sketch.js
@@ -17,4 +17,4 @@ function mousePressed() {
song.play();
background(0,255,0);
}
-}
\ No newline at end of file
+}
diff --git a/examples/looper_simple/sketch.js b/examples/looper_simple/sketch.js
index 99bafebe..021aa16a 100644
--- a/examples/looper_simple/sketch.js
+++ b/examples/looper_simple/sketch.js
@@ -16,7 +16,7 @@ var prevTime = 0;
function setup() {
// prepare the osc and env used by playNote()
env = new p5.Envelope(0.01, 0.8, 0.2, 0);
- osc = new p5.TriOsc(); // connects to master output by default
+ osc = new p5.TriOsc(); // connects to main output by default
osc.start(0);
osc.connect();
env.setInput(osc);
@@ -61,4 +61,4 @@ function draw() {
fill(255, 0, 0);
var noteHeight = map(currentBassNote, 40, 50, height, 0);
ellipse(width/2, noteHeight, 30, 30);
-}
\ No newline at end of file
+}
diff --git a/examples/micLevel_on_off/sketch.js b/examples/micLevel_on_off/sketch.js
index edf32d80..a6bc352b 100644
--- a/examples/micLevel_on_off/sketch.js
+++ b/examples/micLevel_on_off/sketch.js
@@ -1,5 +1,5 @@
var mic;
-var amplitude, micLevel, masterLevel, levelLabel;
+var amplitude, micLevel, outputLevel, levelLabel;
var soundToggle;
var soundOn = false;
@@ -17,8 +17,8 @@ function setup() {
mic.start();
// create controls
- levelLabel = createP('Master Volume: ');
- masterLevel = createSlider(0,100,50);
+ levelLabel = createP('Output Volume: ');
+ outputLevel = createSlider(0,100,50);
soundToggle = createButton('Sound ON');
soundToggle.mousePressed(toggleSound);
@@ -27,7 +27,7 @@ function setup() {
micToggle.mousePressed(toggleMic);
h = createP('enable the mic...');
- createP('NOTE: Mic is disconnected from master output (speakers) by default. Turning sound on with mic.connect( ) may cause a feedback loop between the mic and speakers. Try headphones.');
+ createP('NOTE: Mic is disconnected from main output (speakers) by default. Turning sound on with mic.connect( ) may cause a feedback loop between the mic and speakers. Try headphones.');
}
function draw() {
@@ -46,13 +46,13 @@ function draw() {
ellipse(width/2,height/2, 400*micLevel + 10, 400*micLevel + 10);
- // set master output
- levelLabel.html('Master Volume: ' + masterLevel.value()/100);
- masterVolume(masterLevel.value()/100);
+ // set main output
+ levelLabel.html('Output Volume: ' + outputLevel.value()/100);
+ outputVolume(outputLevel.value()/100);
}
-// Toggle whether mic is connected to master output
+// Toggle whether mic is connected to main output
function toggleSound() {
if (soundOn == false) {
mic.connect();
@@ -76,4 +76,4 @@ function toggleMic() {
micOn = true;
micToggle.html('Stop mic');
}
-}
\ No newline at end of file
+}
diff --git a/examples/mixingSounds/sketch.js b/examples/mixingSounds/sketch.js
index fb9c5ac5..facc58fb 100644
--- a/examples/mixingSounds/sketch.js
+++ b/examples/mixingSounds/sketch.js
@@ -12,9 +12,9 @@ function preload(){
function setup() {
createCanvas(400,200);
- // create a 'master' gain to which we will connect both soundfiles
- gain3 = new p5.Gain();
- gain3.connect();
+ // create a 'mix bus' gain to which we will connect both soundfiles
+ mixBus = new p5.Gain();
+ mixBus.connect();
// setup first sound for playing
sound1.rate(1);
@@ -23,7 +23,7 @@ function setup() {
gain1 = new p5.Gain(); // setup a gain node
gain1.setInput(sound1); // connect the first sound to its input
- gain1.connect(gain3); // connect its output to the 'master'
+ gain1.connect(mixBus); // connect its output to the 'mix bus'
sound2.rate(1);
sound2.disconnect();
@@ -31,7 +31,7 @@ function setup() {
gain2 = new p5.Gain();
gain2.setInput(sound2);
- gain2.connect(gain3);
+ gain2.connect(mixBus);
}
@@ -49,9 +49,9 @@ function draw(){
gain1.amp(vol1,0.5,0);
gain2.amp(vol2,0.5,0);
- // map the vertical position of the mouse to values useable for 'master volume control'
+ // map the vertical position of the mouse to values useable for 'output volume control'
var vol3 = map(mouseY,0,height,0,1);
- gain3.amp(vol3,0.5,0);
+ mixBus.amp(vol3,0.5,0);
}
diff --git a/examples/noiseMod_AM/sketch.js b/examples/noiseMod_AM/sketch.js
index 8e4315d8..356ffb12 100644
--- a/examples/noiseMod_AM/sketch.js
+++ b/examples/noiseMod_AM/sketch.js
@@ -4,12 +4,12 @@
* the carrier's amplitude.
*
* The carrier is typically set at an audible frequency (i.e. 440 Hz)
- * and connected to master output by default. The carrier.amp is
+ * and connected to main output by default. The carrier.amp is
* set to zero because we will have the modulator control its amplitude.
*
* The modulator is typically set to a frequency that is lower than
* humans can hear (i.e. 1 Hz, or one cycle every second). The modulator
- * is disconnected from master output. Instead, it is connected
+ * is diconnected from main output. Instead, it is connected
* to the amplitude of the Carrier, like this: carrier.amp(modulator).
*
* MouseX controls the amplitude of the modulator from 0 to 1. When the
@@ -31,7 +31,7 @@ function setup() {
background(30); // alpha
noFill();
- carrier = new p5.Noise(); // connects to master output by default
+ carrier = new p5.Noise(); // connects to main output by default
// carrier.freq(340);
carrier.amp(0);
// carrier's amp is 0 by default, giving our modulator total control
@@ -39,7 +39,7 @@ function setup() {
carrier.start();
modulator = new p5.Oscillator('triangle');
- modulator.disconnect(); // disconnect the modulator from master output
+ modulator.disconnect(); // disconnect the modulator from main output
modulator.freq(5);
modulator.amp(0.5);
modulator.start();
@@ -77,4 +77,4 @@ function draw() {
}
endShape();
-}
\ No newline at end of file
+}
diff --git a/examples/oscillatorMod_AM/sketch.js b/examples/oscillatorMod_AM/sketch.js
index 58400337..e3ad4f1e 100644
--- a/examples/oscillatorMod_AM/sketch.js
+++ b/examples/oscillatorMod_AM/sketch.js
@@ -4,12 +4,12 @@
* the carrier's amplitude.
*
* The carrier is typically set at an audible frequency (i.e. 440 Hz)
- * and connected to master output by default. The carrier.amp is
+ * and connected to main output by default. The carrier.amp is
* set to zero because we will have the modulator control its amplitude.
*
* The modulator is typically set to a frequency that is lower than
* humans can hear (i.e. 1 Hz, or one cycle every second). The modulator
- * is disconnected from master output. Instead, it is connected
+ * is diconnected from main output. Instead, it is connected
* to the amplitude of the Carrier, like this: carrier.amp(modulator).
*
* MouseX controls the amplitude of the modulator from 0 to 1. When the
@@ -31,7 +31,7 @@ function setup() {
background(30); // alpha
noFill();
- carrier = new p5.Oscillator(); // connects to master output by default
+ carrier = new p5.Oscillator(); // connects to main output by default
carrier.start();
carrier.freq(340);
carrier.amp(0.2);
@@ -39,7 +39,7 @@ function setup() {
modulator = new p5.Oscillator('triangle');
- modulator.disconnect(); // disconnect the modulator from master output
+ modulator.disconnect(); // disconnect the modulator from main output
modulator.start();
modulator.freq(5);
modulator.amp(1);
@@ -75,4 +75,4 @@ function draw() {
}
endShape();
-}
\ No newline at end of file
+}
diff --git a/examples/oscillatorMod_FM/sketch.js b/examples/oscillatorMod_FM/sketch.js
index 98eb0d7c..0aa5a425 100644
--- a/examples/oscillatorMod_FM/sketch.js
+++ b/examples/oscillatorMod_FM/sketch.js
@@ -4,11 +4,11 @@
* the carrier's frequency.
*
* The carrier oscillates at an audible frequency (i.e. 440 Hz)
- * and connected to master output by default.
+ * and connected to main output by default.
*
* The modulator is typically set to a frequency that is lower
* than humans can hear (i.e. 1 Hz, or one cycle every second).
- * The modulator is disconnected from master output, and is connected
+ * The modulator is diconnected from main output, and is connected
* to the frequency of the carrier, like this: carrier.freq(modulator).
*
* In this example...
@@ -77,4 +77,4 @@ function draw() {
}
endShape();
-}
\ No newline at end of file
+}
diff --git a/examples/playbackRatePart/sketch.js b/examples/playbackRatePart/sketch.js
index 6136408c..70bb336b 100644
--- a/examples/playbackRatePart/sketch.js
+++ b/examples/playbackRatePart/sketch.js
@@ -10,7 +10,7 @@ function setup() {
noStroke();
fill(255);
textAlign(CENTER);
- masterVolume(0.1);
+ outputVolume(0.1);
myPhrase = new p5.Phrase('bbox', makeSound, pattern);
myPart = new p5.Part();
@@ -35,4 +35,4 @@ function mouseClicked() {
myPart.start();
msg = 'playing pattern';
}
-}
\ No newline at end of file
+}
diff --git a/examples/soundfileMod_AM/sketch.js b/examples/soundfileMod_AM/sketch.js
index def24bfc..2160a1bd 100644
--- a/examples/soundfileMod_AM/sketch.js
+++ b/examples/soundfileMod_AM/sketch.js
@@ -4,12 +4,12 @@
* the carrier's amplitude.
*
* The carrier is typically set at an audible frequency (i.e. 440 Hz)
- * and connected to master output by default. The carrier.amp is
+ * and connected to main output by default. The carrier.amp is
* set to zero because we will have the modulator control its amplitude.
*
* The modulator is typically set to a frequency that is lower than
* humans can hear (i.e. 1 Hz, or one cycle every second). The modulator
- * is disconnected from master output. Instead, it is connected
+ * is diconnected from main output. Instead, it is connected
* to the amplitude of the Carrier, like this: carrier.amp(modulator).
*
* MouseX controls the amplitude of the modulator from 0 to 1. When the
@@ -27,7 +27,7 @@ var modulator; // this oscillator will modulate the amplitude of the carrier
var fft; // we'll visualize the waveform
function preload() {
- carrier = loadSound('../files/Damscray_-_Dancing_Tiger_01.mp3'); // connects to master output by default
+ carrier = loadSound('../files/Damscray_-_Dancing_Tiger_01.mp3'); // connects to main output by default
}
function setup() {
@@ -42,7 +42,7 @@ function setup() {
carrier.loop();
modulator = new p5.Oscillator('triangle');
- modulator.disconnect(); // disconnect the modulator from master output
+ modulator.disconnect(); // disconnect the modulator from main output
modulator.freq(5);
modulator.amp(1);
modulator.start();
@@ -79,4 +79,4 @@ function draw() {
}
endShape();
-}
\ No newline at end of file
+}
diff --git a/src/amplitude.js b/src/amplitude.js
index 062ceba9..103be844 100644
--- a/src/amplitude.js
+++ b/src/amplitude.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import { safeBufferSize } from './helpers';
import processorNames from './audioWorklet/processorNames';
@@ -97,7 +97,7 @@ class Amplitude {
// this may only be necessary because of a Chrome bug
this.output.connect(this.audiocontext.destination);
- // connect to p5sound master output by default, unless set by input()
+ // connect to p5sound main output by default, unless set by input()
p5sound.meter.connect(this._workletNode);
// add this p5.SoundFile to the soundArray
@@ -105,14 +105,14 @@ class Amplitude {
}
/**
- * Connects to the p5sound instance (master output) by default.
+ * Connects to the p5sound instance (main output) by default.
* Optionally, you can pass in a specific source (i.e. a soundfile).
*
* @method setInput
* @for p5.Amplitude
* @param {soundObject|undefined} [snd] set the sound source
* (optional, defaults to
- * master output)
+ * main output)
* @param {Number|undefined} [smoothing] a range between 0.0 and 1.0
* to smooth amplitude readings
* @example
@@ -159,7 +159,7 @@ class Amplitude {
// connect to the master out of p5s instance if no snd is provided
if (source == null) {
console.log(
- 'Amplitude input source is not ready! Connecting to master output instead'
+ 'Amplitude input source is not ready! Connecting to main output instead'
);
p5sound.meter.connect(this._workletNode);
}
diff --git a/src/app.js b/src/app.js
index 03fd3d41..1cd14c22 100644
--- a/src/app.js
+++ b/src/app.js
@@ -5,7 +5,7 @@ import { getAudioContext, userStartAudio } from './audiocontext';
p5.prototype.getAudioContext = getAudioContext;
p5.prototype.userStartAudio = userStartAudio;
-import './master';
+import './main';
import {
sampleRate,
diff --git a/src/audioVoice.js b/src/audioVoice.js
index 242b4fc1..3fdfe064 100644
--- a/src/audioVoice.js
+++ b/src/audioVoice.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
/**
* Base class for monophonic synthesizers. Any extensions of this class
diff --git a/src/audioWorklet/index.js b/src/audioWorklet/index.js
index 6180b7a4..432dc3ba 100644
--- a/src/audioWorklet/index.js
+++ b/src/audioWorklet/index.js
@@ -1,4 +1,4 @@
-import p5sound from '../master.js';
+import p5sound from '../main.js';
const moduleSources = [
require('raw-loader!./recorderProcessor').default,
require('raw-loader!./soundFileProcessor').default,
diff --git a/src/audioin.js b/src/audioin.js
index a1be6ab5..d4ccc651 100644
--- a/src/audioin.js
+++ b/src/audioin.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import Amplitude from './amplitude';
// an array of input sources
@@ -185,7 +185,7 @@ class AudioIn {
/**
* Connect to an audio unit. If no parameter is provided, will
- * connect to the master output (i.e. your speakers).
+ * connect to the main output (i.e. your speakers).
*
* @method connect
* @for p5.AudioIn
diff --git a/src/compressor.js b/src/compressor.js
index 173e16b4..6ad3c444 100644
--- a/src/compressor.js
+++ b/src/compressor.js
@@ -8,7 +8,7 @@ import Effect from './effect';
* Compression can be used to avoid clipping (sound distortion due to
* peaks in volume) and is especially useful when many sounds are played
* at once. Compression can be used on indivudal sound sources in addition
- * to the master output.
+ * to the main output.
*
* This class extends p5.Effect.
* Methods amp(), chain(),
diff --git a/src/effect.js b/src/effect.js
index 08df0bd4..bd884d12 100644
--- a/src/effect.js
+++ b/src/effect.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import CrossFade from 'Tone/component/CrossFade.js';
/**
diff --git a/src/envelope.js b/src/envelope.js
index 9adc142b..b5832220 100644
--- a/src/envelope.js
+++ b/src/envelope.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import Add from 'Tone/signal/Add';
import Mult from 'Tone/signal/Multiply';
import Scale from 'Tone/signal/Scale';
diff --git a/src/eqFilter.js b/src/eqFilter.js
index 39da7967..a4823e3f 100644
--- a/src/eqFilter.js
+++ b/src/eqFilter.js
@@ -1,5 +1,5 @@
import Filter from './filter';
-import p5sound from './master';
+import p5sound from './main';
/**
* EQFilter extends p5.Filter with constraints
diff --git a/src/fft.js b/src/fft.js
index fd714ac7..090bd91d 100644
--- a/src/fft.js
+++ b/src/fft.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
/**
*
FFT (Fast Fourier Transform) is an analysis algorithm that diff --git a/src/gain.js b/src/gain.js index 461b1620..837ffcde 100644 --- a/src/gain.js +++ b/src/gain.js @@ -1,4 +1,4 @@ -import p5sound from './master'; +import p5sound from './main'; /** * A gain node is usefull to set the relative volume of sound. @@ -11,7 +11,7 @@ import p5sound from './master'; * * // load two soundfile and crossfade beetween them * let sound1,sound2; - * let sound1Gain, sound2Gain, masterGain; + * let sound1Gain, sound2Gain, mixGain; * function preload(){ * soundFormats('ogg', 'mp3'); * sound1 = loadSound('assets/Damscray_-_Dancing_Tiger_01'); @@ -20,17 +20,17 @@ import p5sound from './master'; * function setup() { * let cnv = createCanvas(100, 100); * cnv.mousePressed(startSound); - * // create a 'master' gain to which we will connect both soundfiles - * masterGain = new p5.Gain(); - * masterGain.connect(); + * // create a 'mix' gain bus to which we will connect both soundfiles + * mixGain = new p5.Gain(); + * mixGain.connect(); * sound1.disconnect(); // diconnect from p5 output * sound1Gain = new p5.Gain(); // setup a gain node * sound1Gain.setInput(sound1); // connect the first sound to its input - * sound1Gain.connect(masterGain); // connect its output to the 'master' + * sound1Gain.connect(mixGain); // connect its output to the final mix bus * sound2.disconnect(); * sound2Gain = new p5.Gain(); * sound2Gain.setInput(sound2); - * sound2Gain.connect(masterGain); + * sound2Gain.connect(mixGain); * } * function startSound() { * sound1.loop(); @@ -55,10 +55,10 @@ import p5sound from './master'; * var sound2Volume = 1-sound1Volume; * sound1Gain.amp(sound1Volume); * sound2Gain.amp(sound2Volume); - * // map the vertical position of the mouse to values useable for 'master * volume control' - * var masterVolume = constrain(map(mouseY,height,0,0,1), 0, 1); - * masterGain.amp(masterVolume); - * text('master', width/2, height - masterVolume * height * 0.9) + * // map the vertical position of the mouse to values useable for 'output * volume control' + * var outputVolume = constrain(map(mouseY,height,0,0,1), 0, 1); + * mixGain.amp(outputVolume); + * text('output', width/2, height - outputVolume * height * 0.9) * fill(255, 0, 255); * textAlign(LEFT); * text('sound1', 5, height - sound1Volume * height * 0.9); diff --git a/src/helpers.js b/src/helpers.js index cc252f95..da5cb39a 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,4 +1,4 @@ -import p5sound from './master'; +import p5sound from './main'; import processorNames from './audioWorklet/processorNames'; /** * @for p5 diff --git a/src/listener3d.js b/src/listener3d.js index a18b02fd..4a61693e 100644 --- a/src/listener3d.js +++ b/src/listener3d.js @@ -1,4 +1,4 @@ -import p5sound from './master'; +import p5sound from './main'; // /** // * listener is a class that can construct both a Spatial Panner diff --git a/src/looper.js b/src/looper.js index 2dfaf9e5..bbc54acd 100644 --- a/src/looper.js +++ b/src/looper.js @@ -1,4 +1,4 @@ -import p5sound from './master'; +import p5sound from './main'; import Metro from './metro'; var BPM = 120; diff --git a/src/master.js b/src/main.js similarity index 86% rename from src/master.js rename to src/main.js index 10c3918a..ca729979 100644 --- a/src/master.js +++ b/src/main.js @@ -1,6 +1,7 @@ import audiocontext from './audiocontext.js'; -// Master contains the master sound output. -class Master { + +// P5Sound contains the final sound output bus. +class Main { constructor() { this.input = audiocontext.createGain(); this.output = audiocontext.createGain(); @@ -40,18 +41,18 @@ class Master { } } -// create a single instance of the p5Sound / master output for use within this sketch -const p5sound = new Master(); +// create a single instance of the p5Sound main output for use within this sketch +const p5sound = new Main(); /** - * Returns a number representing the master amplitude (volume) for sound + * Returns a number representing the output volume for sound * in this sketch. * - * @method getMasterVolume - * @return {Number} Master amplitude (volume) for sound in this sketch. + * @method getOutputVolume + * @return {Number} Output volume for sound in this sketch. * Should be between 0.0 (silence) and 1.0. */ -p5.prototype.getMasterVolume = function () { +p5.prototype.getOutputVolume = function () { return p5sound.output.gain.value; }; @@ -74,14 +75,14 @@ p5.prototype.getMasterVolume = function () { * *
If no value is provided, returns a Web Audio API Gain Node
* - * @method masterVolume + * @method outputVolume * @param {Number|Object} volume Volume (amplitude) between 0.0 * and 1.0 or modulating signal/oscillator * @param {Number} [rampTime] Fade for t seconds * @param {Number} [timeFromNow] Schedule this event to happen at * t seconds in the future */ -p5.prototype.masterVolume = function (vol, rampTime = 0, tFromNow = 0) { +p5.prototype.outputVolume = function (vol, rampTime = 0, tFromNow = 0) { if (typeof vol === 'number') { var now = p5sound.audiocontext.currentTime; var currentVol = p5sound.output.gain.value; @@ -97,7 +98,7 @@ p5.prototype.masterVolume = function (vol, rampTime = 0, tFromNow = 0) { }; /** - * `p5.soundOut` is the p5.sound master output. It sends output to + * `p5.soundOut` is the p5.sound final output bus. It sends output to * the destination of this window's web audio context. It contains * Web Audio API nodes including a dyanmicsCompressor (.limiter
),
* and Gain Nodes for .input
and .output
.
diff --git a/src/metro.js b/src/metro.js
index 74382a96..8f0f5de0 100644
--- a/src/metro.js
+++ b/src/metro.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
// requires the Tone.js library's Clock (MIT license, Yotam Mann)
// https://github.com/TONEnoTONE/Tone.js/
import Clock from 'Tone/core/Clock';
diff --git a/src/monosynth.js b/src/monosynth.js
index b9ed6107..bb5dc039 100644
--- a/src/monosynth.js
+++ b/src/monosynth.js
@@ -1,6 +1,6 @@
import AudioVoice from './audioVoice';
import Envelope from './envelope';
-import p5sound from './master';
+import p5sound from './main';
import Oscillator from './oscillator';
import { noteToFreq } from './helpers';
diff --git a/src/noise.js b/src/noise.js
index 82d6312e..1bdd9b61 100644
--- a/src/noise.js
+++ b/src/noise.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import Oscillator from './oscillator';
// generate noise buffers
diff --git a/src/oscillator.js b/src/oscillator.js
index e15ad1fc..6f02fb2a 100644
--- a/src/oscillator.js
+++ b/src/oscillator.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import Add from 'Tone/signal/Add';
import Mult from 'Tone/signal/Multiply';
import Scale from 'Tone/signal/Scale';
diff --git a/src/panner.js b/src/panner.js
index 595116fe..e946f788 100644
--- a/src/panner.js
+++ b/src/panner.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
var ac = p5sound.audiocontext;
var panner;
// Stereo panner
diff --git a/src/polysynth.js b/src/polysynth.js
index 61c23ba4..468d1dd1 100644
--- a/src/polysynth.js
+++ b/src/polysynth.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import TimelineSignal from 'Tone/signal/TimelineSignal.js';
import { noteToFreq, freqToMidi } from './helpers';
diff --git a/src/pulse.js b/src/pulse.js
index f01efeb1..b7446700 100644
--- a/src/pulse.js
+++ b/src/pulse.js
@@ -1,7 +1,7 @@
import Signal from 'Tone/signal/Signal';
import Multiply from 'Tone/signal/Multiply';
-import p5sound from './master';
+import p5sound from './main';
import Oscillator, { SawOsc } from './oscillator';
/**
diff --git a/src/reverb.js b/src/reverb.js
index b66ab6f0..8087a585 100644
--- a/src/reverb.js
+++ b/src/reverb.js
@@ -255,7 +255,7 @@ class Reverb extends Effect {
* background(220);
* text('tap to play', 20, 20);
*
- * // disconnect from master output...
+ * // disconnect from main output...
* sound.disconnect();
*
* // ...and process with cVerb
@@ -429,7 +429,7 @@ class Convolver extends Reverb {
* background(220);
* text('tap to play', 20, 20);
*
- * // disconnect from master output...
+ * // disconnect from main output...
* sound.disconnect();
*
* // ...and process with cVerb
@@ -579,7 +579,7 @@ class Convolver extends Reverb {
* background(220);
* text('tap to play', 20, 20);
*
- * // disconnect from master output...
+ * // disconnect from main output...
* sound.disconnect();
*
* // ...and process with cVerb
diff --git a/src/soundLoop.js b/src/soundLoop.js
index 3ca60a74..29bb393d 100644
--- a/src/soundLoop.js
+++ b/src/soundLoop.js
@@ -1,4 +1,4 @@
-import p5sound from './master';
+import p5sound from './main';
import Clock from 'Tone/core/Clock';
/**
diff --git a/src/soundRecorder.js b/src/soundRecorder.js
index 7541be3b..10688544 100644
--- a/src/soundRecorder.js
+++ b/src/soundRecorder.js
@@ -1,6 +1,6 @@
// inspiration: recorder.js, Tone.js & typedarray.org
-import p5sound from './master';
+import p5sound from './main';
import { safeBufferSize } from './helpers';
import processorNames from './audioWorklet/processorNames';
diff --git a/src/soundfile.js b/src/soundfile.js
index a0f382f0..2eedd35b 100644
--- a/src/soundfile.js
+++ b/src/soundfile.js
@@ -1,5 +1,5 @@
import CustomError from './errorHandler';
-import p5sound from './master';
+import p5sound from './main';
import { midiToFreq, convertToWav, safeBufferSize } from './helpers';
import processorNames from './audioWorklet/processorNames';
import Panner from './panner';
@@ -1196,7 +1196,7 @@ class SoundFile {
* Connects the output of a p5sound object to input of another
* p5.sound object. For example, you may connect a p5.SoundFile to an
* FFT or an Effect. If no parameter is given, it will connect to
- * the master output. Most p5sound objects connect to the master
+ * the main output. Most p5sound objects connect to the master
* output when they are created.
*
* @method connect
diff --git a/test/setup.js b/test/setup.js
index 43d334b9..86734f77 100644
--- a/test/setup.js
+++ b/test/setup.js
@@ -11,7 +11,7 @@ const startTest = () => {
const mousePressed = () => {
if (!test_has_run) {
document.getElementById('mocha').innerHTML = '';
- p5.prototype.masterVolume(0);
+ p5.prototype.outputVolume(0);
p5.prototype.userStartAudio();
mocha.run();
test_has_run = true;
diff --git a/test/tests.js b/test/tests.js
index c3f05890..553bfea9 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -1,4 +1,4 @@
-import('./tests/p5.Master.js');
+import('./tests/main.js');
import('./tests/p5.Helpers.js');
import('./tests/p5.Distortion.js');
import('./tests/p5.Effect.js');
diff --git a/test/tests/main.js b/test/tests/main.js
new file mode 100644
index 00000000..4b5bd2d2
--- /dev/null
+++ b/test/tests/main.js
@@ -0,0 +1,30 @@
+const expect = chai.expect;
+describe('main output', function () {
+ it('can set and return output volume', function (done) {
+ p5.prototype.outputVolume(0.6);
+
+ setTimeout(function () {
+ expect(p5.prototype.getOutputVolume()).to.be.closeTo(0.6, 0.05);
+ done();
+ }, 100);
+ });
+ it('can set output volume after t seconds in future', function (done) {
+ let t = 1;
+ p5.prototype.outputVolume(0.9, 0, t);
+
+ setTimeout(function () {
+ expect(p5.prototype.getOutputVolume()).to.be.closeTo(0.9, 0.05);
+ done();
+ }, 1100);
+ });
+
+ it('can create a linear fade effect in output volume ', function (done) {
+ let t = 1;
+ p5.prototype.outputVolume(1, t, 0);
+
+ setTimeout(function () {
+ expect(p5.prototype.getOutputVolume()).to.be.closeTo(0.5, 0.5);
+ done();
+ }, 500);
+ });
+});
diff --git a/test/tests/p5.Master.js b/test/tests/p5.Master.js
deleted file mode 100644
index 7159d906..00000000
--- a/test/tests/p5.Master.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const expect = chai.expect;
-describe('P5.master', function () {
- it('can set and return master volume', function (done) {
- p5.prototype.masterVolume(0.6);
-
- setTimeout(function () {
- expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.6, 0.05);
- done();
- }, 100);
- });
- it('can set master volume after t seconds in future', function (done) {
- let t = 1;
- p5.prototype.masterVolume(0.9, 0, t);
-
- setTimeout(function () {
- expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.9, 0.05);
- done();
- }, 1100);
- });
-
- it('can create a linear fade effect in master volume ', function (done) {
- let t = 1;
- p5.prototype.masterVolume(1, t, 0);
-
- setTimeout(function () {
- expect(p5.prototype.getMasterVolume()).to.be.closeTo(0.5, 0.5);
- done();
- }, 500);
- });
-});
diff --git a/test/tests/p5.SoundRecorder.js b/test/tests/p5.SoundRecorder.js
index 0d7092a1..796a8d52 100644
--- a/test/tests/p5.SoundRecorder.js
+++ b/test/tests/p5.SoundRecorder.js
@@ -48,8 +48,8 @@ describe('p5.SoundRecorder', function () {
const recordingDuration =
recorder.bufferSize / p5.soundOut.audiocontext.sampleRate;
- // need to enable master volume to test recording from the microphone
- p5.prototype.masterVolume(1);
+ // need to enable output volume to test recording from the microphone
+ p5.prototype.outputVolume(1);
const mic = new p5.AudioIn();
mic.start(function () {
@@ -62,7 +62,7 @@ describe('p5.SoundRecorder', function () {
outputSoundFile.dispose();
mic.dispose();
- p5.prototype.masterVolume(0);
+ p5.prototype.outputVolume(0);
done();
});
});
@@ -91,7 +91,7 @@ describe('p5.SoundRecorder', function () {
});
});
- it('can record the master output of a sketch', function (done) {
+ it('can record the main output of a sketch', function (done) {
// this is the shortest possible recording duration
const recordingDuration =
recorder.bufferSize / p5.soundOut.audiocontext.sampleRate;
@@ -99,8 +99,8 @@ describe('p5.SoundRecorder', function () {
// input SoundFile should contain all 1s
expect(inputChannel[0]).to.eq(1);
- // need to enable master volume to test recording from master output
- p5.prototype.masterVolume(1);
+ // need to enable output volume to test recording from main output
+ p5.prototype.outputVolume(1);
const outputSoundFile = new p5.SoundFile();
inputSoundFile.connect();
@@ -113,7 +113,7 @@ describe('p5.SoundRecorder', function () {
expect(outputChannel[0]).to.not.eq(0);
outputSoundFile.dispose();
- p5.prototype.masterVolume(0);
+ p5.prototype.outputVolume(0);
done();
});
});