GithubHelp home page GithubHelp logo

Comments (15)

bert2 avatar bert2 commented on June 15, 2024 1

Not all of NAudio's functionality is available on Linux it seems: naudio/NAudio#472

Maybe try a different audio format?

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

Yup, you should be fine like that.

Do the integration tests still pass? I had trouble with an earlier upgrade of NAudio breaking a test.

Running the tests should work with dotnet test or with:

> dotnet test --project test/integration

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

Hi @bert2

Not so sure it still pass... I got the below error:

MSBUILD : error MSB1001: Unknown switch.
    Full command line: '/home/xxxx/.dotnet/sdk/6.0.300/MSBuild.dll -maxcpucount -verbosity:m -restore -target:VSTest -nodereuse:false -nologo --project test/integration -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/home/xxxx/.dotnet/sdk/6.0.300/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/home/xxxxx/.dotnet/sdk/6.0.300/dotnet.dll'
  Switches appended by response files:
Switch: --project

For switch syntax, type "MSBuild -help"

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

My mistake. Try it without --project:

> dotnet test test/integration

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

Hi @bert2

I'm getting a different error now:

CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point  [/home/xxxx/bin/DtmfDetection/src/DtmfDetection.NAudio/DtmfDetection.NAudio.csproj]

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

Please show the exact command you're executing along with the directory you're in.

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

And also show the complete output please.

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

I was able to fix that issue by creating a dummy Program.cs file in both the src folders:

  • DtmfDetection
  • DtmfDetection.NAudio

The content is as follows:

using System;

class Program {
    static void Main() {
    }
}

However I am now facing a different issue related to dotnet version:

user@host:~/xxxxx/bin/DtmfDetection $ dotnet test test/integration
  Determining projects to restore...
/home/xxxxx/bin/DtmfDetection/test/integration/integration.csproj : error NU1201: Project DtmfDetection.NAudio is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Project DtmfDetection.NAudio supports: net6.0 (.NETCoreApp,Version=v6.0)

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

No, this makes no sense. You don't need those Programm.cs files.

Again, please show the exact command you're executing along with the directory you're in. You're simply not executing the tests correctly.

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

I rebuilt integration.csproj with net6.0 instead of 3.1 as the TargetFramework, the previous error is now gone.

But I'm now facing the below issue. I'm executing dotnet test test/integration from the root folder called DtmfDetection :

user@host:~/bin/DtmfDetection $ dotnet test test/integration
  Determining projects to restore...
  Restored /home/xxx/bin/DtmfDetection/src/DtmfDetection.NAudio/DtmfDetection.NAudio.csproj (in 1.6 sec).
  Restored /home/xxx/bin/DtmfDetection/test/integration/integration.csproj (in 2.04 sec).
  1 of 3 projects are up-to-date for restore.
  DtmfDetection -> /home/xxx/bin/DtmfDetection/src/DtmfDetection/bin/Debug/net6.0/DtmfDetection.dll
  DtmfDetection.NAudio -> /home/xxx/bin/DtmfDetection/src/DtmfDetection.NAudio/bin/Debug/net6.0/DtmfDetection.NAudio.dll
/home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs(80,13): error CS0012: The type 'WaveStream' is defined in an assembly that is not referenced. You must add a reference to assembly 'NAudio, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'. [/home/xxx/bin/DtmfDetection/test/integration/integration.csproj]
/home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs(80,13): error CS0012: The type 'ISampleProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'NAudio, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'. [/home/xxx/bin/DtmfDetection/test/integration/integration.csproj]
/home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs(80,13): error CS0012: The type 'IWaveProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'NAudio, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'. [/home/xxx/bin/DtmfDetection/test/integration/integration.csproj]
/home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs(81,30): error CS0012: The type 'WaveStream' is defined in an assembly that is not referenced. You must add a reference to assembly 'NAudio, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'. [/home/xxx/bin/DtmfDetection/test/integration/integration.csproj]
/home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs(81,25): error CS0012: The type 'WaveStream' is defined in an assembly that is not referenced. You must add a reference to assembly 'NAudio, Version=1.9.0.0, Culture=neutral, PublicKeyToken=null'. [/home/xxx/bin/DtmfDetection/test/integration/integration.csproj]

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

Ok, very good. Looks like the NAudio reference inside the integration.csproj got mangled or something during the nuget update. Could you show the contents of integration.csproj?

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

Here it is:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <IsPackable>false</IsPackable>
    <RootNamespace>Integration</RootNamespace>
    <AssemblyName>test.integration</AssemblyName>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="coverlet.msbuild" Version="3.0.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
    <PackageReference Include="NAudio" Version="2.1.0" />
    <PackageReference Include="NAudio.Vorbis" Version="1.1.0" />
    <PackageReference Include="Shouldly" Version="4.0.3" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="coverlet.collector" Version="3.0.2">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\DtmfDetection.NAudio\DtmfDetection.NAudio.csproj" />
  </ItemGroup>

  <ItemGroup>
    <None Update="testdata\long_dtmf_tones.mp3">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="testdata\short_dtmf_sequence.mp3">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="testdata\stereo_dtmf_tones.wav">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="testdata\very_short_dtmf_tones.ogg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="xunit.runner.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

There's a version mismatch somewhere. The error message is asking to reference NAudio, Version=1.9.0.0, but the .csproj is referencing Include="NAudio" Version="2.1.0".

I see two possible causes: In some of the other .csproj files the older version 1.9.0 is still being referenced instead of the newer 2.1.0 one. Or there were breaking changes in NAudio and the types mentioned in the error (WaveStream etc.) have been renamed or something.

from dtmfdetection.

bert2 avatar bert2 commented on June 15, 2024

NAudio 2 came with a lot of changes but they should be backwards compatible: https://markheath.net/post/naudio-2-plans

So I guess some other .csproj must still be referencing 1.9.0?

from dtmfdetection.

moving-digital avatar moving-digital commented on June 15, 2024

Hi @bert2

I downgraded NAudio back to the latest v1 available, which is 1.10, and it fixed the issue... So seems like the statement "Or there were breaking changes in NAudio and the types mentioned in the error (WaveStream etc.) have been renamed or something." is correct.

The tests are now able to be executed, but I am facing another issue with a missing Msacm32.dll :

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:03.58]     DetectsDtmfTonesInShortSequence [FAIL]
[xUnit.net 00:00:03.63]     LongDtmfTones [FAIL]
  Failed DetectsDtmfTonesInShortSequence [57 ms]
  Error Message:
   System.DllNotFoundException : Unable to load shared library 'Msacm32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMsacm32.dll: cannot open shared object file: No such file or directory
  Stack Trace:
     at NAudio.Wave.Compression.AcmInterop.acmFormatSuggest2(IntPtr hAcmDriver, IntPtr sourceFormatPointer, IntPtr destFormatPointer, Int32 sizeDestFormat, AcmFormatSuggestFlags suggestFlags)
   at NAudio.Wave.Compression.AcmStream.SuggestPcmFormat(WaveFormat compressedFormat)
   at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)
   at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)
   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream, FrameDecompressorBuilder frameDecompressorBuilder, Boolean ownInputStream)
   at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)
   at NAudio.Wave.AudioFileReader.CreateReaderStream(String fileName)
   at NAudio.Wave.AudioFileReader..ctor(String fileName)
   at Integration.BackgroundAnalyzerTests.FakeWaveIn..ctor(String audioFile) in /home/xxx/bin/DtmfDetection/test/integration/BackgroundAnalyzerTests.cs:line 28
   at Integration.BackgroundAnalyzerTests.DetectsDtmfTonesInShortSequence() in /home/xxx/bin/DtmfDetection/test/integration/BackgroundAnalyzerTests.cs:line 15
  Failed LongDtmfTones [9 ms]
  Error Message:
   System.DllNotFoundException : Unable to load shared library 'Msacm32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libMsacm32.dll: cannot open shared object file: No such file or directory
  Stack Trace:
     at NAudio.Wave.Compression.AcmInterop.acmFormatSuggest2(IntPtr hAcmDriver, IntPtr sourceFormatPointer, IntPtr destFormatPointer, Int32 sizeDestFormat, AcmFormatSuggestFlags suggestFlags)
   at NAudio.Wave.Compression.AcmStream.SuggestPcmFormat(WaveFormat compressedFormat)
   at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)
   at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)
   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream, FrameDecompressorBuilder frameDecompressorBuilder, Boolean ownInputStream)
   at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)
   at NAudio.Wave.AudioFileReader.CreateReaderStream(String fileName)
   at NAudio.Wave.AudioFileReader..ctor(String fileName)
   at Integration.AudioFileTests.LongDtmfTones() in /home/xxx/bin/DtmfDetection/test/integration/AudioFileTests.cs:line 14

Edit: Seems I'm running on Linux, where am I supposed to store this dll ?

from dtmfdetection.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.