src/codeandchords/ModuleMenu.java
public void updateAmplitudeFollower(int numInput, int followerType)
	{
		if(numInput >= this.module.curNumInputs)
		{
			followerType = 0;
			//System.out.println("WARNING: update amplitude follower was called on a null input");
		}
		
		//this variation of the amplitude follower always moves the follower half way from the
		//current amplitudeFollower value, to the value returned by input.getAmplitude
		if(followerType == 1)
		{
			this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.input.getAmplitude(numInput)) / 2;
			/*
			if(!this.recInputPlaying)
			{
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.input.getAmplitude(numInput)) / 2;
			} else {
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.recInput.getAmplitude(numInput)) / 2;
			}
			*/
		}
		
		//this variation of the amplitude follower always moves the follower half way from the
		//current amplitudeFollower value, to the value returned by input.getAmplitude
		//but there is also a maxIncrament value that puts a limit on how much the amplitudeFollower
		//value can change in one increment
		if(followerType == 2)
		{
			float	amp;
			amp = this.input.getAmplitude(numInput);
			/*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/
			
			if(this.maxAmplitude[numInput] < amp)
			{
				this.maxAmplitude[numInput] = amp;
			}
			
			float maxIncrament = this.maxAmplitude[numInput]/30;
			float incrament = (amp - this.amplitudeFollower[numInput])/2;
			
			if(Math.abs(incrament) < maxIncrament)
			{
				this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] + incrament;
			}
			else
			{
				this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] + (maxIncrament * (incrament/Math.abs(incrament)));
			}
			
			if(this.maxAmplitude[numInput] < amp)
			{
				this.maxAmplitude[numInput] = amp;
			}
		}
		
		/*
		 * jumps to a higher amplitude immediately, has a maximum increment when decreasing
		 */
		if(followerType == 3)
		{
			float amp = 0;
			amp = this.input.getAmplitude(numInput);
			/*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/
			
			if(amp > this.amplitudeFollower[numInput])
			{
				this.amplitudeFollower[numInput] = amp;
			}
			else
			{
				float maxIncramentDown = 60;
				
				if(this.amplitudeFollower[numInput] - amp > maxIncramentDown)
				{
					this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] - maxIncramentDown;
				}
				else
				{
					this.amplitudeFollower[numInput] = amp;
				}
			}
			
			if(amp > this.maxAmplitude[numInput])
			{
				this.maxAmplitude[numInput] = amp;
			}
		}
		
	}
/**
	 * this method updates the amplitude follower and needs to be called every time in the draw loop
	 * for each input that is using it.
	 * 
	 * @param numInput:  Controls the input that is updated
	 * @param followerType:  Controls the style of amplitude follower that is implemented
	 */
this method updates the amplitude follower and needs to be called every time in the draw loop
for each input that is using it.

@param numInput:  Controls the input that is updated
@param followerType:  Controls the style of amplitude follower that is implemented
this method updates the amplitude follower and needs to be called every time in the draw loop for each input that is using it . @param numInput : Controls the input that is updated @param followerType : Controls the style of amplitude follower that is implemented
public void updateAmplitudeFollower(int numInput, int followerType)
	{
		if(numInput >= this.module.curNumInputs)
		{
			followerType = 0;
		}
		if(followerType == 1)
		{
			this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.input.getAmplitude(numInput)) / 2;
			/*
			if(!this.recInputPlaying)
			{
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.input.getAmplitude(numInput)) / 2;
			} else {
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.recInput.getAmplitude(numInput)) / 2;
			}
			*/
		}
		if(followerType == 2)
		{
			float	amp;
			amp = this.input.getAmplitude(numInput);
			/*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/
			if(this.maxAmplitude[numInput] < amp)
			{
				this.maxAmplitude[numInput] = amp;
			}
			float maxIncrament = this.maxAmplitude[numInput]/30;
			float incrament = (amp - this.amplitudeFollower[numInput])/2;
			if(Math.abs(incrament) < maxIncrament)
			{
				this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] + incrament;
			}
			else
			{
				this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] + (maxIncrament * (incrament/Math.abs(incrament)));
			}
			if(this.maxAmplitude[numInput] < amp)
			{
				this.maxAmplitude[numInput] = amp;
			}
		}
		/*
		 * jumps to a higher amplitude immediately, has a maximum increment when decreasing
		 */
		if(followerType == 3)
		{
			float amp = 0;
			amp = this.input.getAmplitude(numInput);
			/*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/
			if(amp > this.amplitudeFollower[numInput])
			{
				this.amplitudeFollower[numInput] = amp;
			}
			else
			{
				float maxIncramentDown = 60;
				if(this.amplitudeFollower[numInput] - amp > maxIncramentDown)
				{
					this.amplitudeFollower[numInput] = this.amplitudeFollower[numInput] - maxIncramentDown;
				}
				else
				{
					this.amplitudeFollower[numInput] = amp;
				}
			}
			if(amp > this.maxAmplitude[numInput])
			{
				this.maxAmplitude[numInput] = amp;
			}
		}
	}
public void updateAmplitudeFollower ( int numInput , int followerType ) { if ( numInput >= this . module . curNumInputs ) { followerType = 0 ; } if ( followerType == 1 ) { this . amplitudeFollower [ numInput ] = ( this . amplitudeFollower [ numInput ] + this . input . getAmplitude ( numInput ) ) / 2 ; /*
			if(!this.recInputPlaying)
			{
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.input.getAmplitude(numInput)) / 2;
			} else {
				this.amplitudeFollower[numInput] = (this.amplitudeFollower[numInput] + this.recInput.getAmplitude(numInput)) / 2;
			}
			*/ } if ( followerType == 2 ) { float amp ; amp = this . input . getAmplitude ( numInput ) ; /*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/ if ( this . maxAmplitude [ numInput ] < amp ) { this . maxAmplitude [ numInput ] = amp ; } float maxIncrament = this . maxAmplitude [ numInput ] / 30 ; float incrament = ( amp - this . amplitudeFollower [ numInput ] ) / 2 ; if ( Math . abs ( incrament ) < maxIncrament ) { this . amplitudeFollower [ numInput ] = this . amplitudeFollower [ numInput ] + incrament ; } else { this . amplitudeFollower [ numInput ] = this . amplitudeFollower [ numInput ] + ( maxIncrament * ( incrament / Math . abs ( incrament ) ) ) ; } if ( this . maxAmplitude [ numInput ] < amp ) { this . maxAmplitude [ numInput ] = amp ; } } /*
		 * jumps to a higher amplitude immediately, has a maximum increment when decreasing
		 */ if ( followerType == 3 ) { float amp = 0 ; amp = this . input . getAmplitude ( numInput ) ; /*
			if(!this.recInputPlaying)
			{
				amp = this.input.getAmplitude(numInput);
			} else {
				amp	= this.recInput.getAmplitude(numInput);
			}
			*/ if ( amp > this . amplitudeFollower [ numInput ] ) { this . amplitudeFollower [ numInput ] = amp ; } else { float maxIncramentDown = 60 ; if ( this . amplitudeFollower [ numInput ] - amp > maxIncramentDown ) { this . amplitudeFollower [ numInput ] = this . amplitudeFollower [ numInput ] - maxIncramentDown ; } else { this . amplitudeFollower [ numInput ] = amp ; } } if ( amp > this . maxAmplitude [ numInput ] ) { this . maxAmplitude [ numInput ] = amp ; } } }
this method updates the amplitude follower and needs to be called every time in the draw loop
 for each input that is using it.
this method updates the amplitude follower and needs to be called every time in the draw loop for each input that is using it .
//System.out.println("WARNING: update amplitude follower was called on a null input"); //this variation of the amplitude follower always moves the follower half way from the //current amplitudeFollower value, to the value returned by input.getAmplitude //this variation of the amplitude follower always moves the follower half way from the //current amplitudeFollower value, to the value returned by input.getAmplitude //but there is also a maxIncrament value that puts a limit on how much the amplitudeFollower //value can change in one increment