From 4cff9021d942ba2c1a9feeaf0767ce046c03bb00 Mon Sep 17 00:00:00 2001
From: StoneRed5 <56473591+StoneRed5@users.noreply.github.com>
Date: Tue, 15 Dec 2020 13:55:16 +0100
Subject: [PATCH] =?UTF-8?q?Projektdateien=20hinzuf=C3=BCgen.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
AudioVisualizer.sln | 25 +++
AudioVisualizer/App.config | 6 +
AudioVisualizer/AudioVisualizer.csproj | 89 ++++++++
AudioVisualizer/MainForm.Designer.cs | 201 ++++++++++++++++++
AudioVisualizer/MainForm.cs | 187 ++++++++++++++++
AudioVisualizer/MainForm.resx | 120 +++++++++++
AudioVisualizer/Program.cs | 22 ++
AudioVisualizer/Properties/AssemblyInfo.cs | 36 ++++
.../Properties/Resources.Designer.cs | 71 +++++++
AudioVisualizer/Properties/Resources.resx | 117 ++++++++++
.../Properties/Settings.Designer.cs | 30 +++
AudioVisualizer/Properties/Settings.settings | 7 +
AudioVisualizer/SampleAggregator.cs | 68 ++++++
AudioVisualizer/packages.config | 4 +
14 files changed, 983 insertions(+)
create mode 100644 AudioVisualizer.sln
create mode 100644 AudioVisualizer/App.config
create mode 100644 AudioVisualizer/AudioVisualizer.csproj
create mode 100644 AudioVisualizer/MainForm.Designer.cs
create mode 100644 AudioVisualizer/MainForm.cs
create mode 100644 AudioVisualizer/MainForm.resx
create mode 100644 AudioVisualizer/Program.cs
create mode 100644 AudioVisualizer/Properties/AssemblyInfo.cs
create mode 100644 AudioVisualizer/Properties/Resources.Designer.cs
create mode 100644 AudioVisualizer/Properties/Resources.resx
create mode 100644 AudioVisualizer/Properties/Settings.Designer.cs
create mode 100644 AudioVisualizer/Properties/Settings.settings
create mode 100644 AudioVisualizer/SampleAggregator.cs
create mode 100644 AudioVisualizer/packages.config
diff --git a/AudioVisualizer.sln b/AudioVisualizer.sln
new file mode 100644
index 0000000..e1cc044
--- /dev/null
+++ b/AudioVisualizer.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30225.117
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AudioVisualizer", "AudioVisualizer\AudioVisualizer.csproj", "{1BFBC902-F01B-4C28-AAE8-4B84C23118EC}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1BFBC902-F01B-4C28-AAE8-4B84C23118EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1BFBC902-F01B-4C28-AAE8-4B84C23118EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1BFBC902-F01B-4C28-AAE8-4B84C23118EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1BFBC902-F01B-4C28-AAE8-4B84C23118EC}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {F2FB4503-B5E1-4E1C-A19E-EADB93E00A05}
+ EndGlobalSection
+EndGlobal
diff --git a/AudioVisualizer/App.config b/AudioVisualizer/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/AudioVisualizer/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AudioVisualizer/AudioVisualizer.csproj b/AudioVisualizer/AudioVisualizer.csproj
new file mode 100644
index 0000000..5d4e0a9
--- /dev/null
+++ b/AudioVisualizer/AudioVisualizer.csproj
@@ -0,0 +1,89 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {1BFBC902-F01B-4C28-AAE8-4B84C23118EC}
+ WinExe
+ AudioVisualizer
+ AudioVisualizer
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\NAudio.1.10.0\lib\net35\NAudio.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainForm.cs
+
+
+
+
+
+ MainForm.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AudioVisualizer/MainForm.Designer.cs b/AudioVisualizer/MainForm.Designer.cs
new file mode 100644
index 0000000..f9ac140
--- /dev/null
+++ b/AudioVisualizer/MainForm.Designer.cs
@@ -0,0 +1,201 @@
+namespace AudioVisualizer
+{
+ partial class MainForm
+ {
+ ///
+ /// Erforderliche Designervariable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Verwendete Ressourcen bereinigen.
+ ///
+ /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Vom Windows Form-Designer generierter Code
+
+ ///
+ /// Erforderliche Methode für die Designerunterstützung.
+ /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
+ ///
+ private void InitializeComponent()
+ {
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
+ this.barCountNumericUpDown = new System.Windows.Forms.NumericUpDown();
+ this.flattenValueNumericUpDown = new System.Windows.Forms.NumericUpDown();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.volumeTrackBar = new System.Windows.Forms.TrackBar();
+ this.volumeLabel = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.bufferValueNumericUpDown = new System.Windows.Forms.NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.barCountNumericUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.flattenValueNumericUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.volumeTrackBar)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.bufferValueNumericUpDown)).BeginInit();
+ this.SuspendLayout();
+ //
+ // chart1
+ //
+ this.chart1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ chartArea2.Name = "ChartArea1";
+ this.chart1.ChartAreas.Add(chartArea2);
+ legend2.Name = "Legend1";
+ this.chart1.Legends.Add(legend2);
+ this.chart1.Location = new System.Drawing.Point(0, 0);
+ this.chart1.Name = "chart1";
+ series2.ChartArea = "ChartArea1";
+ series2.Legend = "Legend1";
+ series2.Name = "Series1";
+ this.chart1.Series.Add(series2);
+ this.chart1.Size = new System.Drawing.Size(664, 300);
+ this.chart1.TabIndex = 0;
+ this.chart1.Text = "chart1";
+ //
+ // barCountNumericUpDown
+ //
+ this.barCountNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.barCountNumericUpDown.Location = new System.Drawing.Point(14, 324);
+ this.barCountNumericUpDown.Name = "barCountNumericUpDown";
+ this.barCountNumericUpDown.Size = new System.Drawing.Size(120, 20);
+ this.barCountNumericUpDown.TabIndex = 1;
+ //
+ // flattenValueNumericUpDown
+ //
+ this.flattenValueNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.flattenValueNumericUpDown.Location = new System.Drawing.Point(140, 324);
+ this.flattenValueNumericUpDown.Name = "flattenValueNumericUpDown";
+ this.flattenValueNumericUpDown.Size = new System.Drawing.Size(120, 20);
+ this.flattenValueNumericUpDown.TabIndex = 2;
+ this.flattenValueNumericUpDown.Value = new decimal(new int[] {
+ 4,
+ 0,
+ 0,
+ 0});
+ //
+ // label1
+ //
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(14, 302);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(57, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Bar Count:";
+ //
+ // label2
+ //
+ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(140, 302);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(72, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Flatten Value:";
+ //
+ // volumeTrackBar
+ //
+ this.volumeTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.volumeTrackBar.Location = new System.Drawing.Point(392, 324);
+ this.volumeTrackBar.Maximum = 199;
+ this.volumeTrackBar.Name = "volumeTrackBar";
+ this.volumeTrackBar.Size = new System.Drawing.Size(260, 45);
+ this.volumeTrackBar.TabIndex = 5;
+ this.volumeTrackBar.Value = 185;
+ //
+ // volumeLabel
+ //
+ this.volumeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.volumeLabel.AutoSize = true;
+ this.volumeLabel.Location = new System.Drawing.Point(389, 308);
+ this.volumeLabel.Name = "volumeLabel";
+ this.volumeLabel.Size = new System.Drawing.Size(45, 13);
+ this.volumeLabel.TabIndex = 6;
+ this.volumeLabel.Text = "Volume:";
+ //
+ // label3
+ //
+ this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(266, 302);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(68, 13);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Buffer Value:";
+ //
+ // bufferValueNumericUpDown
+ //
+ this.bufferValueNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.bufferValueNumericUpDown.DecimalPlaces = 1;
+ this.bufferValueNumericUpDown.Increment = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 65536});
+ this.bufferValueNumericUpDown.Location = new System.Drawing.Point(266, 324);
+ this.bufferValueNumericUpDown.Maximum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.bufferValueNumericUpDown.Name = "bufferValueNumericUpDown";
+ this.bufferValueNumericUpDown.Size = new System.Drawing.Size(120, 20);
+ this.bufferValueNumericUpDown.TabIndex = 7;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(664, 356);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.bufferValueNumericUpDown);
+ this.Controls.Add(this.volumeLabel);
+ this.Controls.Add(this.volumeTrackBar);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.flattenValueNumericUpDown);
+ this.Controls.Add(this.barCountNumericUpDown);
+ this.Controls.Add(this.chart1);
+ this.Name = "MainForm";
+ this.Text = "MainForm";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
+ this.Load += new System.EventHandler(this.MainForm_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.barCountNumericUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.flattenValueNumericUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.volumeTrackBar)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.bufferValueNumericUpDown)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.DataVisualization.Charting.Chart chart1;
+ private System.Windows.Forms.NumericUpDown barCountNumericUpDown;
+ private System.Windows.Forms.NumericUpDown flattenValueNumericUpDown;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TrackBar volumeTrackBar;
+ private System.Windows.Forms.Label volumeLabel;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.NumericUpDown bufferValueNumericUpDown;
+ }
+}
+
diff --git a/AudioVisualizer/MainForm.cs b/AudioVisualizer/MainForm.cs
new file mode 100644
index 0000000..16f71e3
--- /dev/null
+++ b/AudioVisualizer/MainForm.cs
@@ -0,0 +1,187 @@
+using NAudio.Wave;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace AudioVisualizer
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ private IWaveIn waveIn;
+ private static int fftLength = 1024; // Has to be powers of two!
+ private SampleAggregator sampleAggregator = new SampleAggregator(fftLength);
+
+ private void MainForm_Load(object sender, EventArgs e)
+ {
+ //Add fft event handler
+ sampleAggregator.FftCalculated += new EventHandler(FftCalculated);
+ sampleAggregator.PerformFFT = true;
+
+ //Setting up the chart1
+ chart1.ChartAreas[0].AxisY.Minimum = 0;
+ chart1.ChartAreas[0].AxisY.Maximum = 0.01;
+ chart1.ChartAreas[0].AxisX.LineWidth = 0;
+ chart1.ChartAreas[0].AxisY.LineWidth = 0;
+ chart1.ChartAreas[0].AxisX.LabelStyle.Enabled = false;
+ chart1.ChartAreas[0].AxisY.LabelStyle.Enabled = false;
+ chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
+ chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
+ chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = false;
+ chart1.ChartAreas[0].AxisY.MinorGrid.Enabled = false;
+ chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
+ chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;
+ chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
+ chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
+ chart1.Series[0].IsVisibleInLegend = false;
+ chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
+ chart1.Series[0]["PointWidth"] = "1";
+
+
+
+ //Set waveIn to WasapiLoopbackCapture to capture the system Audio
+ waveIn = new WasapiLoopbackCapture();
+
+ waveIn.DataAvailable += OnDataAvailable;
+
+ waveIn.StartRecording();
+ }
+
+
+ void OnDataAvailable(object sender, WaveInEventArgs e)
+ {
+ if (this.InvokeRequired)
+ {
+ this.BeginInvoke(new EventHandler(OnDataAvailable), sender, e);
+ }
+ else
+ {
+
+ byte[] buffer = e.Buffer;
+ int bytesRecorded = e.BytesRecorded;
+ int bufferIncrement = waveIn.WaveFormat.BlockAlign;
+
+ for (int index = 0; index < bytesRecorded; index += bufferIncrement)
+ {
+ float sample32 = BitConverter.ToSingle(buffer, index);
+ sampleAggregator.Add(sample32);
+ }
+ }
+ }
+
+ List lastFft = new List();
+
+ void FftCalculated(object sender, FftEventArgs e)
+ {
+ List fft = new List();
+
+ //Adding values form e.Result to fft List
+ for (int i = 0; i < e.Result.Length / 2 - 70; i++)
+ {
+ fft.Add(Math.Abs(e.Result[i].Y * i / (200 - volumeTrackBar.Value)));
+ }
+
+ //set volumeLabel to the current volume
+ volumeLabel.Text = "Volume: " + (volumeTrackBar.Value + 1) + " | " + (200 - volumeTrackBar.Value);
+
+ //Check if the previous fft list isn't 0
+ if (lastFft.Count != 0)
+ {
+ //Dampening the fft
+ for (int i = 0; i < fft.Count; i++)
+ {
+ if(fft[i] > lastFft[i] || bufferValueNumericUpDown.Value == 0)
+ {
+ fft[i] = (fft[i] + lastFft[i]) / 2;
+ }
+ else
+ {
+ fft[i] = lastFft[i] - (double)bufferValueNumericUpDown.Value / 1000;
+ }
+ }
+ }
+
+ int barCount = (int)barCountNumericUpDown.Value;
+ List scaledFft = new List();
+
+ //Calculate voulume of bars
+ if (barCount > 0)
+ {
+ int count = fft.Count / barCount;
+ for (int i = 0; i < barCount; i++)
+ {
+ double temp = 0;
+ int j;
+ for (j = i * count; j < count + i * count; j++)
+ {
+ temp += fft[j];
+ }
+
+ scaledFft.Add(temp);
+ }
+ }
+ else
+ {
+ scaledFft.AddRange(fft);
+ }
+
+ #region flatten
+ int flattenValue = (int)flattenValueNumericUpDown.Value;
+
+ //flatten the values
+ for (int i = 0; i < scaledFft.Count; i++)
+ {
+ if (flattenValue > 0)
+ {
+ double temp = 0;
+ for (int j = 0; j < flattenValue; j++)
+ {
+ if (i + j < scaledFft.Count)
+ temp += scaledFft[i + j];
+ }
+ scaledFft[i] = temp / flattenValue;
+ }
+ }
+
+ for (int i = 0; i < scaledFft.Count; i++)
+ {
+ if (flattenValue > 0)
+ {
+ double temp = 0;
+ for (int j = 0; j < flattenValue; j++)
+ {
+ if (i - j >= 0)
+ temp += scaledFft[i - j];
+ }
+ scaledFft[i] = temp / flattenValue;
+ }
+ }
+ #endregion
+
+
+ //Clear and add cuurent data to chart1
+ lastFft = fft;
+ chart1.Series[0].Points.Clear();
+
+ for (int i = 0; i < scaledFft.Count; i++)
+ {
+ chart1.Series[0].Points.AddY(scaledFft[i]);
+ }
+ }
+
+ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ Application.Exit();
+ }
+ }
+}
diff --git a/AudioVisualizer/MainForm.resx b/AudioVisualizer/MainForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/AudioVisualizer/MainForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/AudioVisualizer/Program.cs b/AudioVisualizer/Program.cs
new file mode 100644
index 0000000..8e93619
--- /dev/null
+++ b/AudioVisualizer/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace AudioVisualizer
+{
+ static class Program
+ {
+ ///
+ /// Der Haupteinstiegspunkt für die Anwendung.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
diff --git a/AudioVisualizer/Properties/AssemblyInfo.cs b/AudioVisualizer/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..47bbb9a
--- /dev/null
+++ b/AudioVisualizer/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Allgemeine Informationen über eine Assembly werden über die folgenden
+// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
+// die einer Assembly zugeordnet sind.
+[assembly: AssemblyTitle("AudioVisualizer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("AudioVisualizer")]
+[assembly: AssemblyCopyright("Copyright © 2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
+// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
+// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
+[assembly: ComVisible(false)]
+
+// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
+[assembly: Guid("1bfbc902-f01b-4c28-aae8-4b84c23118ec")]
+
+// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
+//
+// Hauptversion
+// Nebenversion
+// Buildnummer
+// Revision
+//
+// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
+// indem Sie "*" wie unten gezeigt eingeben:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/AudioVisualizer/Properties/Resources.Designer.cs b/AudioVisualizer/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..467dd29
--- /dev/null
+++ b/AudioVisualizer/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion: 4.0.30319.42000
+//
+// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
+// der Code neu generiert wird.
+//
+//------------------------------------------------------------------------------
+
+namespace AudioVisualizer.Properties
+{
+
+
+ ///
+ /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
+ ///
+ // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
+ // über ein Tool wie ResGen oder Visual Studio automatisch generiert.
+ // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
+ // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AudioVisualizer.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
+ /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/AudioVisualizer/Properties/Resources.resx b/AudioVisualizer/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/AudioVisualizer/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/AudioVisualizer/Properties/Settings.Designer.cs b/AudioVisualizer/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..f608147
--- /dev/null
+++ b/AudioVisualizer/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace AudioVisualizer.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/AudioVisualizer/Properties/Settings.settings b/AudioVisualizer/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/AudioVisualizer/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/AudioVisualizer/SampleAggregator.cs b/AudioVisualizer/SampleAggregator.cs
new file mode 100644
index 0000000..4c0d5ff
--- /dev/null
+++ b/AudioVisualizer/SampleAggregator.cs
@@ -0,0 +1,68 @@
+using NAudio.Dsp;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AudioVisualizer
+{
+ /*
+ *This class is not created by me(Stone_Red)
+ *I forgot who mad this class if i find the source of this class i will credit the original creator
+ */
+ class SampleAggregator
+ {
+ // FFT
+ public event EventHandler FftCalculated;
+ public bool PerformFFT { get; set; }
+ private Complex[] fftBuffer;
+ private FftEventArgs fftArgs;
+ private int fftPos;
+ private int fftLength;
+ private int m;
+
+ public SampleAggregator(int fftLength)
+ {
+ if (!IsPowerOfTwo(fftLength))
+ {
+ throw new ArgumentException("FFT Length must be a power of two");
+ }
+ this.m = (int)Math.Log(fftLength, 2.0);
+ this.fftLength = fftLength;
+ this.fftBuffer = new Complex[fftLength];
+ this.fftArgs = new FftEventArgs(fftBuffer);
+ }
+
+ bool IsPowerOfTwo(int x)
+ {
+ return (x & (x - 1)) == 0;
+ }
+
+ public void Add(float value)
+ {
+ if (PerformFFT && FftCalculated != null)
+ {
+ fftBuffer[fftPos].X = (float)(value * FastFourierTransform.HammingWindow(fftPos, fftLength));
+ fftBuffer[fftPos].Y = 0; // This is always zero with audio.
+ fftPos++;
+ if (fftPos >= fftLength)
+ {
+ fftPos = 0;
+ FastFourierTransform.FFT(true, m, fftBuffer);
+ FftCalculated(this, fftArgs);
+ }
+ }
+ }
+ }
+
+ public class FftEventArgs : EventArgs
+ {
+ public FftEventArgs(Complex[] result)
+ {
+ this.Result = result;
+ }
+ public Complex[] Result { get; private set; }
+ }
+}
diff --git a/AudioVisualizer/packages.config b/AudioVisualizer/packages.config
new file mode 100644
index 0000000..30d766f
--- /dev/null
+++ b/AudioVisualizer/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file