Skip to content

Commit

Permalink
Inizio della versione a linea di comando
Browse files Browse the repository at this point in the history
  • Loading branch information
gpicchiarelli committed Mar 15, 2024
1 parent aa2f596 commit 7d8bd85
Show file tree
Hide file tree
Showing 59 changed files with 515 additions and 45 deletions.
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.
2 changes: 1 addition & 1 deletion AccordaGUItar/obj/AccordaGUItar.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json"
}
}
}
Expand Down
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+1a5bfd29191140f8be2175aac4fdb3aa3e373b96")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+aa2f59693ba199c1c97ede6c668daceb30f44ea4")]
[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 @@
cf7d50a86938932fe0154cbaf2b17c14daf17bd2b6c34275e4997c6e2cef64a7
f2be71a1ef2589e0a0dccc1a3141779699ed6b1320df7ab8a93364a6fa80a198
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3db0b58dd267c54dfc2b0d2cdaff22410beca87bccd5f74c8c6e8a9d40961b2e
fe20a567920a28446407c79d971cd1fcecc164bfc3b3b69ad403a5e2633307b7
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.AssemblyInfo.cs
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.csproj.CoreCompileInputs.cache
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.sourcelink.json
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.csproj.CopyComplete
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.dll
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\refint\AccordaGUItar.dll
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar.pdb
Expand All @@ -76,3 +75,4 @@ C:\Users\gpicc\source\repos\accorda\AccordaGUItar\bin\Debug\net8.0-windows7.0\de
C:\Users\gpicc\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaGUItar_MarkupCompile.lref
C:\Users\gpicc\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\App.baml
C:\Users\gpicc\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaG.4EE8D8B3.Up2Date
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\AccordaG.4EE8D8B3.Up2Date
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net8.0-windows7.0/AccordaGUItar.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public partial class AccordaGUI : MahApps.Metro.Controls.MetroWindow, System.Win
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.2.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.3.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
Expand All @@ -95,7 +95,7 @@ public void InitializeComponent() {
}

[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.2.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.3.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0fccc1bfeafb9a52b2b4fe06f9d74034418f352daa810ca9a13432a6675b4f6b
1cda14dfc667c5e70ff2f53c4ffe2d3cff7a0e1759b4eba1cc60fd7f7467e222
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\\gpicc\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/a93e8860f867ed4963914202293dacaf09842448/*"}}
{"documents":{"C:\\Users\\Giacomo\\source\\repos\\accorda\\*":"https://raw.githubusercontent.com/gpicchiarelli/accorda/aa2f59693ba199c1c97ede6c668daceb30f44ea4/*"}}
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+aa2f59693ba199c1c97ede6c668daceb30f44ea4")]
[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 @@
f2be71a1ef2589e0a0dccc1a3141779699ed6b1320df7ab8a93364a6fa80a198
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_0wbrsh1c_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/aa2f59693ba199c1c97ede6c668daceb30f44ea4/*"}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
winexe
C#
.cs
C:\Users\gpicc\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\obj\Debug\net8.0-windows7.0\
AccordaGUItar
none
false
TRACE;DEBUG;NET;NET8_0;NETCOREAPP
C:\Users\gpicc\source\repos\accorda\AccordaGUItar\App.xaml
C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\App.xaml
1-1812784380

6791824736
218-1159209033
218529696958
AccordaGUItar.xaml;

False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ C:\Users\Giacomo\source\repos\accorda\AccordaGUItar\App.xaml
1-1812784380

8-1335952047
218529696958
2181090816813
AccordaGUItar.xaml;

True
False

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

FC:\Users\gpicc\source\repos\accorda\AccordaGUItar\App.xaml;;
FC:\Users\Giacomo\source\repos\accorda\AccordaGUItar\App.xaml;;

2 changes: 1 addition & 1 deletion AccordaGUItar/obj/Debug/net8.0-windows7.0/App.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9D93C5DB3FA77968BDA7E1E14F12D4BF74377CFD"
#pragma checksum "..\..\..\App.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "6890181222E7A3B7BB557A0AEE2A6D94F0690A8E"
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
Expand Down
4 changes: 2 additions & 2 deletions AccordaGUItar/obj/Debug/net8.0-windows7.0/App.g.i.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public partial class App : System.Windows.Application {
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.2.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.3.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
Expand All @@ -73,7 +73,7 @@ public void InitializeComponent() {
/// </summary>
[System.STAThreadAttribute()]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.2.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.3.0")]
public static void Main() {
AccordaGUItar.App app = new AccordaGUItar.App();
app.InitializeComponent();
Expand Down
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.
2 changes: 1 addition & 1 deletion AccordaGUItar/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@
"privateAssets": "none"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.200/PortableRuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.202/PortableRuntimeIdentifierGraph.json"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AccordaGUItar/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "vUxFim742jjuxrz6EJC6iJ1aFaQS2gdVcR/DS8AS7w6BYduSi84hfkmVC/kriOZJ+gBI7OYNGbFMVfRZzTePDQ==",
"dgSpecHash": "TeFe9k210XLVtIXdoOKGMmsTU+GSp/rWTtnfzqUg4TSPi1hhQElMhLtj3fkhzaObNmMKLUFpqx44ZNhwSGlv7A==",
"success": true,
"projectFilePath": "C:\\Users\\Giacomo\\source\\repos\\accorda\\AccordaGUItar\\AccordaGUItar.csproj",
"expectedPackageFiles": [
Expand Down
113 changes: 113 additions & 0 deletions accorda-cli/Audio/Audio.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
using NAudio.Dsp;
using NAudio.Wave;
using System;
using System.Collections.Generic;

namespace Accorda.Audio
{
public class Audio
{
private readonly WaveInEvent waveIn;
private const int sampleRate = 44100;
private const int bufferSize = 1024;
private readonly float[] buffer;
private readonly Complex[] complexBuffer;
private readonly BiQuadFilter filter;

// Aggiunto un evento per rilevare la frequenza istantanea
public event EventHandler<double> DominantFrequencyDetected;

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

public Audio(int InputDeviceSelector = 0)
{
waveIn = new WaveInEvent
{
DeviceNumber = InputDeviceSelector,
BufferMilliseconds = bufferSize * 1000 / sampleRate,
WaveFormat = new WaveFormat(sampleRate, 1)
};

buffer = new float[bufferSize];
complexBuffer = new Complex[bufferSize];
filter = BiQuadFilter.LowPassFilter(sampleRate, 1000, (float)0.7071);

waveIn.DataAvailable += WaveIn_DataAvailable;
StartRecording();
}

private void WaveIn_DataAvailable(object sender, WaveInEventArgs e)
{
double maxVolume = 0.0;

for (int i = 0; i < e.BytesRecorded / 2; i++)
{
short sample = (short)((e.Buffer[(2 * i) + 1] << 8) | e.Buffer[2 * i]);
buffer[i] = (float)sample / short.MaxValue;
buffer[i] = filter.Transform(buffer[i]);
complexBuffer[i].X = buffer[i];
complexBuffer[i].Y = 0;

double volume = Math.Abs(buffer[i]);
if (volume > maxVolume)
{
maxVolume = volume;
}
}

if (maxVolume > volumeThreshold)
{
FastFourierTransform.FFT(true, (int)Math.Log(bufferSize, 2.0), complexBuffer);

int maxIndex = 0;
double maxMagnitude = 0;

for (int i = 0; i < bufferSize / 2; i++)
{
double magnitude = CalculateMagnitude(complexBuffer[i]);
if (magnitude > maxMagnitude)
{
maxMagnitude = magnitude;
maxIndex = i;
}
}
double frequency = maxIndex * sampleRate / bufferSize;
DominantFrequencyDetected?.Invoke(this, frequency);
}
}

private double CalculateMagnitude(Complex complex)
{
return Math.Sqrt((complex.X * complex.X) + (complex.Y * complex.Y));
}

public List<string> ElencaDispositiviIngresso()
{
int inputDeviceCount = WaveInEvent.DeviceCount;
List<string> dispositivi = new();
for (int deviceIndex = 0; deviceIndex < inputDeviceCount; deviceIndex++)
{
WaveInCapabilities deviceInfo = WaveInEvent.GetCapabilities(deviceIndex);
dispositivi.Add($"Dispositivo {deviceIndex + 1}: {deviceInfo.ProductName}");
}
return dispositivi;
}

private void StartRecording()
{
waveIn.StartRecording();
}

public void StopRecording()
{
waveIn.StopRecording();
}

// Aggiunto un metodo per impostare il threshold di volume
public void SetVolumeThreshold(double threshold)
{
volumeThreshold = threshold;
}
}
}
36 changes: 36 additions & 0 deletions accorda-cli/Note/NoteMusicali.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/// <summary>
/// Namespace for frequency constants
/// </summary>
namespace accorda.Note
{
/// <summary>
/// Class for frequency constants
/// </summary>
public class NoteMusicali
{
/// <summary>
/// The mi basso
/// </summary>
public const double Mi_Basso = 82.41;
/// <summary>
/// The la
/// </summary>
public const double La = 110;
/// <summary>
/// The re
/// </summary>
public const double Re = 146.83;
/// <summary>
/// The sol
/// </summary>
public const double Sol = 196;
/// <summary>
/// The si
/// </summary>
public const double Si = 246.94;
/// <summary>
/// The mi alto
/// </summary>
public const double Mi_Alto = 329.63;
}
}
2 changes: 2 additions & 0 deletions accorda-cli/accorda-cli.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
22 changes: 22 additions & 0 deletions accorda-cli/accorda-cli.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>accorda_cli</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE" Link="LICENSE">
<PackagePath>\</PackagePath>
<Pack>True</Pack>
</None>
<None Include="..\README.md" Link="README.md">
<PackagePath>\</PackagePath>
<Pack>True</Pack>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
23 changes: 23 additions & 0 deletions accorda-cli/obj/Debug/net8.0/accorda-cli.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <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("accorda-cli")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+aa2f59693ba199c1c97ede6c668daceb30f44ea4")]
[assembly: System.Reflection.AssemblyProductAttribute("accorda-cli")]
[assembly: System.Reflection.AssemblyTitleAttribute("accorda-cli")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generato dalla classe WriteCodeFragment di MSBuild.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d02a347f02f655ab8761ae3554b1ebe99d0c3c323d064f497867b08b87f1cca2
Loading

0 comments on commit 7d8bd85

Please sign in to comment.