Comments (15)
Hi @bert2 ,
I was able to get everything working, thank you so much for your help, really appreciate it!
from dtmfdetection.
Thank you @moving-digital 🙂
I haven't updated this project in a while so the build tool cake is pretty outdated and seems to still require the old dotnet framework which is not available on linux.
You can build with the newer dotnet 6 framework that you've installed on your machine though:
root-dir> dotnet build
That will give you some compiler warnings like:
CSC : warning CA9998: FxCopAnalyzers package has been deprecated in favor of 'Microsoft.CodeAnalysis.NetAnalyzers', that ships with the .NET SDK. Please refer to https://docs.microsoft.com/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers to migr
ate to .NET analyzers.
Since all warnings are treated as errors in this project, that'll stop the build.
In order to fix this you can either migrate that depedency, remove it or edit the two *.csproj files so warnigns won't be treated as errors:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<DocumentationFile>.\obj\DtmfDetection.NAudio.xml</DocumentationFile>
</PropertyGroup>
<!-- remove this PropertyGroup node below -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>
<ItemGroup>
...
Removing the dependecy is done by removing the corresponding PackageReference
node(s) from all .csprof files.
Creating the nuget packages can be done with the dotnet cli as well nowadays:
root-dir> dotnet pack
Hope that helps.
from dtmfdetection.
Thanks a lot, @bert2, for your swift response 👍
Using both dotnet build
and/or dotnet pack
is now working, however I am still facing the same error:
./build.ps1
Preparing to run build script...
Running build script...
**Error: Failed to install addin 'Cake.Git'.**
With verbose:
Processing build script...
Installing tools...
Resolving assembly 'NuGet.Resolver.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35' using runtime installed at '/usr/lib/mono/4.5'...
Exception occurred while resolving assembly NuGet.Resolver.resources: Could not load the file 'NuGet.Resolver.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35'.
Assembly 'NuGet.Resolver.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35' not resolved
Resolving assembly 'NuGet.Protocol.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35' using runtime installed at '/usr/lib/mono/4.5'...
Exception occurred while resolving assembly NuGet.Protocol.resources: Could not load the file 'NuGet.Protocol.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35'.
Assembly 'NuGet.Protocol.resources, Version=5.11.0.10, Culture=en-GB, PublicKeyToken=31bf3856ad364e35' not resolved
CACHE https://api.nuget.org/v3/registration5-gz-semver2/codecov/index.json
Installing addins...
CACHE https://api.nuget.org/v3/registration5-gz-semver2/cake.codecov/index.json
The addin Cake.Codecov will reference Cake.Codecov.dll.
CACHE https://api.nuget.org/v3/registration5-gz-semver2/cake.git/index.json
Assemblies not found for tfm .NETFramework,Version=v4.6.1 and rid [NULL].
No assemblies found after running content resolver.
Error: Cake.Core.CakeException: Failed to install addin 'Cake.Git'.
at Cake.Core.Scripting.ScriptProcessor.InstallAddins (System.Collections.Generic.IReadOnlyCollection`1[T] addins, Cake.Core.IO.DirectoryPath installPath) [0x000c0] in <040622b6758f456b89fd2a5b24e3e64c>:0
at Cake.Core.Scripting.ScriptRunner.Run (Cake.Core.Scripting.IScriptHost host, Cake.Core.IO.FilePath scriptPath) [0x0013b] in <040622b6758f456b89fd2a5b24e3e64c>:0
at Cake.Features.Building.BuildFeature.RunCore (Spectre.Console.Cli.IRemainingArguments arguments, Cake.Features.Building.BuildFeatureSettings settings) [0x0010d] in <21a7d41a88904b88a0986b85ed354c53>:0
at Cake.Features.Building.BuildFeature.Run (Spectre.Console.Cli.IRemainingArguments arguments, Cake.Features.Building.BuildFeatureSettings settings) [0x00012] in <21a7d41a88904b88a0986b85ed354c53>:0
at Cake.Commands.DefaultCommand.Execute (Spectre.Console.Cli.CommandContext context, Cake.Commands.DefaultCommandSettings settings) [0x000d0] in <21a7d41a88904b88a0986b85ed354c53>:0
How to map the build.ps1 to the new dotnet version ?
from dtmfdetection.
Are you trying to integrate this project into your CI? Because that's all the build.ps1 from cake is good for.
I'm unfamiliar with this error but it looks like one of the cake dependencies relies on the old .net framework. You could try to upgrade cake by setting it up from scratch (https://cakebuild.net/docs/getting-started/setting-up-a-new-scripting-project). You can re-use the *.cake files though, which implement the actual CI process. Just make sure not to upgrade to the newest cake frosting which works entirely different.
from dtmfdetection.
But even then that dependency might still cause troubles, so make sure you really want to do this 😄
from dtmfdetection.
Hi @bert2
I'm actually trying to detect and print DTMF changes (DTMF tone starting or stopping) in a mp3 file, exactly as per your example, but when I create my own cs file with the below code (Except a different mp3 file) :
using System;
using DtmfDetection.NAudio;
using NAudio.Wave;
class Program {
static void Main() {
using var audioFile = new AudioFileReader("long_dtmf_tones.mp3");
var dtmfs = audioFile.DtmfChanges();
foreach (var dtmf in dtmfs) Console.WriteLine(dtmf);
}
}
But I am getting the following error message, and I don't know why:
error CS1525: Unexpected symbol `var', expecting `('
Compilation failed: 1 error(s), 0 warnings
I've spent hours on stackoverflow and all, but unable to understand why compiling from cs to exe will throw that error...
A (maybe stupid) question : is there any specific location where the .cs file must be created in the project?
from dtmfdetection.
This error appears because you seem to compile with an outdated compiler or a language version setting that is too low.
It's the using var audioFile
that's only possbile since C# 8.0/dotnet core 3.1.
How are you building your probject? With dotnet build
? Could you show the full output of that command? Also show the contents of your .csproj
file, please.
from dtmfdetection.
.cs files are usually placed next to the .csproj file or in a subdirectory next it.
from dtmfdetection.
Hi @bert2
Yes, building the project with dotnet build
. The full output is:
dotnet build
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
DtmfDetection -> /home/xxx/xxx/bin/DtmfDetection/src/DtmfDetection/bin/Debug/netstandard2.1/DtmfDetection.dll
DtmfDetection.NAudio -> /home/xxx/xxx/bin/DtmfDetection/src/DtmfDetection.NAudio/bin/Debug/netstandard2.1/DtmfDetection.NAudio.dll
integration -> /home/xxx/xxx/bin/DtmfDetection/test/integration/bin/Debug/netcoreapp3.1/test.integration.dll
dtmf-detector -> /home/xxx/xxx/bin/DtmfDetection/example/dtmf-detector/bin/Debug/netcoreapp3.1/dtmf-detector.dll
unit -> /home/xxx/xxx/bin/DtmfDetection/test/unit/bin/Debug/netcoreapp3.1/test.unit.dll
benchmark -> /home/xxx/xxx/bin/DtmfDetection/test/benchmark/bin/Debug/netcoreapp3.1/benchmark.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:14.71
Content of DtmfDetection csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<DocumentationFile>.\obj\DtmfDetection.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
Content of DtmfDetection.NAudio csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<DocumentationFile>.\obj\DtmfDetection.NAudio.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NAudio" Version="1.10.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DtmfDetection\DtmfDetection.csproj" />
</ItemGroup>
</Project>
from dtmfdetection.
I actually meant the output of the build that fails 😄 Where are you adding your example file? It's best if you create a new .csproj for it.
No offense, but I think you should into some C# tutorials on how to do that.
from dtmfdetection.
Hi @bert2
Hoo my bad... Well, since I'm using linux, I've installed mono-complete
, and I have created my example.cs
file next to DtmfDetection.NAudio.csproj
.
Then I try to compile with the following command:
mcs -out:example.exe example.cs
example.cs(7,14): error CS1525: Unexpected symbol `var', expecting `('
Compilation failed: 1 error(s), 0 warnings
However, if I just create a dummy 'hello world' cs file, it can compile without any issue.
from dtmfdetection.
I'm not entirely sure, but since dotnet core 3.1 linux users don't have to use mono anymore. You've installed dotnet 6, so you can use that instead with dotnet build
in the same directory.
from dtmfdetection.
Hi @bert2
I think you're right, the problem may still be coming from dotnet.
After I ran dotnet build
in the example folder, and tried to launch the exe, this is what I got:
./dtmf-detector
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0' (arm64) was not found.
- The following frameworks were found:
6.0.5 at [/home/cxxx/.dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=arm64&rid=debian.11-arm64
Does that mean I got to downgrade to that dotnet version, or is there a way to launch the executable with the current v6 ?
from dtmfdetection.
You better don't try to re-use the source project for this. Create a new dotnet 6 project somewhere else and as per tutorial. Then add your example code. And then add the DtmfDetection.NAudio package via nuget:
example-dir> dotnet add example.csproj DtmfDetection.NAudio
Then run dotnet build
.
from dtmfdetection.
Btw you don't have to literally add the source of this project to your project. It's available on nuget and dotnet will automatically pull that package for you if you reference it in your .csproj file.
from dtmfdetection.
Related Issues (18)
- WaveFileReaderExtensions.cs suggestion HOT 1
- DTMF detector fails for 48KHz audio HOT 1
- LiveAudioDtmfAnalyzer seems not working HOT 5
- Consuming too much processor. HOT 2
- Detect Busy signal frequency HOT 1
- Repeating DTMF tones are not detected correctly when played too fast HOT 1
- I have 4 tones, but it only detects 2 tones HOT 15
- Identify dtmf microphone in the L and R channels separately HOT 5
- FSK CallerID decoder HOT 2
- Incorrect keys at start of sequence HOT 3
- How to implement microphone volume HOT 1
- How to ensure the latest NAudio version is in use? HOT 15
- Is it possible to use a named pipe (fifo) as input of NAudio? HOT 3
- Is it possible to change the detection frequency? HOT 1
- Would appreciate upgrade of NAudio dependency to version 2.X
- Identify off-hook phone HOT 1
- System.Threading.ThreadAbortException HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtmfdetection.