public void BuildOnsets() { var audioAnalysis = new AudioAnalysis(); var onsetData = audioAnalysis.DetectOnsets(_frameData, 44100, 1024); _onsets = new FrameData(onsetData, null, 1024); }
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); }
public void Initialize(ISampleSource soundSource, GeneratorOptions options) { analysis = new AudioAnalysis(); analysis.PCMStream = soundSource; analysis.DetectOnsets(); analysis.NormalizeOnsets(0); analysis.PCMStream.Position = 0; fps = options.Fps; Console.WriteLine("Audio analyzer detected " + analysis.GetOnsets().Count(f => f > 0) + " onsets!"); }