Skip to content

Commit

Permalink
Correzione parametri filtro
Browse files Browse the repository at this point in the history
  • Loading branch information
gpicchiarelli committed Dec 9, 2023
1 parent 9d869d1 commit 1c2d8ba
Show file tree
Hide file tree
Showing 25 changed files with 86 additions and 13 deletions.
13 changes: 3 additions & 10 deletions AccordaGUItar/Audio/Audio.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MathNet.Numerics.IntegralTransforms;
using MathNet.Numerics;
using MathNet.Numerics.IntegralTransforms;
using NAudio.Dsp;
using NAudio.Wave;

Expand Down Expand Up @@ -66,9 +66,9 @@ private void WaveIn_DataAvailable(object sender, WaveInEventArgs e)
if (maxVolume > volumeThreshold)
{
double frequency = CalculateFrequencyFromFFT(buffer);
float cutoffFrequency = (float)(frequency * 1.5);
float cutoffFrequency = (float)(frequency * 0.5);

var filter = BiQuadFilter.LowPassFilter(sampleRate, cutoffFrequency, 1.0f);
BiQuadFilter filter = BiQuadFilter.LowPassFilter(sampleRate, cutoffFrequency, 1.0f);
for (int i = 0; i < buffer.Length; i++)
{
buffer[i] = filter.Transform((float)buffer[i]);
Expand Down Expand Up @@ -104,13 +104,6 @@ private double[] CalculateAutocorrelation(double[] buffer)
return autocorrelation;
}

private int FindPeakFrequency(double[] autocorrelation)
{
double maxValue = autocorrelation.Max();
int peakIndex = Array.IndexOf(autocorrelation, maxValue);
return peakIndex != -1 ? peakIndex : 0;
}

private void StartRecording()
{
waveIn.StartRecording();
Expand Down
Binary file modified AccordaGUItar/bin/Debug/net8.0-windows7.0/AccordaGUItar.dll
Binary file not shown.
Binary file modified AccordaGUItar/bin/Debug/net8.0-windows7.0/AccordaGUItar.exe
Binary file not shown.
Binary file modified AccordaGUItar/bin/Debug/net8.0-windows7.0/AccordaGUItar.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+99043929bc6e86eafcb8804520f34f532dae4e15")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9d869d1051e1fb39cfe563eaf1267acec8358d7e")]
[assembly: System.Reflection.AssemblyProductAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyTitleAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
699c2459eecdd4b00c4d541e575984428c95f5e9431eac4c93b476566d1fed69
96211df94e454b1bc2706b8d1adb0f140404a0d0ca820c299fa9bd6979dabc42
Binary file modified AccordaGUItar/obj/Debug/net8.0-windows7.0/AccordaGUItar.dll
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net8.0-windows7.0/AccordaGUItar.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/99043929bc6e86eafcb8804520f34f532dae4e15/*"}}
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/9d869d1051e1fb39cfe563eaf1267acec8358d7e/*"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9d869d1051e1fb39cfe563eaf1267acec8358d7e")]
[assembly: System.Reflection.AssemblyProductAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyTitleAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Generato dalla classe WriteCodeFragment di MSBuild.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
96211df94e454b1bc2706b8d1adb0f140404a0d0ca820c299fa9bd6979dabc42
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0-windows7.0
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = AccordaGUItar_hihqiyol_wpftmp
build_property.ProjectDir = C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/9d869d1051e1fb39cfe563eaf1267acec8358d7e/*"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9d869d1051e1fb39cfe563eaf1267acec8358d7e")]
[assembly: System.Reflection.AssemblyProductAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyTitleAttribute("AccordaGUItar")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]

// Generato dalla classe WriteCodeFragment di MSBuild.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
96211df94e454b1bc2706b8d1adb0f140404a0d0ca820c299fa9bd6979dabc42
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0-windows7.0
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = AccordaGUItar_urbi5but_wpftmp
build_property.ProjectDir = C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/9d869d1051e1fb39cfe563eaf1267acec8358d7e/*"}}
Binary file modified AccordaGUItar/obj/Debug/net8.0-windows7.0/apphost.exe
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net8.0-windows7.0/ref/AccordaGUItar.dll
Binary file not shown.
Binary file not shown.
Binary file modified accorda.net/.vs/Accorda/v17/.suo
Binary file not shown.

0 comments on commit 1c2d8ba

Please sign in to comment.