From 011cba54df8c8ff8bffd5959715bae0ea3d035d6 Mon Sep 17 00:00:00 2001 From: ar1st0crat Date: Sat, 21 Aug 2021 22:49:54 +0300 Subject: [PATCH] update README; move samples to another repo --- .../AdaptiveFiltersForm.Designer.cs | 247 - NWaves.DemoForms/AdaptiveFiltersForm.cs | 70 - NWaves.DemoForms/AdaptiveFiltersForm.resx | 120 - NWaves.DemoForms/AmsForm.Designer.cs | 624 -- NWaves.DemoForms/AmsForm.cs | 320 - NWaves.DemoForms/AmsForm.resx | 123 - NWaves.DemoForms/App.config | 6 - NWaves.DemoForms/EffectsForm.Designer.cs | 828 -- NWaves.DemoForms/EffectsForm.cs | 217 - NWaves.DemoForms/EffectsForm.resx | 123 - NWaves.DemoForms/FeaturesForm.Designer.cs | 180 - NWaves.DemoForms/FeaturesForm.cs | 223 - NWaves.DemoForms/FeaturesForm.resx | 123 - NWaves.DemoForms/FiltersForm.Designer.cs | 659 -- NWaves.DemoForms/FiltersForm.cs | 942 --- NWaves.DemoForms/FiltersForm.resx | 129 - NWaves.DemoForms/HpssForm.Designer.cs | 295 - NWaves.DemoForms/HpssForm.cs | 89 - NWaves.DemoForms/HpssForm.resx | 123 - NWaves.DemoForms/LpcForm.Designer.cs | 124 - NWaves.DemoForms/LpcForm.cs | 184 - NWaves.DemoForms/LpcForm.resx | 123 - NWaves.DemoForms/MemoryStreamPlayer.cs | 55 - NWaves.DemoForms/MfccForm.Designer.cs | 513 -- NWaves.DemoForms/MfccForm.cs | 397 - NWaves.DemoForms/MfccForm.resx | 123 - NWaves.DemoForms/ModulationForm.Designer.cs | 221 - NWaves.DemoForms/ModulationForm.cs | 104 - NWaves.DemoForms/ModulationForm.resx | 120 - NWaves.DemoForms/NWaves.DemoForms.csproj | 276 - NWaves.DemoForms/NoiseForm.Designer.cs | 234 - NWaves.DemoForms/NoiseForm.cs | 103 - NWaves.DemoForms/NoiseForm.resx | 123 - NWaves.DemoForms/OnlineDemoForm.Designer.cs | 305 - NWaves.DemoForms/OnlineDemoForm.cs | 170 - NWaves.DemoForms/OnlineDemoForm.resx | 126 - NWaves.DemoForms/PitchForm.Designer.cs | 312 - NWaves.DemoForms/PitchForm.cs | 190 - NWaves.DemoForms/PitchForm.resx | 123 - NWaves.DemoForms/Program.cs | 19 - NWaves.DemoForms/Properties/AssemblyInfo.cs | 36 - .../Properties/Resources.Designer.cs | 63 - NWaves.DemoForms/Properties/Resources.resx | 117 - .../Properties/Settings.Designer.cs | 26 - NWaves.DemoForms/Properties/Settings.settings | 7 - NWaves.DemoForms/SignalsForm.Designer.cs | 648 -- NWaves.DemoForms/SignalsForm.cs | 470 -- NWaves.DemoForms/SignalsForm.resx | 123 - NWaves.DemoForms/StftForm.Designer.cs | 192 - NWaves.DemoForms/StftForm.cs | 136 - NWaves.DemoForms/StftForm.resx | 123 - .../UserControls/GroupPlot.Designer.cs | 49 - NWaves.DemoForms/UserControls/GroupPlot.cs | 110 - NWaves.DemoForms/UserControls/GroupPlot.resx | 120 - .../UserControls/LinePlot.Designer.cs | 49 - NWaves.DemoForms/UserControls/LinePlot.cs | 288 - NWaves.DemoForms/UserControls/LinePlot.resx | 120 - .../UserControls/PoleZeroPlot.Designer.cs | 48 - NWaves.DemoForms/UserControls/PoleZeroPlot.cs | 123 - .../UserControls/PoleZeroPlot.resx | 120 - .../UserControls/SignalPlot.Designer.cs | 87 - NWaves.DemoForms/UserControls/SignalPlot.cs | 161 - NWaves.DemoForms/UserControls/SignalPlot.resx | 120 - .../UserControls/SpectrogramPlot.Designer.cs | 48 - .../UserControls/SpectrogramPlot.cs | 125 - .../UserControls/SpectrogramPlot.resx | 120 - NWaves.DemoForms/WaveletForm.Designer.cs | 263 - NWaves.DemoForms/WaveletForm.cs | 58 - NWaves.DemoForms/WaveletForm.resx | 120 - NWaves.DemoForms/packages.config | 4 - NWaves.DemoUwp/App.xaml | 7 - NWaves.DemoUwp/App.xaml.cs | 100 - .../Assets/LockScreenLogo.scale-200.png | Bin 1430 -> 0 bytes .../Assets/SplashScreen.scale-200.png | Bin 7700 -> 0 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 2937 -> 0 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 1647 -> 0 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 1255 -> 0 bytes NWaves.DemoUwp/Assets/StoreLogo.png | Bin 1451 -> 0 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 3204 -> 0 bytes NWaves.DemoUwp/MainPage.xaml | 87 - NWaves.DemoUwp/MainPage.xaml.cs | 244 - NWaves.DemoUwp/NWaves.DemoUwp.csproj | 152 - NWaves.DemoUwp/Package.appxmanifest | 32 - NWaves.DemoUwp/Properties/AssemblyInfo.cs | 29 - NWaves.DemoUwp/Properties/Default.rd.xml | 31 - NWaves.DemoUwp/README.md | 26 - .../NWaves.DemoUwpEffect.csproj | 137 - NWaves.DemoUwpEffect/NWavesEffect.cs | 155 - .../Properties/AssemblyInfo.cs | 29 - NWaves.DemoUwpEffect/README.md | 60 - .../Assets/AboutAssets.txt | 19 - .../DependencyServices/AudioService.cs | 180 - .../MainActivity.cs | 35 - .../NWaves.DemoXamarin.Android.csproj | 107 - .../Properties/AndroidManifest.xml | 12 - .../Properties/AssemblyInfo.cs | 34 - .../Resources/AboutResources.txt | 50 - .../Resources/Resource.designer.cs | 7504 ----------------- .../Resources/layout/Tabbar.axml | 11 - .../Resources/layout/Toolbar.axml | 9 - .../Resources/mipmap-anydpi-v26/icon.xml | 5 - .../mipmap-anydpi-v26/icon_round.xml | 5 - .../Resources/mipmap-hdpi/Icon.png | Bin 4754 -> 0 bytes .../mipmap-hdpi/launcher_foreground.png | Bin 11695 -> 0 bytes .../Resources/mipmap-mdpi/icon.png | Bin 2807 -> 0 bytes .../mipmap-mdpi/launcher_foreground.png | Bin 6439 -> 0 bytes .../Resources/mipmap-xhdpi/Icon.png | Bin 7028 -> 0 bytes .../mipmap-xhdpi/launcher_foreground.png | Bin 17898 -> 0 bytes .../Resources/mipmap-xxhdpi/Icon.png | Bin 12827 -> 0 bytes .../mipmap-xxhdpi/launcher_foreground.png | Bin 33484 -> 0 bytes .../Resources/mipmap-xxxhdpi/Icon.png | Bin 19380 -> 0 bytes .../mipmap-xxxhdpi/launcher_foreground.png | Bin 52285 -> 0 bytes .../Resources/values/colors.xml | 7 - .../Resources/values/styles.xml | 30 - .../NWaves.DemoXamarin/App.xaml | 8 - .../NWaves.DemoXamarin/App.xaml.cs | 32 - .../DependencyServices/IAudioService.cs | 12 - .../PitchEstimatedEventArgs.cs | 10 - .../NWaves.DemoXamarin/MainPage.xaml | 15 - .../NWaves.DemoXamarin/MainPage.xaml.cs | 52 - .../NWaves.DemoXamarin.projitems | 25 - .../NWaves.DemoXamarin.shproj | 11 - NWaves.DemoXamarin/README.md | 11 - NWaves.sln | 92 +- README.md | 17 +- 125 files changed, 12 insertions(+), 22830 deletions(-) delete mode 100644 NWaves.DemoForms/AdaptiveFiltersForm.Designer.cs delete mode 100644 NWaves.DemoForms/AdaptiveFiltersForm.cs delete mode 100644 NWaves.DemoForms/AdaptiveFiltersForm.resx delete mode 100644 NWaves.DemoForms/AmsForm.Designer.cs delete mode 100644 NWaves.DemoForms/AmsForm.cs delete mode 100644 NWaves.DemoForms/AmsForm.resx delete mode 100644 NWaves.DemoForms/App.config delete mode 100644 NWaves.DemoForms/EffectsForm.Designer.cs delete mode 100644 NWaves.DemoForms/EffectsForm.cs delete mode 100644 NWaves.DemoForms/EffectsForm.resx delete mode 100644 NWaves.DemoForms/FeaturesForm.Designer.cs delete mode 100644 NWaves.DemoForms/FeaturesForm.cs delete mode 100644 NWaves.DemoForms/FeaturesForm.resx delete mode 100644 NWaves.DemoForms/FiltersForm.Designer.cs delete mode 100644 NWaves.DemoForms/FiltersForm.cs delete mode 100644 NWaves.DemoForms/FiltersForm.resx delete mode 100644 NWaves.DemoForms/HpssForm.Designer.cs delete mode 100644 NWaves.DemoForms/HpssForm.cs delete mode 100644 NWaves.DemoForms/HpssForm.resx delete mode 100644 NWaves.DemoForms/LpcForm.Designer.cs delete mode 100644 NWaves.DemoForms/LpcForm.cs delete mode 100644 NWaves.DemoForms/LpcForm.resx delete mode 100644 NWaves.DemoForms/MemoryStreamPlayer.cs delete mode 100644 NWaves.DemoForms/MfccForm.Designer.cs delete mode 100644 NWaves.DemoForms/MfccForm.cs delete mode 100644 NWaves.DemoForms/MfccForm.resx delete mode 100644 NWaves.DemoForms/ModulationForm.Designer.cs delete mode 100644 NWaves.DemoForms/ModulationForm.cs delete mode 100644 NWaves.DemoForms/ModulationForm.resx delete mode 100644 NWaves.DemoForms/NWaves.DemoForms.csproj delete mode 100644 NWaves.DemoForms/NoiseForm.Designer.cs delete mode 100644 NWaves.DemoForms/NoiseForm.cs delete mode 100644 NWaves.DemoForms/NoiseForm.resx delete mode 100644 NWaves.DemoForms/OnlineDemoForm.Designer.cs delete mode 100644 NWaves.DemoForms/OnlineDemoForm.cs delete mode 100644 NWaves.DemoForms/OnlineDemoForm.resx delete mode 100644 NWaves.DemoForms/PitchForm.Designer.cs delete mode 100644 NWaves.DemoForms/PitchForm.cs delete mode 100644 NWaves.DemoForms/PitchForm.resx delete mode 100644 NWaves.DemoForms/Program.cs delete mode 100644 NWaves.DemoForms/Properties/AssemblyInfo.cs delete mode 100644 NWaves.DemoForms/Properties/Resources.Designer.cs delete mode 100644 NWaves.DemoForms/Properties/Resources.resx delete mode 100644 NWaves.DemoForms/Properties/Settings.Designer.cs delete mode 100644 NWaves.DemoForms/Properties/Settings.settings delete mode 100644 NWaves.DemoForms/SignalsForm.Designer.cs delete mode 100644 NWaves.DemoForms/SignalsForm.cs delete mode 100644 NWaves.DemoForms/SignalsForm.resx delete mode 100644 NWaves.DemoForms/StftForm.Designer.cs delete mode 100644 NWaves.DemoForms/StftForm.cs delete mode 100644 NWaves.DemoForms/StftForm.resx delete mode 100644 NWaves.DemoForms/UserControls/GroupPlot.Designer.cs delete mode 100644 NWaves.DemoForms/UserControls/GroupPlot.cs delete mode 100644 NWaves.DemoForms/UserControls/GroupPlot.resx delete mode 100644 NWaves.DemoForms/UserControls/LinePlot.Designer.cs delete mode 100644 NWaves.DemoForms/UserControls/LinePlot.cs delete mode 100644 NWaves.DemoForms/UserControls/LinePlot.resx delete mode 100644 NWaves.DemoForms/UserControls/PoleZeroPlot.Designer.cs delete mode 100644 NWaves.DemoForms/UserControls/PoleZeroPlot.cs delete mode 100644 NWaves.DemoForms/UserControls/PoleZeroPlot.resx delete mode 100644 NWaves.DemoForms/UserControls/SignalPlot.Designer.cs delete mode 100644 NWaves.DemoForms/UserControls/SignalPlot.cs delete mode 100644 NWaves.DemoForms/UserControls/SignalPlot.resx delete mode 100644 NWaves.DemoForms/UserControls/SpectrogramPlot.Designer.cs delete mode 100644 NWaves.DemoForms/UserControls/SpectrogramPlot.cs delete mode 100644 NWaves.DemoForms/UserControls/SpectrogramPlot.resx delete mode 100644 NWaves.DemoForms/WaveletForm.Designer.cs delete mode 100644 NWaves.DemoForms/WaveletForm.cs delete mode 100644 NWaves.DemoForms/WaveletForm.resx delete mode 100644 NWaves.DemoForms/packages.config delete mode 100644 NWaves.DemoUwp/App.xaml delete mode 100644 NWaves.DemoUwp/App.xaml.cs delete mode 100644 NWaves.DemoUwp/Assets/LockScreenLogo.scale-200.png delete mode 100644 NWaves.DemoUwp/Assets/SplashScreen.scale-200.png delete mode 100644 NWaves.DemoUwp/Assets/Square150x150Logo.scale-200.png delete mode 100644 NWaves.DemoUwp/Assets/Square44x44Logo.scale-200.png delete mode 100644 NWaves.DemoUwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png delete mode 100644 NWaves.DemoUwp/Assets/StoreLogo.png delete mode 100644 NWaves.DemoUwp/Assets/Wide310x150Logo.scale-200.png delete mode 100644 NWaves.DemoUwp/MainPage.xaml delete mode 100644 NWaves.DemoUwp/MainPage.xaml.cs delete mode 100644 NWaves.DemoUwp/NWaves.DemoUwp.csproj delete mode 100644 NWaves.DemoUwp/Package.appxmanifest delete mode 100644 NWaves.DemoUwp/Properties/AssemblyInfo.cs delete mode 100644 NWaves.DemoUwp/Properties/Default.rd.xml delete mode 100644 NWaves.DemoUwp/README.md delete mode 100644 NWaves.DemoUwpEffect/NWaves.DemoUwpEffect.csproj delete mode 100644 NWaves.DemoUwpEffect/NWavesEffect.cs delete mode 100644 NWaves.DemoUwpEffect/Properties/AssemblyInfo.cs delete mode 100644 NWaves.DemoUwpEffect/README.md delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Assets/AboutAssets.txt delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/DependencyServices/AudioService.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/MainActivity.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/NWaves.DemoXamarin.Android.csproj delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Properties/AndroidManifest.xml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Properties/AssemblyInfo.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/AboutResources.txt delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/Resource.designer.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/layout/Tabbar.axml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/layout/Toolbar.axml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-anydpi-v26/icon.xml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-hdpi/Icon.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-mdpi/icon.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xhdpi/Icon.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xxhdpi/Icon.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xxxhdpi/Icon.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/values/colors.xml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin.Android/Resources/values/styles.xml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/App.xaml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/App.xaml.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/DependencyServices/IAudioService.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/DependencyServices/PitchEstimatedEventArgs.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/MainPage.xaml delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/MainPage.xaml.cs delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/NWaves.DemoXamarin.projitems delete mode 100644 NWaves.DemoXamarin/NWaves.DemoXamarin/NWaves.DemoXamarin.shproj delete mode 100644 NWaves.DemoXamarin/README.md diff --git a/NWaves.DemoForms/AdaptiveFiltersForm.Designer.cs b/NWaves.DemoForms/AdaptiveFiltersForm.Designer.cs deleted file mode 100644 index dddb82c..0000000 --- a/NWaves.DemoForms/AdaptiveFiltersForm.Designer.cs +++ /dev/null @@ -1,247 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class AdaptiveFiltersForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.adaptButton = new System.Windows.Forms.Button(); - this.weightsListBox = new System.Windows.Forms.ListBox(); - this.linePlot1 = new NWaves.DemoForms.UserControls.LinePlot(); - this.label1 = new System.Windows.Forms.Label(); - this.generateButton = new System.Windows.Forms.Button(); - this.noiseRadioButton = new System.Windows.Forms.RadioButton(); - this.sinRadioButton = new System.Windows.Forms.RadioButton(); - this.label2 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.lmsRadioButton = new System.Windows.Forms.RadioButton(); - this.nlmsRadioButton = new System.Windows.Forms.RadioButton(); - this.lmfRadioButton = new System.Windows.Forms.RadioButton(); - this.rlsRadioButton = new System.Windows.Forms.RadioButton(); - this.muTextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // adaptButton - // - this.adaptButton.Location = new System.Drawing.Point(112, 72); - this.adaptButton.Name = "adaptButton"; - this.adaptButton.Size = new System.Drawing.Size(273, 62); - this.adaptButton.TabIndex = 1; - this.adaptButton.Text = "Adapt!"; - this.adaptButton.UseVisualStyleBackColor = true; - this.adaptButton.Click += new System.EventHandler(this.adaptButton_Click); - // - // weightsListBox - // - this.weightsListBox.FormattingEnabled = true; - this.weightsListBox.ItemHeight = 16; - this.weightsListBox.Location = new System.Drawing.Point(653, 304); - this.weightsListBox.Name = "weightsListBox"; - this.weightsListBox.Size = new System.Drawing.Size(135, 132); - this.weightsListBox.TabIndex = 2; - // - // linePlot1 - // - this.linePlot1.AutoScroll = true; - this.linePlot1.BackColor = System.Drawing.Color.White; - this.linePlot1.ForeColor = System.Drawing.Color.Blue; - this.linePlot1.Location = new System.Drawing.Point(13, 47); - this.linePlot1.Name = "linePlot1"; - this.linePlot1.PaddingX = 30; - this.linePlot1.PaddingY = 20; - this.linePlot1.Size = new System.Drawing.Size(775, 204); - this.linePlot1.Stride = 1; - this.linePlot1.TabIndex = 0; - this.linePlot1.Thickness = 1; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 13); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(59, 17); - this.label1.TabIndex = 3; - this.label1.Text = "Filtered:"; - // - // generateButton - // - this.generateButton.Location = new System.Drawing.Point(34, 341); - this.generateButton.Name = "generateButton"; - this.generateButton.Size = new System.Drawing.Size(151, 62); - this.generateButton.TabIndex = 4; - this.generateButton.Text = "Generate signal"; - this.generateButton.UseVisualStyleBackColor = true; - this.generateButton.Click += new System.EventHandler(this.generateButton_Click); - // - // noiseRadioButton - // - this.noiseRadioButton.AutoSize = true; - this.noiseRadioButton.Checked = true; - this.noiseRadioButton.Location = new System.Drawing.Point(102, 13); - this.noiseRadioButton.Name = "noiseRadioButton"; - this.noiseRadioButton.Size = new System.Drawing.Size(65, 21); - this.noiseRadioButton.TabIndex = 5; - this.noiseRadioButton.TabStop = true; - this.noiseRadioButton.Text = "Noise"; - this.noiseRadioButton.UseVisualStyleBackColor = true; - // - // sinRadioButton - // - this.sinRadioButton.AutoSize = true; - this.sinRadioButton.Location = new System.Drawing.Point(188, 13); - this.sinRadioButton.Name = "sinRadioButton"; - this.sinRadioButton.Size = new System.Drawing.Size(83, 21); - this.sinRadioButton.TabIndex = 6; - this.sinRadioButton.Text = "Sinusoid"; - this.sinRadioButton.UseVisualStyleBackColor = true; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(686, 274); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(59, 17); - this.label2.TabIndex = 7; - this.label2.Text = "Weights"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.muTextBox); - this.groupBox1.Controls.Add(this.rlsRadioButton); - this.groupBox1.Controls.Add(this.lmfRadioButton); - this.groupBox1.Controls.Add(this.nlmsRadioButton); - this.groupBox1.Controls.Add(this.lmsRadioButton); - this.groupBox1.Controls.Add(this.adaptButton); - this.groupBox1.Location = new System.Drawing.Point(231, 285); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(406, 153); - this.groupBox1.TabIndex = 8; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Adaptive filters"; - // - // lmsRadioButton - // - this.lmsRadioButton.AutoSize = true; - this.lmsRadioButton.Checked = true; - this.lmsRadioButton.Location = new System.Drawing.Point(18, 32); - this.lmsRadioButton.Name = "lmsRadioButton"; - this.lmsRadioButton.Size = new System.Drawing.Size(57, 21); - this.lmsRadioButton.TabIndex = 2; - this.lmsRadioButton.TabStop = true; - this.lmsRadioButton.Text = "LMS"; - this.lmsRadioButton.UseVisualStyleBackColor = true; - // - // nlmsRadioButton - // - this.nlmsRadioButton.AutoSize = true; - this.nlmsRadioButton.Location = new System.Drawing.Point(18, 59); - this.nlmsRadioButton.Name = "nlmsRadioButton"; - this.nlmsRadioButton.Size = new System.Drawing.Size(67, 21); - this.nlmsRadioButton.TabIndex = 3; - this.nlmsRadioButton.Text = "NLMS"; - this.nlmsRadioButton.UseVisualStyleBackColor = true; - // - // lmfRadioButton - // - this.lmfRadioButton.AutoSize = true; - this.lmfRadioButton.Location = new System.Drawing.Point(18, 86); - this.lmfRadioButton.Name = "lmfRadioButton"; - this.lmfRadioButton.Size = new System.Drawing.Size(56, 21); - this.lmfRadioButton.TabIndex = 4; - this.lmfRadioButton.Text = "LMF"; - this.lmfRadioButton.UseVisualStyleBackColor = true; - // - // rlsRadioButton - // - this.rlsRadioButton.AutoSize = true; - this.rlsRadioButton.Location = new System.Drawing.Point(18, 113); - this.rlsRadioButton.Name = "rlsRadioButton"; - this.rlsRadioButton.Size = new System.Drawing.Size(56, 21); - this.rlsRadioButton.TabIndex = 5; - this.rlsRadioButton.Text = "RLS"; - this.rlsRadioButton.UseVisualStyleBackColor = true; - // - // muTextBox - // - this.muTextBox.Location = new System.Drawing.Point(142, 36); - this.muTextBox.Name = "muTextBox"; - this.muTextBox.Size = new System.Drawing.Size(53, 22); - this.muTextBox.TabIndex = 6; - this.muTextBox.Text = "0,95"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(109, 36); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(27, 17); - this.label3.TabIndex = 9; - this.label3.Text = "mu"; - // - // AdaptiveFiltersForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.label2); - this.Controls.Add(this.sinRadioButton); - this.Controls.Add(this.noiseRadioButton); - this.Controls.Add(this.generateButton); - this.Controls.Add(this.label1); - this.Controls.Add(this.weightsListBox); - this.Controls.Add(this.linePlot1); - this.Name = "AdaptiveFiltersForm"; - this.Text = "AdaptiveFiltersForm"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private UserControls.LinePlot linePlot1; - private System.Windows.Forms.Button adaptButton; - private System.Windows.Forms.ListBox weightsListBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button generateButton; - private System.Windows.Forms.RadioButton noiseRadioButton; - private System.Windows.Forms.RadioButton sinRadioButton; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton rlsRadioButton; - private System.Windows.Forms.RadioButton lmfRadioButton; - private System.Windows.Forms.RadioButton nlmsRadioButton; - private System.Windows.Forms.RadioButton lmsRadioButton; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox muTextBox; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/AdaptiveFiltersForm.cs b/NWaves.DemoForms/AdaptiveFiltersForm.cs deleted file mode 100644 index 9694121..0000000 --- a/NWaves.DemoForms/AdaptiveFiltersForm.cs +++ /dev/null @@ -1,70 +0,0 @@ -using NWaves.Filters.Adaptive; -using NWaves.Filters.Base; -using NWaves.Signals; -using NWaves.Signals.Builders; -using System; -using System.ComponentModel; -using System.Linq; -using System.Windows.Forms; - -namespace NWaves.DemoForms -{ - public partial class AdaptiveFiltersForm : Form - { - DiscreteSignal _s; - DiscreteSignal _noise; - - public AdaptiveFiltersForm() - { - InitializeComponent(); - } - - private void adaptButton_Click(object sender, EventArgs e) - { - var mu = float.Parse(muTextBox.Text); - - AdaptiveFilter filter; - - if (nlmsRadioButton.Checked) - filter = new NlmsFilter(5, mu); - else if (lmfRadioButton.Checked) - filter = new LmfFilter(5, mu); - else if (rlsRadioButton.Checked) - filter = new RlsFilter(5, mu); - else - filter = new LmsFilter(5, mu); - - var a = Enumerable.Range(0, _noise.Length) - .Select(i => filter.Process(_noise[i], _s[i])) - .ToArray(); - - linePlot1.Markline = a; - - weightsListBox.DataSource = new BindingList(filter.Kernel); - } - - private void generateButton_Click(object sender, EventArgs e) - { - _noise = sinRadioButton.Checked ? - new SineBuilder() - .SetParameter("freq", 1000) - .OfLength(1000) - .SampledAt(16000) - .Build() - : - new WhiteNoiseBuilder() - .SetParameter("min", -0.5) - .SetParameter("max", 0.5) - .OfLength(1000) - .SampledAt(16000) - .Build(); - - var fir = new FirFilter(new[] { 0.2, 1, -0.5, 0.5, 0.9 }); - - _s = fir.ApplyTo(_noise); - - linePlot1.Stride = 5; - linePlot1.Line = _s.Samples; - } - } -} diff --git a/NWaves.DemoForms/AdaptiveFiltersForm.resx b/NWaves.DemoForms/AdaptiveFiltersForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/AdaptiveFiltersForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/AmsForm.Designer.cs b/NWaves.DemoForms/AmsForm.Designer.cs deleted file mode 100644 index f9b6e2d..0000000 --- a/NWaves.DemoForms/AmsForm.Designer.cs +++ /dev/null @@ -1,624 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class AmsForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.envelopesPanel = new System.Windows.Forms.Panel(); - this.label15 = new System.Windows.Forms.Label(); - this.label14 = new System.Windows.Forms.Label(); - this.label13 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.band4ComboBox = new System.Windows.Forms.ComboBox(); - this.band3ComboBox = new System.Windows.Forms.ComboBox(); - this.band2ComboBox = new System.Windows.Forms.ComboBox(); - this.band1ComboBox = new System.Windows.Forms.ComboBox(); - this.filterbankComboBox = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.filterCountTextBox = new System.Windows.Forms.TextBox(); - this.filterbankButton = new System.Windows.Forms.Button(); - this.modulationSpectrumPanel = new System.Windows.Forms.Panel(); - this.lowFreqTextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.highFreqTextBox = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.samplingRateTextBox = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.fftSizeTextBox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.computeButton = new System.Windows.Forms.Button(); - this.longTermHopSizeTextBox = new System.Windows.Forms.TextBox(); - this.label9 = new System.Windows.Forms.Label(); - this.longTermFftSizeTextBox = new System.Windows.Forms.TextBox(); - this.label10 = new System.Windows.Forms.Label(); - this.hopSizeTextBox = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.analysisFftTextBox = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); - this.nextButton = new System.Windows.Forms.Button(); - this.infoLabel = new System.Windows.Forms.Label(); - this.prevButton = new System.Windows.Forms.Button(); - this.temporalCheckBox = new System.Windows.Forms.CheckBox(); - this.herzTextBox = new System.Windows.Forms.TextBox(); - this.label16 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.shapeComboBox = new System.Windows.Forms.ComboBox(); - this.overlapCheckBox = new System.Windows.Forms.CheckBox(); - this.filterbankPanel = new NWaves.DemoForms.UserControls.GroupPlot(); - this.menuStrip1.SuspendLayout(); - this.envelopesPanel.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1187, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // envelopesPanel - // - this.envelopesPanel.BackColor = System.Drawing.Color.White; - this.envelopesPanel.Controls.Add(this.label15); - this.envelopesPanel.Controls.Add(this.label14); - this.envelopesPanel.Controls.Add(this.label13); - this.envelopesPanel.Controls.Add(this.label12); - this.envelopesPanel.Controls.Add(this.band4ComboBox); - this.envelopesPanel.Controls.Add(this.band3ComboBox); - this.envelopesPanel.Controls.Add(this.band2ComboBox); - this.envelopesPanel.Controls.Add(this.band1ComboBox); - this.envelopesPanel.Location = new System.Drawing.Point(12, 319); - this.envelopesPanel.Name = "envelopesPanel"; - this.envelopesPanel.Size = new System.Drawing.Size(1168, 370); - this.envelopesPanel.TabIndex = 1; - // - // label15 - // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(1055, 255); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(49, 17); - this.label15.TabIndex = 7; - this.label15.Text = "Band#"; - // - // label14 - // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(1055, 170); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(49, 17); - this.label14.TabIndex = 6; - this.label14.Text = "Band#"; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(1055, 89); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(49, 17); - this.label13.TabIndex = 5; - this.label13.Text = "Band#"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(1055, 8); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(49, 17); - this.label12.TabIndex = 4; - this.label12.Text = "Band#"; - // - // band4ComboBox - // - this.band4ComboBox.FormattingEnabled = true; - this.band4ComboBox.Location = new System.Drawing.Point(1110, 252); - this.band4ComboBox.Name = "band4ComboBox"; - this.band4ComboBox.Size = new System.Drawing.Size(52, 24); - this.band4ComboBox.TabIndex = 3; - this.band4ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged); - // - // band3ComboBox - // - this.band3ComboBox.FormattingEnabled = true; - this.band3ComboBox.Location = new System.Drawing.Point(1110, 167); - this.band3ComboBox.Name = "band3ComboBox"; - this.band3ComboBox.Size = new System.Drawing.Size(52, 24); - this.band3ComboBox.TabIndex = 2; - this.band3ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged); - // - // band2ComboBox - // - this.band2ComboBox.FormattingEnabled = true; - this.band2ComboBox.Location = new System.Drawing.Point(1110, 86); - this.band2ComboBox.Name = "band2ComboBox"; - this.band2ComboBox.Size = new System.Drawing.Size(52, 24); - this.band2ComboBox.TabIndex = 1; - this.band2ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged); - // - // band1ComboBox - // - this.band1ComboBox.FormattingEnabled = true; - this.band1ComboBox.Location = new System.Drawing.Point(1110, 5); - this.band1ComboBox.Name = "band1ComboBox"; - this.band1ComboBox.Size = new System.Drawing.Size(52, 24); - this.band1ComboBox.TabIndex = 0; - this.band1ComboBox.TextChanged += new System.EventHandler(this.bandComboBox_TextChanged); - // - // filterbankComboBox - // - this.filterbankComboBox.FormattingEnabled = true; - this.filterbankComboBox.Items.AddRange(new object[] { - "Herz", - "Mel", - "Bark", - "Critical bands", - "ERB", - "Octave bands"}); - this.filterbankComboBox.Location = new System.Drawing.Point(184, 42); - this.filterbankComboBox.Name = "filterbankComboBox"; - this.filterbankComboBox.Size = new System.Drawing.Size(92, 24); - this.filterbankComboBox.TabIndex = 2; - this.filterbankComboBox.Text = "Mel"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(104, 45); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(74, 17); - this.label1.TabIndex = 3; - this.label1.Text = "Filter bank"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(13, 45); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(35, 17); - this.label2.TabIndex = 5; - this.label2.Text = "Size"; - // - // filterCountTextBox - // - this.filterCountTextBox.Location = new System.Drawing.Point(54, 43); - this.filterCountTextBox.Name = "filterCountTextBox"; - this.filterCountTextBox.Size = new System.Drawing.Size(38, 22); - this.filterCountTextBox.TabIndex = 6; - this.filterCountTextBox.Text = "13"; - // - // filterbankButton - // - this.filterbankButton.Location = new System.Drawing.Point(372, 78); - this.filterbankButton.Name = "filterbankButton"; - this.filterbankButton.Size = new System.Drawing.Size(240, 51); - this.filterbankButton.TabIndex = 7; - this.filterbankButton.Text = ">>"; - this.filterbankButton.UseVisualStyleBackColor = true; - this.filterbankButton.Click += new System.EventHandler(this.filterbankButton_Click); - // - // modulationSpectrumPanel - // - this.modulationSpectrumPanel.BackColor = System.Drawing.Color.White; - this.modulationSpectrumPanel.Location = new System.Drawing.Point(865, 65); - this.modulationSpectrumPanel.Name = "modulationSpectrumPanel"; - this.modulationSpectrumPanel.Size = new System.Drawing.Size(315, 248); - this.modulationSpectrumPanel.TabIndex = 8; - // - // lowFreqTextBox - // - this.lowFreqTextBox.Location = new System.Drawing.Point(105, 78); - this.lowFreqTextBox.Name = "lowFreqTextBox"; - this.lowFreqTextBox.Size = new System.Drawing.Size(70, 22); - this.lowFreqTextBox.TabIndex = 10; - this.lowFreqTextBox.Text = "200"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(13, 82); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(62, 17); - this.label3.TabIndex = 9; - this.label3.Text = "LowFreq"; - // - // highFreqTextBox - // - this.highFreqTextBox.Location = new System.Drawing.Point(105, 107); - this.highFreqTextBox.Name = "highFreqTextBox"; - this.highFreqTextBox.Size = new System.Drawing.Size(70, 22); - this.highFreqTextBox.TabIndex = 12; - this.highFreqTextBox.Text = "3800"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(13, 110); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(66, 17); - this.label4.TabIndex = 11; - this.label4.Text = "HighFreq"; - // - // samplingRateTextBox - // - this.samplingRateTextBox.Location = new System.Drawing.Point(282, 106); - this.samplingRateTextBox.Name = "samplingRateTextBox"; - this.samplingRateTextBox.Size = new System.Drawing.Size(70, 22); - this.samplingRateTextBox.TabIndex = 16; - this.samplingRateTextBox.Text = "16000"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(181, 109); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(95, 17); - this.label5.TabIndex = 15; - this.label5.Text = "Sampling rate"; - // - // fftSizeTextBox - // - this.fftSizeTextBox.Location = new System.Drawing.Point(282, 78); - this.fftSizeTextBox.Name = "fftSizeTextBox"; - this.fftSizeTextBox.Size = new System.Drawing.Size(70, 22); - this.fftSizeTextBox.TabIndex = 14; - this.fftSizeTextBox.Text = "512"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(181, 82); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(62, 17); - this.label6.TabIndex = 13; - this.label6.Text = "FFT size"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.computeButton); - this.groupBox1.Controls.Add(this.longTermHopSizeTextBox); - this.groupBox1.Controls.Add(this.label9); - this.groupBox1.Controls.Add(this.longTermFftSizeTextBox); - this.groupBox1.Controls.Add(this.label10); - this.groupBox1.Controls.Add(this.hopSizeTextBox); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.analysisFftTextBox); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.ForeColor = System.Drawing.Color.MidnightBlue; - this.groupBox1.Location = new System.Drawing.Point(621, 60); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(238, 253); - this.groupBox1.TabIndex = 28; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Extractor parameters"; - // - // computeButton - // - this.computeButton.Location = new System.Drawing.Point(22, 185); - this.computeButton.Name = "computeButton"; - this.computeButton.Size = new System.Drawing.Size(193, 58); - this.computeButton.TabIndex = 36; - this.computeButton.Text = ">>"; - this.computeButton.UseVisualStyleBackColor = true; - this.computeButton.Click += new System.EventHandler(this.computeButton_Click); - // - // longTermHopSizeTextBox - // - this.longTermHopSizeTextBox.Location = new System.Drawing.Point(156, 146); - this.longTermHopSizeTextBox.Name = "longTermHopSizeTextBox"; - this.longTermHopSizeTextBox.Size = new System.Drawing.Size(59, 22); - this.longTermHopSizeTextBox.TabIndex = 35; - this.longTermHopSizeTextBox.Text = "32"; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(19, 146); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(130, 17); - this.label9.TabIndex = 34; - this.label9.Text = "Long-term hop size"; - // - // longTermFftSizeTextBox - // - this.longTermFftSizeTextBox.Location = new System.Drawing.Point(156, 111); - this.longTermFftSizeTextBox.Name = "longTermFftSizeTextBox"; - this.longTermFftSizeTextBox.Size = new System.Drawing.Size(59, 22); - this.longTermFftSizeTextBox.TabIndex = 33; - this.longTermFftSizeTextBox.Text = "64"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(19, 111); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(131, 17); - this.label10.TabIndex = 32; - this.label10.Text = "Long-term FFT size"; - // - // hopSizeTextBox - // - this.hopSizeTextBox.Location = new System.Drawing.Point(156, 76); - this.hopSizeTextBox.Name = "hopSizeTextBox"; - this.hopSizeTextBox.Size = new System.Drawing.Size(59, 22); - this.hopSizeTextBox.TabIndex = 31; - this.hopSizeTextBox.Text = "0,03125"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(19, 76); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(87, 17); - this.label7.TabIndex = 30; - this.label7.Text = "Overlap size"; - // - // analysisFftTextBox - // - this.analysisFftTextBox.Location = new System.Drawing.Point(156, 42); - this.analysisFftTextBox.Name = "analysisFftTextBox"; - this.analysisFftTextBox.Size = new System.Drawing.Size(59, 22); - this.analysisFftTextBox.TabIndex = 29; - this.analysisFftTextBox.Text = "0,0625"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(20, 42); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(86, 17); - this.label8.TabIndex = 28; - this.label8.Text = "Window size"; - // - // nextButton - // - this.nextButton.BackColor = System.Drawing.Color.Transparent; - this.nextButton.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.nextButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.nextButton.Location = new System.Drawing.Point(1142, 31); - this.nextButton.Name = "nextButton"; - this.nextButton.Size = new System.Drawing.Size(38, 34); - this.nextButton.TabIndex = 29; - this.nextButton.Text = ">"; - this.nextButton.UseVisualStyleBackColor = false; - this.nextButton.Click += new System.EventHandler(this.nextButton_Click); - // - // infoLabel - // - this.infoLabel.AutoSize = true; - this.infoLabel.Location = new System.Drawing.Point(1040, 40); - this.infoLabel.Name = "infoLabel"; - this.infoLabel.Size = new System.Drawing.Size(62, 17); - this.infoLabel.TabIndex = 30; - this.infoLabel.Text = "10x1024"; - // - // prevButton - // - this.prevButton.BackColor = System.Drawing.Color.Transparent; - this.prevButton.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.prevButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.prevButton.Location = new System.Drawing.Point(1108, 31); - this.prevButton.Name = "prevButton"; - this.prevButton.Size = new System.Drawing.Size(38, 34); - this.prevButton.TabIndex = 31; - this.prevButton.Text = "<"; - this.prevButton.UseVisualStyleBackColor = false; - this.prevButton.Click += new System.EventHandler(this.prevButton_Click); - // - // temporalCheckBox - // - this.temporalCheckBox.AutoSize = true; - this.temporalCheckBox.Location = new System.Drawing.Point(865, 38); - this.temporalCheckBox.Name = "temporalCheckBox"; - this.temporalCheckBox.Size = new System.Drawing.Size(104, 21); - this.temporalCheckBox.TabIndex = 32; - this.temporalCheckBox.Text = "time plot for"; - this.temporalCheckBox.UseVisualStyleBackColor = true; - this.temporalCheckBox.CheckedChanged += new System.EventHandler(this.temporalCheckBox_CheckedChanged); - // - // herzTextBox - // - this.herzTextBox.Location = new System.Drawing.Point(965, 38); - this.herzTextBox.Name = "herzTextBox"; - this.herzTextBox.Size = new System.Drawing.Size(27, 22); - this.herzTextBox.TabIndex = 33; - this.herzTextBox.Text = "4"; - // - // label16 - // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(994, 40); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(25, 17); - this.label16.TabIndex = 34; - this.label16.Text = "Hz"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(369, 45); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(49, 17); - this.label11.TabIndex = 36; - this.label11.Text = "Shape"; - // - // shapeComboBox - // - this.shapeComboBox.FormattingEnabled = true; - this.shapeComboBox.Items.AddRange(new object[] { - "Triangular", - "Rectangular", - "Trapezoidal", - "BiQuad"}); - this.shapeComboBox.Location = new System.Drawing.Point(443, 42); - this.shapeComboBox.Name = "shapeComboBox"; - this.shapeComboBox.Size = new System.Drawing.Size(169, 24); - this.shapeComboBox.TabIndex = 35; - this.shapeComboBox.Text = "Triangular"; - // - // overlapCheckBox - // - this.overlapCheckBox.AutoSize = true; - this.overlapCheckBox.Location = new System.Drawing.Point(283, 43); - this.overlapCheckBox.Name = "overlapCheckBox"; - this.overlapCheckBox.Size = new System.Drawing.Size(77, 21); - this.overlapCheckBox.TabIndex = 37; - this.overlapCheckBox.Text = "overlap"; - this.overlapCheckBox.UseVisualStyleBackColor = true; - // - // filterbankPanel - // - this.filterbankPanel.AutoScroll = true; - this.filterbankPanel.BackColor = System.Drawing.Color.White; - this.filterbankPanel.Gain = 100; - this.filterbankPanel.Groups = null; - this.filterbankPanel.Location = new System.Drawing.Point(12, 138); - this.filterbankPanel.Name = "filterbankPanel"; - this.filterbankPanel.Size = new System.Drawing.Size(600, 175); - this.filterbankPanel.Stride = 2; - this.filterbankPanel.TabIndex = 38; - // - // AmsForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1187, 701); - this.Controls.Add(this.filterbankPanel); - this.Controls.Add(this.overlapCheckBox); - this.Controls.Add(this.label11); - this.Controls.Add(this.shapeComboBox); - this.Controls.Add(this.label16); - this.Controls.Add(this.herzTextBox); - this.Controls.Add(this.temporalCheckBox); - this.Controls.Add(this.prevButton); - this.Controls.Add(this.infoLabel); - this.Controls.Add(this.nextButton); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.samplingRateTextBox); - this.Controls.Add(this.label5); - this.Controls.Add(this.fftSizeTextBox); - this.Controls.Add(this.label6); - this.Controls.Add(this.highFreqTextBox); - this.Controls.Add(this.label4); - this.Controls.Add(this.lowFreqTextBox); - this.Controls.Add(this.label3); - this.Controls.Add(this.modulationSpectrumPanel); - this.Controls.Add(this.filterbankButton); - this.Controls.Add(this.filterCountTextBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.filterbankComboBox); - this.Controls.Add(this.envelopesPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "AmsForm"; - this.Text = "AmsForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.envelopesPanel.ResumeLayout(false); - this.envelopesPanel.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.Panel envelopesPanel; - private System.Windows.Forms.ComboBox filterbankComboBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox filterCountTextBox; - private System.Windows.Forms.Button filterbankButton; - private System.Windows.Forms.Panel modulationSpectrumPanel; - private System.Windows.Forms.TextBox lowFreqTextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox highFreqTextBox; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox samplingRateTextBox; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox fftSizeTextBox; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Button computeButton; - private System.Windows.Forms.TextBox longTermHopSizeTextBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox longTermFftSizeTextBox; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.TextBox hopSizeTextBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.TextBox analysisFftTextBox; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox band4ComboBox; - private System.Windows.Forms.ComboBox band3ComboBox; - private System.Windows.Forms.ComboBox band2ComboBox; - private System.Windows.Forms.ComboBox band1ComboBox; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.Button nextButton; - private System.Windows.Forms.Label infoLabel; - private System.Windows.Forms.Button prevButton; - private System.Windows.Forms.CheckBox temporalCheckBox; - private System.Windows.Forms.TextBox herzTextBox; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.ComboBox shapeComboBox; - private System.Windows.Forms.CheckBox overlapCheckBox; - private UserControls.GroupPlot filterbankPanel; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/AmsForm.cs b/NWaves.DemoForms/AmsForm.cs deleted file mode 100644 index f04d9cc..0000000 --- a/NWaves.DemoForms/AmsForm.cs +++ /dev/null @@ -1,320 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.FeatureExtractors; -using NWaves.FeatureExtractors.Options; -using NWaves.Filters.Fda; -using NWaves.Signals; -using NWaves.Windows; -using SciColorMaps; - -namespace NWaves.DemoForms -{ - public partial class AmsForm : Form - { - private DiscreteSignal _signal; - private AmsExtractor _extractor; - - private List _features; - private int _featIndex; - - private float[][] _filterbank; - - public AmsForm() - { - InitializeComponent(); - - var filterCount = int.Parse(filterCountTextBox.Text); - band1ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band2ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band3ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band4ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band1ComboBox.Text = "1"; - band2ComboBox.Text = "2"; - band3ComboBox.Text = "3"; - band4ComboBox.Text = "4"; - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - } - - private void filterbankButton_Click(object sender, EventArgs e) - { - var filterCount = int.Parse(filterCountTextBox.Text); - var samplingRate = int.Parse(samplingRateTextBox.Text); - var fftSize = int.Parse(fftSizeTextBox.Text); - var lowFreq = float.Parse(lowFreqTextBox.Text); - var highFreq = float.Parse(highFreqTextBox.Text); - - (double, double, double)[] bands; - - switch (filterbankComboBox.Text) - { - case "Mel": - bands = FilterBanks.MelBands(filterCount, samplingRate, lowFreq, highFreq, overlapCheckBox.Checked); - break; - case "Bark": - bands = FilterBanks.BarkBands(filterCount, samplingRate, lowFreq, highFreq, overlapCheckBox.Checked); - break; - case "Critical bands": - bands = FilterBanks.CriticalBands(filterCount, samplingRate, lowFreq, highFreq); - break; - case "Octave bands": - bands = FilterBanks.OctaveBands(filterCount, samplingRate, lowFreq, highFreq, overlapCheckBox.Checked); - break; - case "ERB": - bands = null; - _filterbank = FilterBanks.Erb(filterCount, fftSize, samplingRate, lowFreq, highFreq); - - // ==================================================== - // =================== ! SQUARE ! ==================== - - //foreach (var filter in _filterbank) - //{ - // for (var j = 0; j < filter.Length; j++) - // { - // var squared = filter[j] * filter[j]; - // filter[j] = squared; - // } - //} - - // normalization coefficient (for plotting) - var scaleCoeff = (int)(1.0 / _filterbank.Max(f => f.Max())); - filterbankPanel.Gain = 100 * scaleCoeff; - - - break; - default: - bands = FilterBanks.HerzBands(filterCount, samplingRate, lowFreq, highFreq, overlapCheckBox.Checked); - break; - } - - if (bands != null) - { - switch (shapeComboBox.Text) - { - case "Triangular": - _filterbank = FilterBanks.Triangular(fftSize, samplingRate, bands); - break; - case "Trapezoidal": - _filterbank = FilterBanks.Trapezoidal(fftSize, samplingRate, bands); - break; - case "BiQuad": - _filterbank = FilterBanks.BiQuad(fftSize, samplingRate, bands); - break; - default: - _filterbank = FilterBanks.Rectangular(fftSize, samplingRate, bands); - break; - } - } - - band1ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band2ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band3ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band4ComboBox.DataSource = Enumerable.Range(1, filterCount).ToArray(); - band1ComboBox.Text = "1"; - band2ComboBox.Text = "2"; - band3ComboBox.Text = "3"; - band4ComboBox.Text = "4"; - - filterbankPanel.Groups = _filterbank; - } - - private void computeButton_Click(object sender, EventArgs e) - { - var frameDuration = double.Parse(analysisFftTextBox.Text); - var hopDuration = double.Parse(hopSizeTextBox.Text); - var modulationFftSize = int.Parse(longTermFftSizeTextBox.Text); - var modulationHopSize = int.Parse(longTermHopSizeTextBox.Text); - - // ===== test modulation spectrum for Mfcc features ===== - // - //var mfccExtractor = new MfccExtractor( - // new MfccOptions - // { - // SamplingRate = _signal.SamplingRate, - // FeatureCount = 13, - // FrameDuration = frameDuration, - // HopDuration = hopDuration - // }); - //var vectors = mfccExtractor.ComputeFrom(_signal); - ////FeaturePostProcessing.NormalizeMean(vectors); - - //var options = new AmsOptions - //{ - // SamplingRate = _signal.SamplingRate, - // FrameDuration = frameDuration, - // HopDuration = hopDuration, - // ModulationFftSize = modulationFftSize, - // ModulationHopSize = modulationHopSize, - // Featuregram = vectors - //}; - //_extractor = new AmsExtractor(options); - - - var options = new AmsOptions - { - SamplingRate = _signal.SamplingRate, - FrameDuration = frameDuration, - HopDuration = hopDuration, - ModulationFftSize = modulationFftSize, - ModulationHopSize = modulationHopSize, - FilterBank = _filterbank, - Window = WindowType.Hamming - }; - - _extractor = new AmsExtractor(options); - _features = _extractor.ComputeFrom(_signal); - - _featIndex = 0; - - infoLabel.Text = $"{_features.Count}x{_features[0].Length}"; - - DrawEnvelopes(_extractor.Envelopes); - DrawModulationSpectrum(_extractor.MakeSpectrum2D(_features[_featIndex])); - } - - private void nextButton_Click(object sender, EventArgs e) - { - if (_featIndex < _features.Count - 1) _featIndex++; - DrawModulationSpectrum(_extractor.MakeSpectrum2D(_features[_featIndex])); - } - - private void temporalCheckBox_CheckedChanged(object sender, EventArgs e) - { - if (temporalCheckBox.Checked) - { - DrawModulationSpectraHerz( - _extractor.VectorsAtHerz( - _features, float.Parse(herzTextBox.Text))); - } - else - { - DrawModulationSpectrum( - _extractor.MakeSpectrum2D(_features[_featIndex])); - } - } - - private void prevButton_Click(object sender, EventArgs e) - { - if (_featIndex > 0) _featIndex--; - DrawModulationSpectrum(_extractor.MakeSpectrum2D(_features[_featIndex])); - } - - private void bandComboBox_TextChanged(object sender, EventArgs e) - { - if (_extractor == null) - { - return; - } - - DrawEnvelopes(_extractor.Envelopes); - } - - #region drawing - - private void DrawEnvelopes(float[][] envelopes) - { - var g = envelopesPanel.CreateGraphics(); - g.Clear(Color.White); - - var xOffset = 10; - var offsets = Enumerable.Range(0, 4).Select(i => 80 + i * 80).ToArray(); - - var blackPen = new Pen(Color.Black); - var pen = new Pen(Color.Blue); - - var envNo = new [] - { - int.Parse(band1ComboBox.Text), - int.Parse(band2ComboBox.Text), - int.Parse(band3ComboBox.Text), - int.Parse(band4ComboBox.Text) - }; - - var stride = 2; - for (var i = 0; i < 4; i++) - { - var en = envNo[i] - 1; - - g.DrawLine(blackPen, xOffset, offsets[i], envelopesPanel.Width - xOffset, offsets[i]); - g.DrawLine(blackPen, xOffset, offsets[i] - 70, xOffset, offsets[i]); - - var x = stride; - for (var j = 1; j < envelopes[en].Length; j++) - { - g.DrawLine(pen, - xOffset + x - stride, (float)-envelopes[en][j - 1] * 1.5f + offsets[i], - xOffset + x, (float)-envelopes[en][j] * 1.5f + offsets[i]); - x += stride; - } - } - - pen.Dispose(); - } - - private void DrawModulationSpectrum(float[][] spectrum) - { - var minValue = spectrum.SelectMany(s => s).Min(); - var maxValue = spectrum.SelectMany(s => s).Max(); - - var cmap = new MirrorColorMap(new ColorMap("bone", minValue, maxValue)); - - var g = modulationSpectrumPanel.CreateGraphics(); - g.Clear(Color.White); - - var spectrumBitmap = new Bitmap(spectrum[0].Length, spectrum.Length); - - for (var i = 0; i < spectrum.Length; i++) - { - for (var j = 0; j < spectrum[i].Length; j++) - { - spectrumBitmap.SetPixel(j, spectrum.Length - 1 - i, cmap.GetColor(spectrum[i][j])); - } - } - - g.DrawImage(spectrumBitmap, 25, 25, modulationSpectrumPanel.Width - 25, modulationSpectrumPanel.Height - 25); - } - - private void DrawModulationSpectraHerz(List spectra) - { - var minValue = spectra.SelectMany(s => s).Min(); - var maxValue = spectra.SelectMany(s => s).Max(); - - var cmap = new ColorMap("blues", minValue, maxValue); - - var g = modulationSpectrumPanel.CreateGraphics(); - g.Clear(Color.White); - - var spectrumBitmap = new Bitmap(spectra.Count, spectra[0].Length); - - for (var i = 0; i < spectra.Count; i++) - { - for (var j = 0; j < spectra[i].Length; j++) - { - spectrumBitmap.SetPixel(i, spectra[i].Length - 1 - j, cmap.GetColor(spectra[i][j])); - } - } - - g.DrawImage(spectrumBitmap, 25, 25, modulationSpectrumPanel.Width - 25, modulationSpectrumPanel.Height - 25); - } - - #endregion - } -} diff --git a/NWaves.DemoForms/AmsForm.resx b/NWaves.DemoForms/AmsForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/AmsForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/App.config b/NWaves.DemoForms/App.config deleted file mode 100644 index 8d23437..0000000 --- a/NWaves.DemoForms/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/NWaves.DemoForms/EffectsForm.Designer.cs b/NWaves.DemoForms/EffectsForm.Designer.cs deleted file mode 100644 index 0ca7a3c..0000000 --- a/NWaves.DemoForms/EffectsForm.Designer.cs +++ /dev/null @@ -1,828 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class EffectsForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.playFilteredSignalButton = new System.Windows.Forms.Button(); - this.playSignalButton = new System.Windows.Forms.Button(); - this.label6 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.spectrogramAfterFilteringPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.spectrogramBeforeFilteringPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.stopButton = new System.Windows.Forms.Button(); - this.stopFilteredButton = new System.Windows.Forms.Button(); - this.applyEffectButton = new System.Windows.Forms.Button(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label2 = new System.Windows.Forms.Label(); - this.widthTextBox = new System.Windows.Forms.TextBox(); - this.flangerRadioButton = new System.Windows.Forms.RadioButton(); - this.label18 = new System.Windows.Forms.Label(); - this.dryTextBox = new System.Windows.Forms.TextBox(); - this.label19 = new System.Windows.Forms.Label(); - this.wetTextBox = new System.Windows.Forms.TextBox(); - this.label17 = new System.Windows.Forms.Label(); - this.label16 = new System.Windows.Forms.Label(); - this.hopSizeTextBox = new System.Windows.Forms.TextBox(); - this.winSizeTextBox = new System.Windows.Forms.TextBox(); - this.tsmComboBox = new System.Windows.Forms.ComboBox(); - this.pitchShiftCheckBox = new System.Windows.Forms.CheckBox(); - this.delayRadioButton = new System.Windows.Forms.RadioButton(); - this.label15 = new System.Windows.Forms.Label(); - this.pitchShiftTextBox = new System.Windows.Forms.TextBox(); - this.pitchShiftRadioButton = new System.Windows.Forms.RadioButton(); - this.label13 = new System.Windows.Forms.Label(); - this.label14 = new System.Windows.Forms.Label(); - this.lfoQTextBox = new System.Windows.Forms.TextBox(); - this.lfoFreqTextBox = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.maxFreqTextBox = new System.Windows.Forms.TextBox(); - this.minFreqTextBox = new System.Windows.Forms.TextBox(); - this.phaserRadioButton = new System.Windows.Forms.RadioButton(); - this.label9 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.tremoloDepthTextBox = new System.Windows.Forms.TextBox(); - this.tremoloFrequencyTextBox = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.echoDecayTextBox = new System.Windows.Forms.TextBox(); - this.echoDelayTextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.distTextBox = new System.Windows.Forms.TextBox(); - this.qTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.distortionGainTextBox = new System.Windows.Forms.TextBox(); - this.wahwahRadioButton = new System.Windows.Forms.RadioButton(); - this.echoRadioButton = new System.Windows.Forms.RadioButton(); - this.tubeDistortionRadioButton = new System.Windows.Forms.RadioButton(); - this.distortionRadioButton = new System.Windows.Forms.RadioButton(); - this.overdriveRadioButton = new System.Windows.Forms.RadioButton(); - this.tremoloRadioButton = new System.Windows.Forms.RadioButton(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.signalAfterFilteringPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.signalBeforeFilteringPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.groupBox1.SuspendLayout(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // playFilteredSignalButton - // - this.playFilteredSignalButton.Location = new System.Drawing.Point(831, 291); - this.playFilteredSignalButton.Name = "playFilteredSignalButton"; - this.playFilteredSignalButton.Size = new System.Drawing.Size(59, 26); - this.playFilteredSignalButton.TabIndex = 27; - this.playFilteredSignalButton.Text = "Play"; - this.playFilteredSignalButton.UseVisualStyleBackColor = true; - this.playFilteredSignalButton.Click += new System.EventHandler(this.playFilteredSignalButton_Click); - // - // playSignalButton - // - this.playSignalButton.Location = new System.Drawing.Point(347, 291); - this.playSignalButton.Name = "playSignalButton"; - this.playSignalButton.Size = new System.Drawing.Size(59, 26); - this.playSignalButton.TabIndex = 26; - this.playSignalButton.Text = "Play"; - this.playSignalButton.UseVisualStyleBackColor = true; - this.playSignalButton.Click += new System.EventHandler(this.playSignalButton_Click); - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(477, 296); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(77, 17); - this.label6.TabIndex = 25; - this.label6.Text = "After effect"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 296); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(89, 17); - this.label5.TabIndex = 24; - this.label5.Text = "Before effect"; - // - // spectrogramAfterFilteringPanel - // - this.spectrogramAfterFilteringPanel.AutoScroll = true; - this.spectrogramAfterFilteringPanel.BackColor = System.Drawing.Color.White; - this.spectrogramAfterFilteringPanel.ColorMapName = "magma"; - this.spectrogramAfterFilteringPanel.Location = new System.Drawing.Point(480, 476); - this.spectrogramAfterFilteringPanel.Markline = null; - this.spectrogramAfterFilteringPanel.MarklineThickness = 0; - this.spectrogramAfterFilteringPanel.Name = "spectrogramAfterFilteringPanel"; - this.spectrogramAfterFilteringPanel.Size = new System.Drawing.Size(475, 152); - this.spectrogramAfterFilteringPanel.Spectrogram = null; - this.spectrogramAfterFilteringPanel.TabIndex = 23; - // - // spectrogramBeforeFilteringPanel - // - this.spectrogramBeforeFilteringPanel.AutoScroll = true; - this.spectrogramBeforeFilteringPanel.BackColor = System.Drawing.Color.White; - this.spectrogramBeforeFilteringPanel.ColorMapName = "magma"; - this.spectrogramBeforeFilteringPanel.Location = new System.Drawing.Point(13, 475); - this.spectrogramBeforeFilteringPanel.Markline = null; - this.spectrogramBeforeFilteringPanel.MarklineThickness = 0; - this.spectrogramBeforeFilteringPanel.Name = "spectrogramBeforeFilteringPanel"; - this.spectrogramBeforeFilteringPanel.Size = new System.Drawing.Size(461, 153); - this.spectrogramBeforeFilteringPanel.Spectrogram = null; - this.spectrogramBeforeFilteringPanel.TabIndex = 22; - // - // stopButton - // - this.stopButton.Location = new System.Drawing.Point(412, 291); - this.stopButton.Name = "stopButton"; - this.stopButton.Size = new System.Drawing.Size(59, 26); - this.stopButton.TabIndex = 28; - this.stopButton.Text = "Stop"; - this.stopButton.UseVisualStyleBackColor = true; - this.stopButton.Click += new System.EventHandler(this.stopButton_Click); - // - // stopFilteredButton - // - this.stopFilteredButton.Location = new System.Drawing.Point(896, 291); - this.stopFilteredButton.Name = "stopFilteredButton"; - this.stopFilteredButton.Size = new System.Drawing.Size(59, 26); - this.stopFilteredButton.TabIndex = 29; - this.stopFilteredButton.Text = "Stop"; - this.stopFilteredButton.UseVisualStyleBackColor = true; - this.stopFilteredButton.Click += new System.EventHandler(this.stopButton_Click); - // - // applyEffectButton - // - this.applyEffectButton.Location = new System.Drawing.Point(15, 247); - this.applyEffectButton.Name = "applyEffectButton"; - this.applyEffectButton.Size = new System.Drawing.Size(940, 38); - this.applyEffectButton.TabIndex = 30; - this.applyEffectButton.Text = "Apply!"; - this.applyEffectButton.UseVisualStyleBackColor = true; - this.applyEffectButton.Click += new System.EventHandler(this.applyEffectButton_Click); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.widthTextBox); - this.groupBox1.Controls.Add(this.flangerRadioButton); - this.groupBox1.Controls.Add(this.label18); - this.groupBox1.Controls.Add(this.dryTextBox); - this.groupBox1.Controls.Add(this.label19); - this.groupBox1.Controls.Add(this.wetTextBox); - this.groupBox1.Controls.Add(this.label17); - this.groupBox1.Controls.Add(this.label16); - this.groupBox1.Controls.Add(this.hopSizeTextBox); - this.groupBox1.Controls.Add(this.winSizeTextBox); - this.groupBox1.Controls.Add(this.tsmComboBox); - this.groupBox1.Controls.Add(this.pitchShiftCheckBox); - this.groupBox1.Controls.Add(this.delayRadioButton); - this.groupBox1.Controls.Add(this.label15); - this.groupBox1.Controls.Add(this.pitchShiftTextBox); - this.groupBox1.Controls.Add(this.pitchShiftRadioButton); - this.groupBox1.Controls.Add(this.label13); - this.groupBox1.Controls.Add(this.label14); - this.groupBox1.Controls.Add(this.lfoQTextBox); - this.groupBox1.Controls.Add(this.lfoFreqTextBox); - this.groupBox1.Controls.Add(this.label11); - this.groupBox1.Controls.Add(this.label12); - this.groupBox1.Controls.Add(this.maxFreqTextBox); - this.groupBox1.Controls.Add(this.minFreqTextBox); - this.groupBox1.Controls.Add(this.phaserRadioButton); - this.groupBox1.Controls.Add(this.label9); - this.groupBox1.Controls.Add(this.label10); - this.groupBox1.Controls.Add(this.tremoloDepthTextBox); - this.groupBox1.Controls.Add(this.tremoloFrequencyTextBox); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.label8); - this.groupBox1.Controls.Add(this.echoDecayTextBox); - this.groupBox1.Controls.Add(this.echoDelayTextBox); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.distTextBox); - this.groupBox1.Controls.Add(this.qTextBox); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.distortionGainTextBox); - this.groupBox1.Controls.Add(this.wahwahRadioButton); - this.groupBox1.Controls.Add(this.echoRadioButton); - this.groupBox1.Controls.Add(this.tubeDistortionRadioButton); - this.groupBox1.Controls.Add(this.distortionRadioButton); - this.groupBox1.Controls.Add(this.overdriveRadioButton); - this.groupBox1.Controls.Add(this.tremoloRadioButton); - this.groupBox1.Location = new System.Drawing.Point(13, 31); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(942, 210); - this.groupBox1.TabIndex = 31; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Sound Effects"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(597, 95); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(44, 17); - this.label2.TabIndex = 47; - this.label2.Text = "Width"; - // - // widthTextBox - // - this.widthTextBox.Location = new System.Drawing.Point(647, 93); - this.widthTextBox.Name = "widthTextBox"; - this.widthTextBox.Size = new System.Drawing.Size(41, 22); - this.widthTextBox.TabIndex = 46; - this.widthTextBox.Text = "0,003"; - // - // flangerRadioButton - // - this.flangerRadioButton.AutoSize = true; - this.flangerRadioButton.Location = new System.Drawing.Point(387, 90); - this.flangerRadioButton.Name = "flangerRadioButton"; - this.flangerRadioButton.Size = new System.Drawing.Size(77, 21); - this.flangerRadioButton.TabIndex = 45; - this.flangerRadioButton.Text = "Flanger"; - this.flangerRadioButton.UseVisualStyleBackColor = true; - // - // label18 - // - this.label18.AutoSize = true; - this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.label18.Location = new System.Drawing.Point(835, 56); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(42, 25); - this.label18.TabIndex = 44; - this.label18.Text = "Dry"; - // - // dryTextBox - // - this.dryTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.dryTextBox.Location = new System.Drawing.Point(883, 56); - this.dryTextBox.Name = "dryTextBox"; - this.dryTextBox.Size = new System.Drawing.Size(49, 30); - this.dryTextBox.TabIndex = 43; - this.dryTextBox.Text = "0,2"; - this.dryTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label19 - // - this.label19.AutoSize = true; - this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.label19.Location = new System.Drawing.Point(827, 19); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(48, 25); - this.label19.TabIndex = 42; - this.label19.Text = "Wet"; - // - // wetTextBox - // - this.wetTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.wetTextBox.Location = new System.Drawing.Point(883, 19); - this.wetTextBox.Name = "wetTextBox"; - this.wetTextBox.Size = new System.Drawing.Size(49, 30); - this.wetTextBox.TabIndex = 41; - this.wetTextBox.Text = "0,8"; - this.wetTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(851, 174); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(34, 17); - this.label17.TabIndex = 40; - this.label17.Text = "Hop"; - // - // label16 - // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(766, 174); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(32, 17); - this.label16.TabIndex = 39; - this.label16.Text = "Win"; - // - // hopSizeTextBox - // - this.hopSizeTextBox.Location = new System.Drawing.Point(891, 172); - this.hopSizeTextBox.Name = "hopSizeTextBox"; - this.hopSizeTextBox.Size = new System.Drawing.Size(41, 22); - this.hopSizeTextBox.TabIndex = 38; - this.hopSizeTextBox.Text = "128"; - // - // winSizeTextBox - // - this.winSizeTextBox.Location = new System.Drawing.Point(804, 172); - this.winSizeTextBox.Name = "winSizeTextBox"; - this.winSizeTextBox.Size = new System.Drawing.Size(41, 22); - this.winSizeTextBox.TabIndex = 37; - this.winSizeTextBox.Text = "512"; - // - // tsmComboBox - // - this.tsmComboBox.FormattingEnabled = true; - this.tsmComboBox.Items.AddRange(new object[] { - "Phase Vocoder", - "Phase Vocoder (Phase Locking)", - "WSOLA", - "Paul stretch"}); - this.tsmComboBox.Location = new System.Drawing.Point(687, 142); - this.tsmComboBox.Name = "tsmComboBox"; - this.tsmComboBox.Size = new System.Drawing.Size(245, 24); - this.tsmComboBox.TabIndex = 36; - this.tsmComboBox.Text = "Phase Vocoder"; - // - // pitchShiftCheckBox - // - this.pitchShiftCheckBox.AutoSize = true; - this.pitchShiftCheckBox.Location = new System.Drawing.Point(583, 159); - this.pitchShiftCheckBox.Name = "pitchShiftCheckBox"; - this.pitchShiftCheckBox.Size = new System.Drawing.Size(91, 21); - this.pitchShiftCheckBox.TabIndex = 35; - this.pitchShiftCheckBox.Text = "Pitch shift"; - this.pitchShiftCheckBox.UseVisualStyleBackColor = true; - // - // delayRadioButton - // - this.delayRadioButton.AutoSize = true; - this.delayRadioButton.Location = new System.Drawing.Point(7, 172); - this.delayRadioButton.Name = "delayRadioButton"; - this.delayRadioButton.Size = new System.Drawing.Size(65, 21); - this.delayRadioButton.TabIndex = 34; - this.delayRadioButton.Text = "Delay"; - this.delayRadioButton.UseVisualStyleBackColor = true; - // - // label15 - // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(493, 163); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(23, 17); - this.label15.TabIndex = 33; - this.label15.Text = "by"; - // - // pitchShiftTextBox - // - this.pitchShiftTextBox.Location = new System.Drawing.Point(530, 158); - this.pitchShiftTextBox.Name = "pitchShiftTextBox"; - this.pitchShiftTextBox.Size = new System.Drawing.Size(41, 22); - this.pitchShiftTextBox.TabIndex = 32; - this.pitchShiftTextBox.Text = "1,2"; - // - // pitchShiftRadioButton - // - this.pitchShiftRadioButton.AutoSize = true; - this.pitchShiftRadioButton.Location = new System.Drawing.Point(387, 161); - this.pitchShiftRadioButton.Name = "pitchShiftRadioButton"; - this.pitchShiftRadioButton.Size = new System.Drawing.Size(107, 21); - this.pitchShiftRadioButton.TabIndex = 31; - this.pitchShiftRadioButton.Text = "Time stretch"; - this.pitchShiftRadioButton.UseVisualStyleBackColor = true; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(598, 68); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(19, 17); - this.label13.TabIndex = 30; - this.label13.Text = "Q"; - // - // label14 - // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(486, 68); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(37, 17); - this.label14.TabIndex = 29; - this.label14.Text = "Freq"; - // - // lfoQTextBox - // - this.lfoQTextBox.Location = new System.Drawing.Point(647, 65); - this.lfoQTextBox.Name = "lfoQTextBox"; - this.lfoQTextBox.Size = new System.Drawing.Size(41, 22); - this.lfoQTextBox.TabIndex = 28; - this.lfoQTextBox.Text = "0,5"; - // - // lfoFreqTextBox - // - this.lfoFreqTextBox.Location = new System.Drawing.Point(530, 65); - this.lfoFreqTextBox.Name = "lfoFreqTextBox"; - this.lfoFreqTextBox.Size = new System.Drawing.Size(54, 22); - this.lfoFreqTextBox.TabIndex = 27; - this.lfoFreqTextBox.Text = "1,2"; - // - // label11 - // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(598, 40); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(33, 17); - this.label11.TabIndex = 26; - this.label11.Text = "Max"; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(486, 40); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(30, 17); - this.label12.TabIndex = 25; - this.label12.Text = "Min"; - // - // maxFreqTextBox - // - this.maxFreqTextBox.Location = new System.Drawing.Point(647, 37); - this.maxFreqTextBox.Name = "maxFreqTextBox"; - this.maxFreqTextBox.Size = new System.Drawing.Size(41, 22); - this.maxFreqTextBox.TabIndex = 24; - this.maxFreqTextBox.Text = "2000"; - // - // minFreqTextBox - // - this.minFreqTextBox.Location = new System.Drawing.Point(530, 37); - this.minFreqTextBox.Name = "minFreqTextBox"; - this.minFreqTextBox.Size = new System.Drawing.Size(54, 22); - this.minFreqTextBox.TabIndex = 23; - this.minFreqTextBox.Text = "300"; - // - // phaserRadioButton - // - this.phaserRadioButton.AutoSize = true; - this.phaserRadioButton.Location = new System.Drawing.Point(387, 38); - this.phaserRadioButton.Name = "phaserRadioButton"; - this.phaserRadioButton.Size = new System.Drawing.Size(74, 21); - this.phaserRadioButton.TabIndex = 22; - this.phaserRadioButton.Text = "Phaser"; - this.phaserRadioButton.UseVisualStyleBackColor = true; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(257, 40); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(41, 17); - this.label9.TabIndex = 21; - this.label9.Text = "Index"; - // - // label10 - // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(145, 40); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(37, 17); - this.label10.TabIndex = 20; - this.label10.Text = "Freq"; - // - // tremoloDepthTextBox - // - this.tremoloDepthTextBox.Location = new System.Drawing.Point(306, 37); - this.tremoloDepthTextBox.Name = "tremoloDepthTextBox"; - this.tremoloDepthTextBox.Size = new System.Drawing.Size(41, 22); - this.tremoloDepthTextBox.TabIndex = 19; - this.tremoloDepthTextBox.Text = "0,5"; - // - // tremoloFrequencyTextBox - // - this.tremoloFrequencyTextBox.Location = new System.Drawing.Point(189, 37); - this.tremoloFrequencyTextBox.Name = "tremoloFrequencyTextBox"; - this.tremoloFrequencyTextBox.Size = new System.Drawing.Size(54, 22); - this.tremoloFrequencyTextBox.TabIndex = 18; - this.tremoloFrequencyTextBox.Text = "10"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(256, 163); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(48, 17); - this.label7.TabIndex = 17; - this.label7.Text = "Decay"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(145, 163); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(44, 17); - this.label8.TabIndex = 16; - this.label8.Text = "Delay"; - // - // echoDecayTextBox - // - this.echoDecayTextBox.Location = new System.Drawing.Point(306, 160); - this.echoDecayTextBox.Name = "echoDecayTextBox"; - this.echoDecayTextBox.Size = new System.Drawing.Size(41, 22); - this.echoDecayTextBox.TabIndex = 15; - this.echoDecayTextBox.Text = "0,5"; - // - // echoDelayTextBox - // - this.echoDelayTextBox.Location = new System.Drawing.Point(189, 160); - this.echoDelayTextBox.Name = "echoDelayTextBox"; - this.echoDelayTextBox.Size = new System.Drawing.Size(54, 22); - this.echoDelayTextBox.TabIndex = 14; - this.echoDelayTextBox.Text = "0,18"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(257, 121); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(32, 17); - this.label3.TabIndex = 13; - this.label3.Text = "Dist"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(145, 121); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(19, 17); - this.label4.TabIndex = 12; - this.label4.Text = "Q"; - // - // distTextBox - // - this.distTextBox.Location = new System.Drawing.Point(306, 118); - this.distTextBox.Name = "distTextBox"; - this.distTextBox.Size = new System.Drawing.Size(41, 22); - this.distTextBox.TabIndex = 11; - this.distTextBox.Text = "5"; - // - // qTextBox - // - this.qTextBox.Location = new System.Drawing.Point(189, 118); - this.qTextBox.Name = "qTextBox"; - this.qTextBox.Size = new System.Drawing.Size(54, 22); - this.qTextBox.TabIndex = 10; - this.qTextBox.Text = "-0,2"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(145, 94); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(38, 17); - this.label1.TabIndex = 8; - this.label1.Text = "Gain"; - // - // distortionGainTextBox - // - this.distortionGainTextBox.Location = new System.Drawing.Point(189, 91); - this.distortionGainTextBox.Name = "distortionGainTextBox"; - this.distortionGainTextBox.Size = new System.Drawing.Size(54, 22); - this.distortionGainTextBox.TabIndex = 6; - this.distortionGainTextBox.Text = "20"; - // - // wahwahRadioButton - // - this.wahwahRadioButton.AutoSize = true; - this.wahwahRadioButton.Location = new System.Drawing.Point(387, 64); - this.wahwahRadioButton.Name = "wahwahRadioButton"; - this.wahwahRadioButton.Size = new System.Drawing.Size(87, 21); - this.wahwahRadioButton.TabIndex = 5; - this.wahwahRadioButton.Text = "WahWah"; - this.wahwahRadioButton.UseVisualStyleBackColor = true; - // - // echoRadioButton - // - this.echoRadioButton.AutoSize = true; - this.echoRadioButton.Location = new System.Drawing.Point(7, 145); - this.echoRadioButton.Name = "echoRadioButton"; - this.echoRadioButton.Size = new System.Drawing.Size(61, 21); - this.echoRadioButton.TabIndex = 4; - this.echoRadioButton.Text = "Echo"; - this.echoRadioButton.UseVisualStyleBackColor = true; - // - // tubeDistortionRadioButton - // - this.tubeDistortionRadioButton.AutoSize = true; - this.tubeDistortionRadioButton.Location = new System.Drawing.Point(7, 118); - this.tubeDistortionRadioButton.Name = "tubeDistortionRadioButton"; - this.tubeDistortionRadioButton.Size = new System.Drawing.Size(126, 21); - this.tubeDistortionRadioButton.TabIndex = 3; - this.tubeDistortionRadioButton.Text = "Tube Distortion"; - this.tubeDistortionRadioButton.UseVisualStyleBackColor = true; - // - // distortionRadioButton - // - this.distortionRadioButton.AutoSize = true; - this.distortionRadioButton.Location = new System.Drawing.Point(7, 91); - this.distortionRadioButton.Name = "distortionRadioButton"; - this.distortionRadioButton.Size = new System.Drawing.Size(89, 21); - this.distortionRadioButton.TabIndex = 2; - this.distortionRadioButton.Text = "Distortion"; - this.distortionRadioButton.UseVisualStyleBackColor = true; - // - // overdriveRadioButton - // - this.overdriveRadioButton.AutoSize = true; - this.overdriveRadioButton.Location = new System.Drawing.Point(7, 64); - this.overdriveRadioButton.Name = "overdriveRadioButton"; - this.overdriveRadioButton.Size = new System.Drawing.Size(91, 21); - this.overdriveRadioButton.TabIndex = 1; - this.overdriveRadioButton.Text = "Overdrive"; - this.overdriveRadioButton.UseVisualStyleBackColor = true; - // - // tremoloRadioButton - // - this.tremoloRadioButton.AutoSize = true; - this.tremoloRadioButton.Checked = true; - this.tremoloRadioButton.Location = new System.Drawing.Point(7, 37); - this.tremoloRadioButton.Name = "tremoloRadioButton"; - this.tremoloRadioButton.Size = new System.Drawing.Size(81, 21); - this.tremoloRadioButton.TabIndex = 0; - this.tremoloRadioButton.TabStop = true; - this.tremoloRadioButton.Text = "Tremolo"; - this.tremoloRadioButton.UseVisualStyleBackColor = true; - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(970, 28); - this.menuStrip1.TabIndex = 32; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem, - this.saveAsToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // saveAsToolStripMenuItem - // - this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 26); - this.saveAsToolStripMenuItem.Text = "&Save As..."; - this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); - // - // signalAfterFilteringPanel - // - this.signalAfterFilteringPanel.AutoScroll = true; - this.signalAfterFilteringPanel.BackColor = System.Drawing.Color.White; - this.signalAfterFilteringPanel.ForeColor = System.Drawing.Color.Blue; - this.signalAfterFilteringPanel.Gain = 1F; - this.signalAfterFilteringPanel.Location = new System.Drawing.Point(480, 316); - this.signalAfterFilteringPanel.Name = "signalAfterFilteringPanel"; - this.signalAfterFilteringPanel.PaddingX = 24; - this.signalAfterFilteringPanel.PaddingY = 5; - this.signalAfterFilteringPanel.Signal = null; - this.signalAfterFilteringPanel.Size = new System.Drawing.Size(475, 153); - this.signalAfterFilteringPanel.Stride = 256; - this.signalAfterFilteringPanel.TabIndex = 21; - // - // signalBeforeFilteringPanel - // - this.signalBeforeFilteringPanel.AutoScroll = true; - this.signalBeforeFilteringPanel.BackColor = System.Drawing.Color.White; - this.signalBeforeFilteringPanel.ForeColor = System.Drawing.Color.Blue; - this.signalBeforeFilteringPanel.Gain = 1F; - this.signalBeforeFilteringPanel.Location = new System.Drawing.Point(13, 316); - this.signalBeforeFilteringPanel.Name = "signalBeforeFilteringPanel"; - this.signalBeforeFilteringPanel.PaddingX = 24; - this.signalBeforeFilteringPanel.PaddingY = 5; - this.signalBeforeFilteringPanel.Signal = null; - this.signalBeforeFilteringPanel.Size = new System.Drawing.Size(461, 153); - this.signalBeforeFilteringPanel.Stride = 256; - this.signalBeforeFilteringPanel.TabIndex = 20; - // - // EffectsForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(970, 640); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.applyEffectButton); - this.Controls.Add(this.stopFilteredButton); - this.Controls.Add(this.stopButton); - this.Controls.Add(this.playFilteredSignalButton); - this.Controls.Add(this.playSignalButton); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.spectrogramAfterFilteringPanel); - this.Controls.Add(this.signalAfterFilteringPanel); - this.Controls.Add(this.spectrogramBeforeFilteringPanel); - this.Controls.Add(this.signalBeforeFilteringPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "EffectsForm"; - this.Text = "EffectsForm"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button playFilteredSignalButton; - private System.Windows.Forms.Button playSignalButton; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label5; - private SpectrogramPlot spectrogramAfterFilteringPanel; - private SpectrogramPlot spectrogramBeforeFilteringPanel; - private System.Windows.Forms.Button stopButton; - private System.Windows.Forms.Button stopFilteredButton; - private System.Windows.Forms.Button applyEffectButton; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.RadioButton wahwahRadioButton; - private System.Windows.Forms.RadioButton echoRadioButton; - private System.Windows.Forms.RadioButton tubeDistortionRadioButton; - private System.Windows.Forms.RadioButton distortionRadioButton; - private System.Windows.Forms.RadioButton overdriveRadioButton; - private System.Windows.Forms.RadioButton tremoloRadioButton; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox distortionGainTextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox distTextBox; - private System.Windows.Forms.TextBox qTextBox; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.TextBox tremoloDepthTextBox; - private System.Windows.Forms.TextBox tremoloFrequencyTextBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox echoDecayTextBox; - private System.Windows.Forms.TextBox echoDelayTextBox; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.TextBox lfoQTextBox; - private System.Windows.Forms.TextBox lfoFreqTextBox; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.TextBox maxFreqTextBox; - private System.Windows.Forms.TextBox minFreqTextBox; - private System.Windows.Forms.RadioButton phaserRadioButton; - private System.Windows.Forms.RadioButton delayRadioButton; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.TextBox pitchShiftTextBox; - private System.Windows.Forms.RadioButton pitchShiftRadioButton; - private System.Windows.Forms.CheckBox pitchShiftCheckBox; - private SignalPlot signalAfterFilteringPanel; - private SignalPlot signalBeforeFilteringPanel; - private System.Windows.Forms.ComboBox tsmComboBox; - private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.TextBox hopSizeTextBox; - private System.Windows.Forms.TextBox winSizeTextBox; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.TextBox dryTextBox; - private System.Windows.Forms.Label label19; - private System.Windows.Forms.TextBox wetTextBox; - private System.Windows.Forms.RadioButton flangerRadioButton; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox widthTextBox; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/EffectsForm.cs b/NWaves.DemoForms/EffectsForm.cs deleted file mode 100644 index 6a39114..0000000 --- a/NWaves.DemoForms/EffectsForm.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.Effects; -using NWaves.Effects.Base; -using NWaves.Filters.Base; -using NWaves.Operations; -using NWaves.Operations.Tsm; -using NWaves.Signals; -using NWaves.Signals.Builders; -using NWaves.Transforms; - -namespace NWaves.DemoForms -{ - public partial class EffectsForm : Form - { - private DiscreteSignal _signal; - private DiscreteSignal _filteredSignal; - - private readonly Stft _stft = new Stft(256, fftSize: 256); - - private string _waveFileName; - private short _bitDepth; - - private readonly MemoryStreamPlayer _player = new MemoryStreamPlayer(); - - - public EffectsForm() - { - InitializeComponent(); - - signalBeforeFilteringPanel.Gain = 80; - signalAfterFilteringPanel.Gain = 80; - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - _waveFileName = ofd.FileName; - - using (var stream = new FileStream(_waveFileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _signal = waveFile[Channels.Average]; - } - - signalBeforeFilteringPanel.Signal = _signal; - spectrogramBeforeFilteringPanel.Spectrogram = _stft.Spectrogram(_signal); - } - - private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) - { - var sfd = new SaveFileDialog(); - if (sfd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(sfd.FileName, FileMode.Create)) - { - var waveFile = new WaveFile(_filteredSignal, _bitDepth); - waveFile.SaveTo(stream); - } - } - - private void applyEffectButton_Click(object sender, EventArgs e) - { - AudioEffect effect; - - var fs = _signal.SamplingRate; - - var winSize = int.Parse(winSizeTextBox.Text); - var hopSize = int.Parse(hopSizeTextBox.Text); - var tsm = (TsmAlgorithm)tsmComboBox.SelectedIndex; - - var shift = float.Parse(pitchShiftTextBox.Text); - - if (tremoloRadioButton.Checked) - { - var freq = float.Parse(tremoloFrequencyTextBox.Text); - var depth = float.Parse(tremoloDepthTextBox.Text); - effect = new TremoloEffect(fs, depth, freq); - } - else if (overdriveRadioButton.Checked) - { - var gain = float.Parse(distortionGainTextBox.Text); - effect = new DistortionEffect(DistortionMode.SoftClipping, gain, -12); - } - else if (distortionRadioButton.Checked) - { - var gain = float.Parse(distortionGainTextBox.Text); - effect = new DistortionEffect(DistortionMode.Exponential, gain, -12); - } - else if (tubeDistortionRadioButton.Checked) - { - var gain = float.Parse(distortionGainTextBox.Text); - var dist = float.Parse(distTextBox.Text); - var q = float.Parse(qTextBox.Text); - effect = new TubeDistortionEffect(gain, -12, q, dist); - } - else if (echoRadioButton.Checked) - { - var delay = float.Parse(echoDelayTextBox.Text); - var decay = float.Parse(echoDecayTextBox.Text); - effect = new EchoEffect(fs, delay, decay); - } - else if (delayRadioButton.Checked) - { - var delay = float.Parse(echoDelayTextBox.Text); - var decay = float.Parse(echoDecayTextBox.Text); - effect = new DelayEffect(fs, delay, decay); - } - else if (wahwahRadioButton.Checked) - { - var lfoFrequency = float.Parse(lfoFreqTextBox.Text); - var minFrequency = float.Parse(minFreqTextBox.Text); - var maxFrequency = float.Parse(maxFreqTextBox.Text); - var q = float.Parse(lfoQTextBox.Text); - effect = new WahwahEffect(fs, lfoFrequency, minFrequency, maxFrequency, q); - //effect = new AutowahEffect(fs, minFrequency, maxFrequency, q); - } - else if (flangerRadioButton.Checked) - { - var lfoFrequency = float.Parse(lfoFreqTextBox.Text); - var width = float.Parse(widthTextBox.Text); - effect = new FlangerEffect(fs, lfoFrequency, width);//, 0.7f, 0.5f); - //effect = new VibratoEffect(fs, lfoFrequency, width); - //effect = new ChorusEffect(fs, new[] { 1f, 1f, 1f, 1f }, new[] { 0.004f, 0.0042f, 0.0045f, 0.0038f }); - } - else if (pitchShiftRadioButton.Checked) - { - //effect = pitchShiftCheckBox.Checked ? new PitchShiftVocoderEffect(fs, shift, winSize, hopSize) : null; - effect = pitchShiftCheckBox.Checked ? new PitchShiftEffect(shift, winSize, hopSize, tsm) : null; - //effect = pitchShiftCheckBox.Checked ? new WhisperEffect(hopSize, winSize) : null; - //effect = new MorphEffect(hopSize, winSize); - } - else - { - var lfoFrequency = float.Parse(lfoFreqTextBox.Text); - var minFrequency = float.Parse(minFreqTextBox.Text); - var maxFrequency = float.Parse(maxFreqTextBox.Text); - var q = float.Parse(lfoQTextBox.Text); - - var lfo = new SawtoothBuilder() - .SetParameter("freq", lfoFrequency) - .SetParameter("min", minFrequency) - .SetParameter("max", maxFrequency) - .SampledAt(_signal.SamplingRate); - - effect = new PhaserEffect(fs, lfo, q); - } - - if (effect != null) - { - effect.Wet = float.Parse(wetTextBox.Text); - effect.Dry = float.Parse(dryTextBox.Text); - - _filteredSignal = effect.ApplyTo(_signal, FilteringMethod.Auto); - - - //DiscreteSignal morph; - //using (var stream = new FileStream(@"D:\Docs\Research\DATABASE\Dictor1\wav\21.wav", FileMode.Open)) - //{ - // var waveFile = new WaveFile(stream); - // morph = waveFile[Channels.Average]; - //} - - //if (morph.SamplingRate != _signal.SamplingRate) - //{ - // morph = Operation.Resample(morph, _signal.SamplingRate); - //} - - //var eff = new MorphEffect(hopSize /*50*/, winSize/*256*/) - //{ - // Wet = effect.Wet, - // Dry = effect.Dry - //}; - - //_filteredSignal = eff.ApplyTo(_signal, morph); - } - else - { - _filteredSignal = //Operation.TimeStretch(_signal, shift, tsm); - Operation.TimeStretch(_signal, shift, winSize, hopSize, tsm); - } - - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal.Samples); - } - - #region playback - - private async void playSignalButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_waveFileName); - } - - private async void playFilteredSignalButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_filteredSignal, _bitDepth); - } - - private void stopButton_Click(object sender, EventArgs e) - { - _player.Stop(); - } - - #endregion - } -} diff --git a/NWaves.DemoForms/EffectsForm.resx b/NWaves.DemoForms/EffectsForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/EffectsForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/FeaturesForm.Designer.cs b/NWaves.DemoForms/FeaturesForm.Designer.cs deleted file mode 100644 index 549435b..0000000 --- a/NWaves.DemoForms/FeaturesForm.Designer.cs +++ /dev/null @@ -1,180 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class FeaturesForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.featuresListView = new System.Windows.Forms.ListView(); - this.spectrumPictureBox = new System.Windows.Forms.PictureBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.peaksListBox = new System.Windows.Forms.ListBox(); - this.featureLabel = new System.Windows.Forms.Label(); - this.spectrogramPlot = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.spectrumPictureBox)).BeginInit(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1183, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // featuresListView - // - this.featuresListView.FullRowSelect = true; - this.featuresListView.GridLines = true; - this.featuresListView.Location = new System.Drawing.Point(12, 37); - this.featuresListView.Name = "featuresListView"; - this.featuresListView.Size = new System.Drawing.Size(680, 319); - this.featuresListView.TabIndex = 5; - this.featuresListView.UseCompatibleStateImageBehavior = false; - this.featuresListView.View = System.Windows.Forms.View.Details; - this.featuresListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.featuresListView_ColumnClick); - this.featuresListView.SelectedIndexChanged += new System.EventHandler(this.featuresListView_SelectedIndexChanged); - // - // spectrumPictureBox - // - this.spectrumPictureBox.BackColor = System.Drawing.SystemColors.Window; - this.spectrumPictureBox.Location = new System.Drawing.Point(698, 37); - this.spectrumPictureBox.Name = "spectrumPictureBox"; - this.spectrumPictureBox.Size = new System.Drawing.Size(473, 233); - this.spectrumPictureBox.TabIndex = 6; - this.spectrumPictureBox.TabStop = false; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(557, 365); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(135, 17); - this.label1.TabIndex = 7; - this.label1.Text = "Click column header"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(886, 280); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(110, 17); - this.label2.TabIndex = 8; - this.label2.Text = "Harmonic peaks"; - // - // peaksListBox - // - this.peaksListBox.Font = new System.Drawing.Font("Courier New", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.peaksListBox.FormattingEnabled = true; - this.peaksListBox.ItemHeight = 20; - this.peaksListBox.Location = new System.Drawing.Point(698, 320); - this.peaksListBox.Name = "peaksListBox"; - this.peaksListBox.Size = new System.Drawing.Size(473, 324); - this.peaksListBox.TabIndex = 9; - // - // featureLabel - // - this.featureLabel.AutoSize = true; - this.featureLabel.Location = new System.Drawing.Point(15, 365); - this.featureLabel.Name = "featureLabel"; - this.featureLabel.Size = new System.Drawing.Size(0, 17); - this.featureLabel.TabIndex = 10; - // - // spectrogramPlot - // - this.spectrogramPlot.AutoScroll = true; - this.spectrogramPlot.BackColor = System.Drawing.Color.Black; - this.spectrogramPlot.ColorMapName = "magma"; - this.spectrogramPlot.Location = new System.Drawing.Point(12, 386); - this.spectrogramPlot.Markline = null; - this.spectrogramPlot.Name = "spectrogramPlot"; - this.spectrogramPlot.Size = new System.Drawing.Size(680, 258); - this.spectrogramPlot.Spectrogram = null; - this.spectrogramPlot.TabIndex = 11; - // - // FeaturesForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1183, 652); - this.Controls.Add(this.spectrogramPlot); - this.Controls.Add(this.featureLabel); - this.Controls.Add(this.peaksListBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.spectrumPictureBox); - this.Controls.Add(this.featuresListView); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "FeaturesForm"; - this.Text = "FeaturesForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.spectrumPictureBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.ListView featuresListView; - private System.Windows.Forms.PictureBox spectrumPictureBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ListBox peaksListBox; - private System.Windows.Forms.Label featureLabel; - private SpectrogramPlot spectrogramPlot; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/FeaturesForm.cs b/NWaves.DemoForms/FeaturesForm.cs deleted file mode 100644 index 8696e49..0000000 --- a/NWaves.DemoForms/FeaturesForm.cs +++ /dev/null @@ -1,223 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.FeatureExtractors; -using NWaves.FeatureExtractors.Base; -using NWaves.FeatureExtractors.Multi; -using NWaves.FeatureExtractors.Options; -using NWaves.Signals; -using NWaves.Features; -using System.Drawing; -using NWaves.Transforms; - -namespace NWaves.DemoForms -{ - public partial class FeaturesForm : Form - { - private DiscreteSignal _signal; - private float[][] _vectors; - - private int _frameSize = 512; - private int _hopSize = 128; - - private Stft _stft; - - public FeaturesForm() - { - InitializeComponent(); - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - - _stft = new Stft(_frameSize, _hopSize); - - var frameDuration = (double) _frameSize / _signal.SamplingRate; - var hopDuration = (double) _hopSize / _signal.SamplingRate; - - var freqs = new[] { 300f, 600, 1000, 2000, 4000, 7000 }; - - var pitchOptions = new PitchOptions - { - SamplingRate = _signal.SamplingRate, - FrameDuration = frameDuration, - HopDuration = hopDuration, - HighFrequency = 900/*Hz*/ - }; - - var pitchExtractor = new PitchExtractor(pitchOptions); - var pitchTrack = pitchExtractor.ParallelComputeFrom(_signal) - .Select(p => p[0]) - .ToArray(); - - var options = new MultiFeatureOptions - { - SamplingRate = _signal.SamplingRate, - FrameDuration = frameDuration, - HopDuration = hopDuration - }; - - var tdExtractor = new TimeDomainFeaturesExtractor(options); - tdExtractor.AddFeature("pitch_zcr", (signal, start, end) => Pitch.FromZeroCrossingsSchmitt(signal, start, end)); - - var mpeg7Extractor = new Mpeg7SpectralFeaturesExtractor(options); - mpeg7Extractor.IncludeHarmonicFeatures("all"); - mpeg7Extractor.SetPitchTrack(pitchTrack); - - options.FeatureList = "sc+sn"; - options.Frequencies = freqs; - var spectralExtractor = new SpectralFeaturesExtractor(options); - //spectralExtractor.AddFeature("pitch_hss", (spectrum, fs) => Pitch.FromHss(spectrum, _signal.SamplingRate)); - - var tdVectors = tdExtractor.ParallelComputeFrom(_signal); - var spectralVectors = spectralExtractor.ParallelComputeFrom(_signal); - var mpeg7Vectors = mpeg7Extractor.ComputeFrom(_signal); - - _vectors = FeaturePostProcessing.Join(tdVectors, spectralVectors, mpeg7Vectors); - - //FeaturePostProcessing.NormalizeMean(_vectors); - //FeaturePostProcessing.AddDeltas(_vectors); - - var descriptions = tdExtractor.FeatureDescriptions - .Concat(spectralExtractor.FeatureDescriptions) - .Concat(mpeg7Extractor.FeatureDescriptions) - .ToList(); - - FillFeaturesList(_vectors, descriptions, tdExtractor.TimeMarkers(_vectors.Length)); - - spectrogramPlot.ColorMapName = "afmhot"; - spectrogramPlot.MarklineThickness = 2; - spectrogramPlot.Spectrogram = _stft.Spectrogram(_signal); - } - - private void FillFeaturesList(IList featureVectors, - IList featureDescriptions, - IList timeMarkers) - { - featuresListView.Clear(); - featuresListView.Columns.Add("time", 50); - - foreach (var feat in featureDescriptions) - { - featuresListView.Columns.Add(feat, 70); - } - - for (var i = 0; i < featureVectors.Count; i++) - { - var item = new ListViewItem { Text = timeMarkers[i].ToString("F4") }; - item.SubItems.AddRange(featureVectors[i].Select(f => f.ToString("F4")).ToArray()); - - featuresListView.Items.Add(item); - } - } - - private void featuresListView_ColumnClick(object sender, ColumnClickEventArgs e) - { - if (e.Column == 0) - { - return; - } - - featureLabel.Text = featuresListView.Columns[e.Column].Text; - - var max = _vectors.Select(v => v[e.Column - 1]).Max(); - var min = _vectors.Select(v => v[e.Column - 1]).Min(); - - var height = spectrogramPlot.Height; - - spectrogramPlot.Markline = _vectors.Select(v => height * (v[e.Column - 1] - min) / (max - min)).ToArray(); - - //featurePlotPanel.Stride = 1; - //featurePlotPanel.Line = _vectors.Select(v => v.Features[e.Column - 1]).ToArray(); - } - - - // TODO: remove this ))) - - private void featuresListView_SelectedIndexChanged(object sender, EventArgs e) - { - if (featuresListView.SelectedItems.Count == 0) - { - return; - } - - var pos = featuresListView.SelectedIndices[0]; - - var fft = new Fft(512); - - var spectrum = fft.PowerSpectrum(_signal[pos * _hopSize, pos * _hopSize + _frameSize]).Samples; - - var peaks = new int[10]; - var freqs = new float[10]; - - - Harmonic.Peaks(spectrum, peaks, freqs, _signal.SamplingRate); - - - peaksListBox.Items.Clear(); - for (var p = 0; p < peaks.Length; p++) - { - peaksListBox.Items.Add($"peak #{p+1,-2} : {freqs[p],-7} Hz"); - } - - - _spectrumImage = new Bitmap(512, spectrumPictureBox.Height); - - var g = Graphics.FromImage(_spectrumImage); - g.Clear(Color.White); - - var pen = new Pen(ForeColor); - var redpen = new Pen(Color.Red, 2); - - var i = 1; - var Stride = 4; - var PaddingX = 5; - var PaddingY = 5; - - var x = PaddingX + Stride; - - var min = spectrum.Min(); - var max = spectrum.Max(); - - var height = _spectrumImage.Height; - var gain = max - min < 1e-6 ? 1 : (height - 2 * PaddingY) / (max - min); - - var offset = (int)(height - PaddingY + min * gain); - - for (; i < spectrum.Length; i++) - { - g.DrawLine(pen, x - Stride, -spectrum[i - 1] * gain + offset, - x, -spectrum[i ] * gain + offset); - x += Stride; - } - - for (i = 0; i < peaks.Length; i++) - { - g.DrawLine(redpen, PaddingX + peaks[i] * Stride, PaddingY + offset, - PaddingX + peaks[i] * Stride, -PaddingY - spectrum[peaks[i]] * gain + offset); - } - - pen.Dispose(); - redpen.Dispose(); - g.Dispose(); - - spectrumPictureBox.Image = _spectrumImage; - } - - Bitmap _spectrumImage; - } -} diff --git a/NWaves.DemoForms/FeaturesForm.resx b/NWaves.DemoForms/FeaturesForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/FeaturesForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/FiltersForm.Designer.cs b/NWaves.DemoForms/FiltersForm.Designer.cs deleted file mode 100644 index 35f3dbd..0000000 --- a/NWaves.DemoForms/FiltersForm.Designer.cs +++ /dev/null @@ -1,659 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class FiltersForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.filterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.autoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.overlapAddToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.overlapSaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.differenceEquationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.framebyFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resampleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.interpolateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.decimateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.customToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.resampleTextBox = new System.Windows.Forms.ToolStripTextBox(); - this.analyzeFilterButton = new System.Windows.Forms.Button(); - this.filterTypesComboBox = new System.Windows.Forms.ComboBox(); - this.filterParamsDataGrid = new System.Windows.Forms.DataGridView(); - this.Param = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.numeratorListBox = new System.Windows.Forms.ListBox(); - this.denominatorListBox = new System.Windows.Forms.ListBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.playSignalButton = new System.Windows.Forms.Button(); - this.playFilteredSignalButton = new System.Windows.Forms.Button(); - this.orderNumeratorTextBox = new System.Windows.Forms.TextBox(); - this.orderDenominatorTextBox = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.changeOrderButton = new System.Windows.Forms.Button(); - this.phaseViewComboBox = new System.Windows.Forms.ComboBox(); - this.spectrogramAfterFilteringPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.signalAfterFilteringPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.spectrogramBeforeFilteringPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.signalBeforeFilteringPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.poleZeroPanel = new NWaves.DemoForms.UserControls.PoleZeroPlot(); - this.phaseResponsePanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.magnitudeResponsePanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.label9 = new System.Windows.Forms.Label(); - this.zpIterationsTextBox = new System.Windows.Forms.TextBox(); - this.menuStrip1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.filterParamsDataGrid)).BeginInit(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.filterToolStripMenuItem, - this.resampleToolStripMenuItem, - this.resampleTextBox}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1001, 31); - this.menuStrip1.TabIndex = 5; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem, - this.saveAsToolStripMenuItem, - this.toolStripSeparator1, - this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 27); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(142, 26); - this.openToolStripMenuItem.Text = "&Open"; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // saveAsToolStripMenuItem - // - this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; - this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(142, 26); - this.saveAsToolStripMenuItem.Text = "&Save as..."; - this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(139, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(142, 26); - this.exitToolStripMenuItem.Text = "&Exit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // filterToolStripMenuItem - // - this.filterToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.autoToolStripMenuItem, - this.overlapAddToolStripMenuItem, - this.overlapSaveToolStripMenuItem, - this.differenceEquationToolStripMenuItem, - this.framebyFrameToolStripMenuItem}); - this.filterToolStripMenuItem.Name = "filterToolStripMenuItem"; - this.filterToolStripMenuItem.Size = new System.Drawing.Size(54, 27); - this.filterToolStripMenuItem.Text = "Fi<er"; - // - // autoToolStripMenuItem - // - this.autoToolStripMenuItem.Name = "autoToolStripMenuItem"; - this.autoToolStripMenuItem.Size = new System.Drawing.Size(265, 26); - this.autoToolStripMenuItem.Text = "Auto"; - this.autoToolStripMenuItem.Click += new System.EventHandler(this.autoToolStripMenuItem_Click); - // - // overlapAddToolStripMenuItem - // - this.overlapAddToolStripMenuItem.Name = "overlapAddToolStripMenuItem"; - this.overlapAddToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.A))); - this.overlapAddToolStripMenuItem.Size = new System.Drawing.Size(265, 26); - this.overlapAddToolStripMenuItem.Text = "Overlap-&Add"; - this.overlapAddToolStripMenuItem.Click += new System.EventHandler(this.overlapAddToolStripMenuItem_Click); - // - // overlapSaveToolStripMenuItem - // - this.overlapSaveToolStripMenuItem.Name = "overlapSaveToolStripMenuItem"; - this.overlapSaveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.S))); - this.overlapSaveToolStripMenuItem.Size = new System.Drawing.Size(265, 26); - this.overlapSaveToolStripMenuItem.Text = "Overlap-&Save"; - this.overlapSaveToolStripMenuItem.Click += new System.EventHandler(this.overlapSaveToolStripMenuItem_Click); - // - // differenceEquationToolStripMenuItem - // - this.differenceEquationToolStripMenuItem.Name = "differenceEquationToolStripMenuItem"; - this.differenceEquationToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D))); - this.differenceEquationToolStripMenuItem.Size = new System.Drawing.Size(265, 26); - this.differenceEquationToolStripMenuItem.Text = "Difference &Equation"; - this.differenceEquationToolStripMenuItem.Click += new System.EventHandler(this.differenceEquationToolStripMenuItem_Click); - // - // framebyFrameToolStripMenuItem - // - this.framebyFrameToolStripMenuItem.Name = "framebyFrameToolStripMenuItem"; - this.framebyFrameToolStripMenuItem.Size = new System.Drawing.Size(265, 26); - this.framebyFrameToolStripMenuItem.Text = "Frame-by-Frame"; - this.framebyFrameToolStripMenuItem.Click += new System.EventHandler(this.framebyFrameToolStripMenuItem_Click); - // - // resampleToolStripMenuItem - // - this.resampleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.interpolateToolStripMenuItem, - this.decimateToolStripMenuItem, - this.customToolStripMenuItem}); - this.resampleToolStripMenuItem.Name = "resampleToolStripMenuItem"; - this.resampleToolStripMenuItem.Size = new System.Drawing.Size(86, 27); - this.resampleToolStripMenuItem.Text = "&Resample"; - // - // interpolateToolStripMenuItem - // - this.interpolateToolStripMenuItem.Name = "interpolateToolStripMenuItem"; - this.interpolateToolStripMenuItem.Size = new System.Drawing.Size(157, 26); - this.interpolateToolStripMenuItem.Text = "&Interpolate"; - this.interpolateToolStripMenuItem.Click += new System.EventHandler(this.interpolateToolStripMenuItem_Click); - // - // decimateToolStripMenuItem - // - this.decimateToolStripMenuItem.Name = "decimateToolStripMenuItem"; - this.decimateToolStripMenuItem.Size = new System.Drawing.Size(157, 26); - this.decimateToolStripMenuItem.Text = "&Decimate"; - this.decimateToolStripMenuItem.Click += new System.EventHandler(this.decimateToolStripMenuItem_Click); - // - // customToolStripMenuItem - // - this.customToolStripMenuItem.Name = "customToolStripMenuItem"; - this.customToolStripMenuItem.Size = new System.Drawing.Size(157, 26); - this.customToolStripMenuItem.Text = "&Custom"; - this.customToolStripMenuItem.Click += new System.EventHandler(this.customToolStripMenuItem_Click); - // - // resampleTextBox - // - this.resampleTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.resampleTextBox.Name = "resampleTextBox"; - this.resampleTextBox.Size = new System.Drawing.Size(50, 27); - this.resampleTextBox.Text = "2"; - // - // analyzeFilterButton - // - this.analyzeFilterButton.Location = new System.Drawing.Point(13, 338); - this.analyzeFilterButton.Name = "analyzeFilterButton"; - this.analyzeFilterButton.Size = new System.Drawing.Size(189, 52); - this.analyzeFilterButton.TabIndex = 6; - this.analyzeFilterButton.Text = "Analyze filter"; - this.analyzeFilterButton.UseVisualStyleBackColor = true; - this.analyzeFilterButton.Click += new System.EventHandler(this.buttonAnalyzeFilter_Click); - // - // filterTypesComboBox - // - this.filterTypesComboBox.FormattingEnabled = true; - this.filterTypesComboBox.Items.AddRange(new object[] { - "Custom IIR", - "Custom FIR", - "BiQuad LP", - "BiQuad HP", - "BiQuad BP", - "BiQuad notch", - "BiQuad allpass", - "BiQuad peaking", - "BiQuad lowshelf", - "BiQuad highshelf", - "One-pole LP", - "One-pole HP", - "Comb feed-forward", - "Comb feed-back", - "Moving average", - "Moving average recursive", - "Savitzky-Golay", - "Pre-emphasis", - "De-emphasis", - "DC removal", - "RASTA", - "Butterworth", - "Chebyshev-I", - "Chebyshev-II", - "Elliptic", - "Bessel", - "Thiran", - "Equiripple LP", - "Equiripple BS", - "Custom LP/HP", - "Custom BP/BR"}); - this.filterTypesComboBox.Location = new System.Drawing.Point(12, 50); - this.filterTypesComboBox.Name = "filterTypesComboBox"; - this.filterTypesComboBox.Size = new System.Drawing.Size(190, 24); - this.filterTypesComboBox.TabIndex = 7; - this.filterTypesComboBox.Text = "Custom IIR"; - this.filterTypesComboBox.SelectedIndexChanged += new System.EventHandler(this.filterTypesComboBox_SelectedIndexChanged); - // - // filterParamsDataGrid - // - this.filterParamsDataGrid.AllowUserToAddRows = false; - this.filterParamsDataGrid.AllowUserToDeleteRows = false; - this.filterParamsDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.filterParamsDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Param, - this.Value}); - this.filterParamsDataGrid.Location = new System.Drawing.Point(13, 108); - this.filterParamsDataGrid.Name = "filterParamsDataGrid"; - this.filterParamsDataGrid.RowTemplate.Height = 24; - this.filterParamsDataGrid.Size = new System.Drawing.Size(189, 224); - this.filterParamsDataGrid.TabIndex = 8; - // - // Param - // - this.Param.HeaderText = "Param"; - this.Param.Name = "Param"; - this.Param.ReadOnly = true; - this.Param.Width = 80; - // - // Value - // - this.Value.HeaderText = "Value"; - this.Value.Name = "Value"; - this.Value.Width = 65; - // - // numeratorListBox - // - this.numeratorListBox.FormattingEnabled = true; - this.numeratorListBox.ItemHeight = 16; - this.numeratorListBox.Location = new System.Drawing.Point(797, 290); - this.numeratorListBox.Name = "numeratorListBox"; - this.numeratorListBox.Size = new System.Drawing.Size(75, 100); - this.numeratorListBox.TabIndex = 10; - // - // denominatorListBox - // - this.denominatorListBox.FormattingEnabled = true; - this.denominatorListBox.ItemHeight = 16; - this.denominatorListBox.Location = new System.Drawing.Point(913, 290); - this.denominatorListBox.Name = "denominatorListBox"; - this.denominatorListBox.Size = new System.Drawing.Size(76, 100); - this.denominatorListBox.TabIndex = 11; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(399, 31); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(143, 17); - this.label1.TabIndex = 12; - this.label1.Text = "Frequency Response"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(830, 31); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 17); - this.label2.TabIndex = 13; - this.label2.Text = "Pole-Zero Plot"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(775, 290); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(16, 17); - this.label3.TabIndex = 14; - this.label3.Text = "b"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(891, 290); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(16, 17); - this.label4.TabIndex = 15; - this.label4.Text = "a"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 407); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(100, 17); - this.label5.TabIndex = 16; - this.label5.Text = "Before filtering"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(511, 407); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(88, 17); - this.label6.TabIndex = 17; - this.label6.Text = "After filtering"; - // - // playSignalButton - // - this.playSignalButton.Location = new System.Drawing.Point(118, 402); - this.playSignalButton.Name = "playSignalButton"; - this.playSignalButton.Size = new System.Drawing.Size(59, 26); - this.playSignalButton.TabIndex = 18; - this.playSignalButton.Text = "Play"; - this.playSignalButton.UseVisualStyleBackColor = true; - this.playSignalButton.Click += new System.EventHandler(this.playSignalButton_Click); - // - // playFilteredSignalButton - // - this.playFilteredSignalButton.Location = new System.Drawing.Point(605, 402); - this.playFilteredSignalButton.Name = "playFilteredSignalButton"; - this.playFilteredSignalButton.Size = new System.Drawing.Size(59, 26); - this.playFilteredSignalButton.TabIndex = 19; - this.playFilteredSignalButton.Text = "Play"; - this.playFilteredSignalButton.UseVisualStyleBackColor = true; - this.playFilteredSignalButton.Click += new System.EventHandler(this.playFilteredSignalButton_Click); - // - // orderNumeratorTextBox - // - this.orderNumeratorTextBox.Location = new System.Drawing.Point(36, 80); - this.orderNumeratorTextBox.Name = "orderNumeratorTextBox"; - this.orderNumeratorTextBox.Size = new System.Drawing.Size(29, 22); - this.orderNumeratorTextBox.TabIndex = 20; - this.orderNumeratorTextBox.Text = "2"; - // - // orderDenominatorTextBox - // - this.orderDenominatorTextBox.Location = new System.Drawing.Point(92, 80); - this.orderDenominatorTextBox.Name = "orderDenominatorTextBox"; - this.orderDenominatorTextBox.Size = new System.Drawing.Size(30, 22); - this.orderDenominatorTextBox.TabIndex = 21; - this.orderDenominatorTextBox.Text = "2"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(70, 81); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(16, 17); - this.label7.TabIndex = 22; - this.label7.Text = "a"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(16, 81); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(16, 17); - this.label8.TabIndex = 23; - this.label8.Text = "b"; - // - // changeOrderButton - // - this.changeOrderButton.Location = new System.Drawing.Point(135, 79); - this.changeOrderButton.Name = "changeOrderButton"; - this.changeOrderButton.Size = new System.Drawing.Size(67, 23); - this.changeOrderButton.TabIndex = 24; - this.changeOrderButton.Text = "Change"; - this.changeOrderButton.UseVisualStyleBackColor = true; - this.changeOrderButton.Click += new System.EventHandler(this.changeOrderButton_Click); - // - // phaseViewComboBox - // - this.phaseViewComboBox.FormattingEnabled = true; - this.phaseViewComboBox.Items.AddRange(new object[] { - "Phase", - "Phase unwrapped", - "Group delay", - "Phase delay"}); - this.phaseViewComboBox.Location = new System.Drawing.Point(219, 217); - this.phaseViewComboBox.Name = "phaseViewComboBox"; - this.phaseViewComboBox.Size = new System.Drawing.Size(538, 24); - this.phaseViewComboBox.TabIndex = 25; - this.phaseViewComboBox.Text = "Phase unwrapped"; - this.phaseViewComboBox.SelectedIndexChanged += new System.EventHandler(this.phaseViewComboBox_SelectedIndexChanged); - // - // spectrogramAfterFilteringPanel - // - this.spectrogramAfterFilteringPanel.AutoScroll = true; - this.spectrogramAfterFilteringPanel.BackColor = System.Drawing.Color.White; - this.spectrogramAfterFilteringPanel.ColorMapName = "magma"; - this.spectrogramAfterFilteringPanel.Location = new System.Drawing.Point(499, 566); - this.spectrogramAfterFilteringPanel.Markline = null; - this.spectrogramAfterFilteringPanel.MarklineThickness = 0; - this.spectrogramAfterFilteringPanel.Name = "spectrogramAfterFilteringPanel"; - this.spectrogramAfterFilteringPanel.Size = new System.Drawing.Size(490, 149); - this.spectrogramAfterFilteringPanel.Spectrogram = null; - this.spectrogramAfterFilteringPanel.TabIndex = 9; - // - // signalAfterFilteringPanel - // - this.signalAfterFilteringPanel.AutoScroll = true; - this.signalAfterFilteringPanel.BackColor = System.Drawing.SystemColors.Window; - this.signalAfterFilteringPanel.ForeColor = System.Drawing.Color.Blue; - this.signalAfterFilteringPanel.Gain = 1F; - this.signalAfterFilteringPanel.Location = new System.Drawing.Point(499, 427); - this.signalAfterFilteringPanel.Name = "signalAfterFilteringPanel"; - this.signalAfterFilteringPanel.PaddingX = 24; - this.signalAfterFilteringPanel.PaddingY = 5; - this.signalAfterFilteringPanel.Signal = null; - this.signalAfterFilteringPanel.Size = new System.Drawing.Size(490, 133); - this.signalAfterFilteringPanel.Stride = 256; - this.signalAfterFilteringPanel.TabIndex = 4; - // - // spectrogramBeforeFilteringPanel - // - this.spectrogramBeforeFilteringPanel.AutoScroll = true; - this.spectrogramBeforeFilteringPanel.BackColor = System.Drawing.Color.White; - this.spectrogramBeforeFilteringPanel.ColorMapName = "magma"; - this.spectrogramBeforeFilteringPanel.Location = new System.Drawing.Point(13, 566); - this.spectrogramBeforeFilteringPanel.Markline = null; - this.spectrogramBeforeFilteringPanel.MarklineThickness = 0; - this.spectrogramBeforeFilteringPanel.Name = "spectrogramBeforeFilteringPanel"; - this.spectrogramBeforeFilteringPanel.Size = new System.Drawing.Size(480, 148); - this.spectrogramBeforeFilteringPanel.Spectrogram = null; - this.spectrogramBeforeFilteringPanel.TabIndex = 4; - // - // signalBeforeFilteringPanel - // - this.signalBeforeFilteringPanel.AutoScroll = true; - this.signalBeforeFilteringPanel.BackColor = System.Drawing.SystemColors.Window; - this.signalBeforeFilteringPanel.ForeColor = System.Drawing.Color.Blue; - this.signalBeforeFilteringPanel.Gain = 1F; - this.signalBeforeFilteringPanel.Location = new System.Drawing.Point(13, 427); - this.signalBeforeFilteringPanel.Name = "signalBeforeFilteringPanel"; - this.signalBeforeFilteringPanel.PaddingX = 24; - this.signalBeforeFilteringPanel.PaddingY = 5; - this.signalBeforeFilteringPanel.Signal = null; - this.signalBeforeFilteringPanel.Size = new System.Drawing.Size(480, 133); - this.signalBeforeFilteringPanel.Stride = 256; - this.signalBeforeFilteringPanel.TabIndex = 3; - // - // poleZeroPanel - // - this.poleZeroPanel.AutoScroll = true; - this.poleZeroPanel.BackColor = System.Drawing.SystemColors.Window; - this.poleZeroPanel.Location = new System.Drawing.Point(772, 50); - this.poleZeroPanel.Name = "poleZeroPanel"; - this.poleZeroPanel.Poles = null; - this.poleZeroPanel.Size = new System.Drawing.Size(217, 202); - this.poleZeroPanel.TabIndex = 2; - this.poleZeroPanel.Zeros = null; - // - // phaseResponsePanel - // - this.phaseResponsePanel.AutoScroll = true; - this.phaseResponsePanel.BackColor = System.Drawing.SystemColors.Window; - this.phaseResponsePanel.ForeColor = System.Drawing.Color.Blue; - this.phaseResponsePanel.Location = new System.Drawing.Point(219, 247); - this.phaseResponsePanel.Name = "phaseResponsePanel"; - this.phaseResponsePanel.PaddingX = 30; - this.phaseResponsePanel.PaddingY = 20; - this.phaseResponsePanel.Size = new System.Drawing.Size(538, 143); - this.phaseResponsePanel.Stride = 1; - this.phaseResponsePanel.TabIndex = 1; - this.phaseResponsePanel.Thickness = 1; - // - // magnitudeResponsePanel - // - this.magnitudeResponsePanel.AutoScroll = true; - this.magnitudeResponsePanel.BackColor = System.Drawing.SystemColors.Window; - this.magnitudeResponsePanel.ForeColor = System.Drawing.Color.Blue; - this.magnitudeResponsePanel.Location = new System.Drawing.Point(219, 50); - this.magnitudeResponsePanel.Name = "magnitudeResponsePanel"; - this.magnitudeResponsePanel.PaddingX = 30; - this.magnitudeResponsePanel.PaddingY = 20; - this.magnitudeResponsePanel.Size = new System.Drawing.Size(538, 149); - this.magnitudeResponsePanel.Stride = 1; - this.magnitudeResponsePanel.TabIndex = 0; - this.magnitudeResponsePanel.Thickness = 1; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(773, 257); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(131, 17); - this.label9.TabIndex = 26; - this.label9.Text = "Zero/pole iterations"; - // - // zpIterationsTextBox - // - this.zpIterationsTextBox.Location = new System.Drawing.Point(910, 256); - this.zpIterationsTextBox.Name = "zpIterationsTextBox"; - this.zpIterationsTextBox.Size = new System.Drawing.Size(79, 22); - this.zpIterationsTextBox.TabIndex = 27; - // - // FiltersForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1001, 729); - this.Controls.Add(this.zpIterationsTextBox); - this.Controls.Add(this.label9); - this.Controls.Add(this.phaseViewComboBox); - this.Controls.Add(this.changeOrderButton); - this.Controls.Add(this.label8); - this.Controls.Add(this.label7); - this.Controls.Add(this.orderDenominatorTextBox); - this.Controls.Add(this.orderNumeratorTextBox); - this.Controls.Add(this.playFilteredSignalButton); - this.Controls.Add(this.playSignalButton); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.analyzeFilterButton); - this.Controls.Add(this.denominatorListBox); - this.Controls.Add(this.numeratorListBox); - this.Controls.Add(this.spectrogramAfterFilteringPanel); - this.Controls.Add(this.signalAfterFilteringPanel); - this.Controls.Add(this.filterParamsDataGrid); - this.Controls.Add(this.filterTypesComboBox); - this.Controls.Add(this.spectrogramBeforeFilteringPanel); - this.Controls.Add(this.signalBeforeFilteringPanel); - this.Controls.Add(this.poleZeroPanel); - this.Controls.Add(this.phaseResponsePanel); - this.Controls.Add(this.magnitudeResponsePanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "FiltersForm"; - this.Text = "FiltersForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.filterParamsDataGrid)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private LinePlot magnitudeResponsePanel; - private LinePlot phaseResponsePanel; - private PoleZeroPlot poleZeroPanel; - private SignalPlot signalBeforeFilteringPanel; - private SpectrogramPlot spectrogramBeforeFilteringPanel; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.Button analyzeFilterButton; - private System.Windows.Forms.ComboBox filterTypesComboBox; - private System.Windows.Forms.DataGridView filterParamsDataGrid; - private SignalPlot signalAfterFilteringPanel; - private SpectrogramPlot spectrogramAfterFilteringPanel; - private System.Windows.Forms.DataGridViewTextBoxColumn Param; - private System.Windows.Forms.DataGridViewTextBoxColumn Value; - private System.Windows.Forms.ListBox numeratorListBox; - private System.Windows.Forms.ListBox denominatorListBox; - private System.Windows.Forms.ToolStripMenuItem filterToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem overlapAddToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem overlapSaveToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem differenceEquationToolStripMenuItem; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Button playSignalButton; - private System.Windows.Forms.Button playFilteredSignalButton; - private System.Windows.Forms.TextBox orderNumeratorTextBox; - private System.Windows.Forms.TextBox orderDenominatorTextBox; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Button changeOrderButton; - private System.Windows.Forms.ToolStripMenuItem resampleToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem interpolateToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem decimateToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem customToolStripMenuItem; - private System.Windows.Forms.ToolStripTextBox resampleTextBox; - private System.Windows.Forms.ComboBox phaseViewComboBox; - private System.Windows.Forms.ToolStripMenuItem framebyFrameToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem autoToolStripMenuItem; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox zpIterationsTextBox; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/FiltersForm.cs b/NWaves.DemoForms/FiltersForm.cs deleted file mode 100644 index 74389a9..0000000 --- a/NWaves.DemoForms/FiltersForm.cs +++ /dev/null @@ -1,942 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; -using NWaves.Signals; -using NWaves.Audio; -using NWaves.Filters; -using NWaves.Filters.Base; -using NWaves.Filters.BiQuad; -using NWaves.Filters.Fda; -using NWaves.Operations; -using NWaves.Transforms; -using NWaves.Utils; -using HighPassFilter = NWaves.Filters.BiQuad.HighPassFilter; -using LowPassFilter = NWaves.Filters.BiQuad.LowPassFilter; -using System.Linq; - -namespace NWaves.DemoForms -{ - public partial class FiltersForm : Form - { - private LtiFilter _filter; - - private DiscreteSignal _signal; - private DiscreteSignal _filteredSignal; - - private readonly Stft _stft = new Stft(256); - - private string _waveFileName; - private short _bitDepth; - - private readonly MemoryStreamPlayer _player = new MemoryStreamPlayer(); - - - public FiltersForm() - { - InitializeComponent(); - - magnitudeResponsePanel.Stride = 2; - magnitudeResponsePanel.Thickness = 2; - magnitudeResponsePanel.ForeColor = Color.SeaGreen; - phaseResponsePanel.Stride = 1; - phaseResponsePanel.Thickness = 2; - phaseResponsePanel.ForeColor = Color.SeaGreen; - - signalBeforeFilteringPanel.Gain = 80; - signalAfterFilteringPanel.Gain = 80; - - zpIterationsTextBox.Text = MathUtils.PolyRootsIterations.ToString(); - } - - private void buttonAnalyzeFilter_Click(object sender, EventArgs e) - { - Cursor.Current = Cursors.WaitCursor; - - switch (filterTypesComboBox.Text) - { - case "Custom IIR": - AnalyzeCustomIirFilter(); - break; - case "Custom FIR": - AnalyzeCustomFirFilter(); - break; - case "BiQuad LP": - case "BiQuad HP": - case "BiQuad BP": - case "BiQuad notch": - case "BiQuad allpass": - case "BiQuad peaking": - case "BiQuad lowshelf": - case "BiQuad highshelf": - AnalyzeBiQuadFilter(filterTypesComboBox.Text); - break; - case "One-pole LP": - _filter = new Filters.OnePole.LowPassFilter(0.25); - break; - case "One-pole HP": - _filter = new Filters.OnePole.HighPassFilter(0.25); - break; - case "Comb feed-forward": - _filter = new CombFeedforwardFilter(500); - break; - case "Comb feed-back": - _filter = new CombFeedbackFilter(1800); - break; - case "Moving average": - AnalyzeMovingAverageFilter(); - break; - case "Moving average recursive": - AnalyzeRecursiveMovingAverageFilter(); - break; - case "Savitzky-Golay": - AnalyzeSavitzkyGolayFilter(); - break; - case "Pre-emphasis": - AnalyzePreemphasisFilter(); - break; - case "De-emphasis": - _filter = new DeEmphasisFilter(); - break; - case "DC removal": - _filter = new DcRemovalFilter(); - break; - case "RASTA": - _filter = new RastaFilter(); - break; - case "Butterworth": - AnalyzeButterworthFilter(); - break; - case "Elliptic": - AnalyzeEllipticFilter(); - break; - case "Chebyshev-I": - AnalyzeChebyshevIFilter(); - break; - case "Chebyshev-II": - AnalyzeChebyshevIIFilter(); - break; - case "Bessel": - AnalyzeBesselFilter(); - break; - case "Thiran": - AnalyzeThiranFilter(); - break; - case "Equiripple LP": - AnalyzeEquirippleLpFilter(); - break; - case "Equiripple BS": - AnalyzeEquirippleBsFilter(); - break; - case "Custom LP/HP": - AnalyzeCustomLpFilter(); - break; - case "Custom BP/BR": - AnalyzeCustomBandpassFilter(); - break; - } - - // we can load TF from csv file: - - //using (var csv = new FileStream("fir.csv", FileMode.Open)) - //{ - // _filter = new FirFilter(TransferFunction.FromCsv(csv)); - //} - - var tf = _filter.Tf; - - // we can save TF to csv file: - - //using (var csv = new FileStream("fir.csv", FileMode.Create)) - //{ - // tf.ToCsv(csv); - //} - - magnitudeResponsePanel.Line = tf.FrequencyResponse().Magnitude.ToFloats(); - UpdatePhaseResponse(); - - // adjust this if you need finer precision: - tf.CalculateZpIterations = int.Parse(zpIterationsTextBox.Text); - - if (tf.Numerator.Length + tf.Denominator.Length < 70) - { - poleZeroPanel.Zeros = tf.Zeros; - poleZeroPanel.Poles = tf.Poles; - } - - numeratorListBox.DataSource = tf.Numerator; - denominatorListBox.DataSource = tf.Denominator; - - Cursor.Current = Cursors.Default; - } - - private void filterTypesComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - switch (filterTypesComboBox.Text) - { - case "Custom IIR": - orderNumeratorTextBox.Enabled = true; - orderDenominatorTextBox.Enabled = true; - changeOrderButton.Enabled = true; - break; - case "Custom FIR": - orderNumeratorTextBox.Enabled = true; - orderDenominatorTextBox.Enabled = false; - changeOrderButton.Enabled = true; - orderDenominatorTextBox.Text = "0"; - break; - default: - orderNumeratorTextBox.Enabled = false; - orderDenominatorTextBox.Enabled = false; - changeOrderButton.Enabled = false; - break; - } - - filterParamsDataGrid.RowCount = 0; - } - - private void phaseViewComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - UpdatePhaseResponse(); - } - - private void changeOrderButton_Click(object sender, EventArgs e) - { - var b = int.Parse(orderNumeratorTextBox.Text) + 1; - var a = int.Parse(orderDenominatorTextBox.Text) + 1; - - filterParamsDataGrid.RowCount = b + a; - - var pos = 0; - filterParamsDataGrid.Rows[0].Cells[0].Value = "b0"; - filterParamsDataGrid.Rows[0].Cells[1].Value = 1; - pos++; - for (var i = 1; i < b; i++, pos++) - { - filterParamsDataGrid.Rows[pos].Cells[0].Value = "b" + i; - filterParamsDataGrid.Rows[pos].Cells[1].Value = 0; - } - filterParamsDataGrid.Rows[pos].Cells[0].Value = "a0"; - filterParamsDataGrid.Rows[pos].Cells[1].Value = 1; - pos++; - for (var i = 1; i < a; i++, pos++) - { - filterParamsDataGrid.Rows[pos].Cells[0].Value = "a" + i; - filterParamsDataGrid.Rows[pos].Cells[1].Value = 0; - } - } - - private void UpdatePhaseResponse() - { - var tf = _filter.Tf; - - var fr = tf.FrequencyResponse(); - - switch (phaseViewComboBox.Text) - { - case "Phase unwrapped": - phaseResponsePanel.Line = fr.PhaseUnwrapped.ToFloats(); - break; - case "Group delay": - phaseResponsePanel.Line = tf.GroupDelay(256).ToFloats(); - // or like this: - // fr.GroupDelay.ToFloats(); - break; - case "Phase delay": - phaseResponsePanel.Line = tf.PhaseDelay(256).ToFloats(); - // or like this: - // fr.PhaseDelay.ToFloats(); - break; - default: - phaseResponsePanel.Line = fr.Phase.ToFloats(); - break; - } - } - - #region filter analysis - - private void AnalyzeCustomIirFilter() - { - var b = new List(); - var a = new List(); - - if (filterParamsDataGrid.RowCount == 0) - { - b.AddRange(new[] { 1, -0.4, 0.6 }); - a.AddRange(new[] { 1, 0.4, 0.2 }); - } - else - { - for (var i = 0; i < filterParamsDataGrid.RowCount; i++) - { - var param = filterParamsDataGrid.Rows[i].Cells[0].Value; - if (param.ToString().StartsWith("b")) - { - b.Add(Convert.ToSingle(filterParamsDataGrid.Rows[i].Cells[1].Value)); - } - else - { - a.Add(Convert.ToSingle(filterParamsDataGrid.Rows[i].Cells[1].Value)); - } - } - } - - // lose some precision: - - _filter = new IirFilter(b, a); - - // double precision: - - // _filter = new IirFilter(new TransferFunction(b.ToArray(), a.ToArray())); - - filterParamsDataGrid.RowCount = a.Count + b.Count; - var pos = 0; - for (var i = 0; i < b.Count; i++, pos++) - { - filterParamsDataGrid.Rows[pos].Cells[0].Value = "b" + i; - filterParamsDataGrid.Rows[pos].Cells[1].Value = b[i]; - } - for (var i = 0; i < a.Count; i++, pos++) - { - filterParamsDataGrid.Rows[pos].Cells[0].Value = "a" + i; - filterParamsDataGrid.Rows[pos].Cells[1].Value = a[i]; - } - } - - private void AnalyzeCustomFirFilter() - { - var b = new List(); - - var size = filterParamsDataGrid.RowCount; - if (size == 0) - { - b.AddRange(new []{ 1, 0.4, -0.6 }); - } - else - { - for (var i = 0; i < filterParamsDataGrid.RowCount; i++) - { - var param = filterParamsDataGrid.Rows[i].Cells[0].Value; - if (param.ToString().StartsWith("b")) - { - b.Add(Convert.ToDouble(filterParamsDataGrid.Rows[i].Cells[1].Value)); - } - } - } - - _filter = new FirFilter(b); - - filterParamsDataGrid.RowCount = b.Count + 1; - for (var i = 0; i < b.Count; i++) - { - filterParamsDataGrid.Rows[i].Cells[0].Value = "b" + i; - filterParamsDataGrid.Rows[i].Cells[1].Value = b[i]; - } - filterParamsDataGrid.Rows[b.Count].Cells[0].Value = "a0"; - filterParamsDataGrid.Rows[b.Count].Cells[1].Value = 1.0; - } - - private void AnalyzeBiQuadFilter(string filterType) - { - var freq = 0.1; - var q = 1.0; - var gain = 9.0; - - for (var i = 0; i < filterParamsDataGrid.RowCount; i++) - { - if (filterParamsDataGrid.Rows[i].Cells[0].Value.ToString() == "freq") - { - freq = Convert.ToDouble(filterParamsDataGrid.Rows[i].Cells[1].Value); - } - if (filterParamsDataGrid.Rows[i].Cells[0].Value.ToString() == "q") - { - q = Convert.ToDouble(filterParamsDataGrid.Rows[i].Cells[1].Value); - } - if (filterParamsDataGrid.Rows[i].Cells[0].Value.ToString() == "gain") - { - gain = Convert.ToDouble(filterParamsDataGrid.Rows[i].Cells[1].Value); - } - } - - string[] parameters = { "freq", "q" }; - double[] values = { freq, q }; - - switch (filterType) - { - case "BiQuad LP": - _filter = new LowPassFilter(freq, q); - break; - case "BiQuad HP": - _filter = new HighPassFilter(freq, q); - break; - case "BiQuad BP": - _filter = new Filters.BiQuad.BandPassFilter(freq, q); - break; - case "BiQuad notch": - _filter = new NotchFilter(freq, q); - break; - case "BiQuad allpass": - _filter = new AllPassFilter(freq, q); - break; - case "BiQuad peaking": - _filter = new PeakFilter(freq, q, gain); - parameters = new[] { "freq", "q", "gain" }; - values = new[] { freq, q, gain }; - break; - case "BiQuad lowshelf": - _filter = new LowShelfFilter(freq, q, gain); - parameters = new[] { "freq", "q", "gain" }; - values = new[] { freq, q, gain }; - break; - case "BiQuad highshelf": - _filter = new HighShelfFilter(freq, q, gain); - parameters = new[] { "freq", "q", "gain" }; - values = new[] { freq, q, gain }; - break; - } - - filterParamsDataGrid.RowCount = parameters.Length; - for (var i = 0; i < parameters.Length; i++) - { - filterParamsDataGrid.Rows[i].Cells[0].Value = parameters[i]; - filterParamsDataGrid.Rows[i].Cells[1].Value = values[i]; - } - orderNumeratorTextBox.Text = "2"; - orderDenominatorTextBox.Text = "2"; - } - - private void AnalyzeMovingAverageFilter() - { - var size = 3; - if (filterParamsDataGrid.RowCount > 0) - { - size = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (size - 1).ToString(); - orderDenominatorTextBox.Text = "0"; - - _filter = new MovingAverageFilter(size); - - filterParamsDataGrid.RowCount = 1; - filterParamsDataGrid.Rows[0].Cells[0].Value = "size"; - filterParamsDataGrid.Rows[0].Cells[1].Value = size; - } - - private void AnalyzeRecursiveMovingAverageFilter() - { - var size = 3; - if (filterParamsDataGrid.RowCount > 0) - { - size = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (size - 1).ToString(); - orderDenominatorTextBox.Text = "0"; - - _filter = new MovingAverageRecursiveFilter(size); - - filterParamsDataGrid.RowCount = 1; - filterParamsDataGrid.Rows[0].Cells[0].Value = "size"; - filterParamsDataGrid.Rows[0].Cells[1].Value = size; - } - - private void AnalyzeSavitzkyGolayFilter() - { - var size = 9; - if (filterParamsDataGrid.RowCount > 0) - { - size = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (size - 1).ToString(); - orderDenominatorTextBox.Text = "0"; - - _filter = new SavitzkyGolayFilter(size); - - filterParamsDataGrid.RowCount = 1; - filterParamsDataGrid.Rows[0].Cells[0].Value = "size"; - filterParamsDataGrid.Rows[0].Cells[1].Value = size; - } - - private void AnalyzePreemphasisFilter() - { - var pre = 0.95; - if (filterParamsDataGrid.RowCount > 0) - { - pre = Convert.ToDouble(filterParamsDataGrid.Rows[0].Cells[1].Value); - } - - _filter = new PreEmphasisFilter(pre); - - filterParamsDataGrid.RowCount = 1; - filterParamsDataGrid.Rows[0].Cells[0].Value = "a"; - filterParamsDataGrid.Rows[0].Cells[1].Value = pre.ToString("F2"); - orderNumeratorTextBox.Text = "1"; - orderDenominatorTextBox.Text = "0"; - } - - private void AnalyzeButterworthFilter() - { - var order = 5; - var freq = 0.1; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new Filters.Butterworth.BandPassFilter(freq, 0.4, order); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeEllipticFilter() - { - var order = 4; - var freq = 0.15; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - // example how to convert linear scale specifications to decibel scale: - - var deltaPass = 0.96; - var deltaStop = 0.04; - - var ripplePassDb = Utils.Scale.ToDecibel(1 / deltaPass); - var attenuateDb = Utils.Scale.ToDecibel(1 / deltaStop); - - _filter = new Filters.Elliptic.LowPassFilter(freq, order, ripplePassDb, attenuateDb); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeChebyshevIFilter() - { - var order = 6; - var freq = 0.2; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new Filters.ChebyshevI.HighPassFilter(freq, order); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeChebyshevIIFilter() - { - var order = 4; - var freq = 0.25; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new Filters.ChebyshevII.BandStopFilter(freq, 0.4, order); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeBesselFilter() - { - var order = 4; - var freq = 0.15; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new Filters.Bessel.LowPassFilter(freq, order); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeThiranFilter() - { - var order = 10; - var delta = 10.3; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - delta = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new ThiranFilter(order, order + delta); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "delta"; - filterParamsDataGrid.Rows[1].Cells[1].Value = delta; - } - - private void AnalyzeEquirippleLpFilter() - { - var order = 47; - var fp = 0.15; - var fa = 0.18; - var ripplePass = 1.0; // dB - var rippleStop = 42.0; // dB - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - fp = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - fa = Convert.ToDouble(filterParamsDataGrid.Rows[2].Cells[1].Value); - ripplePass = Convert.ToDouble(filterParamsDataGrid.Rows[3].Cells[1].Value); - rippleStop = Convert.ToDouble(filterParamsDataGrid.Rows[4].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - var wp = Remez.DbToPassbandWeight(ripplePass); - var wa = Remez.DbToStopbandWeight(rippleStop); - - _filter = new FirFilter(DesignFilter.FirEquirippleLp(order, fp, fa, wp, wa)); - - filterParamsDataGrid.RowCount = 5; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "fp"; - filterParamsDataGrid.Rows[1].Cells[1].Value = fp; - filterParamsDataGrid.Rows[2].Cells[0].Value = "fa"; - filterParamsDataGrid.Rows[2].Cells[1].Value = fa; - filterParamsDataGrid.Rows[3].Cells[0].Value = "rp"; - filterParamsDataGrid.Rows[3].Cells[1].Value = ripplePass; - filterParamsDataGrid.Rows[4].Cells[0].Value = "rs"; - filterParamsDataGrid.Rows[4].Cells[1].Value = rippleStop; - } - - private void AnalyzeEquirippleBsFilter() - { - var order = 51; - var fp1 = 0.19; - var fa1 = 0.21; - var fa2 = 0.39; - var fp2 = 0.41; - var ripplePass1 = 1.0; - var rippleStop = 24.0; - var ripplePass2 = 3.0; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - fp1 = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - fa1 = Convert.ToDouble(filterParamsDataGrid.Rows[2].Cells[1].Value); - fa2 = Convert.ToDouble(filterParamsDataGrid.Rows[3].Cells[1].Value); - fp2 = Convert.ToDouble(filterParamsDataGrid.Rows[4].Cells[1].Value); - ripplePass1 = Convert.ToDouble(filterParamsDataGrid.Rows[5].Cells[1].Value); - rippleStop = Convert.ToDouble(filterParamsDataGrid.Rows[6].Cells[1].Value); - ripplePass2 = Convert.ToDouble(filterParamsDataGrid.Rows[7].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - var freqs = new[] { 0, fp1, fa1, fa2, fp2, 0.5 }; - - var weights = new[] - { - Remez.DbToPassbandWeight(ripplePass1), - Remez.DbToStopbandWeight(rippleStop), - Remez.DbToPassbandWeight(ripplePass2), - }; - - var remez = new Remez(order, freqs, new double[] { 1, 0, 1 }, weights); - - _filter = new FirFilter(remez.Design()); - - var extrema = string.Join("\t", Enumerable.Range(0, remez.K).Select(e => remez.ExtremalFrequencies[e].ToString("F5"))); - var message = $"Iterations: {remez.Iterations}\n\nEstimated order: {Remez.EstimateOrder(freqs, weights)}\n\nExtrema:\n{extrema}"; - MessageBox.Show(message); - - filterParamsDataGrid.RowCount = 8; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "fp1"; - filterParamsDataGrid.Rows[1].Cells[1].Value = fp1; - filterParamsDataGrid.Rows[2].Cells[0].Value = "fa1"; - filterParamsDataGrid.Rows[2].Cells[1].Value = fa1; - filterParamsDataGrid.Rows[3].Cells[0].Value = "fa2"; - filterParamsDataGrid.Rows[3].Cells[1].Value = fa2; - filterParamsDataGrid.Rows[4].Cells[0].Value = "fp2"; - filterParamsDataGrid.Rows[4].Cells[1].Value = fp2; - filterParamsDataGrid.Rows[5].Cells[0].Value = "rp1"; - filterParamsDataGrid.Rows[5].Cells[1].Value = ripplePass1; - filterParamsDataGrid.Rows[6].Cells[0].Value = "rs"; - filterParamsDataGrid.Rows[6].Cells[1].Value = rippleStop; - filterParamsDataGrid.Rows[7].Cells[0].Value = "rp2"; - filterParamsDataGrid.Rows[7].Cells[1].Value = ripplePass2; - } - - private void AnalyzeCustomLpFilter() - { - var order = 23; - var freq = 0.22; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - _filter = new FirFilter(DesignFilter.FirWinLp(order, freq)); - - // for double precision and FDA: - - //var tf = new TransferFunction(DesignFilter.FirWinLp(order, freq)); - //_filter = new FirFilter(tf); - - filterParamsDataGrid.RowCount = 2; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq; - } - - private void AnalyzeCustomBandpassFilter() - { - var order = 231; - var freq1 = 0.06; - var freq2 = 0.2; - - if (filterParamsDataGrid.RowCount > 0) - { - order = Convert.ToInt32(filterParamsDataGrid.Rows[0].Cells[1].Value); - freq1 = Convert.ToDouble(filterParamsDataGrid.Rows[1].Cells[1].Value); - freq2 = Convert.ToDouble(filterParamsDataGrid.Rows[2].Cells[1].Value); - } - - orderNumeratorTextBox.Text = (order - 1).ToString(); - orderDenominatorTextBox.Text = (order - 1).ToString(); - - //_filter = new FirFilter(DesignFilter.FirWinBp(order, freq1, freq2)); - - // for double precision and FDA: - - var tf = new TransferFunction(DesignFilter.FirWinBp(order, freq1, freq2)); - _filter = new FirFilter(tf); - - filterParamsDataGrid.RowCount = 3; - filterParamsDataGrid.Rows[0].Cells[0].Value = "order"; - filterParamsDataGrid.Rows[0].Cells[1].Value = order; - filterParamsDataGrid.Rows[1].Cells[0].Value = "freq1"; - filterParamsDataGrid.Rows[1].Cells[1].Value = freq1; - filterParamsDataGrid.Rows[2].Cells[0].Value = "freq2"; - filterParamsDataGrid.Rows[2].Cells[1].Value = freq2; - } - - #endregion - - #region filtering - - private void autoToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - _filteredSignal = _filter.ApplyTo(_signal); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void overlapAddToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - _filteredSignal = _filter.ApplyTo(_signal, FilteringMethod.OverlapAdd); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void overlapSaveToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - _filteredSignal = _filter.ApplyTo(_signal, FilteringMethod.OverlapSave); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void differenceEquationToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - _filteredSignal = _filter.ApplyTo(_signal, FilteringMethod.DifferenceEquation); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void framebyFrameToolStripMenuItem_Click(object sender, EventArgs e) - { -#if DEBUG - if (_signal == null) return; - - _filter.Reset(); - - _filteredSignal = _filter.ProcessChunks(_signal); - //_filteredSignal = _filter.ProcessChunks(_signal, method: FilteringMethod.OverlapAdd); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); -#endif - } - -#endregion - -#region resampling - - private void interpolateToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - var factor = int.Parse(resampleTextBox.Text); - - _filteredSignal = Operation.Interpolate(_signal, factor); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void decimateToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - var factor = int.Parse(resampleTextBox.Text); - - _filteredSignal = Operation.Decimate(_signal, factor); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - } - - private void customToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_signal == null) return; - - Cursor.Current = Cursors.WaitCursor; - - var rate = int.Parse(resampleTextBox.Text); - - _filteredSignal = Operation.Resample(_signal, rate); - signalAfterFilteringPanel.Signal = _filteredSignal; - spectrogramAfterFilteringPanel.Spectrogram = _stft.Spectrogram(_filteredSignal); - - Cursor.Current = Cursors.Default; - } - -#endregion - -#region File menu - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - _waveFileName = ofd.FileName; - - using (var stream = new FileStream(_waveFileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _signal = waveFile[Channels.Left]; - } - - signalBeforeFilteringPanel.Signal = _signal; - spectrogramBeforeFilteringPanel.Spectrogram = _stft.Spectrogram(_signal); - } - - private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) - { - var sfd = new SaveFileDialog(); - if (sfd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(sfd.FileName, FileMode.Create)) - { - var waveFile = new WaveFile(_filteredSignal, _bitDepth); - waveFile.SaveTo(stream); - } - } - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - -#endregion - -#region playback - - private async void playSignalButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_waveFileName); - } - - private async void playFilteredSignalButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_filteredSignal, _bitDepth); - } - -#endregion - } -} diff --git a/NWaves.DemoForms/FiltersForm.resx b/NWaves.DemoForms/FiltersForm.resx deleted file mode 100644 index 152b330..0000000 --- a/NWaves.DemoForms/FiltersForm.resx +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - - True - - - True - - \ No newline at end of file diff --git a/NWaves.DemoForms/HpssForm.Designer.cs b/NWaves.DemoForms/HpssForm.Designer.cs deleted file mode 100644 index 9fb9581..0000000 --- a/NWaves.DemoForms/HpssForm.Designer.cs +++ /dev/null @@ -1,295 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class HpssForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.fftSizeTextBox = new System.Windows.Forms.TextBox(); - this.hopSizeTextBox = new System.Windows.Forms.TextBox(); - this.harmonicWindowTextBox = new System.Windows.Forms.TextBox(); - this.percussiveWindowTextBox = new System.Windows.Forms.TextBox(); - this.maskingComboBox = new System.Windows.Forms.ComboBox(); - this.evaluateButton = new System.Windows.Forms.Button(); - this.playButton1 = new System.Windows.Forms.Button(); - this.playButton2 = new System.Windows.Forms.Button(); - this.playButton3 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.spectrogramPlot3 = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.spectrogramPlot2 = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.spectrogramPlot1 = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1245, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(66, 24); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // fftSizeTextBox - // - this.fftSizeTextBox.Location = new System.Drawing.Point(13, 61); - this.fftSizeTextBox.Name = "fftSizeTextBox"; - this.fftSizeTextBox.Size = new System.Drawing.Size(121, 22); - this.fftSizeTextBox.TabIndex = 4; - this.fftSizeTextBox.Text = "2048"; - // - // hopSizeTextBox - // - this.hopSizeTextBox.Location = new System.Drawing.Point(12, 109); - this.hopSizeTextBox.Name = "hopSizeTextBox"; - this.hopSizeTextBox.Size = new System.Drawing.Size(122, 22); - this.hopSizeTextBox.TabIndex = 5; - this.hopSizeTextBox.Text = "512"; - // - // harmonicWindowTextBox - // - this.harmonicWindowTextBox.Location = new System.Drawing.Point(13, 160); - this.harmonicWindowTextBox.Name = "harmonicWindowTextBox"; - this.harmonicWindowTextBox.Size = new System.Drawing.Size(121, 22); - this.harmonicWindowTextBox.TabIndex = 6; - this.harmonicWindowTextBox.Text = "17"; - // - // percussiveWindowTextBox - // - this.percussiveWindowTextBox.Location = new System.Drawing.Point(13, 211); - this.percussiveWindowTextBox.Name = "percussiveWindowTextBox"; - this.percussiveWindowTextBox.Size = new System.Drawing.Size(121, 22); - this.percussiveWindowTextBox.TabIndex = 7; - this.percussiveWindowTextBox.Text = "17"; - // - // maskingComboBox - // - this.maskingComboBox.FormattingEnabled = true; - this.maskingComboBox.Items.AddRange(new object[] { - "Binary mask", - "Wiener order 1", - "Wiener order 2"}); - this.maskingComboBox.Location = new System.Drawing.Point(13, 261); - this.maskingComboBox.Name = "maskingComboBox"; - this.maskingComboBox.Size = new System.Drawing.Size(121, 24); - this.maskingComboBox.TabIndex = 8; - this.maskingComboBox.Text = "Binary mask"; - // - // evaluateButton - // - this.evaluateButton.Location = new System.Drawing.Point(13, 321); - this.evaluateButton.Name = "evaluateButton"; - this.evaluateButton.Size = new System.Drawing.Size(121, 42); - this.evaluateButton.TabIndex = 9; - this.evaluateButton.Text = "Evaluate"; - this.evaluateButton.UseVisualStyleBackColor = true; - this.evaluateButton.Click += new System.EventHandler(this.evaluateButton_Click); - // - // playButton1 - // - this.playButton1.Location = new System.Drawing.Point(164, 31); - this.playButton1.Name = "playButton1"; - this.playButton1.Size = new System.Drawing.Size(64, 32); - this.playButton1.TabIndex = 10; - this.playButton1.Text = "Play"; - this.playButton1.UseVisualStyleBackColor = true; - this.playButton1.Click += new System.EventHandler(this.playButton1_Click); - // - // playButton2 - // - this.playButton2.Location = new System.Drawing.Point(164, 293); - this.playButton2.Name = "playButton2"; - this.playButton2.Size = new System.Drawing.Size(64, 32); - this.playButton2.TabIndex = 11; - this.playButton2.Text = "Play"; - this.playButton2.UseVisualStyleBackColor = true; - this.playButton2.Click += new System.EventHandler(this.playButton2_Click); - // - // playButton3 - // - this.playButton3.Location = new System.Drawing.Point(164, 555); - this.playButton3.Name = "playButton3"; - this.playButton3.Size = new System.Drawing.Size(64, 32); - this.playButton3.TabIndex = 12; - this.playButton3.Text = "Play"; - this.playButton3.UseVisualStyleBackColor = true; - this.playButton3.Click += new System.EventHandler(this.playButton3_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 39); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(62, 17); - this.label1.TabIndex = 13; - this.label1.Text = "FFT size"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 89); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(63, 17); - this.label2.TabIndex = 14; - this.label2.Text = "Hop size"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 140); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(117, 17); - this.label3.TabIndex = 15; - this.label3.Text = "Harmonic window"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(12, 191); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(126, 17); - this.label4.TabIndex = 16; - this.label4.Text = "Percussive window"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(12, 241); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(99, 17); - this.label5.TabIndex = 17; - this.label5.Text = "Masking mode"; - // - // spectrogramPlot3 - // - this.spectrogramPlot3.AutoScroll = true; - this.spectrogramPlot3.BackColor = System.Drawing.Color.Black; - this.spectrogramPlot3.ColorMapName = "magma"; - this.spectrogramPlot3.Location = new System.Drawing.Point(164, 555); - this.spectrogramPlot3.Markline = null; - this.spectrogramPlot3.MarklineThickness = 0; - this.spectrogramPlot3.Name = "spectrogramPlot3"; - this.spectrogramPlot3.Size = new System.Drawing.Size(1069, 256); - this.spectrogramPlot3.Spectrogram = null; - this.spectrogramPlot3.TabIndex = 3; - // - // spectrogramPlot2 - // - this.spectrogramPlot2.AutoScroll = true; - this.spectrogramPlot2.BackColor = System.Drawing.Color.Black; - this.spectrogramPlot2.ColorMapName = "magma"; - this.spectrogramPlot2.Location = new System.Drawing.Point(164, 293); - this.spectrogramPlot2.Markline = null; - this.spectrogramPlot2.MarklineThickness = 0; - this.spectrogramPlot2.Name = "spectrogramPlot2"; - this.spectrogramPlot2.Size = new System.Drawing.Size(1069, 256); - this.spectrogramPlot2.Spectrogram = null; - this.spectrogramPlot2.TabIndex = 2; - // - // spectrogramPlot1 - // - this.spectrogramPlot1.AutoScroll = true; - this.spectrogramPlot1.BackColor = System.Drawing.Color.Black; - this.spectrogramPlot1.ColorMapName = "magma"; - this.spectrogramPlot1.Location = new System.Drawing.Point(164, 31); - this.spectrogramPlot1.Markline = null; - this.spectrogramPlot1.MarklineThickness = 0; - this.spectrogramPlot1.Name = "spectrogramPlot1"; - this.spectrogramPlot1.Size = new System.Drawing.Size(1069, 256); - this.spectrogramPlot1.Spectrogram = null; - this.spectrogramPlot1.TabIndex = 1; - // - // HpssForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1245, 818); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.playButton3); - this.Controls.Add(this.playButton2); - this.Controls.Add(this.playButton1); - this.Controls.Add(this.evaluateButton); - this.Controls.Add(this.maskingComboBox); - this.Controls.Add(this.percussiveWindowTextBox); - this.Controls.Add(this.harmonicWindowTextBox); - this.Controls.Add(this.hopSizeTextBox); - this.Controls.Add(this.fftSizeTextBox); - this.Controls.Add(this.spectrogramPlot3); - this.Controls.Add(this.spectrogramPlot2); - this.Controls.Add(this.spectrogramPlot1); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "HpssForm"; - this.Text = "HpssForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private UserControls.SpectrogramPlot spectrogramPlot1; - private UserControls.SpectrogramPlot spectrogramPlot2; - private UserControls.SpectrogramPlot spectrogramPlot3; - private System.Windows.Forms.TextBox fftSizeTextBox; - private System.Windows.Forms.TextBox hopSizeTextBox; - private System.Windows.Forms.TextBox harmonicWindowTextBox; - private System.Windows.Forms.TextBox percussiveWindowTextBox; - private System.Windows.Forms.ComboBox maskingComboBox; - private System.Windows.Forms.Button evaluateButton; - private System.Windows.Forms.Button playButton1; - private System.Windows.Forms.Button playButton2; - private System.Windows.Forms.Button playButton3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/HpssForm.cs b/NWaves.DemoForms/HpssForm.cs deleted file mode 100644 index 50b633c..0000000 --- a/NWaves.DemoForms/HpssForm.cs +++ /dev/null @@ -1,89 +0,0 @@ -using NWaves.Audio; -using NWaves.Operations; -using NWaves.Signals; -using NWaves.Transforms; -using System; -using System.IO; -using System.Windows.Forms; - -namespace NWaves.DemoForms -{ - public partial class HpssForm : Form - { - private DiscreteSignal _signal; - private DiscreteSignal _harmonicSignal; - private DiscreteSignal _percussiveSignal; - - private short _bitDepth; - - private readonly MemoryStreamPlayer _player = new MemoryStreamPlayer(); - - public HpssForm() - { - InitializeComponent(); - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _signal = waveFile[Channels.Average]; - } - - Evaluate(); - } - - private void evaluateButton_Click(object sender, EventArgs e) - { - Evaluate(); - } - - private void Evaluate() - { - var fftSize = int.Parse(fftSizeTextBox.Text); - var hopSize = int.Parse(hopSizeTextBox.Text); - var harmWinSize = int.Parse(harmonicWindowTextBox.Text); - var percWinSize = int.Parse(percussiveWindowTextBox.Text); - var masking = HpsMasking.Binary; - - if (maskingComboBox.SelectedIndex == 1) masking = HpsMasking.WienerOrder1; - else if (maskingComboBox.SelectedIndex == 2) masking = HpsMasking.WienerOrder2; - - var hpss = new HarmonicPercussiveSeparator(fftSize, hopSize, harmWinSize, percWinSize, masking) - .EvaluateSignals(_signal); - //.EvaluateSpectrograms(_signal); - - var stft = new Stft(512, 256); - - _harmonicSignal = hpss.Item1;// new DiscreteSignal(_signal.SamplingRate, stft.ReconstructMagnitudePhase(hpss.Item1)); - _percussiveSignal = hpss.Item2;// new DiscreteSignal(_signal.SamplingRate, stft.ReconstructMagnitudePhase(hpss.Item2)); - - spectrogramPlot1.Spectrogram = stft.Spectrogram(_signal); - spectrogramPlot2.Spectrogram = stft.Spectrogram(_harmonicSignal); - spectrogramPlot3.Spectrogram = stft.Spectrogram(_percussiveSignal); - } - - private async void playButton1_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_signal); - } - - private async void playButton2_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_harmonicSignal); - } - - private async void playButton3_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_percussiveSignal * 2); - } - } -} diff --git a/NWaves.DemoForms/HpssForm.resx b/NWaves.DemoForms/HpssForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/HpssForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/LpcForm.Designer.cs b/NWaves.DemoForms/LpcForm.Designer.cs deleted file mode 100644 index 1e722e6..0000000 --- a/NWaves.DemoForms/LpcForm.Designer.cs +++ /dev/null @@ -1,124 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class LpcForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.lpcListView = new System.Windows.Forms.ListView(); - this.lpcPanel = new LinePlot(); - this.spectrumPanel = new LinePlot(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1030, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // lpcListView - // - this.lpcListView.FullRowSelect = true; - this.lpcListView.GridLines = true; - this.lpcListView.Location = new System.Drawing.Point(12, 41); - this.lpcListView.Name = "lpcListView"; - this.lpcListView.Size = new System.Drawing.Size(1004, 366); - this.lpcListView.TabIndex = 6; - this.lpcListView.UseCompatibleStateImageBehavior = false; - this.lpcListView.View = System.Windows.Forms.View.Details; - this.lpcListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lpcListView_ItemSelectionChanged); - // - // lpcPanel - // - this.lpcPanel.BackColor = System.Drawing.Color.White; - this.lpcPanel.Location = new System.Drawing.Point(605, 413); - this.lpcPanel.Name = "lpcPanel"; - this.lpcPanel.Size = new System.Drawing.Size(411, 210); - this.lpcPanel.TabIndex = 5; - // - // spectrumPanel - // - this.spectrumPanel.BackColor = System.Drawing.Color.White; - this.spectrumPanel.Location = new System.Drawing.Point(11, 413); - this.spectrumPanel.Name = "spectrumPanel"; - this.spectrumPanel.Size = new System.Drawing.Size(588, 210); - this.spectrumPanel.TabIndex = 4; - // - // LpcForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1030, 635); - this.Controls.Add(this.lpcListView); - this.Controls.Add(this.lpcPanel); - this.Controls.Add(this.spectrumPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "LpcForm"; - this.Text = "LpcForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.ListView lpcListView; - private LinePlot lpcPanel; - private LinePlot spectrumPanel; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/LpcForm.cs b/NWaves.DemoForms/LpcForm.cs deleted file mode 100644 index 8e5b001..0000000 --- a/NWaves.DemoForms/LpcForm.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.FeatureExtractors; -using NWaves.FeatureExtractors.Base; -using NWaves.FeatureExtractors.Options; -using NWaves.Filters.Base; -using NWaves.Filters.Fda; -using NWaves.Signals; -using NWaves.Transforms; -using NWaves.Utils; -using NWaves.Windows; - -namespace NWaves.DemoForms -{ - public partial class LpcForm : Form - { - private const double FrameDuration = 0.032; - private const double HopDuration = 0.010; - - private DiscreteSignal _signal; - private List _lpcVectors; - - private RealFft _fft; - - - public LpcForm() - { - InitializeComponent(); - lpcPanel.ForeColor = Color.SeaGreen; - lpcPanel.Stride = 20; - lpcPanel.Thickness = 2; - spectrumPanel.Stride = 2; - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - - _fft = new RealFft(512); - - var options = new LpcOptions - { - SamplingRate = _signal.SamplingRate, - LpcOrder = 16, - FrameDuration = FrameDuration, - HopDuration = HopDuration - }; - - var lpcExtractor = new LpcExtractor(options); - - //var lpcExtractor = new LpccExtractor(options); - - //var lpcExtractor = new PlpExtractor(_signal.SamplingRate, 10, - // lpcOrder: 8, - // rasta: 0.94, - // filterbankSize: 20, - // //lifterSize: 22, - // window: WindowTypes.Hann); - - _lpcVectors = lpcExtractor.ParallelComputeFrom(_signal); - - FillFeaturesList(_lpcVectors, lpcExtractor.FeatureDescriptions, lpcExtractor.TimeMarkers(_lpcVectors.Count)); - lpcListView.Items[0].Selected = true; - - spectrumPanel.Line = ComputeSpectrum(0); - spectrumPanel.Markline = EstimateSpectrum(0); - spectrumPanel.ToDecibel(); - - lpcPanel.Line = _lpcVectors[0].Skip(1).ToArray(); - } - - float[] ComputeSpectrum(int idx) - { - var pos = (int)(_signal.SamplingRate * HopDuration * idx); - - return _fft.PowerSpectrum(_signal[pos, pos + 512], normalize: false) - .Samples; - } - - float[] EstimateSpectrum(int idx) - { - // LPC-reconstructed spectrum: - - var vector = _lpcVectors[idx].ToDoubles(); // make new copy of array of features - var gain = Math.Sqrt(vector[0]); - vector[0] = 1.0; - - var lpcTf = new TransferFunction(new[] { gain }, vector); - - return lpcTf.FrequencyResponse().Power.ToFloats(); - - - // LPCC- / PLP-reconstructed spectrum: - - //var lpcc = _lpcVectors[idx].Features; - //var lpc = new float[lpcc.Length]; - //var gain = Lpc.FromCepstrum(lpcc, lpc); - - //var vector = lpc.ToDoubles(); - //vector[0] = 1.0; - - //var lpcTf = new TransferFunction(new double[] { Math.Sqrt(gain) }, vector); - - //return lpcTf.FrequencyResponse().Power.ToFloats(); - } - - private void FillFeaturesList(IList featureVectors, - IList featureDescriptions, - IList timeMarkers) - { - lpcListView.Clear(); - lpcListView.Columns.Add("time", 50); - - foreach (var name in featureDescriptions) - { - lpcListView.Columns.Add(name, 70); - } - - for (var i = 0; i < featureVectors.Count; i++) - { - var item = new ListViewItem { Text = timeMarkers[i].ToString("F4") }; - item.SubItems.AddRange(featureVectors[i].Select(f => f.ToString("F4")).ToArray()); - - lpcListView.Items.Add(item); - } - } - - private void lpcListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) - { - var pos = e.ItemIndex; - - spectrumPanel.Line = ComputeSpectrum(pos); - spectrumPanel.Markline = EstimateSpectrum(pos); - spectrumPanel.ToDecibel(); - - lpcPanel.Line = _lpcVectors[pos].Skip(1).ToArray(); - } - } -} - -// ============================================== TEST PLP extractor against HTK: ======================================================== - -//const int sr = 16000; -//var melbands = FilterBanks.MelBands(24, sr, 0, 8000); -//var melbank = FilterBanks.Triangular(512, sr, melbands, null, Utils.Scale.HerzToMel); - -//var opts = new PlpOptions -//{ -// SamplingRate = sr, -// FeatureCount = 13, -// FrameDuration = 512.0 / sr, -// FilterBank = melbank, -// CenterFrequencies = melbands.Select(m => m.Item2).ToArray(), -// Window = WindowTypes.Rectangular -//}; -//var lpcExtractor = new PlpExtractor(opts); - -//var data = new float[] { 1, 7, 2, 5, 4, 9, 1, 2, 3, 4, 5, 3, 4, 7, 6, 5, 1, 2, 3, 4, 5, 7, 7, 2, 3, 1, 9 }.PadZeros(512); - -//for (var i = 0; i< 30; i++) data[i + 40] = -data[i]; -//for (var i = 0; i< 70; i += 2) data[i] = -data[i]; - -//_signal = new DiscreteSignal(sr, data); -//_lpcVectors = lpcExtractor.ComputeFrom(_signal); - -//// HTK result: -//// -0.580443, -0.0684327, -0.227281, -0.10092, -0.0703564, -0.0446244, -0.104119, -0.0334703, -0.102588, -0.00156306, 0.0435456, 0.0358385, - -// ========================================================================================================================================== diff --git a/NWaves.DemoForms/LpcForm.resx b/NWaves.DemoForms/LpcForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/LpcForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/MemoryStreamPlayer.cs b/NWaves.DemoForms/MemoryStreamPlayer.cs deleted file mode 100644 index abf525a..0000000 --- a/NWaves.DemoForms/MemoryStreamPlayer.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.IO; -using System.Media; -using System.Threading.Tasks; -using NWaves.Audio; -using NWaves.Audio.Interfaces; -using NWaves.Signals; - -namespace NWaves.DemoForms -{ - /// - /// Simple player wrapped around System.Media.SoundPlayer - /// - public class MemoryStreamPlayer : IAudioPlayer - { - private SoundPlayer _player; - - public async Task PlayAsync(string location, int startPos = 0, int endPos = -1) - { - _player?.Dispose(); - _player = new SoundPlayer(location); - _player.Play(); - } - - public async Task PlayAsync(DiscreteSignal signal, int startPos = 0, int endPos = -1, short bitDepth = 16) - { - var stream = new MemoryStream(); - var wave = new WaveFile(signal, bitDepth); - wave.SaveTo(stream); - - stream = new MemoryStream(stream.ToArray()); - - _player?.Dispose(); - _player = new SoundPlayer(stream); - _player.Stream.Seek(0, SeekOrigin.Begin); - _player.Play(); - } - - public void Pause() - { - _player.Stop(); - } - - public void Resume() - { - _player.Play(); - } - - public void Stop() - { - _player.Stop(); - } - - public float Volume { get; set; } - } -} diff --git a/NWaves.DemoForms/MfccForm.Designer.cs b/NWaves.DemoForms/MfccForm.Designer.cs deleted file mode 100644 index ce26a31..0000000 --- a/NWaves.DemoForms/MfccForm.Designer.cs +++ /dev/null @@ -1,513 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class MfccForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.melFilterBankPanel = new NWaves.DemoForms.UserControls.GroupPlot(); - this.mfccPanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.mfccListView = new System.Windows.Forms.ListView(); - this.checkBoxOverlap = new System.Windows.Forms.CheckBox(); - this.label27 = new System.Windows.Forms.Label(); - this.comboBoxShape = new System.Windows.Forms.ComboBox(); - this.textBoxFftSize = new System.Windows.Forms.TextBox(); - this.label21 = new System.Windows.Forms.Label(); - this.textBoxHighFreq = new System.Windows.Forms.TextBox(); - this.label20 = new System.Windows.Forms.Label(); - this.textBoxLowFreq = new System.Windows.Forms.TextBox(); - this.label19 = new System.Windows.Forms.Label(); - this.buttonCompute = new System.Windows.Forms.Button(); - this.textBoxSize = new System.Windows.Forms.TextBox(); - this.label18 = new System.Windows.Forms.Label(); - this.label17 = new System.Windows.Forms.Label(); - this.comboBoxFilterbank = new System.Windows.Forms.ComboBox(); - this.textBoxVtlnAlpha = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.comboBoxSpectrum = new System.Windows.Forms.ComboBox(); - this.comboBoxNonLinearity = new System.Windows.Forms.ComboBox(); - this.textBoxLogFloor = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.checkBoxNormalize = new System.Windows.Forms.CheckBox(); - this.textBoxVtlnLow = new System.Windows.Forms.TextBox(); - this.textBoxVtlnHigh = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.checkBoxVtln = new System.Windows.Forms.CheckBox(); - this.label7 = new System.Windows.Forms.Label(); - this.comboBoxDct = new System.Windows.Forms.ComboBox(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(937, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // melFilterBankPanel - // - this.melFilterBankPanel.AutoScroll = true; - this.melFilterBankPanel.BackColor = System.Drawing.Color.White; - this.melFilterBankPanel.Gain = 100; - this.melFilterBankPanel.Groups = null; - this.melFilterBankPanel.Location = new System.Drawing.Point(12, 465); - this.melFilterBankPanel.Name = "melFilterBankPanel"; - this.melFilterBankPanel.Size = new System.Drawing.Size(588, 160); - this.melFilterBankPanel.Stride = 2; - this.melFilterBankPanel.TabIndex = 1; - // - // mfccPanel - // - this.mfccPanel.AutoScroll = true; - this.mfccPanel.BackColor = System.Drawing.Color.White; - this.mfccPanel.ForeColor = System.Drawing.Color.Blue; - this.mfccPanel.Location = new System.Drawing.Point(606, 465); - this.mfccPanel.Name = "mfccPanel"; - this.mfccPanel.PaddingX = 30; - this.mfccPanel.PaddingY = 20; - this.mfccPanel.Size = new System.Drawing.Size(322, 160); - this.mfccPanel.Stride = 1; - this.mfccPanel.TabIndex = 2; - this.mfccPanel.Thickness = 1; - // - // mfccListView - // - this.mfccListView.FullRowSelect = true; - this.mfccListView.GridLines = true; - this.mfccListView.Location = new System.Drawing.Point(13, 32); - this.mfccListView.Name = "mfccListView"; - this.mfccListView.Size = new System.Drawing.Size(915, 322); - this.mfccListView.TabIndex = 3; - this.mfccListView.UseCompatibleStateImageBehavior = false; - this.mfccListView.View = System.Windows.Forms.View.Details; - this.mfccListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.mfccListView_ItemSelectionChanged); - // - // checkBoxOverlap - // - this.checkBoxOverlap.AutoSize = true; - this.checkBoxOverlap.Location = new System.Drawing.Point(107, 366); - this.checkBoxOverlap.Name = "checkBoxOverlap"; - this.checkBoxOverlap.Size = new System.Drawing.Size(77, 21); - this.checkBoxOverlap.TabIndex = 53; - this.checkBoxOverlap.Text = "overlap"; - this.checkBoxOverlap.UseVisualStyleBackColor = true; - // - // label27 - // - this.label27.AutoSize = true; - this.label27.Location = new System.Drawing.Point(12, 432); - this.label27.Name = "label27"; - this.label27.Size = new System.Drawing.Size(49, 17); - this.label27.TabIndex = 52; - this.label27.Text = "Shape"; - // - // comboBoxShape - // - this.comboBoxShape.FormattingEnabled = true; - this.comboBoxShape.Items.AddRange(new object[] { - "Triangular", - "Rectangular", - "Trapezoidal", - "BiQuad"}); - this.comboBoxShape.Location = new System.Drawing.Point(75, 430); - this.comboBoxShape.Name = "comboBoxShape"; - this.comboBoxShape.Size = new System.Drawing.Size(109, 24); - this.comboBoxShape.TabIndex = 51; - this.comboBoxShape.Text = "Triangular"; - // - // textBoxFftSize - // - this.textBoxFftSize.Location = new System.Drawing.Point(340, 430); - this.textBoxFftSize.Name = "textBoxFftSize"; - this.textBoxFftSize.Size = new System.Drawing.Size(60, 22); - this.textBoxFftSize.TabIndex = 48; - this.textBoxFftSize.Text = "512"; - // - // label21 - // - this.label21.AutoSize = true; - this.label21.Location = new System.Drawing.Point(338, 402); - this.label21.Name = "label21"; - this.label21.Size = new System.Drawing.Size(62, 17); - this.label21.TabIndex = 47; - this.label21.Text = "FFT size"; - // - // textBoxHighFreq - // - this.textBoxHighFreq.Location = new System.Drawing.Point(275, 430); - this.textBoxHighFreq.Name = "textBoxHighFreq"; - this.textBoxHighFreq.Size = new System.Drawing.Size(54, 22); - this.textBoxHighFreq.TabIndex = 46; - this.textBoxHighFreq.Text = "8000"; - // - // label20 - // - this.label20.AutoSize = true; - this.label20.Location = new System.Drawing.Point(203, 430); - this.label20.Name = "label20"; - this.label20.Size = new System.Drawing.Size(66, 17); - this.label20.TabIndex = 45; - this.label20.Text = "HighFreq"; - // - // textBoxLowFreq - // - this.textBoxLowFreq.Location = new System.Drawing.Point(275, 400); - this.textBoxLowFreq.Name = "textBoxLowFreq"; - this.textBoxLowFreq.Size = new System.Drawing.Size(54, 22); - this.textBoxLowFreq.TabIndex = 44; - this.textBoxLowFreq.Text = "0"; - // - // label19 - // - this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(203, 402); - this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(62, 17); - this.label19.TabIndex = 43; - this.label19.Text = "LowFreq"; - // - // buttonCompute - // - this.buttonCompute.Location = new System.Drawing.Point(859, 369); - this.buttonCompute.Name = "buttonCompute"; - this.buttonCompute.Size = new System.Drawing.Size(69, 87); - this.buttonCompute.TabIndex = 42; - this.buttonCompute.Text = ">>"; - this.buttonCompute.UseVisualStyleBackColor = true; - this.buttonCompute.Click += new System.EventHandler(this.buttonCompute_Click); - // - // textBoxSize - // - this.textBoxSize.Location = new System.Drawing.Point(53, 364); - this.textBoxSize.Name = "textBoxSize"; - this.textBoxSize.Size = new System.Drawing.Size(38, 22); - this.textBoxSize.TabIndex = 41; - this.textBoxSize.Text = "13"; - // - // label18 - // - this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(12, 366); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(35, 17); - this.label18.TabIndex = 40; - this.label18.Text = "Size"; - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(12, 401); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(74, 17); - this.label17.TabIndex = 39; - this.label17.Text = "Filter bank"; - // - // comboBoxFilterbank - // - this.comboBoxFilterbank.FormattingEnabled = true; - this.comboBoxFilterbank.Items.AddRange(new object[] { - "Herz", - "Mel", - "Mel Slaney", - "Bark", - "Bark Slaney", - "Critical bands", - "ERB", - "Octave bands"}); - this.comboBoxFilterbank.Location = new System.Drawing.Point(92, 398); - this.comboBoxFilterbank.Name = "comboBoxFilterbank"; - this.comboBoxFilterbank.Size = new System.Drawing.Size(92, 24); - this.comboBoxFilterbank.TabIndex = 38; - this.comboBoxFilterbank.Text = "Mel"; - // - // textBoxVtlnAlpha - // - this.textBoxVtlnAlpha.Location = new System.Drawing.Point(546, 372); - this.textBoxVtlnAlpha.Name = "textBoxVtlnAlpha"; - this.textBoxVtlnAlpha.Size = new System.Drawing.Size(54, 22); - this.textBoxVtlnAlpha.TabIndex = 55; - this.textBoxVtlnAlpha.Text = "1"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(485, 373); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(43, 17); - this.label1.TabIndex = 54; - this.label1.Text = "alpha"; - // - // comboBoxSpectrum - // - this.comboBoxSpectrum.FormattingEnabled = true; - this.comboBoxSpectrum.Location = new System.Drawing.Point(737, 359); - this.comboBoxSpectrum.Name = "comboBoxSpectrum"; - this.comboBoxSpectrum.Size = new System.Drawing.Size(116, 24); - this.comboBoxSpectrum.TabIndex = 56; - this.comboBoxSpectrum.Text = "Power"; - // - // comboBoxNonLinearity - // - this.comboBoxNonLinearity.FormattingEnabled = true; - this.comboBoxNonLinearity.Location = new System.Drawing.Point(737, 386); - this.comboBoxNonLinearity.Name = "comboBoxNonLinearity"; - this.comboBoxNonLinearity.Size = new System.Drawing.Size(116, 24); - this.comboBoxNonLinearity.TabIndex = 57; - this.comboBoxNonLinearity.Text = "LogE"; - // - // textBoxLogFloor - // - this.textBoxLogFloor.Location = new System.Drawing.Point(737, 413); - this.textBoxLogFloor.Name = "textBoxLogFloor"; - this.textBoxLogFloor.Size = new System.Drawing.Size(116, 22); - this.textBoxLogFloor.TabIndex = 59; - this.textBoxLogFloor.Text = "1e-45"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(620, 413); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(64, 17); - this.label2.TabIndex = 58; - this.label2.Text = "Log floor"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(619, 361); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(99, 17); - this.label3.TabIndex = 60; - this.label3.Text = "Spectrum type"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(619, 388); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(88, 17); - this.label4.TabIndex = 61; - this.label4.Text = "Non-linearity"; - // - // checkBoxNormalize - // - this.checkBoxNormalize.AutoSize = true; - this.checkBoxNormalize.Location = new System.Drawing.Point(192, 366); - this.checkBoxNormalize.Name = "checkBoxNormalize"; - this.checkBoxNormalize.Size = new System.Drawing.Size(91, 21); - this.checkBoxNormalize.TabIndex = 62; - this.checkBoxNormalize.Text = "normalize"; - this.checkBoxNormalize.UseVisualStyleBackColor = true; - // - // textBoxVtlnLow - // - this.textBoxVtlnLow.Location = new System.Drawing.Point(546, 400); - this.textBoxVtlnLow.Name = "textBoxVtlnLow"; - this.textBoxVtlnLow.Size = new System.Drawing.Size(54, 22); - this.textBoxVtlnLow.TabIndex = 63; - this.textBoxVtlnLow.Text = "0"; - // - // textBoxVtlnHigh - // - this.textBoxVtlnHigh.Location = new System.Drawing.Point(546, 428); - this.textBoxVtlnHigh.Name = "textBoxVtlnHigh"; - this.textBoxVtlnHigh.Size = new System.Drawing.Size(54, 22); - this.textBoxVtlnHigh.TabIndex = 64; - this.textBoxVtlnHigh.Text = "8000"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(485, 402); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(28, 17); - this.label5.TabIndex = 65; - this.label5.Text = "low"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(485, 431); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(35, 17); - this.label6.TabIndex = 66; - this.label6.Text = "high"; - // - // checkBoxVtln - // - this.checkBoxVtln.AutoSize = true; - this.checkBoxVtln.Location = new System.Drawing.Point(413, 366); - this.checkBoxVtln.Name = "checkBoxVtln"; - this.checkBoxVtln.Size = new System.Drawing.Size(66, 21); - this.checkBoxVtln.TabIndex = 67; - this.checkBoxVtln.Text = "VTLN"; - this.checkBoxVtln.UseVisualStyleBackColor = true; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(619, 440); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(67, 17); - this.label7.TabIndex = 69; - this.label7.Text = "DCT type"; - // - // comboBoxDct - // - this.comboBoxDct.FormattingEnabled = true; - this.comboBoxDct.Items.AddRange(new object[] { - "1", - "2", - "3", - "4", - "1N", - "2N", - "3N", - "4N"}); - this.comboBoxDct.Location = new System.Drawing.Point(737, 438); - this.comboBoxDct.Name = "comboBoxDct"; - this.comboBoxDct.Size = new System.Drawing.Size(116, 24); - this.comboBoxDct.TabIndex = 68; - this.comboBoxDct.Text = "2N"; - // - // MfccForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(937, 637); - this.Controls.Add(this.label7); - this.Controls.Add(this.comboBoxDct); - this.Controls.Add(this.checkBoxVtln); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.textBoxVtlnHigh); - this.Controls.Add(this.textBoxVtlnLow); - this.Controls.Add(this.checkBoxNormalize); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.textBoxLogFloor); - this.Controls.Add(this.label2); - this.Controls.Add(this.comboBoxNonLinearity); - this.Controls.Add(this.comboBoxSpectrum); - this.Controls.Add(this.textBoxVtlnAlpha); - this.Controls.Add(this.label1); - this.Controls.Add(this.checkBoxOverlap); - this.Controls.Add(this.label27); - this.Controls.Add(this.comboBoxShape); - this.Controls.Add(this.textBoxFftSize); - this.Controls.Add(this.label21); - this.Controls.Add(this.textBoxHighFreq); - this.Controls.Add(this.label20); - this.Controls.Add(this.textBoxLowFreq); - this.Controls.Add(this.label19); - this.Controls.Add(this.buttonCompute); - this.Controls.Add(this.textBoxSize); - this.Controls.Add(this.label18); - this.Controls.Add(this.label17); - this.Controls.Add(this.comboBoxFilterbank); - this.Controls.Add(this.mfccListView); - this.Controls.Add(this.mfccPanel); - this.Controls.Add(this.melFilterBankPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "MfccForm"; - this.Text = "MfccForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private GroupPlot melFilterBankPanel; - private LinePlot mfccPanel; - private System.Windows.Forms.ListView mfccListView; - private System.Windows.Forms.CheckBox checkBoxOverlap; - private System.Windows.Forms.Label label27; - private System.Windows.Forms.ComboBox comboBoxShape; - private System.Windows.Forms.TextBox textBoxFftSize; - private System.Windows.Forms.Label label21; - private System.Windows.Forms.TextBox textBoxHighFreq; - private System.Windows.Forms.Label label20; - private System.Windows.Forms.TextBox textBoxLowFreq; - private System.Windows.Forms.Label label19; - private System.Windows.Forms.Button buttonCompute; - private System.Windows.Forms.TextBox textBoxSize; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.ComboBox comboBoxFilterbank; - private System.Windows.Forms.TextBox textBoxVtlnAlpha; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox comboBoxSpectrum; - private System.Windows.Forms.ComboBox comboBoxNonLinearity; - private System.Windows.Forms.TextBox textBoxLogFloor; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.CheckBox checkBoxNormalize; - private System.Windows.Forms.TextBox textBoxVtlnLow; - private System.Windows.Forms.TextBox textBoxVtlnHigh; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.CheckBox checkBoxVtln; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.ComboBox comboBoxDct; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/MfccForm.cs b/NWaves.DemoForms/MfccForm.cs deleted file mode 100644 index 6743e55..0000000 --- a/NWaves.DemoForms/MfccForm.cs +++ /dev/null @@ -1,397 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.FeatureExtractors; -using NWaves.FeatureExtractors.Base; -using NWaves.FeatureExtractors.Multi; -using NWaves.FeatureExtractors.Options; -using NWaves.FeatureExtractors.Serializers; -using NWaves.Filters; -using NWaves.Filters.Base; -using NWaves.Filters.Fda; -using NWaves.Signals; -using NWaves.Transforms; -using NWaves.Windows; - -namespace NWaves.DemoForms -{ - public partial class MfccForm : Form - { - private DiscreteSignal _signal; - private List _mfccVectors, pnccVectors; - - public MfccForm() - { - InitializeComponent(); - - mfccPanel.ForeColor = Color.SeaGreen; - mfccPanel.Thickness = 2; - mfccPanel.Stride = 20; - - comboBoxNonLinearity.Items.AddRange(Enum.GetNames(typeof(NonLinearityType))); - comboBoxSpectrum.Items.AddRange(Enum.GetNames(typeof(SpectrumType))); - - comboBoxNonLinearity.SelectedIndex = 0; - comboBoxSpectrum.SelectedIndex = 1; - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - - buttonCompute_Click(this, null); // :-D - } - - private void FillFeaturesList(IList featureVectors, - IList featureDescriptions, - IList timeMarkers) - { - mfccListView.Clear(); - mfccListView.Columns.Add("time", 50); - - foreach (var feat in featureDescriptions) - { - mfccListView.Columns.Add(feat, 70); - } - - for (var i = 0; i < featureVectors.Count; i++) - { - var item = new ListViewItem { Text = timeMarkers[i].ToString("F4") }; - item.SubItems.AddRange(featureVectors[i].Select(f => f.ToString("F4")).ToArray()); - - mfccListView.Items.Add(item); - } - } - - private void buttonCompute_Click(object sender, EventArgs e) - { - var filterCount = int.Parse(textBoxSize.Text); - var samplingRate = _signal.SamplingRate; - var fftSize = int.Parse(textBoxFftSize.Text); - var lowFreq = float.Parse(textBoxLowFreq.Text); - var highFreq = float.Parse(textBoxHighFreq.Text); - - (double, double, double)[] bands; - float[][] filterbank = null; - VtlnWarper vtln = null; - - if (checkBoxVtln.Checked) - { - var alpha = float.Parse(textBoxVtlnAlpha.Text); - var vtlnLow = float.Parse(textBoxVtlnLow.Text); - var vtlnHigh = float.Parse(textBoxVtlnHigh.Text); - - vtln = new VtlnWarper(alpha, lowFreq, highFreq, vtlnLow, vtlnHigh); - } - - switch (comboBoxFilterbank.Text) - { - case "Mel": - bands = FilterBanks.MelBands(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - break; - case "Mel Slaney": - bands = FilterBanks.MelBandsSlaney(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - filterbank = FilterBanks.MelBankSlaney(filterCount, fftSize, samplingRate, lowFreq, highFreq, checkBoxNormalize.Checked, vtln); - break; - case "Bark": - bands = FilterBanks.BarkBands(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - break; - case "Bark Slaney": - bands = FilterBanks.BarkBandsSlaney(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - filterbank = FilterBanks.BarkBankSlaney(filterCount, fftSize, samplingRate, lowFreq, highFreq); - break; - case "Critical bands": - bands = FilterBanks.CriticalBands(filterCount, samplingRate, lowFreq, highFreq); - break; - case "Octave bands": - bands = FilterBanks.OctaveBands(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - break; - case "ERB": - bands = null; - filterbank = FilterBanks.Erb(filterCount, fftSize, samplingRate, lowFreq, highFreq); - break; - default: - bands = FilterBanks.HerzBands(filterCount, samplingRate, lowFreq, highFreq, checkBoxOverlap.Checked); - break; - } - - if (bands != null && filterbank == null) - { - switch (comboBoxShape.Text) - { - case "Triangular": - filterbank = FilterBanks.Triangular(fftSize, samplingRate, bands, vtln, Utils.Scale.HerzToMel); - break; - case "Trapezoidal": - filterbank = FilterBanks.Trapezoidal(fftSize, samplingRate, bands, vtln); - break; - case "BiQuad": - filterbank = FilterBanks.BiQuad(fftSize, samplingRate, bands); - break; - default: - filterbank = FilterBanks.Rectangular(fftSize, samplingRate, bands, vtln); - break; - } - - if (checkBoxNormalize.Checked) FilterBanks.Normalize(filterCount, bands, filterbank); - } - - - var spectrumType = (SpectrumType)comboBoxSpectrum.SelectedIndex; - var nonLinearity = (NonLinearityType)comboBoxNonLinearity.SelectedIndex; - var logFloor = float.Parse(textBoxLogFloor.Text); - - var mfccOptions = new MfccOptions - { - SamplingRate = samplingRate, - FeatureCount = 13, - FrameDuration = 512.0 / samplingRate, - HopDuration = 0.01, - FilterBank = filterbank, - SpectrumType = spectrumType, - NonLinearity = nonLinearity, - DctType = comboBoxDct.Text, - Window = WindowType.Hamming, - LogFloor = logFloor, - //FilterBankSize = 26, - //HighFrequency = 6000, - //PreEmphasis = 0.97, - //LifterSize = 22, - //IncludeEnergy = true, - //LogEnergyFloor = 1e-10 - }; - - var mfccExtractor = new MfccExtractor(mfccOptions); - _mfccVectors = mfccExtractor.ComputeFrom(_signal); - - //FeaturePostProcessing.NormalizeMean(_mfccVectors); // optional - //FeaturePostProcessing.AddDeltas(_mfccVectors); - - var header = mfccExtractor.FeatureDescriptions; - //.Concat(mfccExtractor.DeltaFeatureDescriptions) - //.Concat(mfccExtractor.DeltaDeltaFeatureDescriptions); - - FillFeaturesList(_mfccVectors, header, mfccExtractor.TimeMarkers(_mfccVectors.Count)); - mfccListView.Items[0].Selected = true; - - melFilterBankPanel.Groups = mfccExtractor.FilterBank; - - mfccPanel.Line = _mfccVectors[0]; - } - - private void mfccListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) - { - mfccPanel.Line = _mfccVectors[e.ItemIndex]; - - // ============== I use this code to test PNCC results (just ignore it))): ======================== - - //mfccPanel.Line = _mfccVectors[e.ItemIndex]; - //mfccPanel.Markline = pnccVectors[e.ItemIndex]; - - // ================================================================================================ - } - } - - - // If you want to test MFCC against HTK ======================================================= - // keep in mind that HTK does the following pre-processing: zero-mean and pre-emphasis ======== - // (turn these settings off in HTK config if possible): ======================================= - - // HTK does this pre-processing per frame instead of entire signal - // (which is weird given that frames overlap). - - // Also: HTK DOESN't normalize signal! If it's normalized then multiply by 32768 before processing: - - // _signal *= 32768; - // _extractor.ComputeFrom(_signal); - - class MfccExtractorTestHtk : MfccExtractor - { - private readonly float[] _hammingWin; - - public MfccExtractorTestHtk(MfccOptions options) : base(options) - { - _hammingWin = Window.OfType(WindowType.Hamming, FrameSize); - } - - /// - /// HTK-style pre-processing (zero-mean and pre-emphasis) - /// - /// - /// - public override void ProcessFrame(float[] block, float[] features) - { - // 1) HTK zero-mean: - - var frameSize = FrameSize; - - var mean = block.Take(frameSize).Average(); - - for (var k = 0; k < frameSize; k++) - { - block[k] -= mean; - block[k] += Math.Sign(block[k]) * 0.5f; - } - - // 2) HTK pre-emphasis (it's different from conventional pre-emphasis!): - - // set base _preEmphasis field to 0 and do pre-emphasis here: - - var pre = 0.97f; - - for (var k = frameSize - 1; k >= 1; k--) - { - block[k] -= block[k - 1] * pre; - } - block[0] *= 1 - pre; - - - // 3) apply hamming window: - - block.ApplyWindow(_hammingWin); - - - // ...and now continue standard computations: - - base.ProcessFrame(block, features); - } - - /// - /// True if computations can be done in parallel - /// - /// - public override bool IsParallelizable() => true; - - /// - /// Copy of current extractor that can work in parallel - /// - /// - public override FeatureExtractor ParallelCopy() => - new MfccExtractorTestHtk( - new MfccOptions - { - SamplingRate = SamplingRate, - FeatureCount = FeatureCount, - FrameDuration = FrameDuration, - HopDuration = HopDuration, - FilterBank = FilterBank, - FilterBankSize = FilterBank.Length, - FftSize = _blockSize, - LifterSize = _lifterSize, - PreEmphasis = _preEmphasis, - IncludeEnergy = _includeEnergy, - LogEnergyFloor = _logEnergyFloor, - SpectrumType = _spectrumType, - Window = _window - }); - } -} - - -// =================================================== TEST ParallelComputeFrom: ======================================================== - -//_mfccVectors = mfccExtractor.ComputeFrom(_signal); -//var mfccVectorsP = mfccExtractor.ParallelComputeFrom(_signal); - -//for (var i = 0; i < _mfccVectors.Count; i++) -//{ -// for (var j = 0; j < _mfccVectors[i].Length; j++) -// { -// if (Math.Abs(_mfccVectors[i][j] - mfccVectorsP[i][j]) > 1e-32f) -// { -// MessageBox.Show($"Nope: {i} - {j}"); -// return; -// } -// } -//} - - - - -// ====================================================== test PNCC: ============================================================= - -//var mfccExtractor = new PnccExtractor( -// new PnccOptions -// { -// SamplingRate = _signal.SamplingRate, -// FeatureCount = 13, -// PreEmphasis = 0.97, -// FftSize = 1024, -// Window = WindowTypes.Hamming -// }); - -//_mfccVectors = mfccExtractor.ComputeFrom(_signal); - -// FeaturePostProcessing.NormalizeMean(_mfccVectors); - - -// // ============== I use this code to test PNCC results (just ignore it))): ======================== - -// pnccVectors = new List(); -// var vector = new float[13]; -//var pos = 1; - -// using (var fs = new FileStream(@"E:\Projects\github\NWaves_Materials\pncc\esh_ru_0001.pncc", FileMode.Open)) -// using (var br = new BinaryReader(fs)) -// { -// while (pos< 700) -// { -// br.ReadSingle(); -// for (var i = 0; i< 12; i++) -// { -// vector[i] = br.ReadSingle(); -// } -// pnccVectors.Add(vector); -// vector = new float[13]; -// pos++; -// } -// } - -// mfccPanel.Markline = pnccVectors[0]; - -// // ================================================================================================ - - -// var header = mfccExtractor.FeatureDescriptions -// .Concat(mfccExtractor.DeltaFeatureDescriptions) -// .Concat(mfccExtractor.DeltaDeltaFeatureDescriptions); - -// FillFeaturesList(_mfccVectors, header); -// mfccListView.Items[0].Selected = true; - -// melFilterBankPanel.Groups = mfccExtractor.FilterBank; - -// mfccPanel.Line = _mfccVectors[0].Features; - -// //using (var csvFile = new FileStream("mfccs.csv", FileMode.Create)) -// //{ -// // var serializer = new CsvFeatureSerializer(_mfccVectors, header); -// // await serializer.SerializeAsync(csvFile); -// //} - - - - -// var sr = _signal.SamplingRate; - -// var melbands = FilterBanks.MelBands(26, 512, sr, 0, 8000); - -// // HTK, Kaldi: -// var melbank = FilterBanks.Triangular(512, sr, melbands, null, Utils.Scale.HerzToMel); - -// // LIBROSA: -// // var melbank = FilterBanks.Triangular(512, sr, melbands); \ No newline at end of file diff --git a/NWaves.DemoForms/MfccForm.resx b/NWaves.DemoForms/MfccForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/MfccForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/ModulationForm.Designer.cs b/NWaves.DemoForms/ModulationForm.Designer.cs deleted file mode 100644 index e5d25db..0000000 --- a/NWaves.DemoForms/ModulationForm.Designer.cs +++ /dev/null @@ -1,221 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class ModulationForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.demodulateButton = new System.Windows.Forms.Button(); - this.modulateButton = new System.Windows.Forms.Button(); - this.demodulatedPlot = new NWaves.DemoForms.UserControls.LinePlot(); - this.modulatedPlot = new NWaves.DemoForms.UserControls.LinePlot(); - this.carrierFrequencyTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.modulationFrequencyTextBox = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.modulationIndexTextBox = new System.Windows.Forms.TextBox(); - this.amplitudeRadioButton = new System.Windows.Forms.RadioButton(); - this.frequencyRadioButton = new System.Windows.Forms.RadioButton(); - this.phaseRadioButton = new System.Windows.Forms.RadioButton(); - this.SuspendLayout(); - // - // demodulateButton - // - this.demodulateButton.Location = new System.Drawing.Point(633, 305); - this.demodulateButton.Name = "demodulateButton"; - this.demodulateButton.Size = new System.Drawing.Size(204, 39); - this.demodulateButton.TabIndex = 2; - this.demodulateButton.Text = "Demodulate"; - this.demodulateButton.UseVisualStyleBackColor = true; - this.demodulateButton.Click += new System.EventHandler(this.demodulateButton_Click); - // - // modulateButton - // - this.modulateButton.Location = new System.Drawing.Point(633, 39); - this.modulateButton.Name = "modulateButton"; - this.modulateButton.Size = new System.Drawing.Size(204, 39); - this.modulateButton.TabIndex = 3; - this.modulateButton.Text = "Modulate"; - this.modulateButton.UseVisualStyleBackColor = true; - this.modulateButton.Click += new System.EventHandler(this.modulateButton_Click); - // - // demodulatedPlot - // - this.demodulatedPlot.AutoScroll = true; - this.demodulatedPlot.BackColor = System.Drawing.Color.White; - this.demodulatedPlot.ForeColor = System.Drawing.Color.Blue; - this.demodulatedPlot.Location = new System.Drawing.Point(12, 356); - this.demodulatedPlot.Name = "demodulatedPlot"; - this.demodulatedPlot.PaddingX = 30; - this.demodulatedPlot.PaddingY = 20; - this.demodulatedPlot.Size = new System.Drawing.Size(825, 165); - this.demodulatedPlot.Stride = 1; - this.demodulatedPlot.TabIndex = 1; - this.demodulatedPlot.Thickness = 1; - // - // modulatedPlot - // - this.modulatedPlot.AutoScroll = true; - this.modulatedPlot.BackColor = System.Drawing.Color.White; - this.modulatedPlot.ForeColor = System.Drawing.Color.Blue; - this.modulatedPlot.Location = new System.Drawing.Point(13, 123); - this.modulatedPlot.Name = "modulatedPlot"; - this.modulatedPlot.PaddingX = 30; - this.modulatedPlot.PaddingY = 20; - this.modulatedPlot.Size = new System.Drawing.Size(826, 165); - this.modulatedPlot.Stride = 1; - this.modulatedPlot.TabIndex = 0; - this.modulatedPlot.Thickness = 1; - // - // carrierFrequencyTextBox - // - this.carrierFrequencyTextBox.Location = new System.Drawing.Point(163, 24); - this.carrierFrequencyTextBox.Name = "carrierFrequencyTextBox"; - this.carrierFrequencyTextBox.Size = new System.Drawing.Size(65, 22); - this.carrierFrequencyTextBox.TabIndex = 4; - this.carrierFrequencyTextBox.Text = "3000"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 25); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(118, 17); - this.label1.TabIndex = 5; - this.label1.Text = "Carrier frequency"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(13, 53); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(144, 17); - this.label2.TabIndex = 7; - this.label2.Text = "Modulation frequency"; - // - // modulationFrequencyTextBox - // - this.modulationFrequencyTextBox.Location = new System.Drawing.Point(163, 52); - this.modulationFrequencyTextBox.Name = "modulationFrequencyTextBox"; - this.modulationFrequencyTextBox.Size = new System.Drawing.Size(65, 22); - this.modulationFrequencyTextBox.TabIndex = 6; - this.modulationFrequencyTextBox.Text = "100"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(13, 81); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(114, 17); - this.label3.TabIndex = 9; - this.label3.Text = "Modulation index"; - // - // modulationIndexTextBox - // - this.modulationIndexTextBox.Location = new System.Drawing.Point(163, 80); - this.modulationIndexTextBox.Name = "modulationIndexTextBox"; - this.modulationIndexTextBox.Size = new System.Drawing.Size(65, 22); - this.modulationIndexTextBox.TabIndex = 8; - this.modulationIndexTextBox.Text = "0,5"; - // - // amplitudeRadioButton - // - this.amplitudeRadioButton.AutoSize = true; - this.amplitudeRadioButton.Checked = true; - this.amplitudeRadioButton.Location = new System.Drawing.Point(317, 24); - this.amplitudeRadioButton.Name = "amplitudeRadioButton"; - this.amplitudeRadioButton.Size = new System.Drawing.Size(91, 21); - this.amplitudeRadioButton.TabIndex = 10; - this.amplitudeRadioButton.TabStop = true; - this.amplitudeRadioButton.Text = "Amplitude"; - this.amplitudeRadioButton.UseVisualStyleBackColor = true; - this.amplitudeRadioButton.CheckedChanged += new System.EventHandler(this.amplitudeRadioButton_CheckedChanged); - // - // frequencyRadioButton - // - this.frequencyRadioButton.AutoSize = true; - this.frequencyRadioButton.Location = new System.Drawing.Point(317, 53); - this.frequencyRadioButton.Name = "frequencyRadioButton"; - this.frequencyRadioButton.Size = new System.Drawing.Size(96, 21); - this.frequencyRadioButton.TabIndex = 11; - this.frequencyRadioButton.Text = "Frequency"; - this.frequencyRadioButton.UseVisualStyleBackColor = true; - this.frequencyRadioButton.CheckedChanged += new System.EventHandler(this.frequencyRadioButton_CheckedChanged); - // - // phaseRadioButton - // - this.phaseRadioButton.AutoSize = true; - this.phaseRadioButton.Location = new System.Drawing.Point(317, 81); - this.phaseRadioButton.Name = "phaseRadioButton"; - this.phaseRadioButton.Size = new System.Drawing.Size(69, 21); - this.phaseRadioButton.TabIndex = 12; - this.phaseRadioButton.Text = "Phase"; - this.phaseRadioButton.UseVisualStyleBackColor = true; - this.phaseRadioButton.CheckedChanged += new System.EventHandler(this.phaseRadioButton_CheckedChanged); - // - // ModulationForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(851, 533); - this.Controls.Add(this.phaseRadioButton); - this.Controls.Add(this.frequencyRadioButton); - this.Controls.Add(this.amplitudeRadioButton); - this.Controls.Add(this.label3); - this.Controls.Add(this.modulationIndexTextBox); - this.Controls.Add(this.label2); - this.Controls.Add(this.modulationFrequencyTextBox); - this.Controls.Add(this.label1); - this.Controls.Add(this.carrierFrequencyTextBox); - this.Controls.Add(this.modulateButton); - this.Controls.Add(this.demodulateButton); - this.Controls.Add(this.demodulatedPlot); - this.Controls.Add(this.modulatedPlot); - this.Name = "ModulationForm"; - this.Text = "ModulationForm"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private UserControls.LinePlot modulatedPlot; - private UserControls.LinePlot demodulatedPlot; - private System.Windows.Forms.Button demodulateButton; - private System.Windows.Forms.Button modulateButton; - private System.Windows.Forms.TextBox carrierFrequencyTextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox modulationFrequencyTextBox; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox modulationIndexTextBox; - private System.Windows.Forms.RadioButton amplitudeRadioButton; - private System.Windows.Forms.RadioButton frequencyRadioButton; - private System.Windows.Forms.RadioButton phaseRadioButton; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/ModulationForm.cs b/NWaves.DemoForms/ModulationForm.cs deleted file mode 100644 index 780300f..0000000 --- a/NWaves.DemoForms/ModulationForm.cs +++ /dev/null @@ -1,104 +0,0 @@ -using NWaves.Operations; -using NWaves.Signals; -using NWaves.Signals.Builders; -using System; -using System.Windows.Forms; - -namespace NWaves.DemoForms -{ - public partial class ModulationForm : Form - { - public enum ModulationMode - { - Amplitude, - Frequency, - Phase - } - - Modulator _modulator = new Modulator(); - ModulationMode _modulationMode = ModulationMode.Amplitude; - DiscreteSignal _modulated; - - public ModulationForm() - { - InitializeComponent(); - } - - private void modulateButton_Click(object sender, EventArgs e) - { - var carrierFrequency = float.Parse(carrierFrequencyTextBox.Text); - var carrierAmplitude = 1.0f; - var modulationFrequency = float.Parse(modulationFrequencyTextBox.Text); - var modulationIndex = float.Parse(modulationIndexTextBox.Text); - - var carrier = new CosineBuilder() - .SetParameter("min", -carrierAmplitude) - .SetParameter("max", carrierAmplitude) - .SetParameter("freq", carrierFrequency) - .OfLength(1024) - .SampledAt(16000) - .Build(); - - var baseband = new CosineBuilder() - .SetParameter("min", -modulationIndex) - .SetParameter("max", modulationIndex) - .SetParameter("freq", modulationFrequency) - .OfLength(1024) - .SampledAt(16000) - .Build(); - - switch (_modulationMode) - { - case ModulationMode.Frequency: - _modulated = _modulator.Frequency(baseband, carrierAmplitude, carrierFrequency); - break; - - case ModulationMode.Phase: - _modulated = _modulator.Phase(baseband, carrierAmplitude, carrierFrequency); - break; - - default: - _modulated = _modulator.Amplitude(carrier, modulationFrequency, modulationIndex); - break; - } - - modulatedPlot.Line = _modulated.Samples; - modulatedPlot.Markline = baseband.Samples; - } - - private void demodulateButton_Click(object sender, EventArgs e) - { - DiscreteSignal demodulated; - - switch (_modulationMode) - { - case ModulationMode.Frequency: - case ModulationMode.Phase: - demodulated = _modulator.DemodulateFrequency(_modulated); - break; - - default: - demodulated = _modulator.DemodulateAmplitude(_modulated); - break; - } - - demodulatedPlot.Markline = demodulated.Samples; - demodulatedPlot.Line = _modulated.Samples; - } - - private void amplitudeRadioButton_CheckedChanged(object sender, EventArgs e) - { - if (amplitudeRadioButton.Checked) _modulationMode = ModulationMode.Amplitude; - } - - private void frequencyRadioButton_CheckedChanged(object sender, EventArgs e) - { - if (frequencyRadioButton.Checked) _modulationMode = ModulationMode.Frequency; - } - - private void phaseRadioButton_CheckedChanged(object sender, EventArgs e) - { - if (phaseRadioButton.Checked) _modulationMode = ModulationMode.Phase; - } - } -} diff --git a/NWaves.DemoForms/ModulationForm.resx b/NWaves.DemoForms/ModulationForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/ModulationForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/NWaves.DemoForms.csproj b/NWaves.DemoForms/NWaves.DemoForms.csproj deleted file mode 100644 index a4350f1..0000000 --- a/NWaves.DemoForms/NWaves.DemoForms.csproj +++ /dev/null @@ -1,276 +0,0 @@ - - - - - Debug - AnyCPU - {E4BDD4FB-2EA6-42BE-A72E-7D0905948EED} - WinExe - Properties - NWaves.DemoForms - NWaves.DemoForms - v4.6.2 - 512 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\ar1st0crat.SciColorMaps.1.0.2\lib\portable40-net40+sl5+win8+wpa81\SciColorMaps.dll - True - - - - - - - - - - - - - - - - - Form - - - AdaptiveFiltersForm.cs - - - Form - - - EffectsForm.cs - - - Form - - - FeaturesForm.cs - - - Form - - - FiltersForm.cs - - - Form - - - HpssForm.cs - - - Form - - - LpcForm.cs - - - Form - - - MfccForm.cs - - - Form - - - AmsForm.cs - - - - Form - - - ModulationForm.cs - - - Form - - - NoiseForm.cs - - - Form - - - OnlineDemoForm.cs - - - Form - - - PitchForm.cs - - - UserControl - - - GroupPlot.cs - - - UserControl - - - PoleZeroPlot.cs - - - UserControl - - - LinePlot.cs - - - UserControl - - - SignalPlot.cs - - - Form - - - SignalsForm.cs - - - - - UserControl - - - SpectrogramPlot.cs - - - Form - - - StftForm.cs - - - Form - - - WaveletForm.cs - - - AdaptiveFiltersForm.cs - - - EffectsForm.cs - - - FeaturesForm.cs - - - FiltersForm.cs - - - HpssForm.cs - - - LpcForm.cs - - - MfccForm.cs - - - AmsForm.cs - - - ModulationForm.cs - - - NoiseForm.cs - - - OnlineDemoForm.cs - - - PitchForm.cs - - - GroupPlot.cs - - - PoleZeroPlot.cs - - - LinePlot.cs - - - SignalPlot.cs - - - SignalsForm.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SpectrogramPlot.cs - - - StftForm.cs - - - WaveletForm.cs - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - {3fbf1b3a-3bed-4f2f-8008-871acf83e352} - NWaves - - - - - \ No newline at end of file diff --git a/NWaves.DemoForms/NoiseForm.Designer.cs b/NWaves.DemoForms/NoiseForm.Designer.cs deleted file mode 100644 index 005e0fe..0000000 --- a/NWaves.DemoForms/NoiseForm.Designer.cs +++ /dev/null @@ -1,234 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class NoiseForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.signalPlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.noisePlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.processedPlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.loadnoiseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.loadsignalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.processToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.playSignalButton = new System.Windows.Forms.Button(); - this.playNoiseButton = new System.Windows.Forms.Button(); - this.playProcessedButton = new System.Windows.Forms.Button(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // signalPlot - // - this.signalPlot.AutoScroll = true; - this.signalPlot.BackColor = System.Drawing.Color.White; - this.signalPlot.ForeColor = System.Drawing.Color.Blue; - this.signalPlot.Gain = 1F; - this.signalPlot.Location = new System.Drawing.Point(13, 53); - this.signalPlot.Name = "signalPlot"; - this.signalPlot.PaddingX = 24; - this.signalPlot.PaddingY = 5; - this.signalPlot.Signal = null; - this.signalPlot.Size = new System.Drawing.Size(993, 156); - this.signalPlot.Stride = 64; - this.signalPlot.TabIndex = 0; - // - // noisePlot - // - this.noisePlot.AutoScroll = true; - this.noisePlot.BackColor = System.Drawing.Color.White; - this.noisePlot.ForeColor = System.Drawing.Color.Blue; - this.noisePlot.Gain = 1F; - this.noisePlot.Location = new System.Drawing.Point(13, 242); - this.noisePlot.Name = "noisePlot"; - this.noisePlot.PaddingX = 24; - this.noisePlot.PaddingY = 5; - this.noisePlot.Signal = null; - this.noisePlot.Size = new System.Drawing.Size(993, 156); - this.noisePlot.Stride = 64; - this.noisePlot.TabIndex = 1; - // - // processedPlot - // - this.processedPlot.AutoScroll = true; - this.processedPlot.BackColor = System.Drawing.Color.White; - this.processedPlot.ForeColor = System.Drawing.Color.Blue; - this.processedPlot.Gain = 1F; - this.processedPlot.Location = new System.Drawing.Point(12, 434); - this.processedPlot.Name = "processedPlot"; - this.processedPlot.PaddingX = 24; - this.processedPlot.PaddingY = 5; - this.processedPlot.Signal = null; - this.processedPlot.Size = new System.Drawing.Size(994, 156); - this.processedPlot.Stride = 64; - this.processedPlot.TabIndex = 2; - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.processToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1018, 28); - this.menuStrip1.TabIndex = 3; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.loadsignalToolStripMenuItem, - this.loadnoiseToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // loadnoiseToolStripMenuItem - // - this.loadnoiseToolStripMenuItem.Name = "loadnoiseToolStripMenuItem"; - this.loadnoiseToolStripMenuItem.Size = new System.Drawing.Size(181, 26); - this.loadnoiseToolStripMenuItem.Text = "Load &noise"; - this.loadnoiseToolStripMenuItem.Click += new System.EventHandler(this.loadnoiseToolStripMenuItem_Click); - // - // loadsignalToolStripMenuItem - // - this.loadsignalToolStripMenuItem.Name = "loadsignalToolStripMenuItem"; - this.loadsignalToolStripMenuItem.Size = new System.Drawing.Size(181, 26); - this.loadsignalToolStripMenuItem.Text = "Load &signal"; - this.loadsignalToolStripMenuItem.Click += new System.EventHandler(this.loadsignalToolStripMenuItem_Click); - // - // processToolStripMenuItem - // - this.processToolStripMenuItem.Name = "processToolStripMenuItem"; - this.processToolStripMenuItem.Size = new System.Drawing.Size(70, 24); - this.processToolStripMenuItem.Text = "&Process"; - this.processToolStripMenuItem.Click += new System.EventHandler(this.processToolStripMenuItem_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(494, 33); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(47, 17); - this.label1.TabIndex = 4; - this.label1.Text = "Signal"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(494, 222); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(44, 17); - this.label2.TabIndex = 5; - this.label2.Text = "Noise"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(479, 414); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(75, 17); - this.label3.TabIndex = 6; - this.label3.Text = "Processed"; - // - // playSignalButton - // - this.playSignalButton.Location = new System.Drawing.Point(931, 53); - this.playSignalButton.Name = "playSignalButton"; - this.playSignalButton.Size = new System.Drawing.Size(75, 31); - this.playSignalButton.TabIndex = 7; - this.playSignalButton.Text = "Play"; - this.playSignalButton.UseVisualStyleBackColor = true; - this.playSignalButton.Click += new System.EventHandler(this.playSignalButton_Click); - // - // playNoiseButton - // - this.playNoiseButton.Location = new System.Drawing.Point(931, 242); - this.playNoiseButton.Name = "playNoiseButton"; - this.playNoiseButton.Size = new System.Drawing.Size(75, 31); - this.playNoiseButton.TabIndex = 8; - this.playNoiseButton.Text = "Play"; - this.playNoiseButton.UseVisualStyleBackColor = true; - this.playNoiseButton.Click += new System.EventHandler(this.playNoiseButton_Click); - // - // playProcessedButton - // - this.playProcessedButton.Location = new System.Drawing.Point(931, 434); - this.playProcessedButton.Name = "playProcessedButton"; - this.playProcessedButton.Size = new System.Drawing.Size(75, 31); - this.playProcessedButton.TabIndex = 9; - this.playProcessedButton.Text = "Play"; - this.playProcessedButton.UseVisualStyleBackColor = true; - this.playProcessedButton.Click += new System.EventHandler(this.playProcessedButton_Click); - // - // NoiseForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1018, 602); - this.Controls.Add(this.playProcessedButton); - this.Controls.Add(this.playNoiseButton); - this.Controls.Add(this.playSignalButton); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.processedPlot); - this.Controls.Add(this.noisePlot); - this.Controls.Add(this.signalPlot); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "NoiseForm"; - this.Text = "NoiseForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private UserControls.SignalPlot signalPlot; - private UserControls.SignalPlot noisePlot; - private UserControls.SignalPlot processedPlot; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem loadsignalToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem loadnoiseToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem processToolStripMenuItem; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button playSignalButton; - private System.Windows.Forms.Button playNoiseButton; - private System.Windows.Forms.Button playProcessedButton; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/NoiseForm.cs b/NWaves.DemoForms/NoiseForm.cs deleted file mode 100644 index ed101d2..0000000 --- a/NWaves.DemoForms/NoiseForm.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.Operations; -using NWaves.Signals; - -namespace NWaves.DemoForms -{ - public partial class NoiseForm : Form - { - private DiscreteSignal _signal; - private DiscreteSignal _noise; - private DiscreteSignal _processed; - - private short _bitDepth; - - private readonly MemoryStreamPlayer _player = new MemoryStreamPlayer(); - - - public NoiseForm() - { - InitializeComponent(); - - signalPlot.Gain = 100; - noisePlot.Gain = 100; - processedPlot.Gain = 100; - } - - private void loadsignalToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog - { - InitialDirectory = @"D:\Docs\Research\DATABASE\Dictor1\wav" - }; - - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _signal = waveFile[Channels.Average]; - } - - signalPlot.Signal = _signal; - } - - private void loadnoiseToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog - { - InitialDirectory = @"D:\Docs\Research\DATABASE\Various\Фоновые звуки" - }; - - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _noise = waveFile[Channels.Average]; - } - - _noise.Amplify(0.2f); - - if (_noise.SamplingRate != _signal.SamplingRate) - { - _noise = Operation.Resample(_noise, _signal.SamplingRate); - } - - noisePlot.Signal = _signal + _noise; - } - - private void processToolStripMenuItem_Click(object sender, EventArgs e) - { - _processed = Operation.SpectralSubtract(_signal + _noise, _noise); - - processedPlot.Signal = _processed; - } - - private async void playSignalButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_signal, _bitDepth); - } - - private async void playNoiseButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_signal + _noise, _bitDepth); - } - - private async void playProcessedButton_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_processed, _bitDepth); - } - } -} diff --git a/NWaves.DemoForms/NoiseForm.resx b/NWaves.DemoForms/NoiseForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/NoiseForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/OnlineDemoForm.Designer.cs b/NWaves.DemoForms/OnlineDemoForm.Designer.cs deleted file mode 100644 index 84e553c..0000000 --- a/NWaves.DemoForms/OnlineDemoForm.Designer.cs +++ /dev/null @@ -1,305 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class OnlineDemoForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.signalPlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.nextButton = new System.Windows.Forms.Button(); - this.startButton = new System.Windows.Forms.Button(); - this.stopButton = new System.Windows.Forms.Button(); - this.intervalTextBox = new System.Windows.Forms.TextBox(); - this.kernelSizeTextBox = new System.Windows.Forms.TextBox(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.fftSizeTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.chunkTimer = new System.Windows.Forms.Timer(this.components); - this.applyButton = new System.Windows.Forms.Button(); - this.filteredSignalPlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.labelInfo = new System.Windows.Forms.Label(); - this.filteredFullSignalPlot = new NWaves.DemoForms.UserControls.SignalPlot(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // signalPlot - // - this.signalPlot.AutoScroll = true; - this.signalPlot.BackColor = System.Drawing.Color.White; - this.signalPlot.ForeColor = System.Drawing.Color.Blue; - this.signalPlot.Gain = 75F; - this.signalPlot.Location = new System.Drawing.Point(10, 229); - this.signalPlot.Name = "signalPlot"; - this.signalPlot.PaddingX = 24; - this.signalPlot.PaddingY = 5; - this.signalPlot.Signal = null; - this.signalPlot.Size = new System.Drawing.Size(535, 140); - this.signalPlot.Stride = 64; - this.signalPlot.TabIndex = 0; - // - // nextButton - // - this.nextButton.Location = new System.Drawing.Point(590, 52); - this.nextButton.Name = "nextButton"; - this.nextButton.Size = new System.Drawing.Size(133, 87); - this.nextButton.TabIndex = 2; - this.nextButton.Text = "Next chunk"; - this.nextButton.UseVisualStyleBackColor = true; - this.nextButton.Click += new System.EventHandler(this.nextButton_Click); - // - // startButton - // - this.startButton.Location = new System.Drawing.Point(729, 52); - this.startButton.Name = "startButton"; - this.startButton.Size = new System.Drawing.Size(133, 87); - this.startButton.TabIndex = 3; - this.startButton.Text = "Start"; - this.startButton.UseVisualStyleBackColor = true; - this.startButton.Click += new System.EventHandler(this.startButton_Click); - // - // stopButton - // - this.stopButton.Location = new System.Drawing.Point(868, 52); - this.stopButton.Name = "stopButton"; - this.stopButton.Size = new System.Drawing.Size(133, 87); - this.stopButton.TabIndex = 4; - this.stopButton.Text = "Stop"; - this.stopButton.UseVisualStyleBackColor = true; - this.stopButton.Click += new System.EventHandler(this.stopButton_Click); - // - // intervalTextBox - // - this.intervalTextBox.Location = new System.Drawing.Point(244, 105); - this.intervalTextBox.Name = "intervalTextBox"; - this.intervalTextBox.Size = new System.Drawing.Size(54, 22); - this.intervalTextBox.TabIndex = 5; - this.intervalTextBox.Text = "100"; - // - // kernelSizeTextBox - // - this.kernelSizeTextBox.Location = new System.Drawing.Point(244, 78); - this.kernelSizeTextBox.Name = "kernelSizeTextBox"; - this.kernelSizeTextBox.Size = new System.Drawing.Size(54, 22); - this.kernelSizeTextBox.TabIndex = 6; - this.kernelSizeTextBox.Text = "301"; - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.loadToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1092, 28); - this.menuStrip1.TabIndex = 7; - this.menuStrip1.Text = "menuStrip1"; - // - // loadToolStripMenuItem - // - this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; - this.loadToolStripMenuItem.Size = new System.Drawing.Size(63, 24); - this.loadToolStripMenuItem.Text = "&Load..."; - this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click); - // - // fftSizeTextBox - // - this.fftSizeTextBox.Location = new System.Drawing.Point(244, 52); - this.fftSizeTextBox.Name = "fftSizeTextBox"; - this.fftSizeTextBox.Size = new System.Drawing.Size(54, 22); - this.fftSizeTextBox.TabIndex = 8; - this.fftSizeTextBox.Text = "4096"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(149, 52); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(62, 17); - this.label1.TabIndex = 9; - this.label1.Text = "FFT size"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(149, 78); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(78, 17); - this.label2.TabIndex = 10; - this.label2.Text = "Kernel size"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(149, 105); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(89, 17); - this.label3.TabIndex = 11; - this.label3.Text = "Time interval"; - // - // chunkTimer - // - this.chunkTimer.Tick += new System.EventHandler(this.ProcessNewChunk); - // - // applyButton - // - this.applyButton.Location = new System.Drawing.Point(152, 144); - this.applyButton.Name = "applyButton"; - this.applyButton.Size = new System.Drawing.Size(146, 34); - this.applyButton.TabIndex = 12; - this.applyButton.Text = "Apply"; - this.applyButton.UseVisualStyleBackColor = true; - this.applyButton.Click += new System.EventHandler(this.applyButton_Click); - // - // filteredSignalPlot - // - this.filteredSignalPlot.AutoScroll = true; - this.filteredSignalPlot.BackColor = System.Drawing.Color.White; - this.filteredSignalPlot.ForeColor = System.Drawing.Color.Blue; - this.filteredSignalPlot.Gain = 75F; - this.filteredSignalPlot.Location = new System.Drawing.Point(551, 229); - this.filteredSignalPlot.Name = "filteredSignalPlot"; - this.filteredSignalPlot.PaddingX = 24; - this.filteredSignalPlot.PaddingY = 5; - this.filteredSignalPlot.Signal = null; - this.filteredSignalPlot.Size = new System.Drawing.Size(529, 140); - this.filteredSignalPlot.Stride = 64; - this.filteredSignalPlot.TabIndex = 13; - // - // labelInfo - // - this.labelInfo.AutoSize = true; - this.labelInfo.Location = new System.Drawing.Point(587, 161); - this.labelInfo.Name = "labelInfo"; - this.labelInfo.Size = new System.Drawing.Size(208, 17); - this.labelInfo.TabIndex = 14; - this.labelInfo.Text = "Chunk #1 Processed 0 seconds"; - // - // filteredFullSignalPlot - // - this.filteredFullSignalPlot.AutoScroll = true; - this.filteredFullSignalPlot.BackColor = System.Drawing.Color.White; - this.filteredFullSignalPlot.ForeColor = System.Drawing.Color.Blue; - this.filteredFullSignalPlot.Gain = 75F; - this.filteredFullSignalPlot.Location = new System.Drawing.Point(10, 420); - this.filteredFullSignalPlot.Name = "filteredFullSignalPlot"; - this.filteredFullSignalPlot.PaddingX = 24; - this.filteredFullSignalPlot.PaddingY = 5; - this.filteredFullSignalPlot.Signal = null; - this.filteredFullSignalPlot.Size = new System.Drawing.Size(1070, 140); - this.filteredFullSignalPlot.Stride = 64; - this.filteredFullSignalPlot.TabIndex = 15; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(499, 389); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(96, 17); - this.label4.TabIndex = 16; - this.label4.Text = "Filtered signal"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(177, 207); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(132, 17); - this.label5.TabIndex = 17; - this.label5.Text = "Current input chunk"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(747, 207); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(141, 17); - this.label6.TabIndex = 18; - this.label6.Text = "Current output chunk"; - // - // OnlineDemoForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1092, 572); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.filteredFullSignalPlot); - this.Controls.Add(this.labelInfo); - this.Controls.Add(this.filteredSignalPlot); - this.Controls.Add(this.applyButton); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.fftSizeTextBox); - this.Controls.Add(this.kernelSizeTextBox); - this.Controls.Add(this.intervalTextBox); - this.Controls.Add(this.stopButton); - this.Controls.Add(this.startButton); - this.Controls.Add(this.nextButton); - this.Controls.Add(this.signalPlot); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "OnlineDemoForm"; - this.Text = "OnlineDemoForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private UserControls.SignalPlot signalPlot; - private System.Windows.Forms.Button nextButton; - private System.Windows.Forms.Button startButton; - private System.Windows.Forms.Button stopButton; - private System.Windows.Forms.TextBox intervalTextBox; - private System.Windows.Forms.TextBox kernelSizeTextBox; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem; - private System.Windows.Forms.TextBox fftSizeTextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Timer chunkTimer; - private System.Windows.Forms.Button applyButton; - private UserControls.SignalPlot filteredSignalPlot; - private System.Windows.Forms.Label labelInfo; - private UserControls.SignalPlot filteredFullSignalPlot; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/OnlineDemoForm.cs b/NWaves.DemoForms/OnlineDemoForm.cs deleted file mode 100644 index 7d8cc7b..0000000 --- a/NWaves.DemoForms/OnlineDemoForm.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.IO; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.Audio.Interfaces; -using NWaves.Filters.Base; -using NWaves.Filters.Fda; -using NWaves.Operations.Convolution; -using NWaves.Signals; -using NWaves.Utils; - -namespace NWaves.DemoForms -{ - public partial class OnlineDemoForm : Form - { - DiscreteSignal _signal; - DiscreteSignal _filtered; - - OlaBlockConvolver _blockConvolver; - - /// - /// Buffer for input chunk - /// - float[] _input; - - /// - /// Buffer for output chunk - /// - float[] _output; - - Random _randomizer = new Random(); - - int _offset = 0; - int _filteredOffset = 0; - int _filteredLength = 0; - int _chunkNo = 0; - int _fftSize; - - public OnlineDemoForm() - { - InitializeComponent(); - ApplySettings(); - - signalPlot.Stride = 100; - filteredSignalPlot.Stride = 100; - filteredFullSignalPlot.Stride = 1000; - } - - private void ApplySettings() - { - _fftSize = int.Parse(fftSizeTextBox.Text); - - chunkTimer.Interval = int.Parse(intervalTextBox.Text); - - var kernel = DesignFilter.FirWinLp(int.Parse(kernelSizeTextBox.Text), 0.2); - - _blockConvolver = new OlaBlockConvolver(kernel, _fftSize); - - // or equivalently: - //_blockConvolver = OlaBlockConvolver.FromFilter(new FirFilter(kernel), _fftSize); - - _output = new float[_blockConvolver.HopSize * 5]; - } - - private void loadToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - IAudioContainer waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - - // this signal will accumulate the output chunks in lower panel and it's just for visualization - - _filteredLength = Math.Min(_signal.Length + _fftSize, 60 * 16000); - _filtered = new DiscreteSignal(_signal.SamplingRate, _filteredLength); - - signalPlot.Signal = _signal; - - Text = $"{ofd.FileName} | {_signal.Length} samples | {_signal.Duration} seconds"; - } - - private void nextButton_Click(object sender, EventArgs e) - { - ProcessNewChunk(this, null); - } - - private void startButton_Click(object sender, EventArgs e) - { - chunkTimer.Start(); - } - - private void stopButton_Click(object sender, EventArgs e) - { - chunkTimer.Stop(); - _offset = 0; - _filteredOffset = 0; - _chunkNo = 0; - - _filtered = new DiscreteSignal(_signal.SamplingRate, _filteredLength); - } - - private void applyButton_Click(object sender, EventArgs e) - { - ApplySettings(); - } - - /// - /// Here is the main function for online processing of chunks: - /// - private void ProcessNewChunk(object sender, EventArgs e) - { - // =========================== take next chunk of random size ================================ - // (random size is chosen carefully) - - var randomSize = Math.Min(_randomizer.Next(_blockConvolver.HopSize / 4, _blockConvolver.HopSize * 4), - Math.Min(_signal.Length - _offset, - _filteredLength - _filteredOffset)); - - _input = _signal[_offset, _offset + randomSize].Samples; - - - // ===================================== process it ========================================== - - _blockConvolver.Process(_input, _output); - - - // ===================== do what we want with a new portion of data ========================== - - _output.FastCopyTo(_filtered.Samples, _input.Length, 0, _filteredOffset); - - _offset += _input.Length; - _filteredOffset += _input.Length; - - // ================================= visualize signals ======================================= - - signalPlot.Signal = new DiscreteSignal(_signal.SamplingRate, _input); - filteredSignalPlot.Signal = new DiscreteSignal(_signal.SamplingRate, _output); - - if (_filteredOffset >= _filtered.Length - _input.Length) - { - _filteredOffset = 0; - _filtered = new DiscreteSignal(_signal.SamplingRate, Math.Min(_signal.Length + _fftSize, 60 * 16000)); - } - filteredFullSignalPlot.Signal = _filtered; - - // ====================== reset if we've reached the end of a signal ========================= - - if (_offset + randomSize >= _signal.Length) - { - _offset = 0; - _filteredOffset = 0; - _chunkNo = 0; - _blockConvolver.Reset(); - - _filtered = new DiscreteSignal(_signal.SamplingRate, _filteredLength); - } - - _chunkNo++; - - labelInfo.Text = $"Chunk #{_chunkNo + 1} / Processed {(float)_offset/_signal.SamplingRate} seconds"; - } - } -} diff --git a/NWaves.DemoForms/OnlineDemoForm.resx b/NWaves.DemoForms/OnlineDemoForm.resx deleted file mode 100644 index 2a8239f..0000000 --- a/NWaves.DemoForms/OnlineDemoForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - - 152, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/PitchForm.Designer.cs b/NWaves.DemoForms/PitchForm.Designer.cs deleted file mode 100644 index 44e5f0c..0000000 --- a/NWaves.DemoForms/PitchForm.Designer.cs +++ /dev/null @@ -1,312 +0,0 @@ -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class PitchForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.prevButton = new System.Windows.Forms.Button(); - this.nextButton = new System.Windows.Forms.Button(); - this.specNoComboBox = new System.Windows.Forms.ComboBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.label5 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.cepstrumSizeTextBox = new System.Windows.Forms.TextBox(); - this.hopSizeTextBox = new System.Windows.Forms.TextBox(); - this.fftSizeTextBox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.spectrogramPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.autoCorrPanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.cepstrumPanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.spectrumPanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.menuStrip1.SuspendLayout(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1204, 28); - this.menuStrip1.TabIndex = 0; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(260, 327); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(68, 17); - this.label1.TabIndex = 3; - this.label1.Text = "Spectrum"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(678, 327); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(68, 17); - this.label2.TabIndex = 4; - this.label2.Text = "Cepstrum"; - // - // prevButton - // - this.prevButton.Location = new System.Drawing.Point(1001, 55); - this.prevButton.Name = "prevButton"; - this.prevButton.Size = new System.Drawing.Size(63, 24); - this.prevButton.TabIndex = 5; - this.prevButton.Text = "Prev"; - this.prevButton.UseVisualStyleBackColor = true; - this.prevButton.Click += new System.EventHandler(this.prevButton_Click); - // - // nextButton - // - this.nextButton.Location = new System.Drawing.Point(1135, 55); - this.nextButton.Name = "nextButton"; - this.nextButton.Size = new System.Drawing.Size(56, 24); - this.nextButton.TabIndex = 6; - this.nextButton.Text = "Next"; - this.nextButton.UseVisualStyleBackColor = true; - this.nextButton.Click += new System.EventHandler(this.nextButton_Click); - // - // specNoComboBox - // - this.specNoComboBox.FormattingEnabled = true; - this.specNoComboBox.ItemHeight = 16; - this.specNoComboBox.Location = new System.Drawing.Point(1070, 55); - this.specNoComboBox.Name = "specNoComboBox"; - this.specNoComboBox.Size = new System.Drawing.Size(59, 24); - this.specNoComboBox.TabIndex = 7; - this.specNoComboBox.TextChanged += new System.EventHandler(this.specNoComboBox_TextChanged); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.label5); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.cepstrumSizeTextBox); - this.groupBox1.Controls.Add(this.hopSizeTextBox); - this.groupBox1.Controls.Add(this.fftSizeTextBox); - this.groupBox1.Location = new System.Drawing.Point(1001, 105); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(190, 206); - this.groupBox1.TabIndex = 11; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Parameters"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(13, 135); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(97, 17); - this.label5.TabIndex = 16; - this.label5.Text = "Cepstrum size"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(13, 94); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(63, 17); - this.label4.TabIndex = 15; - this.label4.Text = "Hop size"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(13, 53); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(62, 17); - this.label3.TabIndex = 14; - this.label3.Text = "FFT size"; - // - // cepstrumSizeTextBox - // - this.cepstrumSizeTextBox.Location = new System.Drawing.Point(121, 130); - this.cepstrumSizeTextBox.Name = "cepstrumSizeTextBox"; - this.cepstrumSizeTextBox.Size = new System.Drawing.Size(55, 22); - this.cepstrumSizeTextBox.TabIndex = 13; - this.cepstrumSizeTextBox.Text = "256"; - // - // hopSizeTextBox - // - this.hopSizeTextBox.Location = new System.Drawing.Point(121, 89); - this.hopSizeTextBox.Name = "hopSizeTextBox"; - this.hopSizeTextBox.Size = new System.Drawing.Size(55, 22); - this.hopSizeTextBox.TabIndex = 12; - this.hopSizeTextBox.Text = "100"; - // - // fftSizeTextBox - // - this.fftSizeTextBox.Location = new System.Drawing.Point(121, 48); - this.fftSizeTextBox.Name = "fftSizeTextBox"; - this.fftSizeTextBox.Size = new System.Drawing.Size(55, 22); - this.fftSizeTextBox.TabIndex = 11; - this.fftSizeTextBox.Text = "1024"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(992, 327); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(109, 17); - this.label6.TabIndex = 6; - this.label6.Text = "Auto-correlation"; - // - // spectrogramPanel - // - this.spectrogramPanel.AutoScroll = true; - this.spectrogramPanel.BackColor = System.Drawing.Color.White; - this.spectrogramPanel.ColorMapName = "magma"; - this.spectrogramPanel.Location = new System.Drawing.Point(12, 55); - this.spectrogramPanel.Markline = null; - this.spectrogramPanel.Name = "spectrogramPanel"; - this.spectrogramPanel.Size = new System.Drawing.Size(973, 256); - this.spectrogramPanel.Spectrogram = null; - this.spectrogramPanel.TabIndex = 2; - // - // autoCorrPanel - // - this.autoCorrPanel.AutoScroll = true; - this.autoCorrPanel.BackColor = System.Drawing.Color.White; - this.autoCorrPanel.ForeColor = System.Drawing.Color.Blue; - this.autoCorrPanel.Location = new System.Drawing.Point(880, 347); - this.autoCorrPanel.Name = "autoCorrPanel"; - this.autoCorrPanel.PaddingX = 30; - this.autoCorrPanel.PaddingY = 20; - this.autoCorrPanel.Size = new System.Drawing.Size(311, 256); - this.autoCorrPanel.Stride = 20; - this.autoCorrPanel.TabIndex = 5; - this.autoCorrPanel.Thickness = 1; - // - // cepstrumPanel - // - this.cepstrumPanel.AutoScroll = true; - this.cepstrumPanel.BackColor = System.Drawing.Color.White; - this.cepstrumPanel.ForeColor = System.Drawing.Color.Blue; - this.cepstrumPanel.Location = new System.Drawing.Point(570, 347); - this.cepstrumPanel.Name = "cepstrumPanel"; - this.cepstrumPanel.PaddingX = 30; - this.cepstrumPanel.PaddingY = 20; - this.cepstrumPanel.Size = new System.Drawing.Size(304, 256); - this.cepstrumPanel.Stride = 20; - this.cepstrumPanel.TabIndex = 2; - this.cepstrumPanel.Thickness = 1; - // - // spectrumPanel - // - this.spectrumPanel.AutoScroll = true; - this.spectrumPanel.BackColor = System.Drawing.Color.White; - this.spectrumPanel.ForeColor = System.Drawing.Color.Blue; - this.spectrumPanel.Location = new System.Drawing.Point(14, 347); - this.spectrumPanel.Name = "spectrumPanel"; - this.spectrumPanel.PaddingX = 30; - this.spectrumPanel.PaddingY = 20; - this.spectrumPanel.Size = new System.Drawing.Size(550, 256); - this.spectrumPanel.Stride = 1; - this.spectrumPanel.TabIndex = 1; - this.spectrumPanel.Thickness = 1; - // - // PitchForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1204, 617); - this.Controls.Add(this.label6); - this.Controls.Add(this.spectrogramPanel); - this.Controls.Add(this.autoCorrPanel); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.specNoComboBox); - this.Controls.Add(this.nextButton); - this.Controls.Add(this.prevButton); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.cepstrumPanel); - this.Controls.Add(this.spectrumPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "PitchForm"; - this.Text = "PitchForm"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private LinePlot spectrumPanel; - private LinePlot cepstrumPanel; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button prevButton; - private System.Windows.Forms.Button nextButton; - private System.Windows.Forms.ComboBox specNoComboBox; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox cepstrumSizeTextBox; - private System.Windows.Forms.TextBox hopSizeTextBox; - private System.Windows.Forms.TextBox fftSizeTextBox; - private SpectrogramPlot spectrogramPanel; - private System.Windows.Forms.Label label6; - private LinePlot autoCorrPanel; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/PitchForm.cs b/NWaves.DemoForms/PitchForm.cs deleted file mode 100644 index 7eef02a..0000000 --- a/NWaves.DemoForms/PitchForm.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.FeatureExtractors; -using NWaves.FeatureExtractors.Base; -using NWaves.FeatureExtractors.Options; -using NWaves.Features; -using NWaves.Operations; -using NWaves.Signals; -using NWaves.Transforms; -using NWaves.Windows; -using LevelScale = NWaves.Utils.Scale; - -namespace NWaves.DemoForms -{ - public partial class PitchForm : Form - { - private DiscreteSignal _signal; - - private RealFft _fft; - private CepstralTransform _cepstralTransform; - private Stft _stft; - - private int _fftSize; - private int _hopSize; - private int _cepstrumSize; - - private List _pitches; - - private int _specNo; - - public PitchForm() - { - InitializeComponent(); - - cepstrumPanel.Gain = 200; - cepstrumPanel.Stride = 1; - cepstrumPanel.ForeColor = Color.Blue; - autoCorrPanel.Gain = 5; - autoCorrPanel.Stride = 1; - autoCorrPanel.ForeColor = Color.SeaGreen; - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(ofd.FileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _signal = waveFile[Channels.Left]; - } - - _fftSize = int.Parse(fftSizeTextBox.Text); - _cepstrumSize = int.Parse(cepstrumSizeTextBox.Text); - _hopSize = int.Parse(hopSizeTextBox.Text); - - _fft = new RealFft(_fftSize); - _cepstralTransform = new CepstralTransform(_cepstrumSize, _fftSize); - - var options = new PitchOptions - { - SamplingRate = _signal.SamplingRate, - FrameDuration = (double)_fftSize / _signal.SamplingRate, - HopDuration = (double)_hopSize / _signal.SamplingRate - }; - - var pitchExtractor = new PitchExtractor(options); - - _pitches = pitchExtractor.ParallelComputeFrom(_signal); - - _specNo = 0; - specNoComboBox.DataSource = Enumerable.Range(1, _pitches.Count).ToArray(); - - // obtain spectrogram - - _stft = new Stft(_fftSize, _hopSize, WindowType.Rectangular); - var spectrogram = _stft.Spectrogram(_signal); - - spectrogramPanel.ColorMapName = "viridis"; - spectrogramPanel.MarklineThickness = 6; - spectrogramPanel.Spectrogram = spectrogram.Select(s => s.Take(224).ToArray()).ToList(); - spectrogramPanel.Markline = _pitches.Select(p => p[0] * _fftSize / _signal.SamplingRate).ToArray(); - } - - private void specNoComboBox_TextChanged(object sender, EventArgs e) - { - _specNo = int.Parse(specNoComboBox.Text) - 1; - UpdateAutoCorrelation(); - UpdateSpectrumAndCepstrum(); - } - - private void prevButton_Click(object sender, EventArgs e) - { - _specNo--; - specNoComboBox.Text = (_specNo + 1).ToString(); - } - - private void nextButton_Click(object sender, EventArgs e) - { - _specNo++; - specNoComboBox.Text = (_specNo + 1).ToString(); - } - - private void UpdateSpectrumAndCepstrum() - { - var fftSize = int.Parse(fftSizeTextBox.Text); - var cepstrumSize = int.Parse(cepstrumSizeTextBox.Text); - _hopSize = int.Parse(hopSizeTextBox.Text); - - if (fftSize != _fftSize) - { - _fftSize = fftSize; - _fft = new RealFft(fftSize); - _cepstralTransform = new CepstralTransform(cepstrumSize, _fftSize); - } - - if (cepstrumSize != _cepstrumSize) - { - _cepstrumSize = cepstrumSize; - _cepstralTransform = new CepstralTransform(_cepstrumSize, _fftSize); - } - - var pos = _hopSize * _specNo; - var block = _signal[pos, pos + _fftSize]; - - //block.ApplyWindow(WindowTypes.Hamming); - - var cepstrum = new float[_fftSize]; - _cepstralTransform.RealCepstrum(block.Samples, cepstrum); - - // ************************************************************************ - // just visualize spectrum estimated from cepstral coefficients: - // ************************************************************************ - - var real = new float[_fftSize]; - var imag = new float[_fftSize]; - - for (var i = 0; i < 32; i++) - { - real[i] = cepstrum[i]; - } - - _fft.Direct(real, real, imag); - - var spectrum = _fft.PowerSpectrum(block, normalize: false).Samples; - var avg = spectrum.Average(s => LevelScale.ToDecibel(s)); - - var spectrumEstimate = real.Take(_fftSize / 2 + 1) - .Select(s => (float)LevelScale.FromDecibel(s * 40 - avg)) - .ToArray(); - - spectrumPanel.Line = spectrum; - spectrumPanel.Markline = spectrumEstimate; - spectrumPanel.ToDecibel(); - - var pitch = Pitch.FromCepstrum(block); - - cepstrumPanel.Line = cepstrum; - cepstrumPanel.Mark = (int)(_signal.SamplingRate / pitch); - } - - private void UpdateAutoCorrelation() - { - var pos = _hopSize * _specNo; - - var pitch = //Pitch.FromHss(_signal, pos, pos + _fftSize); - Pitch.FromAutoCorrelation(_signal, pos, pos + _fftSize, 80, 1000); - //Pitch.FromZeroCrossingsSchmitt(_signal, pos, pos + _fftSize); - //Pitch.FromYin(_signal, pos, pos + _fftSize); - - spectrumPanel.Mark = (int)(_fftSize * pitch / _signal.SamplingRate); // pitch index - spectrumPanel.Legend = string.Format("{0:F2} Hz", pitch); - - var block = _signal[pos, pos + _fftSize]; - var autoCorrelation = Operation.CrossCorrelate(block, block).Last(_fftSize); - - autoCorrPanel.Line = autoCorrelation.Samples; - autoCorrPanel.Mark = pitch == 0 ? 0 : (int)(_signal.SamplingRate / pitch); // pitch index - } - } -} diff --git a/NWaves.DemoForms/PitchForm.resx b/NWaves.DemoForms/PitchForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/PitchForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/Program.cs b/NWaves.DemoForms/Program.cs deleted file mode 100644 index 66b8284..0000000 --- a/NWaves.DemoForms/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace NWaves.DemoForms -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SignalsForm()); - } - } -} diff --git a/NWaves.DemoForms/Properties/AssemblyInfo.cs b/NWaves.DemoForms/Properties/AssemblyInfo.cs deleted file mode 100644 index 951fb09..0000000 --- a/NWaves.DemoForms/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NWaves.DemoForms")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NWaves.DemoForms")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e4bdd4fb-2ea6-42be-a72e-7d0905948eed")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NWaves.DemoForms/Properties/Resources.Designer.cs b/NWaves.DemoForms/Properties/Resources.Designer.cs deleted file mode 100644 index ac557fb..0000000 --- a/NWaves.DemoForms/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 NWaves.DemoForms.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.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() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NWaves.DemoForms.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [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/NWaves.DemoForms/Properties/Resources.resx b/NWaves.DemoForms/Properties/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/NWaves.DemoForms/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/Properties/Settings.Designer.cs b/NWaves.DemoForms/Properties/Settings.Designer.cs deleted file mode 100644 index d27fb56..0000000 --- a/NWaves.DemoForms/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 NWaves.DemoForms.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.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/NWaves.DemoForms/Properties/Settings.settings b/NWaves.DemoForms/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/NWaves.DemoForms/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/NWaves.DemoForms/SignalsForm.Designer.cs b/NWaves.DemoForms/SignalsForm.Designer.cs deleted file mode 100644 index ed4485a..0000000 --- a/NWaves.DemoForms/SignalsForm.Designer.cs +++ /dev/null @@ -1,648 +0,0 @@ -using System.Drawing; -using NWaves.DemoForms.UserControls; - -namespace NWaves.DemoForms -{ - partial class SignalsForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.openFileButton = new System.Windows.Forms.Button(); - this.filenameTextBox = new System.Windows.Forms.TextBox(); - this.builderParametersListBox = new System.Windows.Forms.ListBox(); - this.signalPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.generatedSignalPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.superimposedSignalPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.spectrumPanel = new NWaves.DemoForms.UserControls.LinePlot(); - this.builderComboBox = new System.Windows.Forms.ComboBox(); - this.operationComboBox = new System.Windows.Forms.ComboBox(); - this.generateSignalButton = new System.Windows.Forms.Button(); - this.signalOperationButton = new System.Windows.Forms.Button(); - this.durationTextBox = new System.Windows.Forms.TextBox(); - this.operationSamplesTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.leftSliceTextBox = new System.Windows.Forms.TextBox(); - this.signalSliceButton = new System.Windows.Forms.Button(); - this.rightSliceTextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.playbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.playToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.pauseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.recordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.filtersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.pitchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.mfccToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.lpcToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.modulationSpectrumToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.effectsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.featuresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.noiseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.modulationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.onlineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.adaptiveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.hpssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.stftButton = new System.Windows.Forms.Button(); - this.waveletsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // openFileButton - // - this.openFileButton.Location = new System.Drawing.Point(1122, 31); - this.openFileButton.Name = "openFileButton"; - this.openFileButton.Size = new System.Drawing.Size(75, 37); - this.openFileButton.TabIndex = 0; - this.openFileButton.Text = "Open..."; - this.openFileButton.UseVisualStyleBackColor = true; - this.openFileButton.Click += new System.EventHandler(this.openFileButton_Click); - // - // filenameTextBox - // - this.filenameTextBox.Location = new System.Drawing.Point(12, 38); - this.filenameTextBox.Name = "filenameTextBox"; - this.filenameTextBox.Size = new System.Drawing.Size(1104, 22); - this.filenameTextBox.TabIndex = 1; - // - // builderParametersListBox - // - this.builderParametersListBox.FormattingEnabled = true; - this.builderParametersListBox.ItemHeight = 16; - this.builderParametersListBox.Location = new System.Drawing.Point(13, 99); - this.builderParametersListBox.Name = "builderParametersListBox"; - this.builderParametersListBox.Size = new System.Drawing.Size(177, 628); - this.builderParametersListBox.TabIndex = 2; - // - // signalPanel - // - this.signalPanel.AutoScroll = true; - this.signalPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.signalPanel.ForeColor = System.Drawing.Color.Blue; - this.signalPanel.Gain = 1F; - this.signalPanel.Location = new System.Drawing.Point(196, 99); - this.signalPanel.Name = "signalPanel"; - this.signalPanel.PaddingX = 24; - this.signalPanel.PaddingY = 5; - this.signalPanel.Signal = null; - this.signalPanel.Size = new System.Drawing.Size(1001, 165); - this.signalPanel.Stride = 64; - this.signalPanel.TabIndex = 3; - // - // generatedSignalPanel - // - this.generatedSignalPanel.AutoScroll = true; - this.generatedSignalPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.generatedSignalPanel.ForeColor = System.Drawing.Color.Red; - this.generatedSignalPanel.Gain = 1F; - this.generatedSignalPanel.Location = new System.Drawing.Point(196, 332); - this.generatedSignalPanel.Name = "generatedSignalPanel"; - this.generatedSignalPanel.PaddingX = 24; - this.generatedSignalPanel.PaddingY = 5; - this.generatedSignalPanel.Signal = null; - this.generatedSignalPanel.Size = new System.Drawing.Size(610, 184); - this.generatedSignalPanel.Stride = 64; - this.generatedSignalPanel.TabIndex = 4; - // - // superimposedSignalPanel - // - this.superimposedSignalPanel.AutoScroll = true; - this.superimposedSignalPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.superimposedSignalPanel.ForeColor = System.Drawing.Color.SeaGreen; - this.superimposedSignalPanel.Gain = 1F; - this.superimposedSignalPanel.Location = new System.Drawing.Point(197, 543); - this.superimposedSignalPanel.Name = "superimposedSignalPanel"; - this.superimposedSignalPanel.PaddingX = 24; - this.superimposedSignalPanel.PaddingY = 5; - this.superimposedSignalPanel.Signal = null; - this.superimposedSignalPanel.Size = new System.Drawing.Size(1000, 181); - this.superimposedSignalPanel.Stride = 64; - this.superimposedSignalPanel.TabIndex = 5; - // - // spectrumPanel - // - this.spectrumPanel.AutoScroll = true; - this.spectrumPanel.BackColor = System.Drawing.SystemColors.ButtonHighlight; - this.spectrumPanel.ForeColor = System.Drawing.Color.Blue; - this.spectrumPanel.Location = new System.Drawing.Point(812, 332); - this.spectrumPanel.Name = "spectrumPanel"; - this.spectrumPanel.PaddingX = 30; - this.spectrumPanel.PaddingY = 20; - this.spectrumPanel.Size = new System.Drawing.Size(385, 184); - this.spectrumPanel.Stride = 1; - this.spectrumPanel.TabIndex = 5; - this.spectrumPanel.Thickness = 1; - // - // builderComboBox - // - this.builderComboBox.FormattingEnabled = true; - this.builderComboBox.Items.AddRange(new object[] { - "Sinusoid", - "Sawtooth", - "Triangle Wave", - "Square Wave", - "Pulse Wave", - "Chirp", - "Sinc", - "Ramp", - "White Noise", - "AWGN", - "Pink Noise", - "Red Noise", - "Perlin Noise"}); - this.builderComboBox.Location = new System.Drawing.Point(197, 271); - this.builderComboBox.Name = "builderComboBox"; - this.builderComboBox.Size = new System.Drawing.Size(124, 24); - this.builderComboBox.TabIndex = 6; - this.builderComboBox.Text = "Sinusoid"; - // - // operationComboBox - // - this.operationComboBox.FormattingEnabled = true; - this.operationComboBox.Items.AddRange(new object[] { - "Delay by", - "Repeat times"}); - this.operationComboBox.Location = new System.Drawing.Point(198, 301); - this.operationComboBox.Name = "operationComboBox"; - this.operationComboBox.Size = new System.Drawing.Size(123, 24); - this.operationComboBox.TabIndex = 7; - this.operationComboBox.Text = "Delay by"; - // - // generateSignalButton - // - this.generateSignalButton.Location = new System.Drawing.Point(471, 271); - this.generateSignalButton.Name = "generateSignalButton"; - this.generateSignalButton.Size = new System.Drawing.Size(38, 23); - this.generateSignalButton.TabIndex = 8; - this.generateSignalButton.Text = ">>"; - this.generateSignalButton.UseVisualStyleBackColor = true; - this.generateSignalButton.Click += new System.EventHandler(this.generateSignalButton_Click); - // - // signalOperationButton - // - this.signalOperationButton.Location = new System.Drawing.Point(471, 303); - this.signalOperationButton.Name = "signalOperationButton"; - this.signalOperationButton.Size = new System.Drawing.Size(37, 23); - this.signalOperationButton.TabIndex = 9; - this.signalOperationButton.Text = ">>"; - this.signalOperationButton.UseVisualStyleBackColor = true; - this.signalOperationButton.Click += new System.EventHandler(this.signalOperationButton_Click); - // - // durationTextBox - // - this.durationTextBox.Location = new System.Drawing.Point(327, 272); - this.durationTextBox.Name = "durationTextBox"; - this.durationTextBox.Size = new System.Drawing.Size(71, 22); - this.durationTextBox.TabIndex = 10; - // - // operationSamplesTextBox - // - this.operationSamplesTextBox.Location = new System.Drawing.Point(327, 303); - this.operationSamplesTextBox.Name = "operationSamplesTextBox"; - this.operationSamplesTextBox.Size = new System.Drawing.Size(71, 22); - this.operationSamplesTextBox.TabIndex = 11; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(404, 273); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(60, 17); - this.label1.TabIndex = 12; - this.label1.Text = "samples"; - // - // leftSliceTextBox - // - this.leftSliceTextBox.Location = new System.Drawing.Point(610, 303); - this.leftSliceTextBox.Name = "leftSliceTextBox"; - this.leftSliceTextBox.Size = new System.Drawing.Size(60, 22); - this.leftSliceTextBox.TabIndex = 15; - // - // signalSliceButton - // - this.signalSliceButton.Location = new System.Drawing.Point(769, 303); - this.signalSliceButton.Name = "signalSliceButton"; - this.signalSliceButton.Size = new System.Drawing.Size(37, 23); - this.signalSliceButton.TabIndex = 14; - this.signalSliceButton.Text = ">>"; - this.signalSliceButton.UseVisualStyleBackColor = true; - this.signalSliceButton.Click += new System.EventHandler(this.signalSliceButton_Click); - // - // rightSliceTextBox - // - this.rightSliceTextBox.Location = new System.Drawing.Point(702, 303); - this.rightSliceTextBox.Name = "rightSliceTextBox"; - this.rightSliceTextBox.Size = new System.Drawing.Size(60, 22); - this.rightSliceTextBox.TabIndex = 16; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(568, 304); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(36, 17); - this.label2.TabIndex = 17; - this.label2.Text = "from"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(676, 304); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(20, 17); - this.label3.TabIndex = 18; - this.label3.Text = "to"; - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem, - this.playbackToolStripMenuItem, - this.filtersToolStripMenuItem, - this.pitchToolStripMenuItem, - this.mfccToolStripMenuItem, - this.lpcToolStripMenuItem, - this.modulationSpectrumToolStripMenuItem, - this.effectsToolStripMenuItem, - this.featuresToolStripMenuItem, - this.noiseToolStripMenuItem, - this.modulationToolStripMenuItem, - this.onlineToolStripMenuItem, - this.adaptiveToolStripMenuItem, - this.hpssToolStripMenuItem, - this.waveletsToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1207, 28); - this.menuStrip1.TabIndex = 19; - this.menuStrip1.Text = "menuStrip1"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem1, - this.saveToolStripMenuItem, - this.toolStripSeparator1, - this.exitToolStripMenuItem}); - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.openToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem1 - // - this.openToolStripMenuItem1.Name = "openToolStripMenuItem1"; - this.openToolStripMenuItem1.Size = new System.Drawing.Size(142, 26); - this.openToolStripMenuItem1.Text = "&Open..."; - this.openToolStripMenuItem1.Click += new System.EventHandler(this.openToolStripMenuItem1_Click); - // - // saveToolStripMenuItem - // - this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(142, 26); - this.saveToolStripMenuItem.Text = "&Save as..."; - this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(139, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(142, 26); - this.exitToolStripMenuItem.Text = "&Exit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // playbackToolStripMenuItem - // - this.playbackToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.playToolStripMenuItem, - this.pauseToolStripMenuItem, - this.toolStripSeparator2, - this.recordToolStripMenuItem, - this.toolStripSeparator3, - this.stopToolStripMenuItem}); - this.playbackToolStripMenuItem.Name = "playbackToolStripMenuItem"; - this.playbackToolStripMenuItem.Size = new System.Drawing.Size(79, 24); - this.playbackToolStripMenuItem.Text = "Playback"; - // - // playToolStripMenuItem - // - this.playToolStripMenuItem.Name = "playToolStripMenuItem"; - this.playToolStripMenuItem.Size = new System.Drawing.Size(131, 26); - this.playToolStripMenuItem.Text = "&Play"; - this.playToolStripMenuItem.Click += new System.EventHandler(this.playToolStripMenuItem_Click); - // - // pauseToolStripMenuItem - // - this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem"; - this.pauseToolStripMenuItem.Size = new System.Drawing.Size(131, 26); - this.pauseToolStripMenuItem.Text = "Pa&use"; - this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(128, 6); - // - // recordToolStripMenuItem - // - this.recordToolStripMenuItem.Name = "recordToolStripMenuItem"; - this.recordToolStripMenuItem.Size = new System.Drawing.Size(131, 26); - this.recordToolStripMenuItem.Text = "&Record"; - this.recordToolStripMenuItem.Click += new System.EventHandler(this.recordToolStripMenuItem_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(128, 6); - // - // stopToolStripMenuItem - // - this.stopToolStripMenuItem.Name = "stopToolStripMenuItem"; - this.stopToolStripMenuItem.Size = new System.Drawing.Size(131, 26); - this.stopToolStripMenuItem.Text = "&Stop"; - this.stopToolStripMenuItem.Click += new System.EventHandler(this.stopToolStripMenuItem_Click); - // - // filtersToolStripMenuItem - // - this.filtersToolStripMenuItem.Name = "filtersToolStripMenuItem"; - this.filtersToolStripMenuItem.Size = new System.Drawing.Size(60, 24); - this.filtersToolStripMenuItem.Text = "Filters"; - this.filtersToolStripMenuItem.Click += new System.EventHandler(this.filtersToolStripMenuItem_Click); - // - // pitchToolStripMenuItem - // - this.pitchToolStripMenuItem.Name = "pitchToolStripMenuItem"; - this.pitchToolStripMenuItem.Size = new System.Drawing.Size(53, 24); - this.pitchToolStripMenuItem.Text = "P&itch"; - this.pitchToolStripMenuItem.Click += new System.EventHandler(this.pitchToolStripMenuItem_Click); - // - // mfccToolStripMenuItem - // - this.mfccToolStripMenuItem.Name = "mfccToolStripMenuItem"; - this.mfccToolStripMenuItem.Size = new System.Drawing.Size(53, 24); - this.mfccToolStripMenuItem.Text = "&Mfcc"; - this.mfccToolStripMenuItem.Click += new System.EventHandler(this.mfccToolStripMenuItem_Click); - // - // lpcToolStripMenuItem - // - this.lpcToolStripMenuItem.Name = "lpcToolStripMenuItem"; - this.lpcToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.lpcToolStripMenuItem.Text = "&Lpc"; - this.lpcToolStripMenuItem.Click += new System.EventHandler(this.lpcToolStripMenuItem_Click); - // - // modulationSpectrumToolStripMenuItem - // - this.modulationSpectrumToolStripMenuItem.Name = "modulationSpectrumToolStripMenuItem"; - this.modulationSpectrumToolStripMenuItem.Size = new System.Drawing.Size(50, 24); - this.modulationSpectrumToolStripMenuItem.Text = "&Ams"; - this.modulationSpectrumToolStripMenuItem.Click += new System.EventHandler(this.modulationSpectrumToolStripMenuItem_Click); - // - // effectsToolStripMenuItem - // - this.effectsToolStripMenuItem.Name = "effectsToolStripMenuItem"; - this.effectsToolStripMenuItem.Size = new System.Drawing.Size(65, 24); - this.effectsToolStripMenuItem.Text = "&Effects"; - this.effectsToolStripMenuItem.Click += new System.EventHandler(this.effectsToolStripMenuItem_Click); - // - // featuresToolStripMenuItem - // - this.featuresToolStripMenuItem.Name = "featuresToolStripMenuItem"; - this.featuresToolStripMenuItem.Size = new System.Drawing.Size(76, 24); - this.featuresToolStripMenuItem.Text = "Fea&tures"; - this.featuresToolStripMenuItem.Click += new System.EventHandler(this.featuresToolStripMenuItem_Click); - // - // noiseToolStripMenuItem - // - this.noiseToolStripMenuItem.Name = "noiseToolStripMenuItem"; - this.noiseToolStripMenuItem.Size = new System.Drawing.Size(59, 24); - this.noiseToolStripMenuItem.Text = "&Noise"; - this.noiseToolStripMenuItem.Click += new System.EventHandler(this.noiseToolStripMenuItem_Click); - // - // modulationToolStripMenuItem - // - this.modulationToolStripMenuItem.Name = "modulationToolStripMenuItem"; - this.modulationToolStripMenuItem.Size = new System.Drawing.Size(98, 24); - this.modulationToolStripMenuItem.Text = "Mo&dulation"; - this.modulationToolStripMenuItem.Click += new System.EventHandler(this.modulationToolStripMenuItem_Click); - // - // onlineToolStripMenuItem - // - this.onlineToolStripMenuItem.Name = "onlineToolStripMenuItem"; - this.onlineToolStripMenuItem.Size = new System.Drawing.Size(64, 24); - this.onlineToolStripMenuItem.Text = "&Online"; - this.onlineToolStripMenuItem.Click += new System.EventHandler(this.onlineToolStripMenuItem_Click); - // - // adaptiveToolStripMenuItem - // - this.adaptiveToolStripMenuItem.Name = "adaptiveToolStripMenuItem"; - this.adaptiveToolStripMenuItem.Size = new System.Drawing.Size(81, 24); - this.adaptiveToolStripMenuItem.Text = "Adaptive"; - this.adaptiveToolStripMenuItem.Click += new System.EventHandler(this.adaptiveToolStripMenuItem_Click); - // - // hpssToolStripMenuItem - // - this.hpssToolStripMenuItem.Name = "hpssToolStripMenuItem"; - this.hpssToolStripMenuItem.Size = new System.Drawing.Size(53, 24); - this.hpssToolStripMenuItem.Text = "&Hpss"; - this.hpssToolStripMenuItem.Click += new System.EventHandler(this.hpssToolStripMenuItem_Click); - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(35, 72); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(128, 17); - this.label4.TabIndex = 20; - this.label4.Text = "Builder parameters"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(405, 306); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(60, 17); - this.label5.TabIndex = 21; - this.label5.Text = "samples"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(196, 519); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(140, 17); - this.label6.TabIndex = 22; - this.label6.Text = "Superimposed signal"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(690, 72); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(47, 17); - this.label7.TabIndex = 23; - this.label7.Text = "Signal"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(976, 312); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(68, 17); - this.label8.TabIndex = 24; - this.label8.Text = "Spectrum"; - // - // stftButton - // - this.stftButton.Location = new System.Drawing.Point(1135, 305); - this.stftButton.Name = "stftButton"; - this.stftButton.Size = new System.Drawing.Size(62, 28); - this.stftButton.TabIndex = 25; - this.stftButton.Text = "More..."; - this.stftButton.UseVisualStyleBackColor = true; - this.stftButton.Click += new System.EventHandler(this.stftButton_Click); - // - // waveletsToolStripMenuItem - // - this.waveletsToolStripMenuItem.Name = "waveletsToolStripMenuItem"; - this.waveletsToolStripMenuItem.Size = new System.Drawing.Size(80, 24); - this.waveletsToolStripMenuItem.Text = "&Wavelets"; - this.waveletsToolStripMenuItem.Click += new System.EventHandler(this.waveletsToolStripMenuItem_Click); - // - // SignalsForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1207, 735); - this.Controls.Add(this.stftButton); - this.Controls.Add(this.label8); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.rightSliceTextBox); - this.Controls.Add(this.leftSliceTextBox); - this.Controls.Add(this.signalSliceButton); - this.Controls.Add(this.label1); - this.Controls.Add(this.operationSamplesTextBox); - this.Controls.Add(this.durationTextBox); - this.Controls.Add(this.signalOperationButton); - this.Controls.Add(this.generateSignalButton); - this.Controls.Add(this.operationComboBox); - this.Controls.Add(this.builderComboBox); - this.Controls.Add(this.spectrumPanel); - this.Controls.Add(this.superimposedSignalPanel); - this.Controls.Add(this.generatedSignalPanel); - this.Controls.Add(this.signalPanel); - this.Controls.Add(this.builderParametersListBox); - this.Controls.Add(this.filenameTextBox); - this.Controls.Add(this.openFileButton); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "SignalsForm"; - this.Text = "Signals"; - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button openFileButton; - private System.Windows.Forms.TextBox filenameTextBox; - private System.Windows.Forms.ListBox builderParametersListBox; - private SignalPlot signalPanel; - private SignalPlot generatedSignalPanel; - private SignalPlot superimposedSignalPanel; - private LinePlot spectrumPanel; - private System.Windows.Forms.ComboBox builderComboBox; - private System.Windows.Forms.ComboBox operationComboBox; - private System.Windows.Forms.Button generateSignalButton; - private System.Windows.Forms.Button signalOperationButton; - private System.Windows.Forms.TextBox durationTextBox; - private System.Windows.Forms.TextBox operationSamplesTextBox; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox leftSliceTextBox; - private System.Windows.Forms.Button signalSliceButton; - private System.Windows.Forms.TextBox rightSliceTextBox; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem playToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem pauseToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem recordToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem filtersToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem mfccToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem lpcToolStripMenuItem; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ToolStripMenuItem modulationSpectrumToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem pitchToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem effectsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem featuresToolStripMenuItem; - private System.Windows.Forms.Button stftButton; - private System.Windows.Forms.ToolStripMenuItem noiseToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem playbackToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem onlineToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem modulationToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem adaptiveToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem hpssToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem waveletsToolStripMenuItem; - } -} - diff --git a/NWaves.DemoForms/SignalsForm.cs b/NWaves.DemoForms/SignalsForm.cs deleted file mode 100644 index 6265161..0000000 --- a/NWaves.DemoForms/SignalsForm.cs +++ /dev/null @@ -1,470 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.Audio.Interfaces; -using NWaves.Audio.Mci; -using NWaves.Signals; -using NWaves.Signals.Builders; -using NWaves.Transforms; -using NWaves.Transforms.Wavelets; - -namespace NWaves.DemoForms -{ - public partial class SignalsForm : Form - { - private DiscreteSignal _signal1; - private DiscreteSignal _signal2; - private DiscreteSignal _signal3; - - private string _waveFileName; - - private readonly MciAudioPlayer _player = new MciAudioPlayer(); - private bool _hasStartedPlaying; - private bool _isPaused; - - private readonly MciAudioRecorder _recorder = new MciAudioRecorder(); - private bool _isRecording; - - private readonly Fft _fft = new Fft(); - - public SignalsForm() - { - InitializeComponent(); - - signalPanel.Gain = 100; - generatedSignalPanel.Gain = 100; - superimposedSignalPanel.Gain = 100; - } - - private void OpenSignal() - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - filenameTextBox.Text = ofd.FileName; - _waveFileName = ofd.FileName; - - using (var stream = new FileStream(_waveFileName, FileMode.Open)) - { - IAudioContainer waveFile = new WaveFile(stream); - _signal1 = waveFile[Channels.Left]; - } - - signalPanel.Signal = _signal1; - - Text = $"{ofd.FileName} | {_signal1.Length} samples | {_signal1.Duration} seconds"; - } - - private void openFileButton_Click(object sender, EventArgs e) - { - OpenSignal(); - } - - private void generateSignalButton_Click(object sender, EventArgs e) - { - var sampleCount = int.Parse(durationTextBox.Text); - var samplingRate = _signal1?.SamplingRate ?? 16000; - - SignalBuilder signalBuilder; - - switch (builderComboBox.Text) - { - case "Sinusoid": - signalBuilder = new SineBuilder(); - _signal2 = signalBuilder - .SetParameter("low", -0.4f) - .SetParameter("high", 0.4f) - .SetParameter("freq", 233/*Hz*/) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Sawtooth": - signalBuilder = new SawtoothBuilder() - .SetParameter("low", -0.3f) - .SetParameter("high", 0.3f) - .SetParameter("freq", 233/*Hz*/) - .OfDuration(0.3) - .SampledAt(samplingRate); - - var fadeInOut = new FadeInOutBuilder(signalBuilder).In(0.05).Out(0.12); - - _signal2 = fadeInOut.Build(); - - break; - - case "Triangle Wave": - signalBuilder = new TriangleWaveBuilder(); - _signal2 = signalBuilder - .SetParameter("low", -0.3f) - .SetParameter("high", 0.3f) - .SetParameter("freq", 233/*Hz*/) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Square Wave": - signalBuilder = new SquareWaveBuilder(); - _signal2 = signalBuilder - .SetParameter("low", -0.25f) - .SetParameter("high", 0.25f) - .SetParameter("freq", 233/*Hz*/) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Pulse Wave": - signalBuilder = new PulseWaveBuilder(); - _signal2 = signalBuilder - .SetParameter("min", 0) - .SetParameter("max", 0.5f) - .SetParameter("pulse", 0.007f/*sec*/) - .SetParameter("period", 0.020f/*sec*/) - .OfLength(sampleCount) - .DelayedBy(50) - .SampledAt(samplingRate) - .Build(); - break; - - case "Chirp": - signalBuilder = new ChirpBuilder(); - _signal2 = signalBuilder - .SetParameter("min", -0.3f) - .SetParameter("max", 0.3f) - .OfLength(sampleCount) - .RepeatedTimes(3) - .SampledAt(samplingRate) - .Build(); - break; - - case "Sinc": - signalBuilder = new SincBuilder(); - _signal2 = signalBuilder - .SetParameter("min", 0) - .SetParameter("max", 0.5f) - .SetParameter("freq", 700/*Hz*/) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Ramp": - signalBuilder = new RampBuilder(); - _signal2 = signalBuilder - .SetParameter("slope", 0.0007f) - .SetParameter("intercept", -0.5f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "AWGN": - signalBuilder = new AwgnBuilder(); - _signal2 = signalBuilder - .SetParameter("sigma", 0.25f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Pink Noise": - signalBuilder = new PinkNoiseBuilder(); - _signal2 = signalBuilder - .SetParameter("min", -0.5f) - .SetParameter("max", 0.5f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Red Noise": - signalBuilder = new RedNoiseBuilder(); - _signal2 = signalBuilder - .SetParameter("min", -0.5f) - .SetParameter("max", 0.5f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - case "Perlin Noise": - signalBuilder = new PerlinNoiseBuilder(); - _signal2 = signalBuilder - .SetParameter("min", -0.3f) - .SetParameter("max", 0.7f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - - default: - signalBuilder = new WhiteNoiseBuilder(); - _signal2 = signalBuilder - .SetParameter("min", -0.5f) - .SetParameter("max", 0.5f) - .OfLength(sampleCount) - .SampledAt(samplingRate) - .Build(); - break; - } - - builderParametersListBox.Items.Clear(); - builderParametersListBox.Items.AddRange(signalBuilder.GetParametersInfo()); - builderParametersListBox.Items.Add(""); - builderParametersListBox.Items.Add($"min: {_signal2.Samples.Min():F2}"); - builderParametersListBox.Items.Add($"max: {_signal2.Samples.Max():F2}"); - builderParametersListBox.Items.Add($"avg: {_signal2.Samples.Average():F4}"); - - if (_signal1 != null) - { - //_signal3 = _signal1 + _signal2; - var positions = Enumerable.Range(0, 3).Select(pos => pos * (_signal2.Length + 2000)).ToArray(); - _signal3 = _signal1.SuperimposeMany(_signal2, positions); - superimposedSignalPanel.Signal = _signal3; - } - - generatedSignalPanel.Stride = 1; - generatedSignalPanel.Signal = _signal2; - - var spectrum = _fft.PowerSpectrum(_signal2.First(512)); - - spectrumPanel.Line = spectrum.Samples; - spectrumPanel.ToDecibel(); - } - - private void signalOperationButton_Click(object sender, EventArgs e) - { - if (_signal2 == null) - { - return; - } - - var param = int.Parse(operationSamplesTextBox.Text); - - switch (operationComboBox.Text) - { - case "Delay by": - _signal2 = _signal2.Delay(param); - break; - - case "Repeat times": - _signal2 = _signal2.Repeat(param); - break; - } - - _signal3 = _signal1 == null ? _signal2 : _signal1.Superimpose(_signal2); - - generatedSignalPanel.Signal = _signal2; - superimposedSignalPanel.Signal = _signal3; - } - - private void signalSliceButton_Click(object sender, EventArgs e) - { - if (_signal1 == null) - { - return; - } - - var from = int.Parse(leftSliceTextBox.Text); - var to = int.Parse(rightSliceTextBox.Text); - - _signal2 = _signal1[from, to]; - - generatedSignalPanel.Signal = _signal2; - superimposedSignalPanel.Signal = _signal3; - } - - #region playback demo - - private async void playToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_waveFileName == null || _isPaused) - { - return; - } - - _hasStartedPlaying = true; - - await _player.PlayAsync(_waveFileName); - - _hasStartedPlaying = false; - } - - private void pauseToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_waveFileName == null || _hasStartedPlaying == false) - { - return; - } - - var menuItem = sender as ToolStripMenuItem; - - if (_isPaused) - { - _player.Resume(); - menuItem.Text = "Pause"; - } - else - { - _player.Pause(); - menuItem.Text = "Resume"; - } - - _isPaused = !_isPaused; - } - - private void stopToolStripMenuItem_Click(object sender, EventArgs e) - { - if (_isPaused) - { - pauseToolStripMenuItem_Click(this.menuStrip1.Items[2], null); - } - - _player.Stop(); - _hasStartedPlaying = false; - } - - private void recordToolStripMenuItem_Click(object sender, EventArgs e) - { - var menuItem = sender as ToolStripMenuItem; - - if (_isRecording) - { - menuItem.Text = "Record"; - - _waveFileName = @"d:\recorded.wav"; - - // save to recorded.wav - _recorder.StopRecording(_waveFileName); - - // open it right away and load its audio contents to _signal1 - using (var stream = new FileStream(_waveFileName, FileMode.Open)) - { - IAudioContainer waveFile = new WaveFile(stream); - _signal1 = waveFile[Channels.Left]; - } - - signalPanel.Signal = _signal1; - } - else - { - menuItem.Text = "Stop rec"; - - // start recording with sampling rate 16 kHz - _recorder.StartRecording(16000); - } - - _isRecording = !_isRecording; - } - - #endregion - - #region menu - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void openToolStripMenuItem1_Click(object sender, EventArgs e) - { - OpenSignal(); - } - - private void saveToolStripMenuItem_Click(object sender, EventArgs e) - { - var sfd = new SaveFileDialog(); - if (sfd.ShowDialog() != DialogResult.OK) - { - return; - } - - using (var stream = new FileStream(sfd.FileName, FileMode.Create)) - { - var waveFile = new WaveFile(_signal2); - waveFile.SaveTo(stream); - } - } - - private void filtersToolStripMenuItem_Click(object sender, EventArgs e) - { - var filtersForm = new FiltersForm(); - filtersForm.ShowDialog(); - } - - private void pitchToolStripMenuItem_Click(object sender, EventArgs e) - { - new PitchForm().ShowDialog(); - } - - private void mfccToolStripMenuItem_Click(object sender, EventArgs e) - { - new MfccForm().ShowDialog(); - } - - private void lpcToolStripMenuItem_Click(object sender, EventArgs e) - { - new LpcForm().ShowDialog(); - } - - private void modulationSpectrumToolStripMenuItem_Click(object sender, EventArgs e) - { - new AmsForm().ShowDialog(); - } - - private void effectsToolStripMenuItem_Click(object sender, EventArgs e) - { - new EffectsForm().ShowDialog(); - } - - private void featuresToolStripMenuItem_Click(object sender, EventArgs e) - { - new FeaturesForm().ShowDialog(); - } - - private void stftButton_Click(object sender, EventArgs e) - { - new StftForm().ShowDialog(); - } - - private void noiseToolStripMenuItem_Click(object sender, EventArgs e) - { - new NoiseForm().ShowDialog(); - } - - private void modulationToolStripMenuItem_Click(object sender, EventArgs e) - { - new ModulationForm().ShowDialog(); - } - - private void onlineToolStripMenuItem_Click(object sender, EventArgs e) - { - new OnlineDemoForm().ShowDialog(); - } - - private void adaptiveToolStripMenuItem_Click(object sender, EventArgs e) - { - new AdaptiveFiltersForm().ShowDialog(); - } - - private void hpssToolStripMenuItem_Click(object sender, EventArgs e) - { - new HpssForm().ShowDialog(); - } - - private void waveletsToolStripMenuItem_Click(object sender, EventArgs e) - { - new WaveletForm().ShowDialog(); - } - - #endregion - } -} diff --git a/NWaves.DemoForms/SignalsForm.resx b/NWaves.DemoForms/SignalsForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/SignalsForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/StftForm.Designer.cs b/NWaves.DemoForms/StftForm.Designer.cs deleted file mode 100644 index 6da1410..0000000 --- a/NWaves.DemoForms/StftForm.Designer.cs +++ /dev/null @@ -1,192 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class StftForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.playToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.play2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.windowsComboBox = new System.Windows.Forms.ComboBox(); - this.windowPlot = new NWaves.DemoForms.UserControls.LinePlot(); - this.spectrogramPanel = new NWaves.DemoForms.UserControls.SpectrogramPlot(); - this.processedSignalPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.signalPanel = new NWaves.DemoForms.UserControls.SignalPlot(); - this.menuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // menuStrip1 - // - this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.playToolStripMenuItem, - this.play2ToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(1105, 28); - this.menuStrip1.TabIndex = 8; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); - this.fileToolStripMenuItem.Text = "&File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(129, 26); - this.openToolStripMenuItem.Text = "&Open..."; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // playToolStripMenuItem - // - this.playToolStripMenuItem.Name = "playToolStripMenuItem"; - this.playToolStripMenuItem.Size = new System.Drawing.Size(56, 24); - this.playToolStripMenuItem.Text = "Play&1"; - this.playToolStripMenuItem.Click += new System.EventHandler(this.playToolStripMenuItem_Click); - // - // play2ToolStripMenuItem - // - this.play2ToolStripMenuItem.Name = "play2ToolStripMenuItem"; - this.play2ToolStripMenuItem.Size = new System.Drawing.Size(56, 24); - this.play2ToolStripMenuItem.Text = "Play&2"; - this.play2ToolStripMenuItem.Click += new System.EventHandler(this.play2ToolStripMenuItem_Click); - // - // windowsComboBox - // - this.windowsComboBox.FormattingEnabled = true; - this.windowsComboBox.Location = new System.Drawing.Point(773, 394); - this.windowsComboBox.Name = "windowsComboBox"; - this.windowsComboBox.Size = new System.Drawing.Size(319, 24); - this.windowsComboBox.TabIndex = 13; - this.windowsComboBox.SelectedIndexChanged += new System.EventHandler(this.windowsComboBox_SelectedIndexChanged); - // - // windowPlot - // - this.windowPlot.AutoScroll = true; - this.windowPlot.BackColor = System.Drawing.Color.White; - this.windowPlot.ForeColor = System.Drawing.Color.Blue; - this.windowPlot.Gain = null; - this.windowPlot.Legend = null; - this.windowPlot.Line = null; - this.windowPlot.Location = new System.Drawing.Point(773, 426); - this.windowPlot.Mark = null; - this.windowPlot.Markline = null; - this.windowPlot.Name = "windowPlot"; - this.windowPlot.PaddingX = 30; - this.windowPlot.PaddingY = 20; - this.windowPlot.Size = new System.Drawing.Size(320, 221); - this.windowPlot.Stride = 1; - this.windowPlot.TabIndex = 12; - this.windowPlot.Thickness = 1; - // - // spectrogramPanel - // - this.spectrogramPanel.AutoScroll = true; - this.spectrogramPanel.BackColor = System.Drawing.Color.Black; - this.spectrogramPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.spectrogramPanel.ColorMapName = "magma"; - this.spectrogramPanel.Location = new System.Drawing.Point(13, 394); - this.spectrogramPanel.Markline = null; - this.spectrogramPanel.MarklineThickness = 0; - this.spectrogramPanel.Name = "spectrogramPanel"; - this.spectrogramPanel.Size = new System.Drawing.Size(754, 290); - this.spectrogramPanel.Spectrogram = null; - this.spectrogramPanel.TabIndex = 11; - // - // processedSignalPanel - // - this.processedSignalPanel.AutoScroll = true; - this.processedSignalPanel.BackColor = System.Drawing.Color.White; - this.processedSignalPanel.ForeColor = System.Drawing.Color.Blue; - this.processedSignalPanel.Gain = 1F; - this.processedSignalPanel.Location = new System.Drawing.Point(12, 213); - this.processedSignalPanel.Name = "processedSignalPanel"; - this.processedSignalPanel.PaddingX = 24; - this.processedSignalPanel.PaddingY = 5; - this.processedSignalPanel.Signal = null; - this.processedSignalPanel.Size = new System.Drawing.Size(1080, 165); - this.processedSignalPanel.Stride = 64; - this.processedSignalPanel.TabIndex = 10; - // - // signalPanel - // - this.signalPanel.AutoScroll = true; - this.signalPanel.BackColor = System.Drawing.Color.White; - this.signalPanel.ForeColor = System.Drawing.Color.Blue; - this.signalPanel.Gain = 1F; - this.signalPanel.Location = new System.Drawing.Point(12, 42); - this.signalPanel.Name = "signalPanel"; - this.signalPanel.PaddingX = 24; - this.signalPanel.PaddingY = 5; - this.signalPanel.Signal = null; - this.signalPanel.Size = new System.Drawing.Size(1081, 165); - this.signalPanel.Stride = 64; - this.signalPanel.TabIndex = 9; - // - // StftForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1105, 696); - this.Controls.Add(this.windowsComboBox); - this.Controls.Add(this.windowPlot); - this.Controls.Add(this.spectrogramPanel); - this.Controls.Add(this.processedSignalPanel); - this.Controls.Add(this.signalPanel); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.Name = "StftForm"; - this.Text = "StftForm"; - this.Load += new System.EventHandler(this.StftForm_Load); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.MenuStrip menuStrip1; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem playToolStripMenuItem; - private UserControls.SignalPlot signalPanel; - private UserControls.SignalPlot processedSignalPanel; - private UserControls.SpectrogramPlot spectrogramPanel; - private UserControls.LinePlot windowPlot; - private System.Windows.Forms.ComboBox windowsComboBox; - private System.Windows.Forms.ToolStripMenuItem play2ToolStripMenuItem; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/StftForm.cs b/NWaves.DemoForms/StftForm.cs deleted file mode 100644 index 7d84463..0000000 --- a/NWaves.DemoForms/StftForm.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Windows.Forms; -using NWaves.Audio; -using NWaves.Filters; -using NWaves.Operations; -using NWaves.Signals; -using NWaves.Transforms; -using NWaves.Windows; - -namespace NWaves.DemoForms -{ - public partial class StftForm : Form - { - private DiscreteSignal _signal; - private DiscreteSignal _processedSignal; - - private Stft _stft; - private List _spectrogram; - private WindowType _windowType = WindowType.Hann; - - private string _waveFileName; - private short _bitDepth; - - private readonly MemoryStreamPlayer _player = new MemoryStreamPlayer(); - - - public StftForm() - { - InitializeComponent(); - } - - private void StftForm_Load(object sender, EventArgs e) - { - windowsComboBox.Items.AddRange(Enum.GetNames(typeof(WindowType))); - } - - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - var ofd = new OpenFileDialog(); - if (ofd.ShowDialog() != DialogResult.OK) - { - return; - } - - _waveFileName = ofd.FileName; - - using (var stream = new FileStream(_waveFileName, FileMode.Open)) - { - var waveFile = new WaveFile(stream); - _bitDepth = waveFile.WaveFmt.BitsPerSample; - _signal = waveFile[Channels.Average]; - } - - _stft = new Stft(512, 128, _windowType); - - _spectrogram = _stft.Spectrogram(_signal); - - var processed = _stft.Inverse(_stft.Direct(_signal)); - _processedSignal = new DiscreteSignal(_signal.SamplingRate, processed); - - - // 1) check also this: - //var mp = _stft.MagnitudePhaseSpectrogram(_signal); - //var processed = _stft.ReconstructMagnitudePhase(mp, false); - //_processedSignal = new DiscreteSignal(_signal.SamplingRate, processed); - - // 2) or check this: - //var processed = new GriffinLimReconstructor(_spectrogram, _stft).Reconstruct(); - //_processedSignal = new DiscreteSignal(_signal.SamplingRate, processed); - - signalPanel.Gain = 120; - signalPanel.Signal = _signal; - processedSignalPanel.Gain = 120; - processedSignalPanel.Signal = _processedSignal; - - spectrogramPanel.Spectrogram = _spectrogram; - - - //// StftC - has complex FFT - - //// RealFFT-based Stft is 30% faster! - - //var sr = new Stft(2048, 256); - //var sc = new StftC(2048, 256); - - //var sw = new Stopwatch(); - - //sw.Start(); - - //for (var i = 0; i < 10; i++) - //{ - // var processed1 = sr.Inverse(sr.Direct(_signal)); - // _processedSignal = new DiscreteSignal(_signal.SamplingRate, processed1); - //} - - //sw.Stop(); - - //var t1 = sw.Elapsed; - - - //sw.Reset(); - //sw.Start(); - - //for (var i = 0; i < 10; i++) - //{ - // var processed1 = sc.Inverse(sc.Direct(_signal)); - // _processedSignal = new DiscreteSignal(_signal.SamplingRate, processed1); - //} - - //sw.Stop(); - - //var t2 = sw.Elapsed; - - //MessageBox.Show(t1 + " " + t2); - } - - private async void playToolStripMenuItem_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_signal, _bitDepth); - } - - private async void play2ToolStripMenuItem_Click(object sender, EventArgs e) - { - await _player.PlayAsync(_processedSignal, _bitDepth); - } - - private void windowsComboBox_SelectedIndexChanged(object sender, EventArgs e) - { - _windowType = (WindowType)windowsComboBox.SelectedIndex; - windowPlot.Line = Window.OfType(_windowType, 256); - } - } -} diff --git a/NWaves.DemoForms/StftForm.resx b/NWaves.DemoForms/StftForm.resx deleted file mode 100644 index d5494e3..0000000 --- a/NWaves.DemoForms/StftForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - 17, 17 - - \ No newline at end of file diff --git a/NWaves.DemoForms/UserControls/GroupPlot.Designer.cs b/NWaves.DemoForms/UserControls/GroupPlot.Designer.cs deleted file mode 100644 index 4054c43..0000000 --- a/NWaves.DemoForms/UserControls/GroupPlot.Designer.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace NWaves.DemoForms.UserControls -{ - public partial class GroupPlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // GroupPlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.BackColor = System.Drawing.Color.White; - this.DoubleBuffered = true; - this.Name = "GroupPlot"; - this.Size = new System.Drawing.Size(352, 90); - this.Load += new System.EventHandler(this.GroupPlot_Load); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/NWaves.DemoForms/UserControls/GroupPlot.cs b/NWaves.DemoForms/UserControls/GroupPlot.cs deleted file mode 100644 index 5dd2070..0000000 --- a/NWaves.DemoForms/UserControls/GroupPlot.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; - -namespace NWaves.DemoForms.UserControls -{ - public partial class GroupPlot : UserControl - { - /// - /// Groups to plot - /// - private float[][] _groups; - public float[][] Groups - { - get { return _groups; } - set - { - _groups = value; - if (_groups == null) return; - AutoScrollMinSize = new Size(_groups.Max(g => g.Length) * Stride + 20, 0); - MakeBitmap(); - Invalidate(); - } - } - - public int Stride { get; set; } = 2; - public int Gain { get; set; } = 100; - - - public GroupPlot() - { - InitializeComponent(); - } - - private void GroupPlot_Load(object sender, EventArgs e) - { - MakeBitmap(); - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - e.Graphics.DrawImage(_bmp, 0, 0, - new Rectangle(-AutoScrollPosition.X, 0, Width, Height), - GraphicsUnit.Pixel); - } - - private Bitmap _bmp; - - private void MakeBitmap() - { - var width = Math.Max(AutoScrollMinSize.Width, Width); - - _bmp = new Bitmap(width, Height); - - var g = Graphics.FromImage(_bmp); - g.Clear(Color.White); - - var offset = Height - 30; - - var gray = new Pen(Color.LightGray) { DashPattern = new[] { 2f, 2f } }; - - for (var k = 0; k < offset; k += 10) - { - g.DrawLine(gray, 0, offset + k, width, offset + k); - g.DrawLine(gray, 0, offset - k, width, offset - k); - } - - gray.Dispose(); - - var black = new Pen(Color.Black); - - g.DrawLine(black, 20, offset, width, offset); - g.DrawLine(black, 20, 5, 20, Height - 5); - - black.Dispose(); - - if (_groups == null) - { - return; - } - - - var rand = new Random(); - - for (var j = 0; j < _groups.Length; j++) - { - var pen = new Pen(Color.FromArgb(rand.Next() % 255, rand.Next() % 255, rand.Next() % 255)); - - var i = 1; - var x = Stride; - - while (i < _groups[j].Length) - { - g.DrawLine(pen, - 20 + x - Stride, -_groups[j][i - 1] * Gain + offset, - 20 + x, -_groups[j][i] * Gain + offset); - x += Stride; - i++; - } - - pen.Dispose(); - } - - g.Dispose(); - } - } -} diff --git a/NWaves.DemoForms/UserControls/GroupPlot.resx b/NWaves.DemoForms/UserControls/GroupPlot.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/UserControls/GroupPlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/UserControls/LinePlot.Designer.cs b/NWaves.DemoForms/UserControls/LinePlot.Designer.cs deleted file mode 100644 index 1cb7a18..0000000 --- a/NWaves.DemoForms/UserControls/LinePlot.Designer.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace NWaves.DemoForms.UserControls -{ - public partial class LinePlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // LinePlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.BackColor = System.Drawing.Color.White; - this.DoubleBuffered = true; - this.Name = "LinePlot"; - this.Size = new System.Drawing.Size(352, 90); - this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LinePlot_MouseClick); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/NWaves.DemoForms/UserControls/LinePlot.cs b/NWaves.DemoForms/UserControls/LinePlot.cs deleted file mode 100644 index 599f96c..0000000 --- a/NWaves.DemoForms/UserControls/LinePlot.cs +++ /dev/null @@ -1,288 +0,0 @@ -using System; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; -using LevelScale = NWaves.Utils.Scale; - -namespace NWaves.DemoForms.UserControls -{ - public partial class LinePlot : UserControl - { - /// - /// Line to plot - /// - private float[] _line; - public float[] Line - { - get { return _line; } - set - { - _line = value; - _logLine = null; - if (_line == null) return; - AutoScrollMinSize = new Size(_line.Length * Stride + 20, 0); - MakeBitmap(); - Invalidate(); - } - } - - /// - /// Some mark line to plot - /// - private float[] _markline; - public float[] Markline - { - get { return _markline; } - set - { - _markline = value; - _logMarkline = null; - MakeBitmap(); - Invalidate(); - } - } - - /// - /// One vertical markline - /// - private int? _mark; - public int? Mark - { - get { return _mark; } - set - { - _mark = value; - MakeBitmap(); - Invalidate(); - } - } - - public float? Gain { get; set; } = null; - public int Thickness { get; set; } = 1; - public int Stride { get; set; } = 1; - public string Legend { get; set; } - - public int PaddingX { get; set; } = 30; - public int PaddingY { get; set; } = 20; - - private float[] _logLine; - private float[] _logMarkline; - - - public LinePlot() - { - InitializeComponent(); - ForeColor = Color.Blue; - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - if (_bmp == null) MakeBitmap(); - - e.Graphics.DrawImage(_bmp, 0, 0, - new Rectangle(-AutoScrollPosition.X, 0, Width, Height), - GraphicsUnit.Pixel); - } - - public void ToDecibel() - { - if (_line == null) - { - return; - } - - if (_logLine == null) - { - _logLine = _line.Select(l => - { - var val = (float)LevelScale.ToDecibel(l); - //if (float.IsNaN(val)) val = Height / 2 + 1; - if (float.IsNaN(val) || Math.Abs(val) > int.MaxValue) val = Height / 2 + 1; - return val / Gain ?? val; - }) - .ToArray(); - } - else - { - _logLine = null; - } - - if (_markline != null) - { - if (_logMarkline == null) - { - _logMarkline = _markline.Select(l => - { - var val = (float)LevelScale.ToDecibel(l); - if (float.IsNaN(val) || Math.Abs(val) > Height) val = Height/2 + 1; - return val / Gain ?? val; - }) - .ToArray(); - } - else - { - _logMarkline = null; - } - } - - MakeBitmap(); - Invalidate(); - } - - private void LinePlot_MouseClick(object sender, MouseEventArgs e) - { - ToDecibel(); - } - - - private Bitmap _bmp; - - private void MakeBitmap() - { - var width = Math.Max(AutoScrollMinSize.Width, Width); - - _bmp = new Bitmap(width, Height); - - var g = Graphics.FromImage(_bmp); - g.Clear(Color.White); - - var offset = Height / 2; - - var gray = new Pen(Color.LightGray) { DashPattern = new[] { 2f, 2f } }; - - for (var k = 0; k < offset; k += 10) - { - g.DrawLine(gray, 0, offset + k, width, offset + k); - g.DrawLine(gray, 0, offset - k, width, offset - k); - } - - gray.Dispose(); - - var min = 0.0f; - var max = 0.0f; - - if (_line != null) - { - var pen = new Pen(ForeColor, Thickness); - - var x = PaddingX + Stride; - - var line = _logLine ?? _line; - - var gain = Gain; - if (!Gain.HasValue) - { - min = line.Min(); - max = line.Max(); - - gain = max - min < 1e-6 ? 1 : (Height - 2*PaddingY) / (max - min); - - offset = (int)(Height - PaddingY + min * gain); - - DrawAxes(g, min, max); - } - else - { - DrawAxes(g, -(Height - 2*PaddingY) / (2 * gain.Value), - (Height-2*PaddingY) / (2 * gain.Value)); - } - - for (var i = 1; i < line.Length; i++) - { - g.DrawLine(pen, x - Stride, (float)(-line[i - 1] * gain) + offset, - x, (float)(-line[i] * gain) + offset); - x += Stride; - } - - pen.Dispose(); - } - - if (_logLine != null) - { - g.DrawString("(log)", new Font("arial", 12), new SolidBrush(ForeColor), Width - 50, 5); - } - - - if (_markline != null) - { - var markline = _logMarkline ?? _markline; - - var gain = Gain; - if (!Gain.HasValue) - { - if (_line == null) - { - min = markline.Min(); - max = markline.Max(); - - DrawAxes(g, min, max); - } - - gain = max - min < 1e-6 ? 1 : (Height - 2 * PaddingY) / (max - min); - - offset = (int)(Height - PaddingY + min * gain); - } - - var pen = new Pen(Color.Red, 2); - var x = PaddingX + Stride; - for (var j = 1; j < _markline.Length; j++) - { - var y1 = Math.Abs(markline[j - 1]) < Math.Abs(Height) ? (float)(-markline[j - 1] * gain) : 0; - var y2 = Math.Abs(markline[j]) < Math.Abs(Height) ? (float)(-markline[j] * gain) : 0; - - g.DrawLine(pen, x - Stride, y1 + offset, x, y2 + offset); - x += Stride; - } - - pen.Dispose(); - } - - var red = new Pen(Color.Red, 2); - - if (_mark != null) - { - g.DrawLine(red, PaddingX + _mark.Value * Stride, PaddingY, - PaddingX + _mark.Value * Stride, Height - PaddingY); - } - - if (Legend != null) - { - var font = new Font("arial", 16); - var brush = new SolidBrush(Color.Red); - g.DrawString(Legend, font, brush, 100, 30); - font.Dispose(); - brush.Dispose(); - } - - red.Dispose(); - - g.Dispose(); - } - - private void DrawAxes(Graphics g, float min, float max) - { - var black = new Pen(Color.Black); - - g.DrawLine(black, PaddingX, Height - PaddingY, _bmp.Width, Height - PaddingY); - g.DrawLine(black, PaddingX, 10, PaddingX, Height - PaddingY); - - var font = new Font("arial", 5); - var brush = new SolidBrush(Color.Black); - - const int stride = 20; - var pos = Height - 12; - var n = (Height - 2*PaddingY) / stride; - for (var i = 0; i <= n; i++) - { - g.DrawString(string.Format("{0:F2}", min + i*(max-min)/n), font, brush, 1, pos -= stride); - } - - font.Dispose(); - brush.Dispose(); - - black.Dispose(); - } - } -} diff --git a/NWaves.DemoForms/UserControls/LinePlot.resx b/NWaves.DemoForms/UserControls/LinePlot.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/UserControls/LinePlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/UserControls/PoleZeroPlot.Designer.cs b/NWaves.DemoForms/UserControls/PoleZeroPlot.Designer.cs deleted file mode 100644 index 7446100..0000000 --- a/NWaves.DemoForms/UserControls/PoleZeroPlot.Designer.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace NWaves.DemoForms.UserControls -{ - public partial class PoleZeroPlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // PoleZeroPlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.BackColor = System.Drawing.Color.White; - this.DoubleBuffered = true; - this.Name = "PoleZeroPlot"; - this.Size = new System.Drawing.Size(352, 90); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/NWaves.DemoForms/UserControls/PoleZeroPlot.cs b/NWaves.DemoForms/UserControls/PoleZeroPlot.cs deleted file mode 100644 index 6250106..0000000 --- a/NWaves.DemoForms/UserControls/PoleZeroPlot.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using System.Drawing; -using System.Numerics; -using System.Windows.Forms; -using NWaves.Signals; - -namespace NWaves.DemoForms.UserControls -{ - public partial class PoleZeroPlot : UserControl - { - /// - /// Poles - /// - private Complex[] _poles; - public Complex[] Poles - { - get => _poles; - set - { - _poles = value; - Invalidate(); - } - } - - /// - /// Zeros - /// - private Complex[] _zeros; - public Complex[] Zeros - { - get => _zeros; - set - { - _zeros = value; - Invalidate(); - } - } - - - public PoleZeroPlot() - { - InitializeComponent(); - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - var g = e.Graphics; - g.Clear(Color.White); - - var offset = Height / 2; - - var gray = new Pen(Color.LightGray) { DashPattern = new[] { 2f, 2f } }; - - for (var k = 0; k < offset; k += 10) - { - g.DrawLine(gray, 0, offset + k, Width, offset + k); - g.DrawLine(gray, 0, offset - k, Width, offset - k); - } - - gray.Dispose(); - - - var unitRadius = Height / 3; - - var cx = Width / 2; - var cy = Height / 2; - - var pen = new Pen(Color.Blue); - - g.DrawLine(pen, 10, cy, Width - 10, cy); - g.DrawLine(pen, cx, 10, cx, Height - 10); - - for (var i = 0; i < 360; i++) - { - var x = cx + unitRadius * Math.Cos(i * Math.PI / 180); - var y = cy + unitRadius * Math.Sin(i * Math.PI / 180); - - g.DrawEllipse(pen, (int)x - 1, (int)y - 1, 1, 1); - } - - pen.Dispose(); - - var red = new Pen(Color.Red, 3); - - if (_zeros == null) - { - return; - } - - for (var i = 0; i < _zeros.Length; i++) - { - var x = cx + unitRadius * _zeros[i].Real; - var y = cy + unitRadius * _zeros[i].Imaginary; - if (x - 4 > 0 && x + 4 < Width && - y - 4 > 0 && y + 4 < Height) - { - g.DrawEllipse(red, (int)x - 4, (int)y - 4, 8, 8); - } - } - - if (_poles == null) - { - return; - } - - for (var i = 0; i < _poles.Length; i++) - { - var x = cx + unitRadius * _poles[i].Real; - var y = cy + unitRadius * _poles[i].Imaginary; - if (x - 6 > 0 && x + 6 < Width && - y - 6 > 0 && y + 6 < Height) - { - g.DrawLine(red, (int)x - 6, (int)y - 6, (int)x + 6, (int)y + 6); - g.DrawLine(red, (int)x + 6, (int)y - 6, (int)x - 6, (int)y + 6); - } - } - - red.Dispose(); - } - } -} diff --git a/NWaves.DemoForms/UserControls/PoleZeroPlot.resx b/NWaves.DemoForms/UserControls/PoleZeroPlot.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/UserControls/PoleZeroPlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/UserControls/SignalPlot.Designer.cs b/NWaves.DemoForms/UserControls/SignalPlot.Designer.cs deleted file mode 100644 index a3baca8..0000000 --- a/NWaves.DemoForms/UserControls/SignalPlot.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace NWaves.DemoForms.UserControls -{ - public partial class SignalPlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.buttonZoomIn = new System.Windows.Forms.Button(); - this.buttonZoomOut = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // buttonZoomIn - // - this.buttonZoomIn.BackColor = System.Drawing.Color.LightYellow; - this.buttonZoomIn.FlatAppearance.BorderColor = System.Drawing.Color.Gray; - this.buttonZoomIn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); - this.buttonZoomIn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonZoomIn.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.buttonZoomIn.Location = new System.Drawing.Point(0, 0); - this.buttonZoomIn.Margin = new System.Windows.Forms.Padding(0); - this.buttonZoomIn.Name = "buttonZoomIn"; - this.buttonZoomIn.Size = new System.Drawing.Size(25, 25); - this.buttonZoomIn.TabIndex = 0; - this.buttonZoomIn.Text = "+"; - this.buttonZoomIn.UseVisualStyleBackColor = false; - this.buttonZoomIn.Click += new System.EventHandler(this.buttonZoomIn_Click); - // - // buttonZoomOut - // - this.buttonZoomOut.BackColor = System.Drawing.Color.LightYellow; - this.buttonZoomOut.FlatAppearance.BorderColor = System.Drawing.Color.Gray; - this.buttonZoomOut.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); - this.buttonZoomOut.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.buttonZoomOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.buttonZoomOut.Location = new System.Drawing.Point(24, 0); - this.buttonZoomOut.Margin = new System.Windows.Forms.Padding(0); - this.buttonZoomOut.Name = "buttonZoomOut"; - this.buttonZoomOut.Size = new System.Drawing.Size(25, 25); - this.buttonZoomOut.TabIndex = 1; - this.buttonZoomOut.Text = "-"; - this.buttonZoomOut.UseVisualStyleBackColor = false; - this.buttonZoomOut.Click += new System.EventHandler(this.buttonZoomOut_Click); - // - // SignalPlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.buttonZoomOut); - this.Controls.Add(this.buttonZoomIn); - this.DoubleBuffered = true; - this.Name = "SignalPlot"; - this.Size = new System.Drawing.Size(352, 90); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button buttonZoomIn; - private System.Windows.Forms.Button buttonZoomOut; - } -} diff --git a/NWaves.DemoForms/UserControls/SignalPlot.cs b/NWaves.DemoForms/UserControls/SignalPlot.cs deleted file mode 100644 index 4d9b6bd..0000000 --- a/NWaves.DemoForms/UserControls/SignalPlot.cs +++ /dev/null @@ -1,161 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using NWaves.Signals; - -namespace NWaves.DemoForms.UserControls -{ - public partial class SignalPlot : UserControl - { - /// - /// Signal to plot - /// - private DiscreteSignal _signal; - public DiscreteSignal Signal - { - get { return _signal; } - set - { - _signal = value; - if (_signal == null) return; - AutoScrollMinSize = new Size(_signal.Length / _stride + 20, 0); - MakeBitmap(); - Invalidate(); - } - } - - private int _stride = 64; - public int Stride - { - get { return _stride; } - set - { - _stride = value > 1 ? value : 1; - if (_signal == null) return; - AutoScrollMinSize = new Size(_signal.Length / _stride + 20, 0); - MakeBitmap(); - Invalidate(); - } - } - - public float Gain { get; set; } = 1; - - public int PaddingX { get; set; } = 24; - public int PaddingY { get; set; } = 5; - - - public SignalPlot() - { - InitializeComponent(); - ForeColor = Color.Blue; - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - if (_bmp == null) MakeBitmap(); - - e.Graphics.DrawImage(_bmp, 0, 0, - new Rectangle(-AutoScrollPosition.X, 0, Width, Height), - GraphicsUnit.Pixel); - } - - private void buttonZoomIn_Click(object sender, System.EventArgs e) - { - if (_stride < 4) - { - Stride++; - } - else - { - Stride = (int)(_stride * 1.25); - } - } - - private void buttonZoomOut_Click(object sender, System.EventArgs e) - { - Stride = (int)(_stride / 1.25); - } - - - private Bitmap _bmp; - - private void MakeBitmap() - { - var width = Math.Max(AutoScrollMinSize.Width, Width); - - _bmp = new Bitmap(width, Height); - - var g = Graphics.FromImage(_bmp); - g.Clear(Color.White); - - var offset = Height / 2; - - var gray = new Pen(Color.LightGray) { DashPattern = new[] { 2f, 2f } }; - - for (var k = 0; k < offset; k += 10) - { - g.DrawLine(gray, 0, offset + k, width, offset + k); - g.DrawLine(gray, 0, offset - k, width, offset - k); - } - - gray.Dispose(); - - if (_signal != null) - { - DrawAxes(g, -(Height - 2 * PaddingY) / (2 * Gain), - (Height - 2 * PaddingY) / (2 * Gain)); - - var pen = new Pen(ForeColor); - - var i = 0; - var x = PaddingX; - - while (i < _signal.Length - _stride) - { - var j = 0; - var min = 0.0; - var max = 0.0; - while (j < _stride) - { - if (_signal[i + j] > max) max = _signal[i + j]; - if (_signal[i + j] < min) min = _signal[i + j]; - j++; - } - g.DrawLine(pen, x, (float) (-min*Gain) + offset, x, (float) (-max*Gain) + offset); - x++; - i += _stride; - } - - pen.Dispose(); - } - - g.Dispose(); - } - - private void DrawAxes(Graphics g, float min, float max) - { - var black = new Pen(Color.Black); - - g.DrawLine(black, PaddingX, Height/2, _bmp.Width, Height/2); - g.DrawLine(black, PaddingX, 10, PaddingX, Height - PaddingY); - - var font = new Font("arial", 5); - var brush = new SolidBrush(Color.Black); - - const int stride = 20; - var pos = Height + 2; - var n = (Height - 2 * PaddingY) / stride; - for (var i = 0; i <= n; i++) - { - g.DrawString(string.Format("{0:F2}", min + i * (max - min) / n), font, brush, 1, pos -= stride); - } - - font.Dispose(); - brush.Dispose(); - - black.Dispose(); - } - } -} diff --git a/NWaves.DemoForms/UserControls/SignalPlot.resx b/NWaves.DemoForms/UserControls/SignalPlot.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/UserControls/SignalPlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/UserControls/SpectrogramPlot.Designer.cs b/NWaves.DemoForms/UserControls/SpectrogramPlot.Designer.cs deleted file mode 100644 index a102c8c..0000000 --- a/NWaves.DemoForms/UserControls/SpectrogramPlot.Designer.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace NWaves.DemoForms.UserControls -{ - partial class SpectrogramPlot - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.SuspendLayout(); - // - // SpectrogramPlot - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.BackColor = System.Drawing.Color.Black; - this.DoubleBuffered = true; - this.Name = "SpectrogramPlot"; - this.Size = new System.Drawing.Size(374, 147); - this.ResumeLayout(false); - - } - - #endregion - } -} diff --git a/NWaves.DemoForms/UserControls/SpectrogramPlot.cs b/NWaves.DemoForms/UserControls/SpectrogramPlot.cs deleted file mode 100644 index 69f6ef4..0000000 --- a/NWaves.DemoForms/UserControls/SpectrogramPlot.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Windows.Forms; -using SciColorMaps; - -namespace NWaves.DemoForms.UserControls -{ - public partial class SpectrogramPlot : UserControl - { - private List _spectrogram; - public List Spectrogram - { - get { return _spectrogram; } - set - { - _spectrogram = value; - - if (_spectrogram == null) - { - return; - } - - // post-process spectrogram for better visualization - - var spectraCount = _spectrogram.Count; - - var minValue = _spectrogram.SelectMany(s => s).Min(); - var maxValue = _spectrogram.SelectMany(s => s).Max(); - - for (var i = 0; i < spectraCount; i++) - { - _spectrogram[i] = _spectrogram[i].Select(s => - { - var sqrt = (float)Math.Sqrt(s); - return sqrt*3 < maxValue ? sqrt*3 : sqrt/1.5f; - }) - .ToArray(); - } - maxValue /= 12; - - _cmap = new ColorMap(ColorMapName, minValue, maxValue); - - AutoScrollMinSize = new Size(_spectrogram.Count, 0); - - Invalidate(); - } - } - - private float[] _markline; - public float[] Markline - { - get { return _markline; } - set - { - _markline = value; - Invalidate(); - } - } - - private int _marklineThickness; - public int MarklineThickness - { - get { return _marklineThickness; } - set - { - _marklineThickness = value; - Invalidate(); - } - } - - public string ColorMapName { get; set; } = "magma"; - - private ColorMap _cmap; - - - public SpectrogramPlot() - { - InitializeComponent(); - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - if (_spectrogram == null) - { - return; - } - - var g = e.Graphics; - g.Clear(Color.White); - - var width = Math.Min(Width, _spectrogram.Count); - var spectrogramBitmap = new Bitmap(width, _spectrogram[0].Length); - - var realPos = 0; - var startPos = -AutoScrollPosition.X; - for (var i = startPos; i < startPos + spectrogramBitmap.Width; i++, realPos++) - { - for (var j = 0; j < _spectrogram[i].Length; j++) - { - spectrogramBitmap.SetPixel(realPos, _spectrogram[i].Length - 1 - j, _cmap.GetColor(_spectrogram[i][j])); - } - } - - g.DrawImage(spectrogramBitmap, 0, 0); - - if (_markline != null) - { - var pen = new Pen(Color.DeepPink, _marklineThickness); - - realPos = 1; - for (var i = startPos + 1; i < Math.Min(startPos + spectrogramBitmap.Width, _markline.Length); i++, realPos++) - { - g.DrawLine(pen, realPos - 1, _spectrogram[i].Length - 1 - (int) (_markline[i - 1]), - realPos, _spectrogram[i].Length - 1 - (int) (_markline[i])); - } - - pen.Dispose(); - } - } - } -} diff --git a/NWaves.DemoForms/UserControls/SpectrogramPlot.resx b/NWaves.DemoForms/UserControls/SpectrogramPlot.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/UserControls/SpectrogramPlot.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/WaveletForm.Designer.cs b/NWaves.DemoForms/WaveletForm.Designer.cs deleted file mode 100644 index ddc99a1..0000000 --- a/NWaves.DemoForms/WaveletForm.Designer.cs +++ /dev/null @@ -1,263 +0,0 @@ -namespace NWaves.DemoForms -{ - partial class WaveletForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.comboBoxFamily = new System.Windows.Forms.ComboBox(); - this.comboBoxTaps = new System.Windows.Forms.ComboBox(); - this.textBoxSize = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.linePlotWavelet = new NWaves.DemoForms.UserControls.LinePlot(); - this.textBoxCoeffs = new System.Windows.Forms.TextBox(); - this.textBoxResult = new System.Windows.Forms.TextBox(); - this.buttonCompute = new System.Windows.Forms.Button(); - this.labelWaveletName = new System.Windows.Forms.Label(); - this.textBoxResultInv = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.comboBoxLevel = new System.Windows.Forms.ComboBox(); - this.SuspendLayout(); - // - // comboBoxFamily - // - this.comboBoxFamily.FormattingEnabled = true; - this.comboBoxFamily.Location = new System.Drawing.Point(66, 34); - this.comboBoxFamily.Name = "comboBoxFamily"; - this.comboBoxFamily.Size = new System.Drawing.Size(162, 24); - this.comboBoxFamily.TabIndex = 0; - // - // comboBoxTaps - // - this.comboBoxTaps.FormattingEnabled = true; - this.comboBoxTaps.Location = new System.Drawing.Point(66, 64); - this.comboBoxTaps.Name = "comboBoxTaps"; - this.comboBoxTaps.Size = new System.Drawing.Size(162, 24); - this.comboBoxTaps.TabIndex = 1; - // - // textBoxSize - // - this.textBoxSize.Location = new System.Drawing.Point(66, 6); - this.textBoxSize.Name = "textBoxSize"; - this.textBoxSize.Size = new System.Drawing.Size(162, 22); - this.textBoxSize.TabIndex = 3; - this.textBoxSize.Text = "64"; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 6); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 17); - this.label1.TabIndex = 4; - this.label1.Text = "Size"; - // - // linePlotWavelet - // - this.linePlotWavelet.AutoScroll = true; - this.linePlotWavelet.BackColor = System.Drawing.Color.White; - this.linePlotWavelet.ForeColor = System.Drawing.Color.Blue; - this.linePlotWavelet.Location = new System.Drawing.Point(15, 194); - this.linePlotWavelet.Name = "linePlotWavelet"; - this.linePlotWavelet.PaddingX = 30; - this.linePlotWavelet.PaddingY = 20; - this.linePlotWavelet.Size = new System.Drawing.Size(357, 293); - this.linePlotWavelet.Stride = 1; - this.linePlotWavelet.TabIndex = 5; - this.linePlotWavelet.Thickness = 1; - // - // textBoxCoeffs - // - this.textBoxCoeffs.Location = new System.Drawing.Point(378, 6); - this.textBoxCoeffs.Multiline = true; - this.textBoxCoeffs.Name = "textBoxCoeffs"; - this.textBoxCoeffs.Size = new System.Drawing.Size(208, 481); - this.textBoxCoeffs.TabIndex = 6; - // - // textBoxResult - // - this.textBoxResult.Location = new System.Drawing.Point(592, 6); - this.textBoxResult.Multiline = true; - this.textBoxResult.Name = "textBoxResult"; - this.textBoxResult.Size = new System.Drawing.Size(203, 481); - this.textBoxResult.TabIndex = 7; - // - // buttonCompute - // - this.buttonCompute.Location = new System.Drawing.Point(66, 124); - this.buttonCompute.Name = "buttonCompute"; - this.buttonCompute.Size = new System.Drawing.Size(162, 56); - this.buttonCompute.TabIndex = 8; - this.buttonCompute.Text = "Go!"; - this.buttonCompute.UseVisualStyleBackColor = true; - this.buttonCompute.Click += new System.EventHandler(this.buttonCompute_Click); - // - // labelWaveletName - // - this.labelWaveletName.Location = new System.Drawing.Point(252, 64); - this.labelWaveletName.Name = "labelWaveletName"; - this.labelWaveletName.Size = new System.Drawing.Size(101, 23); - this.labelWaveletName.TabIndex = 9; - this.labelWaveletName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // textBoxResultInv - // - this.textBoxResultInv.Location = new System.Drawing.Point(801, 6); - this.textBoxResultInv.Multiline = true; - this.textBoxResultInv.Name = "textBoxResultInv"; - this.textBoxResultInv.Size = new System.Drawing.Size(203, 481); - this.textBoxResultInv.TabIndex = 10; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 37); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(48, 17); - this.label2.TabIndex = 11; - this.label2.Text = "Family"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 67); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(40, 17); - this.label3.TabIndex = 12; - this.label3.Text = "Taps"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(110, 505); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(162, 17); - this.label4.TabIndex = 13; - this.label4.Text = "Lo_Dec and Hi_Dec plot"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(432, 505); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(99, 17); - this.label5.TabIndex = 14; - this.label5.Text = "Lo_Dec coeffs"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(608, 505); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(158, 17); - this.label6.TabIndex = 15; - this.label6.Text = "FWT of [0,1,2,...,Size-1]"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(818, 505); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(166, 17); - this.label7.TabIndex = 16; - this.label7.Text = "Reconstructed from FWT"; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(12, 97); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(42, 17); - this.label8.TabIndex = 18; - this.label8.Text = "Level"; - // - // comboBoxLevel - // - this.comboBoxLevel.FormattingEnabled = true; - this.comboBoxLevel.Location = new System.Drawing.Point(66, 94); - this.comboBoxLevel.Name = "comboBoxLevel"; - this.comboBoxLevel.Size = new System.Drawing.Size(162, 24); - this.comboBoxLevel.TabIndex = 17; - // - // WaveletForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1015, 547); - this.Controls.Add(this.label8); - this.Controls.Add(this.comboBoxLevel); - this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.label5); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.textBoxResultInv); - this.Controls.Add(this.labelWaveletName); - this.Controls.Add(this.buttonCompute); - this.Controls.Add(this.textBoxResult); - this.Controls.Add(this.textBoxCoeffs); - this.Controls.Add(this.linePlotWavelet); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBoxSize); - this.Controls.Add(this.comboBoxTaps); - this.Controls.Add(this.comboBoxFamily); - this.Name = "WaveletForm"; - this.Text = "WaveletForm"; - this.Load += new System.EventHandler(this.WaveletForm_Load); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.ComboBox comboBoxFamily; - private System.Windows.Forms.ComboBox comboBoxTaps; - private System.Windows.Forms.TextBox textBoxSize; - private System.Windows.Forms.Label label1; - private UserControls.LinePlot linePlotWavelet; - private System.Windows.Forms.TextBox textBoxCoeffs; - private System.Windows.Forms.TextBox textBoxResult; - private System.Windows.Forms.Button buttonCompute; - private System.Windows.Forms.Label labelWaveletName; - private System.Windows.Forms.TextBox textBoxResultInv; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.ComboBox comboBoxLevel; - } -} \ No newline at end of file diff --git a/NWaves.DemoForms/WaveletForm.cs b/NWaves.DemoForms/WaveletForm.cs deleted file mode 100644 index 3ba322f..0000000 --- a/NWaves.DemoForms/WaveletForm.cs +++ /dev/null @@ -1,58 +0,0 @@ -using NWaves.Transforms.Wavelets; -using System; -using System.Data; -using System.Linq; -using System.Windows.Forms; - -namespace NWaves.DemoForms -{ - public partial class WaveletForm : Form - { - public WaveletForm() - { - InitializeComponent(); - } - - private void WaveletForm_Load(object sender, EventArgs e) - { - comboBoxFamily.Items.AddRange(Enum.GetNames(typeof(WaveletFamily))); - comboBoxTaps.Items.AddRange(Enumerable.Range(1, 20).Select(i => i.ToString()).ToArray()); - comboBoxLevel.Items.Add("Auto"); - comboBoxLevel.Items.AddRange(Enumerable.Range(1, 20).Select(i => i.ToString()).ToArray()); - } - - private void buttonCompute_Click(object sender, EventArgs e) - { - var size = int.Parse(textBoxSize.Text); - var family = (WaveletFamily)comboBoxFamily.SelectedIndex; - var taps = comboBoxTaps.SelectedIndex + 1; - var level = comboBoxLevel.SelectedIndex; - - var wavelet = new Wavelet(family, taps); - - var fwt = new Fwt(size, wavelet); - - var output = new float[size]; - var reconstructed = new float[size]; - - fwt.Direct(Enumerable.Range(0, size).Select(x => (float)x).ToArray(), output, level); - fwt.Inverse(output, reconstructed, level); - - var res = string.Join("\r\n", output.Select(o => o.ToString())); - textBoxResult.Text = res; - - var inv = string.Join("\r\n", reconstructed.Select(o => o.ToString())); - textBoxResultInv.Text = inv; - - labelWaveletName.Text = wavelet.Name; - - linePlotWavelet.Thickness = 2; - linePlotWavelet.Stride = 8; - linePlotWavelet.Line = wavelet.LoD; - linePlotWavelet.Markline = wavelet.HiD; - - var coeffs = string.Join("\r\n", wavelet.LoD.Select(o => o.ToString())); - textBoxCoeffs.Text = coeffs; - } - } -} diff --git a/NWaves.DemoForms/WaveletForm.resx b/NWaves.DemoForms/WaveletForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/NWaves.DemoForms/WaveletForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/NWaves.DemoForms/packages.config b/NWaves.DemoForms/packages.config deleted file mode 100644 index 9ca959c..0000000 --- a/NWaves.DemoForms/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/NWaves.DemoUwp/App.xaml b/NWaves.DemoUwp/App.xaml deleted file mode 100644 index f0e7d95..0000000 --- a/NWaves.DemoUwp/App.xaml +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/NWaves.DemoUwp/App.xaml.cs b/NWaves.DemoUwp/App.xaml.cs deleted file mode 100644 index 668c9a5..0000000 --- a/NWaves.DemoUwp/App.xaml.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -namespace NWaves.DemoUwp -{ - /// - /// Provides application-specific behavior to supplement the default Application class. - /// - sealed partial class App : Application - { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - this.Suspending += OnSuspending; - } - - /// - /// Invoked when the application is launched normally by the end user. Other entry points - /// will be used such as when the application is launched to open a specific file. - /// - /// Details about the launch request and process. - protected override void OnLaunched(LaunchActivatedEventArgs e) - { - Frame rootFrame = Window.Current.Content as Frame; - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == null) - { - // Create a Frame to act as the navigation context and navigate to the first page - rootFrame = new Frame(); - - rootFrame.NavigationFailed += OnNavigationFailed; - - if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) - { - //TODO: Load state from previously suspended application - } - - // Place the frame in the current Window - Window.Current.Content = rootFrame; - } - - if (e.PrelaunchActivated == false) - { - if (rootFrame.Content == null) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(MainPage), e.Arguments); - } - // Ensure the current window is active - Window.Current.Activate(); - } - } - - /// - /// Invoked when Navigation to a certain page fails - /// - /// The Frame which failed navigation - /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) - { - throw new Exception("Failed to load Page " + e.SourcePageType.FullName); - } - - /// - /// Invoked when application execution is being suspended. Application state is saved - /// without knowing whether the application will be terminated or resumed with the contents - /// of memory still intact. - /// - /// The source of the suspend request. - /// Details about the suspend request. - private void OnSuspending(object sender, SuspendingEventArgs e) - { - var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity - deferral.Complete(); - } - } -} diff --git a/NWaves.DemoUwp/Assets/LockScreenLogo.scale-200.png b/NWaves.DemoUwp/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57adb5dfc01886d137b4e493d7e97cf13af3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m diff --git a/NWaves.DemoUwp/Assets/SplashScreen.scale-200.png b/NWaves.DemoUwp/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1feda78d5100569825acedfd213a0d84e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^Lb9gny#ro$MOIxIt{+r)EA10$VR3 zanN8D{TUkl+v0CQ_>ZoHP<M-x#8@8ZiT#$Kh`(uRaX1g$Bg|qy$<#7 zSSAi{Nb8Y=lvNVeio+UGLCAtoLBfL`iOv`)yoJMDJBN>4IH@(l7YRF;61@>qq1iM9 zr@b#OC~SAxSle?5Pp8Z78{VO0YFr1x7kZU64Z23eLf2T2#6J_t;-E}DkB?NufZ0Ug zi?J&byXeaB-uTNVhuiM!UVQw}bZrJ3GtAETYp->!{q#zfN7D3AS9@Q7*V^85jGx#R z(QxYV(wW#F0XF9^^s>>H8pPlVJ>)3Oz z&_X8Sf@~?cH_O*cgi$U#`v`RRfv#y3m(ZpKk^5uLup+lVs$~}FZU$r_+}#hl%?g5m z-u-}-666ssp-xWQak~>PPy$mRc|~?pVSs1_@mBEXpPVfLF6(Ktf1S* zPPh@QZ=tFMs?LM2(5P3L2;l_6XX6s&cYsP1ip#eg0`ZEP0HGYh{UmS@o`MihLLvkU zgyAG0G`b1|qjxxh1(ODKFE%AP}Dq=3vK$P7TXP4GrM1kQ72!GUVMDl`rDC&2;TA}*nF z8$nQD&6ys_nc1*E7$*1S@R8$ymy(sQV}imGSedB@{!QR5P&N_H=-^o!?LsWs+2|mH z-e=)T^SvI)=_JIm7}j4;@*Z17=(#}m=~YF~z~CLI+vdAGlJDcdF$TM?CVI1%LhUrN zaa6DJ=Yh$)$k&Oz{-~8yw^GM^8prYxSxo zvI4k#ibryMa%%*8oI-5m61Koa_A_xg=(fwp0aBX{;X4Q;NXUhtaoJDo1>TqhWtn=_ zd5~chq#&6~c%8JZK#t_&J(9EVUU&upYeIovLt1>vaHe}UUq>#RGQj!EN#5+0@T`(@ z^g~>*c`VGRiSt;!$_4+0hk^I!@O3``5=sZ8IwlxWW7km1B&_t&E*u0_9UBa#VqwY* zz>nxv?FAsVnRaD(Bui=6i==BFUw0k4n$>`umU`F2l?7CYTD^)c2X+d9X&ddS9|gj? zM?knGkGCX&W8offw8aLC2$D{PjC3nVZwd4k?eZH8*mZ)U@3Qk8RDFOz_#WUA#vnzy zyP>KrCfKwSXea7}jgJjBc}PGY+4#6%lbZyjhy`5sZd_Vy6Wz;ixa?czkN}J9It1K6 zY!eu>|AwF^fwZlLAYyQI*lM@^>O>Iu6Vf6i>Q$?v!SeUS<{>UYMwz$*%Aq?w^`j{h z!$GZbhu=^D{&ET8;))LL%ZBDZkQqRd2;u~!d9bHGmLRhLDctNgYyjsuvoSZ#iVdoB z2!f--UUA#U;<{je#?cYt^{PIyKa%hW>}uepWMyAI{{Zo7?2>?$c9;whJae%oN|I-kpTQSx_C$Z&;f zi2i)qmEn=y4U0uvk)$m;zKfjPK@oc?I`}1Jzl$Q~aoKBd3kt7L#7gyt|A_qgz6ai< z=X%D1i!d2h?rHR^R8SUj&G||dkC?DT>{o#Yau<@uqVT{Xef&XG}5*E4aPk{}~ zplx&XhaV)&1EfI3Em;Bw#O5SV^c;{twb-1Rw)+=0!e_BLbd7tYmXCH0wrlOSS+~`7He8Iqx0{CN+DVit9;*6L~JAN zD&cyT)2?h}xnYmL?^)<7YyzZ3$FHU^Eg;DLqAV{#wv#Wj7S`Jdl1pX&{3(uZ?!uh} zDc$ZTNV*7le_W6}Hju~GMTxZQ1aWCeUc%!jv3MHAzt>Y-nQK%zfT*3ebDQA5b?iGn; zBjv3B+GhLTexd_(CzZDP4|#n5^~scvB6#Pk%Ho!kQ>yYw((Dv{6=$g3jT1!u6gORW zx5#`7Wy-ZHRa~IxGHdrp(bm%lf>2%J660nj$fCqN(epv@y!l9s7@k6EvxS{AMP>WY zX4$@F8^kayphIx-RGO$+LYl9YdoI5d|4#q9##`_F5Xnx`&GPzp2fB{-{P@ATw=X@~ z_|&^UMWAKD;jjBKTK(~o?cUFRK8EX=6>cXpfzg4ZpMB>*w_^8GSiT-Jp|xBOnzM+j z*09-@-~qJ(eqWq5@R4i^u4^{McCP(!3}C|v_WsTR*bIUxN(Nx`u##3B4{sE`Z`v8w zAwIG`?1~PkID~W{uDzmqH98Pew_1(;x2%8r^vY{)_&J2K)cN{W+h5+g)ZcjP&Ci#O zgy|8K@4kyMfwilHd&6TDlhb%++Pk!>9HRld6HT7gwyZGrxS$}CsD6`>6!!2K1@Mjf z(P0WYB7V_OFZyeWrbOFb>O54BNXf~K&?}3=^v;v_wT{DKr?jN^DtN&DXwX%u?s*c6`%8>WFz z7}YW^tp0bp^NriE)AB6M2l<7rn7fzePtR*omOevpfm9n?}2V*+0iW;S)C zhg`NAjL?D=W#k*$aR{>pGf~lD-rVtD;5jW1_*Jn1j1=es@Kcx4ySM_bwcQCT=d+DV z>Sz~L=Hj@(X%31nK$mWI@7d>}ORB`K(p=+`UD)+99YUGQc7y^bHZ1F(8|tL0 zdK*DT0kSXG_{BKTpP2*2PecdKV9;dq$^ZZDP;Nyq1kp-&GI5eAyZsK!e3V zK@rPy*{(`KIfo+lc878mDKk^V#`VT05}64kBtk%DgwLrOvLMj5-;*GNKv6c6pzMuL z6EP%ob|_0IW}lLRXCP2!9wWhEw3LA7iF#1O1mIZ@Z=6&bz41F;@S_GvYAG-#CW3z{ zP3+6vHhvP&A3$##Vo9$dT^#MoGg^|MDm=Bt1d2RRwSZ<;ZHICpLBv5Xs!D?BH^(9_ z7`H=N&^v|Z-%mP}wNzG{aiFCsRgwzwq!N6obW9+7(R; z(SZ=23`|`>qil!LMGG{_Heq!BD>(Y-zV9wD)}hz25JA37YR%39;kI4y9pgtcUass6 zP24}ZY$vvYeI`zy&)A_X#nY3017ap*0&jx|mVwyGhg3;!keU53a}Uhm3BZI$N$6Se zLWlAmy1S0xKJm4G_U@sN_Tm=`$xWJSEwKU98rZ&)1R^*$$1vA3oG#&*%SMxY_~oGP zP&PFJatFLM-Ps%84IV-+Ow)T{C7cqUAvauy4C z(FRz&?6$Rypj{xO!`y=*J5o4@U8Q-(y5(*=YoKeZ+-1YdljXxkA#B)zo=FeQH#?Le zycNUmEEHWO9a=X^pb#&cOq7-`7UA87#|S22)<7RUtZo|(zibX=w;K3qur9vy#`MNV z6UUcf9ZwEnKCCp+OoBnF@OdbvH)ANXO0o~Pi9l8=x3))}L<#vO0-~O4!~--Ket?d} zJaqsj<@CD1%S2cTW%rOP{Vto%0sGW~1RMa_j^)5nil0Yw- z0EE#bP+l4#P^%PQ+N*oxu1Zq05xZ!bXfYTg>9c{(Iw*lnjR^>kz%lAN^zFce7rppy zY8zA~3GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` diff --git a/NWaves.DemoUwp/Assets/Square150x150Logo.scale-200.png b/NWaves.DemoUwp/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1a5484db1d52a7f9b5ec90a27c7030186..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 zuEf>ih5`wqY)~o@OeVt-wM?Q!>QzdGRj!bz6fzYrfw$hZfAKzr2-M+D+R>}~oT574c;_3zquHcElqKIsryILt3g8n3jcMb+j?i?-L3FpZJ z2WRVBRdDPc+G5aaYg#5hpE+6nQ|(VSoxT3|biF;BUq#==-27Xi=gihDPYP$7?=9cP zYKE$jeQ|3~_L0VG-(F~2ZPyD0=k{J4Q~h(t__{-mz_w8{JDY9{`1ouzz!Vr5!ECdE z6U~O1k8c}24V7~zzXWTV-Pe4)y}wQJS&q%H5`Fo_f_JvIU489aCX$;P`u#!I-=^4ijC2{&9!O&h>mi?9oYD=GC#%)6{GzN6nQYw+Fal50!#x^asjBBR50i`+mho*ttoqV)ubM2KD9S~k7+FR4>{29?6 z{!l6kDdyTN0YJ9LgkPWeXm|gyi@zM3?0@{&pXT12w|78&W-q!RRF)&iLCEZVH<|fR zN0fr2^t8H(>L?>K#>^+jWROLral(Qy-xoBq1U7A&DV||wClb)Otd9?(gZ|8znMF}D zf<1haWz^s0qgecz;RFGt0C-B4g`jNGHsFU+;{<%t65v^sjk^h$lmWn#B0#_)9ij&d z-~lc`A)YYExi^7sBuPM^Y|wA2g*5?`K?#7tzELQYNxGo$UB$4J8RJp1k(8Jj+~hMT zlN~>M@KTTh^--8y3PK_NZ@AC!{PT=CziBzGd+wTJ^@icH!Bd}%)g8V)%K?|c&WTUk zy}qv1C%(fjRoZ4ozC3{O%@5?)XzH35zHns$pgU*Q?fj4v?fp1Qbm+j;3l;9jam9Da zXVcKjPlQ73x78QPu|Ffm6x?`~e3oD=gl=4kYK?={kD5j~QCXU)`HSdduNNENzA*2$ zOm3PzF!lN5e*06-f1Uot67wY#{o-S1!KZ7E=!~7ynnk9_iJR#kFoNbAOT#^2Gd17F zMmvU6>lndZQGd|ax9kUoXXO+$N?|j@6qpsF&_j7YXvwo_C{JpmLw5&#e6k>atv%es z5)7r*Wvv_JkUpT}M!_o!nVlEk1Zbl=a*2hQ*<|%*K1Glj^FcF`6kTzGQ3lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP diff --git a/NWaves.DemoUwp/Assets/Square44x44Logo.scale-200.png b/NWaves.DemoUwp/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2ec8a61291ba76c54604aea7e9d20af11b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ diff --git a/NWaves.DemoUwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/NWaves.DemoUwp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce97e0a802b85f6021e822c89f8bf57d5cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= diff --git a/NWaves.DemoUwp/Assets/StoreLogo.png b/NWaves.DemoUwp/Assets/StoreLogo.png deleted file mode 100644 index 7385b56c0e4d3c6b0efe3324aa1194157d837826..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x diff --git a/NWaves.DemoUwp/Assets/Wide310x150Logo.scale-200.png b/NWaves.DemoUwp/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b397fdbef1fb7e85afd71445d5de1952c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV8$e3?-F=L^&FrtWn~(U_Q~~^uYiyeY6-KoTnfh9AWz@ zIKje0)u!_Lw)E}G!#kEfwKVdNt(UAf9*f>tEL_(=xco-T%jTi@7YlC3hs2ik%Le0H ztj}RTeCF(5mwvi3_56>-yB?l;J>-1%!9~=fs|QcNG3J~a@JCu`4SB460s0ZO+##4fFUSGLcj_ja^fL4&BKALfb#$6$O?>P@qx2Agl^x0i&ugt zsy5Pyu=()`7HRMG3IB7F1@`_ z+-!J%#i6e^U$e#+C%Q>_qVRzWRsG^W_n+@OcX@vzI&z;mzHNb!GQ?LWA(wtpqHqTM z1OFw_{Zn?fD)p)`c`kOgv{de=v@suGRqY{N^U7gI1VF3*F=obwaXI6ob5__Yn zVTguS!%(NI09J8x#AO_aW!9W7k*UvB;IWDFC3srwftr{kHj%g)fvnAm;&h_dnl~

MY- zf+K}sCe8qU6Ujs`3ua{U0Of$R_gVQBuUA za0v=mu#vIOqiiAZOr&h*$WyOw&k-xr$;G4Ixa!#TJNr>95(h>l%)PUy4p+^SgR(uR zta%k*?ny-+nAr8spEk1fo{J4i!b^Fia`N{_F6@zidA2ZTTrjl#^5Z-2KfB@Cu}l9s z(*|Z2jc?p~vn2f)3y9i*7zJV1L{$?|&q)4oaT;uXi6>1GkRXVTOzAz(RHEmr=eFIi z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -