Skip to content

Commit b91cffc

Browse files
authored
Merge pull request #39 from swharden/fftsharp-1.1.2
upgrade dependencies
2 parents 520ab0e + b510ae7 commit b91cffc

File tree

12 files changed

+67
-250
lines changed

12 files changed

+67
-250
lines changed

.github/workflows/ci.yaml

+17-41
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,41 @@ on:
1212
- created
1313

1414
jobs:
15-
package:
16-
# build, test, and deploy the core package on Linux
17-
name: Package
18-
runs-on: ubuntu-latest
19-
env:
20-
CSPROJ_CORE: src/Spectrogram/Spectrogram.csproj
21-
CSPROJ_TESTS: src/Spectrogram.Tests/Spectrogram.Tests.csproj
15+
test:
16+
name: Test
17+
runs-on: windows-latest
2218
steps:
2319
- name: 🛒 Checkout
2420
uses: actions/checkout@v2
25-
- name: ✨ Setup .NET Core 3.1
21+
- name: ✨ Setup .NET 5
2622
uses: actions/setup-dotnet@v1
2723
with:
28-
dotnet-version: "3.1.x"
24+
dotnet-version: "5.0.x"
2925
- name: ✨ Setup .NET 6
3026
uses: actions/setup-dotnet@v1
3127
with:
3228
dotnet-version: "6.0.x"
3329
include-prerelease: true
30+
- name: 🛠️ Setup NuGet
31+
uses: nuget/setup-nuget@v1
32+
with:
33+
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
3434
- name: 🚚 Restore
35-
run: |
36-
dotnet restore ${{ env.CSPROJ_CORE }}
37-
dotnet restore ${{ env.CSPROJ_TESTS }}
35+
run: dotnet restore src
3836
- name: 🛠️ Build
39-
run: |
40-
dotnet build ${{ env.CSPROJ_CORE }} --configuration Release
41-
dotnet build ${{ env.CSPROJ_TESTS }}
37+
run: dotnet build src --configuration Release
4238
- name: 🧪 Test
43-
run: dotnet test ${{ env.CSPROJ_TESTS }}
39+
run: dotnet test src
4440
- name: 📦 Pack
45-
run: dotnet pack ${{ env.CSPROJ_CORE }} --configuration Release
41+
run: dotnet pack src --configuration Release
4642
- name: 💾 Store
4743
uses: actions/upload-artifact@v2
4844
with:
4945
name: Packages
5046
retention-days: 1
51-
path: src/Spectrogram/bin/Release/*.nupkg
52-
- name: 🛠️ Setup NuGet
53-
if: github.event_name == 'release'
54-
uses: nuget/setup-nuget@v1
55-
with:
56-
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
47+
path: |
48+
src/Spectrogram/bin/Release/*.nupkg
49+
src/Spectrogram/bin/Release/*.snupkg
5750
- name: 🚀 Publish
5851
if: github.event_name == 'release'
59-
run: nuget push "src/Spectrogram/bin/Release/*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json
60-
61-
solution:
62-
# build the whole solution (.NET Framework demos require Windows/MSBuild)
63-
name: Build Solution
64-
runs-on: windows-latest
65-
steps:
66-
- name: 🛒 Checkout
67-
uses: actions/checkout@v1
68-
- name: ✨ Setup NuGet
69-
uses: nuget/setup-nuget@v1
70-
- name: ✨ Setup MSBuild
71-
uses: microsoft/[email protected]
72-
- name: 🚚 Restore
73-
working-directory: src
74-
run: nuget restore
75-
- name: 🛠️ Build Release
76-
run: msbuild src -verbosity:minimal
52+
run: nuget push "src\Spectrogram\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json

dev/sff/SffViewer/SffViewer.csproj

+10-87
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,16 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{9478208D-60C7-4F6A-B2E4-6325D38139DA}</ProjectGuid>
3+
<TargetFramework>net5.0-windows</TargetFramework>
84
<OutputType>WinExe</OutputType>
9-
<RootNamespace>SffViewer</RootNamespace>
10-
<AssemblyName>SffViewer</AssemblyName>
11-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12-
<FileAlignment>512</FileAlignment>
13-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14-
<Deterministic>true</Deterministic>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
158
</PropertyGroup>
16-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17-
<PlatformTarget>AnyCPU</PlatformTarget>
18-
<DebugSymbols>true</DebugSymbols>
19-
<DebugType>full</DebugType>
20-
<Optimize>false</Optimize>
21-
<OutputPath>bin\Debug\</OutputPath>
22-
<DefineConstants>DEBUG;TRACE</DefineConstants>
23-
<ErrorReport>prompt</ErrorReport>
24-
<WarningLevel>4</WarningLevel>
25-
</PropertyGroup>
26-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27-
<PlatformTarget>AnyCPU</PlatformTarget>
28-
<DebugType>pdbonly</DebugType>
29-
<Optimize>true</Optimize>
30-
<OutputPath>bin\Release\</OutputPath>
31-
<DefineConstants>TRACE</DefineConstants>
32-
<ErrorReport>prompt</ErrorReport>
33-
<WarningLevel>4</WarningLevel>
34-
</PropertyGroup>
35-
<ItemGroup>
36-
<Reference Include="FftSharp, Version=1.0.8.0, Culture=neutral, processorArchitecture=MSIL">
37-
<HintPath>..\..\..\src\packages\FftSharp.1.0.8\lib\netstandard2.0\FftSharp.dll</HintPath>
38-
</Reference>
39-
<Reference Include="Spectrogram, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
40-
<HintPath>..\..\..\src\packages\Spectrogram.1.2.6\lib\netstandard2.0\Spectrogram.dll</HintPath>
41-
</Reference>
42-
<Reference Include="System" />
43-
<Reference Include="System.Core" />
44-
<Reference Include="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
45-
<HintPath>..\..\..\src\packages\System.Drawing.Common.5.0.0\lib\net461\System.Drawing.Common.dll</HintPath>
46-
</Reference>
47-
<Reference Include="System.Xml.Linq" />
48-
<Reference Include="System.Data.DataSetExtensions" />
49-
<Reference Include="Microsoft.CSharp" />
50-
<Reference Include="System.Data" />
51-
<Reference Include="System.Deployment" />
52-
<Reference Include="System.Drawing" />
53-
<Reference Include="System.Net.Http" />
54-
<Reference Include="System.Windows.Forms" />
55-
<Reference Include="System.Xml" />
56-
</ItemGroup>
57-
<ItemGroup>
58-
<Compile Include="Form1.cs">
59-
<SubType>Form</SubType>
60-
</Compile>
61-
<Compile Include="Form1.Designer.cs">
62-
<DependentUpon>Form1.cs</DependentUpon>
63-
</Compile>
64-
<Compile Include="Program.cs" />
65-
<Compile Include="Properties\AssemblyInfo.cs" />
66-
<EmbeddedResource Include="Form1.resx">
67-
<DependentUpon>Form1.cs</DependentUpon>
68-
</EmbeddedResource>
69-
<EmbeddedResource Include="Properties\Resources.resx">
70-
<Generator>ResXFileCodeGenerator</Generator>
71-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
72-
<SubType>Designer</SubType>
73-
</EmbeddedResource>
74-
<Compile Include="Properties\Resources.Designer.cs">
75-
<AutoGen>True</AutoGen>
76-
<DependentUpon>Resources.resx</DependentUpon>
77-
</Compile>
78-
<None Include="packages.config" />
79-
<None Include="Properties\Settings.settings">
80-
<Generator>SettingsSingleFileGenerator</Generator>
81-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
82-
</None>
83-
<Compile Include="Properties\Settings.Designer.cs">
84-
<AutoGen>True</AutoGen>
85-
<DependentUpon>Settings.settings</DependentUpon>
86-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
87-
</Compile>
88-
</ItemGroup>
899
<ItemGroup>
90-
<None Include="App.config" />
10+
<PackageReference Include="FftSharp" Version="1.0.8" />
11+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
12+
<PackageReference Include="Spectrogram" Version="1.2.6" />
13+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
14+
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
9115
</ItemGroup>
92-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9316
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net5.0-windows</TargetFramework>
4+
<OutputType>WinExe</OutputType>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="..\Spectrogram\Spectrogram.csproj" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<PackageReference Include="FftSharp" Version="1.1.2" />
14+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
15+
<PackageReference Include="NAudio" Version="1.10.0" />
16+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
17+
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
18+
</ItemGroup>
19+
</Project>

src/Spectrogram.MicrophoneDemo/Spectrogram.MicrophoneDemo.csproj

-100
This file was deleted.

src/Spectrogram.Tests/ColormapExamples.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public void Test_Make_CommonColormaps()
1212
(double[] audio, int sampleRate) = AudioFile.ReadWAV("../../../../../data/cant-do-that-44100.wav");
1313
int fftSize = 1 << 12;
1414
var spec = new SpectrogramGenerator(sampleRate, fftSize, stepSize: 700, maxFreq: 2000);
15-
spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
15+
var window = new FftSharp.Windows.Hanning();
16+
spec.SetWindow(window.Create(fftSize / 3)); // sharper window than typical
1617
spec.Add(audio);
1718

1819
// delete old colormap files

src/Spectrogram.Tests/FileFormat.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public void Test_SFF_Linear()
1414
(double[] audio, int sampleRate) = AudioFile.ReadWAV("../../../../../data/cant-do-that-44100.wav");
1515
int fftSize = 1 << 12;
1616
var spec = new SpectrogramGenerator(sampleRate, fftSize, stepSize: 700, maxFreq: 2000);
17-
spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
17+
var window = new FftSharp.Windows.Hanning();
18+
spec.SetWindow(window.Create(fftSize / 3)); // sharper window than typical
1819
spec.Add(audio);
1920
spec.SaveData("../../../../../dev/sff/hal.sff");
2021

@@ -34,7 +35,8 @@ public void Test_SFF_Mel()
3435
(double[] audio, int sampleRate) = AudioFile.ReadWAV("../../../../../data/cant-do-that-44100.wav");
3536
int fftSize = 1 << 12;
3637
var spec = new SpectrogramGenerator(sampleRate, fftSize, stepSize: 700);
37-
spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
38+
var window = new FftSharp.Windows.Hanning();
39+
spec.SetWindow(window.Create(fftSize / 3)); // sharper window than typical
3840
spec.Add(audio);
3941

4042
Bitmap bmp = spec.GetBitmapMel(250);

src/Spectrogram.Tests/Mel.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void Test_Mel_Graph()
4141
double[] power = ScottPlot.DataGen.RandomWalk(rand, specPoints, .02, .5);
4242

4343
var plt1 = new ScottPlot.Plot(800, 300);
44-
plt1.PlotScatter(freq, power, markerSize: 0);
44+
plt1.AddScatter(freq, power, markerSize: 0);
4545

4646
int filterSize = 25;
4747

@@ -64,7 +64,7 @@ public void Test_Mel_Graph()
6464
double freqCenter = binStartFreqs[binIndex + 1];
6565
double freqHigh = binStartFreqs[binIndex + 2];
6666

67-
var sctr = plt1.PlotScatter(
67+
var sctr = plt1.AddScatter(
6868
xs: new double[] { freqLow, freqCenter, freqHigh },
6969
ys: new double[] { 0, 1, 0 },
7070
markerSize: 0, lineWidth: 2);
@@ -84,7 +84,7 @@ public void Test_Mel_Graph()
8484
binValue += power[indexLow + i] * frac;
8585
}
8686
binValue /= binScaleSum;
87-
plt1.PlotPoint(freqCenter, binValue, sctr.color, 10);
87+
plt1.AddPoint(freqCenter, binValue, sctr.Color, 10);
8888
}
8989

9090
plt1.SaveFig("mel1.png");

src/Spectrogram.Tests/Spectrogram.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

@@ -11,7 +11,7 @@
1111
<PackageReference Include="nunit" Version="3.12.0" />
1212
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
14-
<PackageReference Include="ScottPlot" Version="4.0.48" />
14+
<PackageReference Include="ScottPlot" Version="4.1.27" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Spectrogram.Tests/TestAGC.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ private double[] SubtractMovingWindow(double[] input, int windowSizePx = 100)
7878
{
7979
// return a copy of the input array with the moving window subtracted
8080

81-
double[] window = FftSharp.Window.Hanning(windowSizePx);
81+
var hanningWindow = new FftSharp.Windows.Hanning();
82+
double[] window = hanningWindow.Create(windowSizePx);
8283
double windowSum = window.Sum();
8384

8485
double[] windowed = new double[input.Length];

0 commit comments

Comments
 (0)