Skip to content

Commit

Permalink
Merge pull request #39 from swharden/fftsharp-1.1.2
Browse files Browse the repository at this point in the history
upgrade dependencies
  • Loading branch information
swharden authored Oct 27, 2021
2 parents 520ab0e + b510ae7 commit b91cffc
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 250 deletions.
58 changes: 17 additions & 41 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,41 @@ on:
- created

jobs:
package:
# build, test, and deploy the core package on Linux
name: Package
runs-on: ubuntu-latest
env:
CSPROJ_CORE: src/Spectrogram/Spectrogram.csproj
CSPROJ_TESTS: src/Spectrogram.Tests/Spectrogram.Tests.csproj
test:
name: Test
runs-on: windows-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v2
- name: ✨ Setup .NET Core 3.1
- name: ✨ Setup .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: "3.1.x"
dotnet-version: "5.0.x"
- name: ✨ Setup .NET 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
include-prerelease: true
- name: 🛠️ Setup NuGet
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: 🚚 Restore
run: |
dotnet restore ${{ env.CSPROJ_CORE }}
dotnet restore ${{ env.CSPROJ_TESTS }}
run: dotnet restore src
- name: 🛠️ Build
run: |
dotnet build ${{ env.CSPROJ_CORE }} --configuration Release
dotnet build ${{ env.CSPROJ_TESTS }}
run: dotnet build src --configuration Release
- name: 🧪 Test
run: dotnet test ${{ env.CSPROJ_TESTS }}
run: dotnet test src
- name: 📦 Pack
run: dotnet pack ${{ env.CSPROJ_CORE }} --configuration Release
run: dotnet pack src --configuration Release
- name: 💾 Store
uses: actions/upload-artifact@v2
with:
name: Packages
retention-days: 1
path: src/Spectrogram/bin/Release/*.nupkg
- name: 🛠️ Setup NuGet
if: github.event_name == 'release'
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
path: |
src/Spectrogram/bin/Release/*.nupkg
src/Spectrogram/bin/Release/*.snupkg
- name: 🚀 Publish
if: github.event_name == 'release'
run: nuget push "src/Spectrogram/bin/Release/*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json

solution:
# build the whole solution (.NET Framework demos require Windows/MSBuild)
name: Build Solution
runs-on: windows-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v1
- name: ✨ Setup NuGet
uses: nuget/setup-nuget@v1
- name: ✨ Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.3
- name: 🚚 Restore
working-directory: src
run: nuget restore
- name: 🛠️ Build Release
run: msbuild src -verbosity:minimal
run: nuget push "src\Spectrogram\bin\Release\*.nupkg" -SkipDuplicate -Source https://api.nuget.org/v3/index.json
97 changes: 10 additions & 87 deletions dev/sff/SffViewer/SffViewer.csproj
Original file line number Diff line number Diff line change
@@ -1,93 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9478208D-60C7-4F6A-B2E4-6325D38139DA}</ProjectGuid>
<TargetFramework>net5.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>SffViewer</RootNamespace>
<AssemblyName>SffViewer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FftSharp, Version=1.0.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\src\packages\FftSharp.1.0.8\lib\netstandard2.0\FftSharp.dll</HintPath>
</Reference>
<Reference Include="Spectrogram, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\src\packages\Spectrogram.1.2.6\lib\netstandard2.0\Spectrogram.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\..\src\packages\System.Drawing.Common.5.0.0\lib\net461\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<PackageReference Include="FftSharp" Version="1.0.8" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Spectrogram" Version="1.2.6" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
19 changes: 19 additions & 0 deletions src/Spectrogram.MicrophoneDemo/Spectrogram.Demo.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Spectrogram\Spectrogram.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FftSharp" Version="1.1.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="NAudio" Version="1.10.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
</ItemGroup>
</Project>
100 changes: 0 additions & 100 deletions src/Spectrogram.MicrophoneDemo/Spectrogram.MicrophoneDemo.csproj

This file was deleted.

3 changes: 2 additions & 1 deletion src/Spectrogram.Tests/ColormapExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public void Test_Make_CommonColormaps()
(double[] audio, int sampleRate) = AudioFile.ReadWAV("../../../../../data/cant-do-that-44100.wav");
int fftSize = 1 << 12;
var spec = new SpectrogramGenerator(sampleRate, fftSize, stepSize: 700, maxFreq: 2000);
spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
var window = new FftSharp.Windows.Hanning();
spec.SetWindow(window.Create(fftSize / 3)); // sharper window than typical
spec.Add(audio);

// delete old colormap files
Expand Down
6 changes: 4 additions & 2 deletions src/Spectrogram.Tests/FileFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public void Test_SFF_Linear()
(double[] audio, int sampleRate) = AudioFile.ReadWAV("../../../../../data/cant-do-that-44100.wav");
int fftSize = 1 << 12;
var spec = new SpectrogramGenerator(sampleRate, fftSize, stepSize: 700, maxFreq: 2000);
spec.SetWindow(FftSharp.Window.Hanning(fftSize / 3)); // sharper window than typical
var window = new FftSharp.Windows.Hanning();
spec.SetWindow(window.Create(fftSize / 3)); // sharper window than typical
spec.Add(audio);
spec.SaveData("../../../../../dev/sff/hal.sff");

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

Bitmap bmp = spec.GetBitmapMel(250);
Expand Down
6 changes: 3 additions & 3 deletions src/Spectrogram.Tests/Mel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Test_Mel_Graph()
double[] power = ScottPlot.DataGen.RandomWalk(rand, specPoints, .02, .5);

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

int filterSize = 25;

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

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

plt1.SaveFig("mel1.png");
Expand Down
4 changes: 2 additions & 2 deletions src/Spectrogram.Tests/Spectrogram.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -11,7 +11,7 @@
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="ScottPlot" Version="4.0.48" />
<PackageReference Include="ScottPlot" Version="4.1.27" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Spectrogram.Tests/TestAGC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ private double[] SubtractMovingWindow(double[] input, int windowSizePx = 100)
{
// return a copy of the input array with the moving window subtracted

double[] window = FftSharp.Window.Hanning(windowSizePx);
var hanningWindow = new FftSharp.Windows.Hanning();
double[] window = hanningWindow.Create(windowSizePx);
double windowSum = window.Sum();

double[] windowed = new double[input.Length];
Expand Down
Loading

0 comments on commit b91cffc

Please sign in to comment.