public static void main(String[] args) throws FileNotFoundException,
			Exception {

		AudioDecoder decoder = null;
		DetectionFunction onsetDetector = null;

		/*
		 * System.out.println(Math.exp(0.0)); System.out.println(Math.abs(0.0));
		 */

		if (FILE.endsWith(".wav")) {
			decoder = new WavDecoder(new FileInputStream(FILE));
		} else if (FILE.endsWith(".mp3")) {
			decoder = new MP3Decoder(new FileInputStream(FILE));
		} else {
			System.out.println("Only mp3 or wav files supported");
			System.exit(1);
		}

		switch (methodology) {
		case SpectralFlux:
			onsetDetector = new SpectralDifference(decoder, sampleWindowSize,
					hopSize, true);
			break;
		case PhaseDeviation:
			onsetDetector = new PhaseDeviation(decoder, sampleWindowSize,
					hopSize, true);
			break;
		case WeightedPhaseDeviation:
			onsetDetector = new PhaseDeviation(decoder, sampleWindowSize,
					hopSize, true, true);
			break;
		case NormalisedWeightedPhaseDeviation:
			onsetDetector = new PhaseDeviation(decoder, sampleWindowSize,
					hopSize, true, true, true);
			break;
		case HighFrequencyContent:
			onsetDetector = new HighFrequencyContent(decoder, sampleWindowSize,
					hopSize, true);
			break;
		case ComplexDomain:
			onsetDetector = new ComplexDomain(decoder, sampleWindowSize,
					hopSize, true);
			break;
		case RectifiedComplexDomain:
			onsetDetector = new ComplexDomain(decoder, sampleWindowSize,
					hopSize, true, true);
			break;
		default:
			// by default one uses the spectral flux
			onsetDetector = new SpectralDifference(decoder, sampleWindowSize,
					hopSize, true);
			break;
		}

		/**
		 * instantiates the peak detector, by passing the values of the
		 * detection function already calculated, the threshold window size and
		 * the multiplier
		 */
		PeakDetector peaks = new PeakDetector(
				onsetDetector.getDetectionFunction(), thresholdWindowSize,
				multiplier, true);

		/*
		 * calculates the peaks
		 */
		peaks.calcPeaks();
		// peaks.calcPeaks("Bello");

		System.out.println(methodology.toString());
		System.out.println(peaks.getDetectionFunction());
		System.out.println("Onsets:");
		System.out.println(peaks.getPeaksAsInstantsInTime(hopSize,
				(int) decoder.getSampleRate()));

		Plot plot = new Plot(methodology.toString() + "(multiplier = "
				+ multiplier + ")", 800, 600);

		plot.plot(peaks.getThreshold(), 1, Color.red);
		// plot.plot(peaks.getFilteredDetectionFunction(), 1, Color.green);

		// plot.plot(peaks.getPeaks(), 1, Color.CYAN);

		plot.plotFromTimeInstants(
				peaks.getPeaksAsInstantsInTime(hopSize,
						(int) decoder.getSampleRate()), hopSize,
				decoder.getSampleRate(), Color.MAGENTA);

		plot.plotFromFile(new FileInputStream(groundTruth), hopSize,
				decoder.getSampleRate(), Color.blue);

		// plot.plotFromFile(new FileInputStream(myResult), hopSize,
		// decoder.getSampleRate(), Color.magenta);

		plot.PlayInPlot(hopSize, new WavDecoder(new FileInputStream(FILE)));

	}