class PitchExtractionUtil {

    public List<PitchExtractions> extractPitchs(HarmonicLoop harmonicLoop, File audioFile) throws IOException, UnsupportedAudioFileException, InterruptedException {

        int bufferSize = 1024;
        int overlap = 768;
        AudioDispatcher dispatcher = AudioDispatcherFactory.fromFile(audioFile, bufferSize, overlap);

        PitchDetectionHandlerImp pitchDetectionHandler = new PitchDetectionHandlerImp();
        dispatcher.addAudioProcessor(new PitchProcessor(PitchEstimationAlgorithm.MPM, dispatcher.getFormat().getSampleRate(), bufferSize, pitchDetectionHandler));

        new Thread(dispatcher, "Audio dispatching").start();

        Thread.sleep(10000);

        return pitchDetectionHandler.getPitchExtractions((double) LoopUtils.getSecondsInBar(harmonicLoop.getBpm()), harmonicLoop.getBarCount());
    }

    @Autowired public  PitchExtractionUtil(IHarmonicLoopsDal harmonicLoopsDal);

}