private void Worker_RunComplete(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null || e.Cancelled) { return; } SaveFileDialog saveFileDialog = new SaveFileDialog() { Title = "Save Results...", RestoreDirectory = true, Filter = "MusicAnalysis Files (*.musana)|*.musana|All files (*.*)|*.*" }; bool?result = saveFileDialog.ShowDialog(this); if (result == true) { string file = saveFileDialog.FileName; _musicAnalysis.Save(file); } BtnRun.IsEnabled = true; LblProgress.Content = "Not Running"; _musicAnalysis = null; }
// // Functions // // Use this for initialization void Awake() { lastTime = 0; audio = GetComponent<AudioSource>(); audio.Stop(); analyzer = new MusicAnalyzer( audio.clip, sampleSize, soundFeed, beatSubbands, beatSensitivity, thresholdSize, thresholdMultiplier ); while (!analyzer.Analyze()) ; // make fancy rotation animation // debug var beats = analyzer.Beats; var detectedBeats = analyzer.m_soundParser.DetectedBeats; var thresholds = analyzer.Thresholds; audio.Play(); }
public void LoadAnalysis(string location) { using (FileStream s = File.Open(location, FileMode.Open)) { BinaryFormatter formatter = new BinaryFormatter(); _contextAnalyzer = formatter.Deserialize(s) as MusicAnalyzer; } }
// // Functions // // Use this for initialization void Start() { verticalDirection = 1; lastTime = 0; var mainObject = GameObject.Find("MainObject"); var script = mainObject.GetComponent<MainTestPlayer>(); analyzer = script.analyzer; audio = script.audio; sampleSize = script.sampleSize; }
public AnalysisHelper(string fileLocation, string worksheetFile, string worksheetName) { _fileLocation = fileLocation; string worksheetLocation = Path.Combine(fileLocation, worksheetFile); Console.WriteLine("Path: {0}", worksheetLocation); ExcelReader reader = new ExcelReader(worksheetLocation); _worksheet = reader.GetWorksheet(worksheetName); _data = new List <SongData>(); // string[] files = GetFromColumn<string>(_worksheet, "File"); // Console.WriteLine(string.Join(", ", files)); DataRowCollection rows = _worksheet.Rows; for (int i = 0; i < rows.Count; i++) { object[] a = _worksheet.Rows[i].ItemArray; string name = a[0].ToString(); string source = a[1].ToString(); string context = a[2].ToString(); string theme = a[3].ToString(); if (!(string.IsNullOrWhiteSpace(name) && string.IsNullOrWhiteSpace(source) && string.IsNullOrWhiteSpace(context))) { _data.Add(new SongData() { Name = name, Source = source, Context = context, Theme = theme }); } } List <string> contexts = _data.Select(a => a.Context).Distinct().ToList(); _contextAnalyzer = new MusicAnalyzer(contexts); // List<string> themes = _data.Select(a => a.Theme).Distinct().ToList(); // _themeAnalyzer = new MusicAnalyzer(themes); }
private void BtnCompare_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFile = new OpenFileDialog() { Filter = "MusicAnalysis Files (*.musana)|*.musana|All files (*.*)|*.*", Multiselect = false, Title = "Open Music Analysis", RestoreDirectory = true }; bool?result = openFile.ShowDialog(); if (result == true) { MusicAnalyzer analysis = new MusicAnalyzer(openFile.FileName); Compare compare = new Compare(analysis); compare.ShowDialog(); } }
private void Run_Click(object sender, RoutedEventArgs e) { if (_data.Count <= 0) { MessageBox.Show(this, "You cannot run an analysis without input", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Forms.FolderBrowserDialog folderDialog = new Forms.FolderBrowserDialog() { Description = "Song Directory", ShowNewFolderButton = false, }; Forms.DialogResult dialogResult = folderDialog.ShowDialog(); if (dialogResult == Forms.DialogResult.OK) { string selectedSongPath = folderDialog.SelectedPath; var list = _data.Select(sd => _analysisTypeContextSelected ? sd.Context : sd.Theme); var uniqueList = list.Distinct().ToList(); // put this in a new thread _musicAnalysis = new MusicAnalyzer(uniqueList); // load int epoch = 0; int.TryParse(TxbEpoch.Text, out epoch); object arguments = new MusicArg { Analyzer = _musicAnalysis, Epoch = epoch, SongData = _data, IsContext = _analysisTypeContextSelected, FilePath = selectedSongPath }; // var objRef = _backgroundWorker.CreateObjRef(typeof(MusicAnalyzer)); _backgroundWorker.RunWorkerAsync(arguments); // new Thread(new ThreadStart(Analyze)) BtnRun.IsEnabled = false; LblProgress.Content = "Running..."; } }
public Compare(MusicAnalyzer analyzer) { InitializeComponent(); _analyzer = analyzer; }
public AnalyzerServices(AnalyzerConfig config) { _config = config; _analyzer = new MusicAnalyzer(_config); _collector = new MusicInfoCollector(_config); }
// Start is called before the first frame update void Start() { _musicAnalyzer = GetComponent <MusicAnalyzer>(); this.gameObject.GetComponentsInChildren(_pads); PlayLaunchPad(); }