Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename masterVolume to outputVolume #610

Merged
merged 3 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Compressor/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions examples/FFT_frequency_spectrum/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions examples/Filter_BandPass/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -58,4 +58,4 @@ function draw() {
function updateDescription() {
description = 'Playing! Press any key to pause. Filter Frequency = ' + filterFreq + ' Filter Width = ' + filterWidth;
p.html(description);
}
}
4 changes: 2 additions & 2 deletions examples/Filter_LowPass/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -68,4 +68,4 @@ function draw() {
function updateDescription() {
description = 'Filter Frequency = ' + filterFreq + ' Filter Res = ' + filterRes;
p.html(description);
}
}
4 changes: 2 additions & 2 deletions examples/Reverb_convolve/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -53,4 +53,4 @@ function mousePressed() {

// display the current Impulse Response name (the filepath)
p.html('Convolution Impulse Response: ' + cVerb.impulses[currentIR].name);
}
}
4 changes: 2 additions & 2 deletions examples/Reverb_convolve_FFT/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -84,4 +84,4 @@ function mousePressed() {

function keyPressed() {
rawImpulse.play();
}
}
6 changes: 3 additions & 3 deletions examples/amplitude_analysis/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/distortion/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions examples/envAmpFreq/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -32,4 +32,4 @@ function mousePressed() {
function mouseReleased() {
env.triggerRelease();
freqEnv.triggerRelease();
}
}
2 changes: 1 addition & 1 deletion examples/envExp/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions examples/envelopeMultipleSources/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function setup(){

trigger = millis();

masterVolume(0.3);
outputVolume(0.3);

triOsc = new p5.TriOsc();
triOsc.amp(0);
Expand Down Expand Up @@ -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);
}
}
}
}
2 changes: 1 addition & 1 deletion examples/graphical_eq/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ function mousePressed() {
song.play();
background(0,255,0);
}
}
}
4 changes: 2 additions & 2 deletions examples/looper_simple/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -61,4 +61,4 @@ function draw() {
fill(255, 0, 0);
var noteHeight = map(currentBassNote, 40, 50, height, 0);
ellipse(width/2, noteHeight, 30, 30);
}
}
18 changes: 9 additions & 9 deletions examples/micLevel_on_off/sketch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var mic;
var amplitude, micLevel, masterLevel, levelLabel;
var amplitude, micLevel, outputLevel, levelLabel;

var soundToggle;
var soundOn = false;
Expand All @@ -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);
Expand All @@ -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 <a href="https://en.wikipedia.org/wiki/Audio_feedback" target="_blank">feedback loop</a> 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 <a href="https://en.wikipedia.org/wiki/Audio_feedback" target="_blank">feedback loop</a> between the mic and speakers. Try headphones.');
}

function draw() {
Expand All @@ -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();
Expand All @@ -76,4 +76,4 @@ function toggleMic() {
micOn = true;
micToggle.html('Stop mic');
}
}
}
14 changes: 7 additions & 7 deletions examples/mixingSounds/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -23,15 +23,15 @@ 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();
sound2.loop();

gain2 = new p5.Gain();
gain2.setInput(sound2);
gain2.connect(gain3);
gain2.connect(mixBus);

}

Expand All @@ -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);
}


10 changes: 5 additions & 5 deletions examples/noiseMod_AM/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,15 +31,15 @@ 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

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();
Expand Down Expand Up @@ -77,4 +77,4 @@ function draw() {
}
endShape();

}
}
10 changes: 5 additions & 5 deletions examples/oscillatorMod_AM/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,15 +31,15 @@ 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);
// carrier's amp is 0 by default, giving our modulator total control


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);
Expand Down Expand Up @@ -75,4 +75,4 @@ function draw() {
}
endShape();

}
}
6 changes: 3 additions & 3 deletions examples/oscillatorMod_FM/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down Expand Up @@ -77,4 +77,4 @@ function draw() {
}
endShape();

}
}
4 changes: 2 additions & 2 deletions examples/playbackRatePart/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -35,4 +35,4 @@ function mouseClicked() {
myPart.start();
msg = 'playing pattern';
}
}
}
Loading