/ \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x /

r · a · d · i · c · a · l · · · l · i · s · t · e · n · i · n · g

/ \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x / \ / \ x /


http://www.realitat.com/MAT/radicallistening

 

 

 

 

 

This browser-based sound exploration was a result of the two-day workshop "The Radical Listener", led by Lawrence English in May, 2018. This workshop encouraged an active listening, transforming the familiar into the unfamiliar. Two days magically opened for contemplation and documentation of the different micro habitats that surround the UCSB campus.

Nine short recordings were selected and placed on a code-generated map. The visitor can either let the code run automatically or adjust the different playing modes available.

>> VIEW ONLINE: http://www.realitat.com/MAT/radicallistening

 

Special thanks to:
Fulcrum Arts, The UCSB Cheadle Center for Biodiversity and Ecological Restoration and the Media Arts and Technology Graduate Program for funding this workshop.


 
LOCATIONS

 

34°24'23.4"N 119°50'36.3"W
Campus Point Beach / UCSB

First location. Four sounds were recorded here. At the place were the UCSB lagoon and the Pacific Ocean almost intersect. It was a windy day (as the recordings show).

 

34°25'17.5"N 119°53'28.4"W
Ellwood Mesa

First day: second location. The first sound was obtained with a small mic rophone. It was introduced on a small cave near the cliff. A curious insect approached rapidly to investigate the foreign object. The resulting sound of this interaction can be heard in one of the files. The rest of the sounds were recorded near Goleta's Butterfly Grove, just a few steps from the ocean.

 

34°27'20.9"N 119°46'56.2"W
San Antonio Canyon Park

On the second day we lost the main workshop crew and thus, proceeded to record sounds on our own. A woodpecker and a crow can be easily identified . Unfortunately, the hum of the human machines can be heard sometimes on the distance.

 

 

 

*

 




 

FIELD NOTES

 

 

Above: A small red sketchbook was carried at all times during this workshop. Above the main map made on the UCSB beach. The numbers match the *.wav files created by the field recorder. A location 'symbol' was synthesized for future reading.

Below: different excerpts of symbols and diagrams from other pages.

 
 

When to bring the listener (IN & OUT).

 

A journey. Crossing the gates of Ellwood Mesa. 1st frontier. The pacific ocean: the final frontier.

 

Note:
A sense of wonder.

Synthesis:
An insect over the mic.

 

An emphasis
on erosion.

 

An opening.

 

Opening up to
the possibility.

 

Tiny tree 'cave'.
A microphone inside.

 

Cycling buffers idea.
Iteration over repetition?

 

 


 
Top-right photo credit: Bana Haffar
Bottom-left photo credit: Fulcrum Arts.

 

 

CODE

 

 


Using p5.js, a javascript program loaded and stored all sounds for playback. The web experience plays a few seconds of each sound in geographical order: from west to east. After this first cycle, the program plays in automatic mode. This mode randomly selects short or long decays, adds or removing reverb, and chooses between two of the following playing modes:

A. WANDERING. An individual wanders through the terrain. A location sound can be heard once the individual gets close enough. The amplitude of each sound is determined by the distance between the individual and the location x & y.

B. LOCATION. A timeline selects randomly one of the nine locations every certain time. Amplitude for a selected location is set at 1, while the rest are set at zero.

If the user selects a particular location, auto-mode is turned off.

Additional interaction can occur through the navigational bar placed above. The program offers also visual cues to represent each buffer's amplitude and playhead location.

 

 

 

Code arragnement skecth over Ellwood Mesa:

 

*

 

// - - - - - - - - - - - - - - - - - - - - - -\\
// - - - RADICAL LISTENING - - - - - - - - - -\\
// - - - - - - - - - - - - - - - - - - - - - -\\
//
/* - - A visual landscape based on the "Radical Listening Workshop"
by Lawrence English - \ - Santa Barbara, CA, MMXVIII

Sound and code by: Juan Manuel Escalante | 2018
*/
var crossSize = 4;
var navMaxTimer = 150;
var navMaxAlpha = 140;
var navMinAlpha = 30;
//
var canvas; function setup(){
// 1. Canvas operations
canvas = createCanvas(900/2,240);
canvas.position('fixed');
centerCanvas();

// 2. Sound Operations
loadSounds();

// 3. Individual starts
startLandscape();
startLocations();
startIndividual();
}
// ---------------------------------------------------------------------
function draw(){

//
background('#323232');
//
drawCrosses();

//
if(!allSoundsLoaded) checkLoadedSounds();

//
if(!allBarsFinished || !allBarsDisappeared) loadingSoundsText();

//
if(allBarsDisappeared) mainCode();
if(allBarsDisappeared && titleTextActive) displayTitle();
} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// Center function taken from: https://github.com/processing/p5.js/wiki/Positioning-your-canvas
function windowResized(){
centerCanvas();
}
function centerCanvas(){
var canvasX = (windowWidth-width)/2;
var canvasY = (windowHeight-height)/2;
canvas.position(canvasX, canvasY);
// canvas.position(canvasX, 230); // Top Canvas test
canvas.style('z-index', '-99');
canvas.style('position', 'fixed');
} // - - - - - - - - - - - - - - - - - - - - - -\\
// - - - DRAWING FUNCTIONS - - - - - - - - - -\\
// - - - - - - - - - - - - - - - - - - - - - -\\ // - - Radical Listening - Goleta, CA
// Functions by: Juan Manuel Escalante | 2018
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ function drawCross(x1, y1, cSize){

push();
translate(x1, y1); if(random(10)>1){ // Horizontal Line
line(0, 0, -cSize, 0);
line(0, 0, cSize, 0);
}
if(random(10)>1){ // Top Line
line(0, 0, 0, -cSize);
line(0, 0, 0, cSize);
}

pop();

}
function drawCrosses(){
noFill();
stroke(255);
strokeWeight(0.5);
if(random(10)>9.9)strokeWeight(random(0.5, 0.8));
// Drawing a cross in the four corners
drawCross(crossSize*2, crossSize, crossSize);
drawCross(width -crossSize*2, crossSize, crossSize);
drawCross(crossSize, height -crossSize*2, crossSize);
drawCross(width -crossSize*2, height -crossSize*2, crossSize);

} //
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function friccion(val1, val2, coeficiente, igualar){
/*
val1 = current
val2 = desired
coeficiente = friction value /
igualar =
*/
// A. Interval check
var interval = 0;
if(val1 > val2) interval = val1-val2;
if(val2 > val1) interval = val2-val1;
//
//
// B. New point
interval /= coeficiente;

var newVal = 0.0;
if(val1 > val2) newVal = val1-interval;
if(val2 > val1) newVal = val1+interval;

// C. Exception when too small
if(interval < 0.01 && igualar) newVal = val2;

return newVal;
}
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌ TITLE ▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ var titleTextActive = true;
var naciendoTitle = true;
var alphaFinalTitle = 70;
var alphaActualTitle = 0;
var muriendoTitle = false;
var timerTitle = 80; function displayTitle(){
// Alpha Calculations
if(naciendoTitle){
alphaActualTitle = friccion(alphaActualTitle,alphaFinalTitle, 64, true);
if(alphaActualTitle==alphaFinalTitle){
naciendoTitle = false;
esperandoTitle = true;
}
}else if(esperandoTitle){
timerTitle -= 1;
if(timerTitle <= 0){
esperandoTitle = false;
muriendoTitle = true;
}
}else if(muriendoTitle){
alphaActualTitle = friccion(alphaActualTitle,0, 34, true);
if(alphaActualTitle == 0){
muriendoTitle = false;
titleTextActive = false;
}
}

// Display
noStroke();
fill(255,255,255,alphaActualTitle);
textAlign(CENTER);
textSize(19);
var titleText = "34°24'20.9 N 119°50'41.7 W";
text(titleText, width/2, height/2);

} // - - - - - - - - - - - - - - - - - - - - - - - - -\\
// - - - - N A V I G A T I O N - - - - - - - - - - \\
// - - - - - - - - - - - - - - - - - - - - - - - - -\\
/*
Navigation top bar, in a separate file
*/
var navAlpha = 0.0;
var navTimer = 0.0;
var cont = 0; //
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// sN as in.. sketchN
var sN = function( sketch ) {
// 1. Variables
var navIconSize = 10;
var marginBetweenNavIcons = 10;
var totalNavIcons = 7;
var iconStatus = [];
var clickStatus = [];
var xNavT = [];
var yNavT = [];
var topLineScale = [];
/*
0 - AutoPlayMode
1 - Wandering Mode
2 - Location Mode
3 - Reverb
4 - ShortDecay
5 - Long Decay
6 - MUTE
*/
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// 2. Setup
sketch.setup = function(){
sketch.createCanvas(350,35);
for(var i=0;i<totalNavIcons;i++){
iconStatus[i]=0.0; // Icon indicators
clickStatus[i]=0.0; // Click indicators
xNavT[i] = (navIconSize+marginBetweenNavIcons)*(i+1);
if(i == 6) xNavT[i] = sketch.width-(navIconSize+marginBetweenNavIcons);
yNavT[i] = 18; // 10 originally
topLineScale[i] = 0;
}
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// 3. Draw
sketch.draw = function(){
//
sketch.background('#323232');
//
sketch.drawCornerPoints();
checkNavAlpha(); // Checking navigation Alpha
sketch.checkNavIconStatus(); // Draws a line
sketch.checkHoverLines();
sketch.checkLabels();
//
sketch.drawNav();
//
cont++;


};
// - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - -
sketch.drawNav = function(){
for(var i = 0; i < totalNavIcons; i++){
// Drawing the indicator nav line
sketch.stroke(255, 255, 255, navAlpha);
sketch.strokeWeight(1);
var navLineXTA = xNavT[i]-(navIconSize/2);
var navLineXTB = navLineXTA+(navIconSize*iconStatus[i]);
var navLineYT = yNavT[i]+(navIconSize/2)+3;
sketch.line(navLineXTA, navLineYT, navLineXTB, navLineYT);

// Drawing the MOUSE HOVER mode line
sketch.strokeWeight(1);
sketch.stroke(255, 255, 255);
sketch.strokeCap(SQUARE);
var navLineXTAB = xNavT[i]-(navIconSize/2);
var navLineXTBB = navLineXTAB+(navIconSize*topLineScale[i]);
var navLineYTB = yNavT[i]-(navIconSize/2)-4;
if(topLineScale[i]>0.1)sketch.line(navLineXTAB, navLineYTB, navLineXTBB, navLineYTB);


// Drawing the icon (should be a personalized function here)
sketch.stroke(255, 255, 255, navAlpha);
sketch.strokeWeight(0.6);
sketch.noFill();
sketch.rectMode(CENTER);
// sketch.rect(xNavT, yNavT, navIconSize, navIconSize);
if(i==0){ // ---------------->Autoplay
sketch.push();
sketch.translate(xNavT[i], yNavT[i]);
sketch.ellipse(0, 0, navIconSize, navIconSize);
sketch.fill(255,255,255,navAlpha);
if(iconStatus[i] > 0.9 )sketch.rotate(sketch.radians(cont));
sketch.ellipse(navIconSize/2, 0, 2, 2);
sketch.pop();
}else if(i==1){// - - - - - -> Wandering
sketch.push();
sketch.translate(xNavT[i], yNavT[i]);

sketch.line(-navIconSize/2, -navIconSize/2, 0, 0);
sketch.push();
sketch.translate(navIconSize/2,navIconSize/2);
sketch.line(0, 0, -2.5, -2.5);
sketch.line(0, -2.5, -2.5, 0);
sketch.pop();
sketch.pop();

}else if(i==2){// - - - - - -> Location
sketch.push();
sketch.translate(xNavT[i], yNavT[i]);
sketch.line(0, -navIconSize/6, 0, navIconSize/2);
sketch.push();
sketch.translate(navIconSize/8,-navIconSize/4);
sketch.line(0, 0, -2.5, -2.5);
sketch.line(0, -2.5, -2.5, 0);
sketch.pop();
sketch.pop();

}else if(i==3){// - - - - - - -> Reverb
sketch.push();
sketch.translate(xNavT[i], yNavT[i]);
sketch.push();
sketch.translate(-navIconSize/2.9,-navIconSize/2);
sketch.line(0, 0, 0, navIconSize);
sketch.line(0, 0, 2.1, 0);
sketch.line(0, navIconSize, 2.1, navIconSize);
sketch.pop();
sketch.push();
sketch.translate(navIconSize/2.9,-navIconSize/2);
sketch.line(0, 0, 0, navIconSize);
sketch.line(0, 0, -2.1, 0);
sketch.line(0, navIconSize, -2.1, navIconSize);
sketch.pop();
sketch.pop();
}else if(i==4){// - - - - - - -> ShortDecay
sketch.push();
sketch.translate(xNavT[i], yNavT[i]-navIconSize/2);
sketch.line(0, 1, 0, navIconSize -1);
sketch.pop();
}else if(i==5){// - - - - - - -> LongDecay
sketch.push();
sketch.translate(xNavT[i]-navIconSize/2, yNavT[i]-navIconSize/2);
sketch.line(0, 1, navIconSize-1, navIconSize -1);
sketch.pop();
}else if(i==6){ // ---------------->MUTE
sketch.push();
sketch.translate(xNavT[i], yNavT[i]);
// sketch.ellipse(0, 0, navIconSize, navIconSize);
sketch.fill(255,255,255,navAlpha);
sketch.strokeWeight(0.1);
sketch.ellipse(0, 0, 2, 2);
sketch.strokeWeight(0.2);
sketch.noFill();

if(iconStatus[i] < 0.9 ){
var dimensionExcedidaT = 1.0; // sobre el iconSize
var volSizeT = (cont/6)%(navIconSize*dimensionExcedidaT);
var novaAlphaT = 1;
// if(volSizeT > navIconSize){
novaAlphaT = friccion(novaAlphaT,0,40,false);
// }
if(navAlpha != 0){
sketch.fill(255,255,255,120 * novaAlphaT);
// sketch.fill(255,255,255,navAlpha/4 * novaAlphaT);
sketch.noStroke();
}
sketch.ellipse(0, 0, volSizeT, volSizeT);

}
sketch.pop();
}
} }
// - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - -
sketch.drawCornerPoints = function(){
sketch.stroke(255,255,255,220);
sketch.strokeWeight(sketch.random(0.4,2));
sketch.point(1, sketch.height-3);
sketch.point(sketch.width-3, sketch.height-3);
if(firstTimeLoop) sketch.point(1, sketch.height/2);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sketch.checkNavIconStatus = function(){
//
// [0] - AutoPlay
if(autoPlay)sketch.setNavLineStatus(0,1);//ON
if(!autoPlay)sketch.setNavLineStatus(0,0);//off
//
// [1] - Wandering
if(individualPositionType == "wandering")sketch.setNavLineStatus(1,1);//ON
if(individualPositionType != "wandering")sketch.setNavLineStatus(1,0);//off
//
// [2] - Location
if(individualPositionType == "location")sketch.setNavLineStatus(2,1);//ON
if(individualPositionType != "location")sketch.setNavLineStatus(2,0);//off
//
// [3] - Reverb
if(reverb)sketch.setNavLineStatus(3,1);//ON
if(!reverb)sketch.setNavLineStatus(3,0);//off
//
// [4] - Short Decays
if(!longDecays)sketch.setNavLineStatus(4,1);//ON
if(longDecays)sketch.setNavLineStatus(4,0);//off
//
// [5] - Long Decays
if(longDecays)sketch.setNavLineStatus(5,1);//ON
if(!longDecays)sketch.setNavLineStatus(5,0);//off
//
// [6] - M U T E
if(mute)sketch.setNavLineStatus(6,1);//ON
if(!mute)sketch.setNavLineStatus(6,0);//off


};
sketch.setNavLineStatus = function(no, val){
iconStatus[no]=friccion(iconStatus[no], val, 8,false);
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sketch.checkClick = function(){
// print("I am a button checking das clicks!!! "+sketch.mouseX);
for(var i = 0; i < totalNavIcons; i++){
var xToCheck = sketch.mouseX;
var yToCheck = sketch.mouseY;
if(xToCheck > xNavT[i]-navIconSize/2 -2 && xToCheck < xNavT[i]+navIconSize/2 +2 && yToCheck > yNavT[i]-navIconSize/2 -2 && yToCheck < yNavT[i]+navIconSize/2 +2){
// print(">> It's a hit on button: "+i);
// HIT EXECUTION!!!!
executeChange(i);
}
}
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sketch.checkHand = function(){
var hit = 0;
// We check for hits
for(var i = 0; i < totalNavIcons; i++){
var xToCheck = sketch.mouseX;
var yToCheck = sketch.mouseY;
if(xToCheck > xNavT[i]-navIconSize/2 -2 && xToCheck < xNavT[i]+navIconSize/2 +2 && yToCheck > yNavT[i]-navIconSize/2 -2 && yToCheck < yNavT[i]+navIconSize/2 +2){
hit++;
topLineScale[i] = friccion(topLineScale[i], 1, 4, false); }else{
topLineScale[i] = friccion(topLineScale[i], 0, 4, false);
}
}
// Placing a Cursor
if(hit == 0){
// sketch.cursor(ARROW);
}else{
sketch.cursor(HAND);
}
// PLacing label


};
// - - - - - -
sketch.checkHoverLines = function(){
for(var i = 0; i < totalNavIcons; i++){
var xToCheck = sketch.mouseX;
var yToCheck = sketch.mouseY;
if(xToCheck > xNavT[i]-navIconSize/2 -2 && xToCheck < xNavT[i]+navIconSize/2 +2 && yToCheck > yNavT[i]-navIconSize/2 -2 && yToCheck < yNavT[i]+navIconSize/2 +2){
topLineScale[i] = friccion(topLineScale[i], 1, 4, true);
}else{
topLineScale[i] = friccion(topLineScale[i], 0, 4, false);
}
}
};
// - - - - - -
sketch.checkLabels = function(){
for(var i = 0; i < totalNavIcons; i++){
if(topLineScale[i] > 0.05){
sketch.showLabel(i);
}
}
};
//- - - - - - -
sketch.showLabel = function(no){
sketch.fill(255,255,255,120*topLineScale[no]);
sketch.noStroke();
sketch.textAlign(CENTER);
sketch.textSize(6);
var theLabel = "";
if(no==0)theLabel = "AUTO";
if(no==1)theLabel = "WANDERING MODE";
if(no==2)theLabel = "SINGLE LOCATION";
if(no==3)theLabel = "REVERB";
if(no==4)theLabel = "SHORT DECAY";
if(no==5)theLabel = "LONG DECAY";
if(no==6) theLabel = "SOUND ON/OFF";
sketch.rectMode(CENTER);
var textXDisplacement = 0.001;
if(no==6)textXDisplacement = 2.6;
sketch.text(theLabel, xNavT[no]-textXDisplacement, 5);
// print("Trying to show label");
}; };
// We start the sketch and add a div tag (so we can position it inside our html)
var mySketchN = new p5(sN, 'positionN'); // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ //var navMaxTimer = 100;
function checkNavAlpha(){
// 1. Setting the gral alpha
if(navTimer >= navMaxTimer){
navAlpha = friccion(navAlpha, navMinAlpha, 22, true);
}else{
navAlpha = friccion(navAlpha, navMaxAlpha, 7, true);
navTimer++;
}

}
function mouseMoved(){
//
// Navigation Alpha Timer
navTimer = 0;
// cursor.(ARROW);
mySketchN.checkHand();
checkMapInteractivity("moved");
}
function mouseReleased(){
//
// Navigation Alpha Timer
navTimer = 0;
// Action checker
mySketchN.checkClick();
checkMapClickInteractivity();
} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ function executeChange(no){
/*
0 - AutoPlayMode
1 - Wandering Mode
2 - Location Mode
3 - Reverb
4 - ShortDecay
5 - Long Decay
6 - MUTE
*/
if(no == 0){
autoPlay=!autoPlay;
turnMuteOff();
firstTimeLoop = false;
}
if(no == 1){
individualPositionType="wandering";
indivRotation = true;
turnMuteOff();
autoPlay = false;
firstTimeLoop = false;
}
if(no == 2){
individualPositionType="location";
indivRotation = false;
turnMuteOff();
autoPlay = false;
firstTimeLoop = false;
}
if(no == 3){
reverb=!reverb;
print(">> REVERB is now: "+reverb);
autoPlay = false;
}
if(no == 4){
longDecays=false;
turnMuteOff();
autoPlay = false;
}
if(no == 5){
longDecays=true;
turnMuteOff();
autoPlay = false;
}
if(no == 6){
mute=!mute;
print(">> MUTE is now: "+mute);
autoPlay = false;
}

}
function turnMuteOff(){
mute = false;
}
// - - - - - - - - - - - - - - - - - - - - - -\\
// - - - - S O U N D - - - - - - - - - - \\
// - - - - - - - - - - - - - - - - - - - - - -\\ // - - Radical Listening - Goleta, CA
// Functions by: Juan Manuel Escalante | 2018
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ var totalSounds = 9;
var progressBarSize = 150;
var barsFriction = 20;
var disappearingBarsFriction = 4; var loadedSounds = []; // true/false to know when they have been loaded
var sounds = []; // The actual array of sounds
var soundNames = [];
var descriptions = [];
var amplitudes = []; var reverbSingle;
var reverbCurrentVol = 0.0;
var desiredAmplitudes = [];
var totalLoadedSounds = 0; //
var totalLoadedBars = 0;
var allSoundsLoaded = false;
var allBarsFinished = false;
var allBarsDisappeared = false;
var alphaBars = [];
var individualBarsOff = [];
var actualAmps = [];
var volumes = [];
var desiredAmps = [];
var progressBarFinal = [];
var progressBarActual = [];
var barsFinished = [];
var bufferSizes = [];
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌loadSounds▌▌▌▌▌▌▌▌▌
function loadSounds(){
print(">> Starting sound loading...");

// 1 SoundNames
soundNames[0] = "day1-095_Falling-Water-Contact-Mic.mp3";
descriptions[0] = "UCSB Lagoon (contact MIC)";
soundNames[1] = "day1-095_Falling-Water.mp3";
descriptions[1] = "UCSB Lagoon";
soundNames[2] = "day1-101_Ocean.mp3";
descriptions[2] = "UCSB beach";
soundNames[3] = "day1-105_Windy-Ocean-Cave.mp3";
descriptions[3] = "Mic on tiny cave near the ocean";
soundNames[4] = "day1-109_Bug.mp3";
descriptions[4] = "Bug crawling over mic";
soundNames[5] = "day1-116_Elwood.mp3";
descriptions[5] = "Ellwood Mesa";
soundNames[6] = "day2-0120_CloseCrow.mp3";
descriptions[6] = "Close crow";
soundNames[7] = "day2-0122_AmbienceBird.mp3";
descriptions[7] = "San Antonio Canyon Park";
soundNames[8] = "day2-0126_Carpintero.mp3";
descriptions[8] = "Woodpecker";

// 2. Starting all sound related arrays
for(var i = 0; i < totalSounds; i++){
sounds[i] = loadSound("data/"+soundNames[i]);
loadedSounds[i]=false; //
actualAmps[i]= 0.0;
desiredAmps[i]= 0.0;
progressBarFinal[i] = 10.0;
progressBarActual[i] = 0.0;
barsFinished[i] = false;
alphaBars[i] = 1;
individualBarsOff[i] = false;

// Maybe this needs to be done once everything is loaded
amplitudes[i] = new p5.Amplitude();
amplitudes[i].setInput(sounds[i]);
desiredAmplitudes[i] = 0.0;
volumes[i] = 0.0;
}

// 3. Start Reverbs
// startReverb();
}
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function checkLoadedSounds(){
// 1. Checking the loaded sounds
totalLoadedSounds = 0;
for(var i = 0; i < totalSounds; i++){
if(sounds[i].isLoaded()){
if(!loadedSounds[i])startSound1stTime(i); // 1st time
totalLoadedSounds++;
}
}
// 2. Taking action
if(totalLoadedSounds == totalSounds){
print(">> All sounds loaded, may the listening begin!");
allSoundsLoaded = true;
startReverb();
}
} //
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ function startSound1stTime(no){

// We set the sound to true
loadedSounds[no] = true;
// We loop it
sounds[no].loop();
// We set the volume to zero (we'll deal with it later)
sounds[no].amp(0);
// We set the progressBar to 100
progressBarFinal[no] = progressBarSize;
// 4 if the flies:

}
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function loadingSoundsText(){

// 1. Main Title
fill(255, 255, 255, 180*alphaBars[0]);
noStroke();
textSize(8);
text("_ LOADING SONDS:", 20, 20);

// 2. Sound Names
var textHeight = 18.5;
var textX = 20;
var textY = 20+textHeight;
for(var i = 0; i < totalSounds; i++){
fill(255, 255, 255, 180*alphaBars[i]);
var textYTemp = textY+(textHeight*i);
text(" "+soundNames[i], textX, textYTemp);
}

// 3. Drawing Lines

for(var i = 0; i < totalSounds; i++){
stroke(255, 255, 255, 180*alphaBars[i]);
strokeWeight(1);
noFill();
var textYTemp = textY+(textHeight*i) +4;
progressBarActual[i] = friccion(progressBarActual[i], progressBarFinal[i], barsFriction, true);
line(textX, textYTemp, textX +progressBarActual[i], textYTemp);

// Point if not finished
noFill();
if(!barsFinished[i]) point(textX +progressBarActual[i]+4, textYTemp);

}

// 4. Checking loaded vars
totalLoadedBars = 0;
for(var i = 0; i < totalSounds; i++){
if(progressBarActual[i] == progressBarFinal[i]){
barsFinished[i] = true;
totalLoadedBars++;
}
}
var canIDisappearBars = false;
if(totalLoadedBars == totalSounds){ // Taking Action
allBarsFinished = true;
canIDisappearBars = true;
}
//
var totalBarsDisappeared = 0;
if(canIDisappearBars){
for(var i = 0; i < totalSounds; i++){
if(random(10)>9.3) individualBarsOff[i] = true;
if(individualBarsOff[i]){
if(alphaBars[i] == 0)totalBarsDisappeared++;
alphaBars[i] = friccion(alphaBars[i], 0, disappearingBarsFriction, true);
}
}
}
if(totalBarsDisappeared == totalSounds){
allBarsDisappeared = true;
print(">> All Bars disappeared.");
}

} //
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function startReverb(){

reverbSingle = new p5.Reverb();
for(var i = 0; i < totalSounds; i++){
reverbSingle.process(sounds[i], 10, 75);
} reverbSingle.amp(reverbCurrentVol);
reverbSingle.drywet(1.0); print(">> Reverb engine started.");
}
//
function reverbOperations(){
// A. Changing RV value "frictionally"
if(reverb){ // ON
reverbCurrentVol = friccion(reverbCurrentVol, currentMaxVolumeRv, 35, false);
}else{ // OFF
reverbCurrentVol = friccion(reverbCurrentVol, 0, 15, true);
}

// B. We set the volume
reverbSingle.amp(reverbCurrentVol);
} // - - - - - - - - - - - - - - - - - - - - - - - - -\\
// - - - - U I X - - - - - - - - - - \\
// - - - - - - - - - - - - - - - - - - - - - - - - -\\
// This tab features additional sketches for interface aid
// - - Radical Listening - Goleta, CA
// Functions by: Juan Manuel Escalante | 2018
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// - - - - - - CANVAS #1 - - - - - - - - - - - - - - - - \
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// sA as in.. sketchA
var sA = function( sketch ) {
// 1. Variables
// 2. Setup
sketch.setup = function(){
sketch.createCanvas(50,20);
};
// 3. Draw
sketch.draw = function(){
sketch.background('#323232');
sketch.fill(255, 255, 255, 100);
sketch.textSize(7);
if(individualPositionType == "wandering"){
sketch.text("+ ("+floor(indivX)+","+floor(indivY)+") +", 1, 10);
}else if(individualPositionType == "location"){
var number1 = sketch.floor( (millis()-individStartingTime)/1000 );
var number2 = sketch.floor( (individTotalDesiredTime)/1000 );
sketch.text(" "+number1+" / "+number2+" ", 1, 11);
sketch.stroke(255, 255, 255, 100);
sketch.line(5, 0, sketch.map(number1,0,number2,5,sketch.width-5), 0);
sketch.point(sketch.width-1, 0);
sketch.point(1, 0);
sketch.point(1, 15);
}
};
};
// We start the sketch and add a div tag (so we can position it inside our html)
var mySketchA = new p5(sA, 'positionA'); // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// - - - - - - CANVAS #B - - - - - - - - - - - - - - - - \ Levels
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// sB as in.. sketchB
var sB = function( sketch ) {
// 1. Variables
var levelsSizeB = 150;
var levelsSizeHeightB = 20;
var levelsYSeparationB = levelsSizeHeightB/10;
// 2. Setup
sketch.setup = function(){
sketch.createCanvas(levelsSizeB,levelsSizeHeightB);
};
// 3. Draw
sketch.draw = function(){
sketch.background('#323232');
sketch.noFill();

if(allBarsDisappeared){
for(var i = 0; i< totalSounds; i++){
var currentYTB = i*levelsYSeparationB;
// sketch.stroke(255,255,255,locAlphas[i]);
sketch.stroke(255);
sketch.noFill();
sketch.strokeWeight(0.8);
var newWidthB = map(desiredAmplitudes[i], 0, 0.3, 5, sketch.width*2.5);
sketch.line(sketch.width, currentYTB, sketch.width-newWidthB, currentYTB);
}
}
};
};
// We start the sketch and add a div tag (so we can position it inside our html)
var mySketchB = new p5(sB, 'positionB');
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// - - - - - - CANVAS #C - - - - - - - - - - - - - - - - \ Buffer states
// - - - - - - - - - - - - - - - - - - - - - - - - - - - /
// sC as in.. sketchC
var sC = function( sketch ) {
// 1. Variables
var levelsSizeB = 30; // (width) 150 originally
var levelsSizeHeightB = 130; // (height) 30 originally
var levelsYSeparationB = levelsSizeHeightB/(totalSounds+1); // S
var alphaMinValue = 40;
// 2. Setup
sketch.setup = function(){
sketch.createCanvas(levelsSizeB,levelsSizeHeightB);
};
// 3. Draw
sketch.draw = function(){
sketch.background('#323232');
sketch.translate(0, 1);
// sketch.background('red');
var alphaT = alphaMinValue;
for(var i = 0; i< totalSounds; i++){
// A. Visualization options
if(individualPositionType == "location"){
if(indivCurrentLocation == i){
alphaT = 255;
}else{
alphaT = alphaMinValue;
}
}else if(individualPositionType == "wandering"){
alphaT = map(volumes[i], 0, maxVolume, alphaMinValue, 255);
}
sketch.stroke(255, 255, 255, alphaT);
sketch.fill(255, 255, 255, alphaT);
sketch.strokeWeight(0.3);

// B. Point and lines location
var currentYTB = i*levelsYSeparationB;
sketch.line(0, currentYTB, sketch.width, currentYTB);
var pointLoc = sketch.width*bufferSizes[i];
if(allBarsDisappeared)sketch.point(pointLoc, currentYTB);

}

};
};
// We start the sketch and add a div tag (so we can position it inside our html)
var mySketchC = new p5(sC, 'positionC'); // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ MAP INTERACTIVITY
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function checkMapInteractivity(){

// Location Marker
mapInterValue = 0;
for(var i = 0; i < totalSounds; i++){
// 1. Check Hit
if(mouseX > locX[i]-locSize/2 -2 && mouseX < locX[i]+locSize/2 +2 && mouseY > locY[i]-locSize/2 -2 && mouseY < locY[i]+locSize/2 +2){

locBars[i]=friccion(locBars[i],1,7,false);
cursor(HAND);
mapInterValue++; }else{
locBars[i]=friccion(locBars[i],0,4,false);
// cursor(ARROW);
}


}

} function checkMapClickInteractivity(){
for(var i = 0; i < totalSounds; i++){
if(mouseX > locX[i]-locSize/2 -2 && mouseX < locX[i]+locSize/2 +2 && mouseY > locY[i]-locSize/2 -2 && mouseY < locY[i]+locSize/2 +2){
autoPlay = false;
firstTimeLoop = false;
individualPositionType="location";
indivRotation = false;
individualGetNewLocation(true, i);

}
}
} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ DESCRIPTIONS
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ function checkLocationLabels(){
// 1. Checking ALpha
if(locationLabels)locAlphaLabels=friccion(locAlphaLabels, locAlphaMaxLabels, 39, false);
if(!locationLabels)locAlphaLabels=friccion(locAlphaLabels, 0, 39, false);

if(locationLabels && individualPositionType=="location"){



// 1. Text
var tLocX = width/2;
var tLocY = height-20;
var locLabelToPLace = descriptions[indivCurrentLocation];
// locLabelToPLace = locLabelToPLace.toUpperCase();
noStroke();
fill(255,255,255,locAlphaLabels);
textAlign(CENTER);
textSize(5);
// text(locLabelToPLace, tLocX, tLocY);
// X. Pacific Ocean Label
placePacificOceanLabel();
} else if(locationLabels && individualPositionType=="wandering"){
placePacificOceanLabel();
}
} function placePacificOceanLabel(){
var tLocX = width/2;
var tLocY = height-20;
var locLabelToPLace = "P A C I F I C O C E A N";
noStroke();
fill(255,255,255,locAlphaLabels);
textAlign(CENTER);
textSize(5);
text(locLabelToPLace, tLocX, tLocY);
}
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌s o u n d ▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function soundAmplitudes(){
// //
// checkSoundLevels(); // Sound operations in wandering mode
if(individualPositionType == "wandering"){
for(var i = 0; i < totalSounds; i++){
var distance = dist(locX[i], locY[i], indivX, indivY);
// print("IndivX in the SAMplitudes Wandering = "+indivX);
if(distance <= connectionDistance){
// 1. Test connection line (to improve) maybe in a different function
stroke(255,0,0);
strokeWeight(random(0.7,1));
if(locY[i] > indivY){
line(locX[i], locY[i]-locSize/2 -2.5, indivX, indivY+indivSize/2 +2); }else{
line(locX[i], locY[i]+locSize/2 +2.5, indivX, indivY-indivSize/2 -2);
} // 2. Sound operations (maybe in a different function)
volumes[i] = map(distance, 0, connectionDistance, currentMaxVolume, 0.01);
sounds[i].amp(volumes[i]);

}else{
if(!longDecays){
// 1. Main Volumes
volumes[i] = friccion(volumes[i], 0, 2, false);
sounds[i].amp(volumes[i]);
}
if(longDecays) checkSoundDecays(i);
} } // << sounds for ends
}

// Sound operations in location mode
if(individualPositionType == "location"){
// 1. Playing the sound
var no = indivCurrentLocation; // no as in number
// print("++ The currentLoc "+indivCurrentLocation);
volumes[no] = friccion( volumes[no], currentMaxVolume, 33, false);
// print("++ the no is: "+no);
sounds[no].amp(volumes[no]);

// 3. Checking decays
for(var i = 0; i < totalSounds; i++){
if(!longDecays && i != no){
// 3A. Main Volumes
volumes[i] = friccion(volumes[i], 0, 2, false);
sounds[i].amp(0);
}
if(longDecays) checkSoundDecays(i);
}
}
} function checkSoundLevels(){

// Amplitudes per levels
for(var i = 0; i < totalSounds; i++){
desiredAmplitudes[i] = friccion(desiredAmplitudes[i], amplitudes[i].getLevel(), amplitudesFriction, false);
}
// Checking mute ON/OFF
if(!mute){
// 1. Main Piece volumes
currentMaxVolume = friccion(currentMaxVolume,maxVolume,7,true);
currentMaxVolumeRv = friccion(currentMaxVolumeRv,maxReverbVolume,7,true); }else{
// 1. Main Piece Volumes
currentMaxVolume = friccion(currentMaxVolume,0,7,true);
currentMaxVolumeRv = friccion(currentMaxVolumeRv,0,7,true);
}

} function checkSoundDecays(no){

// All sounds will decay, except for the chosen one
if(no != indivCurrentLocation){
// 1. Main Sounds
volumes[no] = friccion(volumes[no], 0, soundDecay, false);
sounds[no].amp(volumes[no]);

}

}
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// This function was mostly written for the visualization on the UI
// Pporly named since it does not relaate to the SlowSoundBuffers
function soundBufferSizes(){

for(var i = 0; i < totalSounds; i++){
// 1. Main Track
var cT = sounds[i].currentTime();// As in Current Time
var tT = sounds[i].duration(); // As in Total time
bufferSizes[i] = map(cT, 0, tT, 0, 1);

}

} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function getFPSFeedback(){
fill(255);
stroke(0);
text("FPS: " + frameRate().toFixed(2), 10, height - 10);
}
// - - - - - - - - - - - - - - - - - - - - - - - - -\\
// - - - - C O R E __ D R A W - - - - - - - - - - \\
// - - - - - - - - - - - - - - - - - - - - - - - - -\\
// This tab features the main core code function
// - - Radical Listening - Goleta, CA
// Functions by: Juan Manuel Escalante | 2018
//
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// MAIN SWITCHES
var indivAngleNoise = 0.00053;
var indivSize = 10; // Size for the "X" wandering individual
var locSize = 12; // Size for locations
var individualPositionType = "location"; // wandering or location
var indivNoiseX = 0.004;
var indivNoiseY = 0.002;
var indivMaxTime = 35;
var indivMinTime = 15;
var coastPointsTotal = 80;
var coastPointYBaseLine = 55; // A percentage, affects the ocean too
var coastNoiseY = 0.09; // How different the coast will be
var coastVariation = 40;
var pullingQ = 45; // Drawing the coast
var oceanPointsTotal = 80;
var oceanPointBirthSpeed = 30; // Friction value
var locAlphaMin = 10; // Friction value
var locAlphaMax = 43;
var connectionDistance = 65;
var amplitudesFriction = 13;
var longDecays = true;
var soundDecay = 50; // A friction value
var maxVolume = 0.8; // Origin 0.8
var maxReverbVolume = 1.9; // Origin 1.9
var reverb = false;
var autoPlay = false;
var mute = false;
var fpsFeedback = false;
var firstTimeLoop = true;
var locationLabels = true;
var loopOrder = [4,5,0,1,2,3,6,7,8,8];
var maxFirstTimeLoopSeconds = 5; // 5 works
var locAlphaMaxLabels = 180;
// Individual
var firstTimeEnteringFirstTimeLoop = true;
var firstTimeCounter = 0; // -2 originally
var indivAngle = 0.0;
var indivAngleVar = 0.0;
var indivVarX = 0.0;
var indivVarY = 0.0;
var indivX = 0.1;
var indivY = 0.1;
var indivNoiseXCurrent = 0.004;
var indivNoiseYCurrent = 0.002;
var currentMaxVolume = 0.1;
var currentMaxVolumeRv = 0.1;
var indivRotation = true;
var indivCurrentLocation = 0;
var indivTLY = 0.0; // Timeline
var indivTimeScale = 0.0;
//var indivTimer = 0.0;
var individTotalDesiredTime = 3;
var individCurrentTime = 0.0;
var individStartingTime = 0;
var individTimeLimit = 0;
var bufferDot = 0.0;
var crazyNoise = false;
//Coast
var coastPointsX = [];
var coastPointsY = [];
var oceanPointsX = [];
var oceanPointsY = [];
var oceanAlphas = [];
var oceanAmIBeingBorn = [];
var oceanAmIAlive = [];
var oceanAmIDying = [];
var locX = [];
var locY = [];
var locAlphas = [];
var locAlphasSpeed = [];
var locBars = []; // 1 - 0
var locAlphaLabels = 0.0;
var mapInterValue = 0;
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
//
function mainCode(){
//
// I N D I V I D U A L
individualPosition();
individual();

//
// L A N D S C A P E
showCoast();
showOcean();
showLocations();
checkMapInteractivity();
checkLocationLabels();

//
// S O U N D
checkSoundLevels(); // MUTE CONTROl
soundAmplitudes(); // Checks connections
reverbOperations(); //
soundBufferSizes(); //

// O T H E R S
if(autoPlay) executeAutoMode();
if(fpsFeedback) getFPSFeedback();

} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ i n d i v i d u al ▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌ function startIndividual(){
print(">> Starting individual...");
// Just so we can get the timer started hardcoded to 0
// individualGetNewLocation(true, 0);
}
// The main character, navigating
function individual(){

push();
// Position operations
// print("SOS echo: "+indivX);
translate(indivX, indivY);
// translate(100, 100);
indivAngleVar += indivAngleNoise;
indivAngle = noise(indivAngleVar)*360;
if(indivRotation)rotate(radians(indivAngle));
// Drawing Properties
noFill();
strokeWeight(random(0.5, 1.1));
stroke(255);
// We draw
line(-indivSize/2, 0, indivSize/2, 0);
line(0, -indivSize/2, 0, indivSize/2);

// TimeLine & timer
if(individualPositionType == "location"){

// TimeLine
stroke(255, 0, 0);
strokeWeight(0.7);
line(0, 10, 0, indivTLY);

// Timer
var timerLineSize = indivSize*indivTimeScale;
var vertDisplacement = 5;
push();
translate(-indivSize/2, -indivSize/2 -vertDisplacement);
fill(255);
stroke(255);
strokeWeight(0.2);
//line(0, 0, timerLineSize, 0); // timed line
line(0, 0, indivSize, 0); // full line
line(0, -1, indivSize, -1); // full line
line(0, 1, indivSize, 1); // full line
strokeWeight(0.8);
point(timerLineSize, 0); // traveling dot
pop(); // << Careful with this pop


// Experiment .. buffer location... might need to be elsewhere
// var cT = sounds[indivCurrentLocation].currentTime();// As in Current Time
// var tT = sounds[indivCurrentLocation].duration(); // As in Total time
// var bufferSizes = map(cT, 0, tT, 0, 1);

bufferDot = friccion(bufferDot, width*bufferSizes[indivCurrentLocation], 5, true);
stroke(255,0,0);
push();
translate(-indivX, 0);
fill(255);
stroke(255);
rectMode(CENTER);
noStroke();
rect(bufferDot, height-17.5, 2.5, 2.5);
pop();


} pop();

}
function individualPosition(){
/*
This function calculates the individuals position
Should change depending on the modes:

"wandering" = wandering with perlin noise
"location" = going from one location to the other

*/

if(individualPositionType == "wandering"){
// Calculating X and Y
indivVarX += indivNoiseXCurrent;
indivVarY += indivNoiseYCurrent;
indivX = noise(indivVarX) * width;
indivY = noise(indivVarY) * height;

}else if(individualPositionType == "location"){
indivRotation = false;
individualEvaluateLocation();
}


} function individualGetNewLocation(hardPushIndiv, val){
print(">>Getting new individual location ("+hardPushIndiv+","+val+")");

if(firstTimeLoop){
// A1. Total Desired Time
individTotalDesiredTime = maxFirstTimeLoopSeconds*1000;

// A2. First time counter control
if(firstTimeEnteringFirstTimeLoop){
firstTimeCounter = 0;
firstTimeEnteringFirstTimeLoop = false;
}else{
firstTimeCounter++;
}

// A3. Setting the current location
indivCurrentLocation = loopOrder[firstTimeCounter];

// A4. Finishing the first cycle
if(firstTimeCounter >= totalSounds){
firstTimeLoop = false;
autoPlay = true;
individualPositionType = "wandering";
}
}else{
print("Not a 1st time Loop");
// B1. We establish a new desired time (in seconds)
individTotalDesiredTime = floor(random(indivMinTime,indivMaxTime))*1000;

// B2. We get the new location
if(!hardPushIndiv){
indivCurrentLocation = floor(random(totalSounds));
}else{
indivCurrentLocation = val;
}

} // C. New starting time & limit
individStartingTime = millis();
individTimeLimit = individStartingTime+individTotalDesiredTime;

// D. FeedBack:
print(" >> New location: "+indivCurrentLocation);

} function individualEvaluateLocation(){

//
//We evaluate if the timer has exceeded itself
if(millis() > individTimeLimit){
individualGetNewLocation(false, 0);
}
//
// Calculating the x and y position
// print("Inside Evaluate Loc indivX = "+indivX);
indivX = friccion(indivX, locX[indivCurrentLocation], 7, true);
indivY = 10;

// The timeline's height
indivTLY = friccion(indivTLY, locY[indivCurrentLocation]-(indivY*2), 3, true);

// A timeScale to animate time
indivTimeScale = map(millis(), individStartingTime, individTimeLimit, 0, 1);


} // ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌l a n d s c a p e ▌▌▌▌▌▌▌▌▌▌▌▌
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function startLandscape(){
print(">> Starting landscape"); // 1. COAST points - - - - - - - - - - - - - - - - - -- - - - - -
var coastY = height*(coastPointYBaseLine/100);
var coastYVar = 0.0;
for(var i = 0; i < coastPointsTotal; i++){

var additionalPull = 0.0;
if(i < coastPointsTotal/2) additionalPull = map(i, 0, coastPointsTotal/2, 0, pullingQ);
if(i >= coastPointsTotal/2){
additionalPull = map(i,coastPointsTotal/2,coastPointsTotal, pullingQ,0);

}
coastYVar += coastNoiseY;
coastPointsX[i] = map(i, 0, coastPointsTotal, 0, width);
coastPointsY[i] = coastY + (noise(coastYVar)*coastVariation) +additionalPull;
}
// 2. OCEAN points - - - - - - - - - - - - - - - -- - - - - - - -

for(var i = 0; i < oceanPointsTotal; i++){
oceanPointsX[i] = random(width);
oceanPointsY[i] = getNewOceanPointY();
oceanAlphas[i] = 0.0;
oceanAmIBeingBorn[i]= false;
oceanAmIAlive[i] = false;
oceanAmIDying[i] = false;
}
}
function getNewOceanPointY(){
var oceanYT = height*((coastPointYBaseLine+5)/100);
return random(oceanYT, height);
}
function showCoast(){
// 1. Drawing properties
stroke(255,255,255,random(140,150));
strokeWeight(0.3);
// 2. The coastline
for(var i = 1; i < coastPointsTotal; i++){
line(coastPointsX[i-1], coastPointsY[i-1], coastPointsX[i], coastPointsY[i]);
}

}
function showOcean(){

//1. Drawing
noFill();

// 2. The points
for(var i = 0; i < oceanPointsTotal; i++){ // 1. Check the point's condition
if(!oceanAmIDying[i] && !oceanAmIAlive[i] && !oceanAmIBeingBorn[i]){
// It can be born
if(random(100)>99.9) oceanAmIBeingBorn[i] = true;
}else if(oceanAmIBeingBorn[i]){
oceanAlphas[i] = friccion(oceanAlphas[i], 255, oceanPointBirthSpeed, true);
if(oceanAlphas[i] == 255){
oceanAmIBeingBorn[i] = false;
oceanAmIAlive[i] = true;
}
}else if(oceanAmIAlive[i]){
if(random(100)>99.9){
oceanAmIAlive[i] = false;
oceanAmIDying[i] = true;
}
}else if(oceanAmIDying[i]){
oceanAlphas[i] = friccion(oceanAlphas[i], 0, oceanPointBirthSpeed, true);
if(oceanAlphas[i] < 1){
oceanPointsX[i] = random(width);
oceanPointsY[i] = getNewOceanPointY();
oceanAmIBeingBorn[i] = false;
oceanAmIAlive[i] = false;
oceanAmIDying[i] = false;
}
}


// 2. Draw the point
stroke(255, 255, 255, oceanAlphas[i]/2);
point(oceanPointsX[i], oceanPointsY[i]);
}

}
function startLocations(){
print(">> Starting locations");

// 1. Manually setting location coordinates by percentages
locX[0] = 45;// "day1-095_Falling-Water-Contact-Mic.mp3";
locY[0] = 65;

locX[1] = 49;// "day1-095_Falling-Water.mp3";
locY[1] = 69;

locX[2] = 54;// "day1-101_Ocean.mp3";
locY[2] = 78;

locX[3] = 56;// "day1-105_Windy-Ocean-Cave.mp3";
locY[3] = 68;

locX[4] = 20;// "day1-109_Bug.mp3";
locY[4] = 53;

locX[5] = 30;// "day1-116_Elwood.mp3";
locY[5] = 39;

locX[6] = 70;// "day2-0120_CloseCrow.mp3";
locY[6] = 18;

locX[7] = 74;// "day2-0122_AmbienceBird.mp3";
locY[7] = 22;

locX[8] = 81;// "day2-0126_Carpintero.mp3";
locY[8] = 14;


// 2. Translation of percentages into points
for(var i = 0; i < totalSounds; i++){
locX[i] /= 100;
locY[i] /= 100;
locX[i] *= width;
locY[i] *= height;
locAlphas[i] = 0.0;
locAlphasSpeed[i] = random(locAlphaMin, locAlphaMax);
locBars[i] = 0.0;
}
print(" >> All location positions set.");

}
function showLocations(){

// 1. Showing locations
// --------------------------------------- IconS for(var i = 0; i < totalSounds; i++){
// stroke(255,0,0);
stroke(255, 255, 255, locAlphas[i]);
noFill();
strokeWeight(0.8);

// Location Bars- - - - -* *
//
push();
translate(locX[i]-locSize/2, locY[i]-locSize/2);
translate(0, -3); // SLight Y displacement
var locLineSize = locSize*locBars[i];
if(locLineSize > 0.1) line(0, 0, locLineSize, 0);
pop(); if(i == 0){ // --------------------------- Falling Water Mic
push();
translate(locX[i], locY[i]);
translate(-1,0);
line(0, 0, -locSize/4, -locSize/4);
line(0, 0, 0, locSize/2);
pop();
}else if(i == 1){// ---------------------- Falling Water
push();
translate(locX[i], locY[i]);
translate(-1,0);
line(0, 0, -locSize/4, -locSize/4);
line(0, 0, 0, locSize/2);
translate(2,0);
line(0, 0, locSize/4, -locSize/4);
line(0, 0, 0, locSize/2);
pop();
}else if(i == 2){// ---------------------- Ocean
push();
translate(locX[i], locY[i]);
translate(0, 3);
rotate(radians(90));
line(0, 0, -locSize/2, -locSize/2);
translate(-3.5,0);
line(0, 0, -locSize/2, -locSize/2);
translate(3.5, 0);
// line(-locSize/2, locSize/2, locSize/2, -locSize/2);
line(-locSize/2, locSize/2, 0, 0);
translate(-3.5, 0);
line(-locSize/2, locSize/2, 0, 0);
pop();
}else if(i == 3){// ---------------------- OceanCave
push();
translate(locX[i], locY[i]);
rectMode(CENTER);
rect(0, 0, locSize/1.2, locSize/1.2);
var tinyMargin = 0.5;
line(-locSize/4 +tinyMargin, -locSize/4 +tinyMargin, locSize/4 -tinyMargin, locSize/4 -tinyMargin);
pop();
}else if(i == 4){// ---------------------- Bug
push();
translate(locX[i], locY[i]);
line(0, -locSize/2, 0, locSize/2);
translate(0, locSize/6);
line(-locSize/6, -locSize/6, locSize/6, locSize/6);
translate(0, -locSize/6);
translate(0, -locSize/6);
line(-locSize/6, -locSize/6, locSize/6, locSize/6);
pop();
}else if(i == 5){// ---------------------- Elwood
push();
translate(locX[i], locY[i]);
line(0, -locSize/2, 0, locSize/2);
translate(0, -locSize/6);
translate(0, -locSize/6);
line(-locSize/6, -locSize/6, locSize/6, locSize/6);
pop();
}else if(i == 6){// ---------------------- Close Crow
push();
translate(locX[i], locY[i]);
line(0, 0, -locSize/2, -locSize/3);
line(0, 0, -locSize/2, +locSize/3);
if(random(10) >5) point(2, 0);
pop();
}else if(i == 7){// ---------------------- AmbienceBirds
push();
translate(locX[i], locY[i]);
translate(0, 8); //adjustment
drawCross(-locSize/2, -locSize/2, locSize/6);
drawCross(+locSize/2, -locSize/2, locSize/6);
drawCross(0, -locSize, locSize/6);
if(random(10) >5) point(0, 0);
pop();
}else if(i == 8){// ---------------------- Carpintero
push();
translate(locX[i], locY[i]);
translate(0, -locSize/3);
line(-locSize/2, 0, locSize/2, 0);
line(locSize/2, -1.5, locSize/2, +1.5);
translate(0, +locSize/3);
line(-locSize/2, 0, 0, 0);
line(0, -1.5, 0, +1.5);
if(random(10) > 5) point(0, -locSize/3);
if(random(10) > 5) point(0,0);
pop();
}


// - - - -
// 2. Calculating Alphas
if(locAlphas[i] < 255){
locAlphas[i] = friccion(locAlphas[i], 255, locAlphasSpeed[i], true);
} }


}
// ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
function executeAutoMode(){

// 1. Changin position mode
if(random(100)>99.87){
if(individualPositionType == "location"){
individualPositionType = "wandering";
indivRotation = true;
}else if(individualPositionType == "wandering"){
individualPositionType = "location";
indivRotation = false;
}
}

// 2. Activating RV
if(random(100)>99.7) reverb != reverb;

// 3. ShortLongDecay
if(random(100)>99.85){
if(longDecays){
longDecays = false;
}else if(!longDecays){
longDecays = true;
}
}

// 4. Crazy Noise

// var indivNoiseX = 0.004;
//v ar indivNoiseY = 0.002; if(random(100)>199.8){
crazyNoise = true;
indivNoiseXCurrent = random(indivNoiseX, 0.02);
indivNoiseYCurrent = random(indivNoiseY, 0.01);
}
if(random(100)>99.6){
crazyNoise = false;
indivNoiseXCurrent = indivNoiseX;
indivNoiseYCurrent = indivNoiseY;
} // 5. Location Labels
if(random(100)>99.8){
locationLabels = !locationLabels;
} }
 

 

 

 

  >> Download CV
>> Previous and further work at Realität
>> "Logics of Elusion" - a photo journal from Cali.

No other work featured in any other UC website is endorsed by the author, unless included or mentioned here.

The contents, including all opinions and views here expressed, do not necessarily represent the opinions or views of anyone else, including other employees in my department or at the University of California. My department and the University of California are not responsible for the material contained in this publication.

2016