// Path: src/main/java/org/harmony_analyser/jharmonyanalyser/chroma_analyser/Chroma.java
// @SuppressWarnings({"SameParameterValue", "WeakerAccess"})
// 
// public class Chroma {
// 	public final float[] values;
// 
// 	public static final Chroma EMPTY_CHROMA = new Chroma();
// 
// 	/* Exceptions */
// 
// 	public class WrongChromaSize extends Exception {
// 		public WrongChromaSize(String message) {
// 			super(message);
// 		}
// 	}
// 
// 	public Chroma() {
// 		this.values = new float[0];
// 	}
// 
// 	public Chroma(float[] chroma) throws WrongChromaSize {
// 		this.values = new float[Chromanal.CHROMA_LENGTH];
// 		if (chroma.length != Chromanal.CHROMA_LENGTH) {
// 			throw new WrongChromaSize("Wrong Chroma size");
// 		}
// 		System.arraycopy(chroma, 0, values, 0, Chromanal.CHROMA_LENGTH - 1);
// 	}
// 
// 	/* Public / Package methods */
// 
// 	/* Private methods */
// }
// 
// Path: src/main/java/org/harmony_analyser/jharmonyanalyser/plugins/LineChartPlugin.java
// @SuppressWarnings("SameParameterValue")
// 
// public abstract class LineChartPlugin extends AnalysisPlugin {
// 	public VisualizationData getDataFromOutput(String inputWavFile) throws IOException, AudioAnalyser.OutputNotReady, AudioAnalyser.ParseOutputError, AudioAnalyser.IncorrectInputException, AudioAnalyser.OutputAlreadyExists {
// 		VisualizationData data = super.prepareVisualizationData();
// 		List<Float> timestamps = new ArrayList<>();
// 		List<Float> values = new ArrayList<>();
// 		List<String> linesList = readOutputFile(inputWavFile);
// 
// 		float timestamp, value;
// 
// 		/* Plugin-specific parsing of the result */
// 		try {
// 			for (String line : linesList) {
// 				timestamp = AudioAnalysisHelper.getTimestampFromLine(line);
// 				value = Float.parseFloat(AudioAnalysisHelper.getLabelFromLine(line));
// 				timestamps.add(timestamp);
// 				values.add(value);
// 			}
// 		} catch (NumberFormatException e) {
// 			throw new AudioAnalyser.ParseOutputError("Output did not have the required fields");
// 		}
// 		data.setTimestamps(timestamps);
// 		data.setValues(values);
// 		return data;
// 	}
// }


import org.harmony_analyser.jharmonyanalyser.services.*;
import org.harmony_analyser.jharmonyanalyser.chroma_analyser.Chroma;
import org.harmony_analyser.jharmonyanalyser.plugins.LineChartPlugin;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
package org.harmony_analyser.jharmonyanalyser.plugins.chromanal_plugins;



/**
 * Abstract class for chrama complexity plugins
 */

@SuppressWarnings("SameParameterValue")

abstract class ChromaAnalyserPlugin extends LineChartPlugin {
	protected static float audibleThreshold = (float) 0.07; // used to filter chroma activations that we consider not audible

	/**
	 * Analyzes the song: converts chroma information to chroma complexity descriptors
	 *
	 * @param inputFile [String] name of the WAV audio file
	 *    These additional files are expected in the folder
	 *    - chromaFile: name of the file containing chroma information (suffix: -chromas.txt)
	 */

// Path: src/main/java/org/harmony_analyser/jharmonyanalyser/chroma_analyser/Chroma.java
// @SuppressWarnings({"SameParameterValue", "WeakerAccess"})
// 
// public class Chroma {
// 	public final float[] values;
// 
// 	public static final Chroma EMPTY_CHROMA = new Chroma();
// 
// 	/* Exceptions */
// 
// 	public class WrongChromaSize extends Exception {
// 		public WrongChromaSize(String message) {
// 			super(message);
// 		}
// 	}
// 
// 	public Chroma() {
// 		this.values = new float[0];
// 	}
// 
// 	public Chroma(float[] chroma) throws WrongChromaSize {
// 		this.values = new float[Chromanal.CHROMA_LENGTH];
// 		if (chroma.length != Chromanal.CHROMA_LENGTH) {
// 			throw new WrongChromaSize("Wrong Chroma size");
// 		}
// 		System.arraycopy(chroma, 0, values, 0, Chromanal.CHROMA_LENGTH - 1);
// 	}
// 
// 	/* Public / Package methods */
// 
// 	/* Private methods */
// }
// 
// Path: src/main/java/org/harmony_analyser/jharmonyanalyser/plugins/LineChartPlugin.java
// @SuppressWarnings("SameParameterValue")
// 
// public abstract class LineChartPlugin extends AnalysisPlugin {
// 	public VisualizationData getDataFromOutput(String inputWavFile) throws IOException, AudioAnalyser.OutputNotReady, AudioAnalyser.ParseOutputError, AudioAnalyser.IncorrectInputException, AudioAnalyser.OutputAlreadyExists {
// 		VisualizationData data = super.prepareVisualizationData();
// 		List<Float> timestamps = new ArrayList<>();
// 		List<Float> values = new ArrayList<>();
// 		List<String> linesList = readOutputFile(inputWavFile);
// 
// 		float timestamp, value;
// 
// 		/* Plugin-specific parsing of the result */
// 		try {
// 			for (String line : linesList) {
// 				timestamp = AudioAnalysisHelper.getTimestampFromLine(line);
// 				value = Float.parseFloat(AudioAnalysisHelper.getLabelFromLine(line));
// 				timestamps.add(timestamp);
// 				values.add(value);
// 			}
// 		} catch (NumberFormatException e) {
// 			throw new AudioAnalyser.ParseOutputError("Output did not have the required fields");
// 		}
// 		data.setTimestamps(timestamps);
// 		data.setValues(values);
// 		return data;
// 	}
// }


// Path: src/main/java/org/harmony_analyser/jharmonyanalyser/plugins/chromanal_plugins/ChromaAnalyserPlugin.java
import org.harmony_analyser.jharmonyanalyser.services.*;
import org.harmony_analyser.jharmonyanalyser.chroma_analyser.Chroma;
import org.harmony_analyser.jharmonyanalyser.plugins.LineChartPlugin;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;

package org.harmony_analyser.jharmonyanalyser.plugins.chromanal_plugins;



/**
 * Abstract class for chrama complexity plugins
 */

@SuppressWarnings("SameParameterValue")

abstract class ChromaAnalyserPlugin extends LineChartPlugin {
	protected static float audibleThreshold = (float) 0.07; // used to filter chroma activations that we consider not audible

	/**
	 * Analyzes the song: converts chroma information to chroma complexity descriptors
	 *
	 * @param inputFile [String] name of the WAV audio file
	 *    These additional files are expected in the folder
	 *    - chromaFile: name of the file containing chroma information (suffix: -chromas.txt)
	 */

	public String analyse(String inputFile, boolean force) throws IOException, AudioAnalyser.IncorrectInputException, AudioAnalyser.OutputAlreadyExists, Chroma.WrongChromaSize {