<commit_before>var Mixer = function () {
	this.mix = []
	this.target
	this.pause = false
}

// ############### TRACK METHODS ##################

//Adds a track to the mix. Takes args = {urls: sound.aws.com, divId: 1}
Mixer.prototype.addTrack = function (args) {
	var newTrack = new Howl({
		urls: [args['urls']],
		volume: 0.5,
		loop: false
	});
	var trackID = args['divId']
	newTrack.on("end", function(){
		var targetComb = $("div#" + trackID + " div.hex_l div.hex_r div.hex_inner.active");
		targetComb.toggleClass("active");
	})
	console.log(this.mix)
	if (typeof this.mix[trackID] !== 'undefined') {
		this.mix[trackID].unload()
	}
	this.mix[trackID] = newTrack;
	this.buildEffects(trackID);
}

//Removes a track from the mix array
Mixer.prototype.removeTrack = function (position) {
	this.mix[position] = undefined;
}


//Plays a track from the mix array
Mixer.prototype.playTrack = function (trackID) {
	this.mix[trackID].play();
}

//Pauses a track from the mix array
Mixer.prototype.pauseTrack = function (trackID) {
	this.mix[trackID].pause();
}

//Stops a track from the mix array
Mixer.prototype.stopTrack = function (trackID) {
	this.mix[trackID].stop();
}

//Pulls context from a track
Mixer.prototype.trackContext = function (trackID) {
	return this.mix[trackID]._audioNode[0].context
}

// ############### BUILD FILTER METHODS ##################

//Build effects structure
Mixer.prototype.buildEffects = function (trackID) {

	//Set context
	var context = this.trackContext(trackID)

	//create Tuna object for the track
	var tuna = new Tuna(context)

	//Put context/tuna into an object
	var tunaParams = {'tuna' : tuna, 'context' : context}

	//Build Tuna effect nodes
	var filter = this.buildFilter(tunaParams)
	var convolver = this.buildConvolver(tunaParams)
	var reverb = this.buildReverb(tunaParams)

	//Point at the gainNode created in our new Howl
	var input = this.mix[trackID]._audioNode[0]

	//Set output destination to our context destination(speakers)
	var output = context.destination

	//Connect the nodes
	input.connect(filter)
	filter.connect(convolver)
	convolver.connect(reverb)
	reverb.connect(output)

	//Push effects into _audioNode array for future manipulation
	this.mix[trackID]._audioNode.push(filter)
	this.mix[trackID]._audioNode.push(convolver)
	this.mix[trackID]._audioNode.push(reverb)

}

//Create new tuna.Filter
Mixer.prototype.buildFilter = function (params) {

	//Set variables for new effect from params
	var tuna = params['tuna']
	var context = params['context']

	//Create new filter effect
	var filter = new tuna.Filter({
    frequency: 20, //20 to 22050
    Q: 20, //0.001 to 100
    gain: 0, //-40 to 40
    filterType: "allpass", //lowpass, highpass, bandpass, lowshelf, highshelf, peaking, notch, allpass
    bypass: 0
	});

	//Return the filter
	return filter
}

//Create new tuna.convolver(echo)
Mixer.prototype.buildConvolver = function (params) {

	//Set variables for new effect from params
	var tuna = params['tuna']
	var context = params['context']

	//Call Convolver method on tuna
	var convolver = new tuna.Convolver({
    highCut: 22050,                         //20 to 22050
    lowCut: 20,                             //20 to 22050
    dryLevel: 1,                            //0 to 1+
    wetLevel: 1,                            //0 to 1+
    level: 1,                               //0 to 1+, adjusts total output of both wet and dry
    impulse: "https://s3.amazonaws.com/the-golden-record/Sound+Effects/impulseResponse.wav",    //the path to your impulse response
    bypass: 0
	});

	//Return the convolver
	return convolver
}<commit_msg>Added working sound impulse link<commit_after>var Mixer = function () {
	this.mix = []
	this.target
	this.pause = false
}

// ############### TRACK METHODS ##################

//Adds a track to the mix. Takes args = {urls: sound.aws.com, divId: 1}
Mixer.prototype.addTrack = function (args) {
	var newTrack = new Howl({
		urls: [args['urls']],
		volume: 0.5,
		loop: false
	});
	var trackID = args['divId']
	newTrack.on("end", function(){
		var targetComb = $("div#" + trackID + " div.hex_l div.hex_r div.hex_inner.active");
		targetComb.toggleClass("active");
	})
	console.log(this.mix)
	if (typeof this.mix[trackID] !== 'undefined') {
		this.mix[trackID].unload()
	}
	this.mix[trackID] = newTrack;
	this.buildEffects(trackID);
}

//Removes a track from the mix array
Mixer.prototype.removeTrack = function (position) {
	this.mix[position] = undefined;
}


//Plays a track from the mix array
Mixer.prototype.playTrack = function (trackID) {
	this.mix[trackID].play();
}

//Pauses a track from the mix array
Mixer.prototype.pauseTrack = function (trackID) {
	this.mix[trackID].pause();
}

//Stops a track from the mix array
Mixer.prototype.stopTrack = function (trackID) {
	this.mix[trackID].stop();
}

//Pulls context from a track
Mixer.prototype.trackContext = function (trackID) {
	return this.mix[trackID]._audioNode[0].context
}

// ############### BUILD FILTER METHODS ##################

//Build effects structure
Mixer.prototype.buildEffects = function (trackID) {

	//Set context
	var context = this.trackContext(trackID)

	//create Tuna object for the track
	var tuna = new Tuna(context)

	//Put context/tuna into an object
	var tunaParams = {'tuna' : tuna, 'context' : context}

	//Build Tuna effect nodes
	var filter = this.buildFilter(tunaParams)
	var convolver = this.buildConvolver(tunaParams)
	var reverb = this.buildReverb(tunaParams)

	//Point at the gainNode created in our new Howl
	var input = this.mix[trackID]._audioNode[0]

	//Set output destination to our context destination(speakers)
	var output = context.destination

	//Connect the nodes
	input.connect(filter)
	filter.connect(convolver)
	convolver.connect(reverb)
	reverb.connect(output)

	//Push effects into _audioNode array for future manipulation
	this.mix[trackID]._audioNode.push(filter)
	this.mix[trackID]._audioNode.push(convolver)
	this.mix[trackID]._audioNode.push(reverb)

}

//Create new tuna.Filter
Mixer.prototype.buildFilter = function (params) {

	//Set variables for new effect from params
	var tuna = params['tuna']
	var context = params['context']

	//Create new filter effect
	var filter = new tuna.Filter({
    frequency: 20, //20 to 22050
    Q: 20, //0.001 to 100
    gain: 0, //-40 to 40
    filterType: "allpass", //lowpass, highpass, bandpass, lowshelf, highshelf, peaking, notch, allpass
    bypass: 0
	});

	//Return the filter
	return filter
}

//Create new tuna.convolver(echo)
Mixer.prototype.buildConvolver = function (params) {

	//Set variables for new effect from params
	var tuna = params['tuna']
	var context = params['context']

	//Call Convolver method on tuna
	var convolver = new tuna.Convolver({
    highCut: 22050,                         //20 to 22050
    lowCut: 20,                             //20 to 22050
    dryLevel: 1,                            //0 to 1+
    wetLevel: 1,                            //0 to 1+
    level: 1,                               //0 to 1+, adjusts total output of both wet and dry
    impulse: "https://the-golden-record.s3.amazonaws.com/Sound Effects/Impulse Response- .wav",    //the path to your impulse response
    bypass: 0
	});

	//Return the convolver
	return convolver
}
{'fraction_non_alphanumeric': 0.1393103448275862, 'fraction_numerical': 0.01682758620689655, 'mean_word_length': 3.2778761061946904, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6122725', 'n_tokens_mistral': 2537, 'n_tokens_neox': 2379, 'n_words': 675}