public Song(string fileDirectory) { #region cppAnalyzerOld /*var FloatSamples = Utilities.FloatArrayFromAudio(fileDirectory).ToArray(); * Process audioAnalyzer = new Process(); * string path = @"AubioAnalyzerCpp.exe"; * string currDirectory = Directory.GetCurrentDirectory(); * audioAnalyzer.StartInfo = new ProcessStartInfo(path, '"' + Directory.GetCurrentDirectory() + "\" " + FloatSamples.Length) * { * UseShellExecute = false, * RedirectStandardInput = true, * RedirectStandardOutput = true, * }; * audioAnalyzer.Start(); * foreach (float sample in FloatSamples) { * audioAnalyzer.StandardInput.WriteLine(sample); * } * * string BPMString = audioAnalyzer.StandardOutput.ReadToEnd(); * BeatsPerMinute = (float)Convert.ToDouble(BPMString); * audioAnalyzer.WaitForExit(); * if (audioAnalyzer.ExitCode != 0) throw new Exception("Audio Analyzer Failed");*/ #endregion cppAnalyzerOld AudioAnalysis analyzer = new AudioAnalysis(); analyzer.LoadAudioFromFile(fileDirectory); analyzer.DetectOnsets(out fluxes); //BPMDetector bpmdet = new BPMDetector(fileDirectory); //BeatsPerMinute = bpmdet.getBPM(); //msTilStart = bpmdet.getOffset(); Onsets = analyzer.GetOnsets().ToList(); TimePerSample = analyzer.GetTimePerSample(); }
void AnalyseSong(string filePath) { // Add the audio file name to the window title this.Window.Title = "11010841 Proof of Concept - " + filePath; // Load the audio file from the given file path audioAnalysis.LoadAudioFromFile(filePath); // Find the onsets //audioAnalysis.PerformSpectralFlux(ONSET_SENSITIVITY); audioAnalysis.DetectOnsets(ONSET_SENSITIVITY); // Normalize the intensity of the onsets audioAnalysis.NormalizeOnsets(0); }