Skip to content

Commit

Permalink
Dimensione del buffer corretta.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpicchiarelli committed Dec 9, 2023
1 parent 1c2d8ba commit 423932a
Show file tree
Hide file tree
Showing 49 changed files with 246 additions and 7 deletions.
7 changes: 3 additions & 4 deletions AccordaGUItar/Audio/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class Audio
{
private readonly WaveInEvent waveIn;
private const int sampleRate = 44100;
private const int bufferSize = 4096;
private const int bufferSize = 32768;
private readonly double[] buffer;
private readonly Complex[] complexBuffer;

// Evento per notificare la frequenza media calcolata
public event EventHandler<double> SmoothedFrequencyDetected;

// Aggiunto un threshold per il volume minimo rilevabile
private double volumeThreshold = 0.005;
private double volumeThreshold = 0.01;

public Audio(int InputDeviceSelector = 0)
{
Expand Down Expand Up @@ -66,14 +66,13 @@ private void WaveIn_DataAvailable(object sender, WaveInEventArgs e)
if (maxVolume > volumeThreshold)
{
double frequency = CalculateFrequencyFromFFT(buffer);
float cutoffFrequency = (float)(frequency * 0.5);
float cutoffFrequency = (float)(frequency * 0.3); // filtraggio

BiQuadFilter filter = BiQuadFilter.LowPassFilter(sampleRate, cutoffFrequency, 1.0f);
for (int i = 0; i < buffer.Length; i++)
{
buffer[i] = filter.Transform((float)buffer[i]);
}

frequency = CalculateFrequencyFromFFT(buffer);
SmoothedFrequencyDetected?.Invoke(this, frequency);
}
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+9d869d1051e1fb39cfe563eaf1267acec8358d7e")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
96211df94e454b1bc2706b8d1adb0f140404a0d0ca820c299fa9bd6979dabc42
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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/9d869d1051e1fb39cfe563eaf1267acec8358d7e/*"}}
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_0dmzcqd3_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_bdaddnxa_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_ltvf1xo0_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_nzagmt1a_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_rawzsqgk_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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+1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3")]
[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 @@
01e2783b3992a43aef24da379b388bc0ec2427e2447eac33aabf0ff575ce792f
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_vbwn1a5w_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/1c2d8ba0406a79032ef1ca5f04a4d8bc352998e3/*"}}
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 423932a

Please sign in to comment.