Placeholder-Software / Dissonance

Unity Voice Chat Asset
71 stars 5 forks source link

[iOS]Audio effect Dissonance Echo Cancellation could not be found. #80

Closed Moomo closed 2 years ago

Moomo commented 6 years ago

Hi,

I'm using Dissonance Echo Cancellation With Photon Unity Networking.

Dissonance Echo Cancellation is working on UnityEditor, But iOS is not working.

This Console Log Appared From iPhone(iPhoneX and iPhone6 plus).

Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly.

I'm using Unity2017.3 to build iOS.

Please how to resolve this case !

martindevans commented 6 years ago

Hi Moomo,

Could you check that the import settings for the ios plugins (both files in Assets/Plugins/Dissonance/Plugins/iOS) look like this:

ios imports

Moomo commented 6 years ago

Hi martindevans,

Yes, my plugins (both files in Assets/Plugins/Dissonance/Plugins/iOS) are checked iOS and also included to Xcode Plugins like this.

https://gyazo.com/9ece7d50e7cf614f5faa1cbfe8e8b9f9

https://gyazo.com/c31602346b26907e562a9bb43f0a62c2

However, this problem will continue to occur :(

martindevans commented 6 years ago

Hi Moomo thanks for checking that, it looks like you have that set up correctly. Tom is going to investigate this for you.

martindevans commented 6 years ago

Hi Moomo, while working on another issue I realised you may have the same problem. As you can see from these comments the Unity installer supplied the wrong plugin files to abelevsov which caused a very similar issue (expected things not being found in the plugins).

Could you try getting the SHA256 hash of the libAudioPluginDissonance.a and libopus.a files. Here's stackexchange question on how to do that. The hashes I get are:

libAudioPluginDissonance.a SHA256:6851C46CF6937111A3767AAF468060D9C3CAE4F48A76003915F3E1BD88E7777B libopus.a SHA256:8F50BD055E09CE2F4B697C4FA209D2088F802305C4993DBCC3ADB58D5711A4C6

If the hashes are not the same then completely delete all dissonance related things from the project, close and re-open the editor (verify that the files are really gone), and then re-install from the asset store again. After all that, verify that you now get the correct file hashes.

Moomo commented 6 years ago

Hi martindevans,

Thank you for teaching me to solve the problem !

I checked to both plugin's SHA256, but they are same as your suggesting SHA256 value.

I reimported DissonanceVoiceChat from AssetStore just in case, I don't know why but Dissonance Echo Cancellation is working !

In addition, I developing project using 2 PCs (MacBookPro And MacPro), But Error-Log such as

Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly.

is only appeared when I build project on Xcode by MacPro.

I hope that you will find out why these problems are caused as soon as possible :)

Best regards.

martindevans commented 6 years ago

That's very odd, we've had some issues where the Unity installer would fail to upgrade the plugin files (that's why I asked you to test the hashes, to see if you had an outdated set of plugins). However if you had the correct plugins I'm not sure what changed when you deleted and re-imported it! If you have the project in source control (e.g. git) can you check exactly what changed when you did that?

The same project working on mac book but not mac is also very odd. Are you using different versions of XCode on the two machines? What exact version(s) are you using?

daisaku19801210 commented 6 years ago

Hi martindevans

In my iPhone And Android building enviroment, Same error occurred.

I checked below

Dissonancce version is 6.1

Do you teach me to work correctly enviroment in iPhone? I will prepare same enviroment and try to check

martindevans commented 6 years ago

Hi daisaku,

Just to be clear: the same error occurs on Android and iOS? Or is this an iOS only problem?

We never managed to work out the cause of this problem, so any extra details you can tell us could help. (e.g. XCode version, OSX version, iOS version etc).

daisaku19801210 commented 6 years ago

development enviroment

*OS

Microsoft Windows 10 version 1709(OS build 16299.309)

*UnityEditor version

Version 2017.3.0p1 (4596dd67072f) Wed, 20 Dec 2017 17:16:08 GMT Branch: 2017.3/patch-release

in this enviroment, correctly working (show attachment pics)


build envriroment

*OS macOS Sierra version 10.12.6

*UnityEditor version Unity2017.3.0p1

*XCode Version 9.2 (9C40b)

*iPhone iPhone8Plus version 11.2.6

libAudioPluginDissonance.a and libopus.a including in XCode are same binary with development enviroment

but error occurred in iPhone (Echo Cancellation could not be found) voicesettings audiomixir echocancel playbackprefab pluginslib

martindevans commented 6 years ago

I've been doing some investigation into this issue. Unfortunately I haven't been able to test on an iOS device yet.

My best guess is that we need to do something like this: https://github.com/playdots/UnityPd#ios. But I really need to test this on an actual device to be sure.

opamped commented 6 years ago

I'm hitting the same issue (Audio effect Dissonance Echo Cancellation could not be found).

Building with

martindevans commented 6 years ago

Would it be possible for you to try the instructions I linked from the UnityPd project? I haven't been able to borrow an iOS device to test this on :(

  1. Unity on iOS needs to load the plugin when the app starts up. To do this you need to edit the UnityAppController.mm file:
  2. add #import "AudioPluginInterface.h; (available from here https://bitbucket.org/Unity-Technologies/nativeaudioplugins/src)
  3. find the preStartUnity method and add the line UnityRegisterAudioPlugin(&UnityGetAudioEffectDefinitions);

This should tell iOS to load up the audio plugins and, in theory, everything from there will work as usual.

opamped commented 6 years ago

Might look into it depending on workload. Looks like Moomoo resolved it by building with a different machine so I figure I'll try the minimal effort, long-shot fix of seeing if for whatever reason it'll run when built with Cloud Build.

opamped commented 6 years ago

Your 3 point solution as described fixed the iOS issue in my case. Ideally, I'd like to be able to avoid opening up Xcode in order to streamline a multi-platform build process. Could probably address that with a PostProcessBuildAttribute script but I'm fine with the work-around for now. Thanks for posting it within minutes of my initial post.

If you're curious about cloud build, that failed.

PS - you should probably get an iOS device

martindevans commented 6 years ago

Your 3 point solution as described fixed the iOS issue in my case.

That's excellent, thanks for trying that out.

address that with a PostProcessBuildAttribute script

That's a good idea, I'll look into doing that. I'll probably make a separate iOS AEC integration which includes the header and the post build script.

martindevans commented 6 years ago

We finally managed to test this out with an iPad yesterday (+Mac book pro/Unity 2017.3) and unfortunately couldn't reproduce the issue at all. We tried a variety of tests with and without the full fix, with just the header imported, with no changes, with AEC and AECM enabled/disabled and nothing produced a problem.

Since you've confirmed the suggested fix works (and I've confirmed it doesn't break anything in a situation where it's evidently not needed) I've updated the documentation to mention the error, the fix and this issue for people to report back to if the problem persists.

alexander12356 commented 6 years ago

Hello, We're still experiencing exactly the same error. We've tried to do what you advised. If we move 'NativeCode' from 'NativeAudioPlugins' (https://bitbucket.org/Unity-Technologies/nativeaudioplugins/overview) to our 'Assets', an additional link is required - CoreAudioUtilityClasses (https://developer.apple.com/library/mac/samplecode/CoreAudioUtilityClasses/CoreAudioUtilityClasses.zip), which uses the old CarbonCore library and thus the error occurs when building the project. We've tried to remove everything related to CoreAudioUtilityClasses. In this case, everything is ok, but there is still the same error. Also, we've tried to transfer all NativeAudioPlugins to the project, but when making step 2 from your hotfix, the project can't be built as 'AudioPlugins.h' cannot be found. Version of Unity 2017.4.2f Version of Xcode 9.4 Version of Mac 10.13.5 Device - Iphone 7 iOS: 11.2.5

martindevans commented 6 years ago

Hi Alexander,

You should be able to grab just the AudioPluginInterface.h file from the bitbucket project. That should fix the CoreAudioUtilityClasses dependency problem.

Also, we've tried to transfer all NativeAudioPlugins to the project, but when making step 2 from your hotfix, the project can't be built as 'AudioPlugins.h' cannot be found.

I'm not sure what you mean by this? Sorry.

Although I do notice that's the wrong header file name you mentioned, but I guess that was just a typo in the issue report :)

opamped commented 6 years ago

Here's what worked for me, don't know if it will help. Please note this is not an ideal solution but it does mean you don't have to make any edits to the Xcode project.

I created a new path in Unity, Plugins>iOS, and added the two attached files.

The simple file that is used to override the app delegate is a duct tape fix. For something more robust, checkout http://eppz.eu/blog/override-app-delegate-unity-ios-osx-1/

DissonancePluginFix.zip

martindevans commented 6 years ago

That's not a bad fix, although it's obviously not something that we could ship ourselves (since it will break if any other plugins try to do that).

My suggestion would be to write a simple post build script which will patch the UnityAppController.mm file, that won't break if another native plugin is loading. We debated doing this ourselves (offering a separate integration with the post build script) but decided against it. It would be a maintenance nightmare to make sure that patched correctly across all the various different versions of Unity which we support, and since we can't reproduce the issue we wouldn't even be able to test that it works before deploying it!

alexander12356 commented 6 years ago

Thanks for responding! Its worked. Thanks :)

daisaku19801210 commented 6 years ago

Hi martindevans,

Thanks for resolving this issue for iOS. worked correctly in my environment. However, android device is not resolved, android has below error

"Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly."

Do you have nice resolution in the same way as ios?

martindevans commented 6 years ago

We do know of one issue with Android - due to a bug in Unity we currently cannot support Android/x86. If this doesn't apply to you could you open up a new issue and give me as many details as possible? Thanks.

Vuxt4 commented 6 years ago

Hi martindevans,

I am having the similar issues on Android device when trying to enable AEC, and on android log it shows:

"Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly"

From your previous comment, it looks like AEC was having an issue on Android device.

I am currently using Version 6.2.0. Is this issue fixed on the latest version of Dissonance ?

Thanks in advance for your time and support :)

martindevans commented 6 years ago

Hi Vuxt4,

I'm not aware of any bugs for Android except that it doesn't work on x86 platforms with certain versions of Unity - this is due to a bug in Unity which won't let you specify x86 as an android target. Unfortunately we got a response from Unity that this won't be fixed since it only affects certain 2017.x versions (.3 and .4 iirc). However I don't think this is likely to be your problem unless you are actually building for Android x86 hardware.

Have you checked that the import settings for all of the files in Assets/Plugins/Dissonance/Plugins/Android/libs look correct? They should look a little like this:

untitled

The two files in libs/armeabi-v7a should target ARMv7 and the two files in libs/x86 should target either x86 or nothing (depending on your Unity version).

Is this issue fixed on the latest version of Dissonance ?

Obviously since I'm not sure what the problem is I can't say for certain. However, I would suggest upgrading anyway unless you have a compelling reason to stay with 6.2.0 - the 6.x.x releases have been focused on bugfixing, so by being just a few versions behind you're missing out on quite a lot of fixes.

Vuxt4 commented 6 years ago

Hi martindevans,

Thanks for your response. Looks like my import settings is correct, I also double check the library md5sum in the apk, it looks fine to me, it's the same as it is in the editor. I will try to upgrade to the 6.2.4 see if the issue occurs.

Here is my current environment and setup:

Development environment: OS: Win10 UnityEditor: 2017.4.8f1

Target Android Device: CPU: ARMv7

default

default

default

default

martindevans commented 6 years ago

Hi Vuxt4,

Thanks for checking all of those details, your setup certainly looks correct and the checksums from editor to build would seem to confirm that Unity is doing it's job properly.

If the problem isn't fixed with the 6.2.4 upgrade could you open up a new issue - that'll make it easier for me to track progress and make sure I don't forget about this problem buried in a closed issue! Just link back to these comments or copy/paste everything across, whichever is easier :)

Vuxt4 commented 6 years ago

Upgrade to 6.2.4 , still sees the error message: 08-07 16:51:43.964 4851 4882 E Unity : Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly.

I will open a new issue

Alexees commented 5 years ago

@martindevans Just want to hook in on this for UWP in Unity 2018.2.6f1. I am receiving this error after upgrading from 6.2.4 to 6.2.6, or I have not noticed it at all since I have implemented it just recently. The size of the copied dll matches the x86 one, so it's the right one and avaiable. They are configured correctly in Unity. I even did a fresh import of the new dissonance package after deleting all the old files. I can try to revert back to 6.2.4 to see if it was recently introduced, but I doubt it. Update: same thing with 6.2.4. Trying empty project now Update: same thing happened again:

martindevans commented 5 years ago

He Alexees, thanks for checking that out in such detail. Could you open a new issue for the UWP problem with a log of a time this happened. Thanks.

vladbasin commented 3 years ago

the link in documentation for iOS (at the very bottom) is broken: https://dissonance.readthedocs.io/en/latest/Tutorials/Acoustic-Echo-Cancellation/#known-issue-with-ios

looks like this repo is in GitHub now https://github.com/Unity-Technologies/NativeAudioPlugins

martindevans commented 3 years ago

Thanks. I've fixed the link.

peterparnes commented 3 years ago

I made a PostBuild-script for Unity that copies the .h and an updated .mm-file into Classes when building for iOS. The script runs automatically on build after you import it to the Unity project.

The only potential problem is if Unity updates the mm-file in the future. The current one comes from 2020.2.7f.

Dissonance-iOSFix.zip

peterparnes commented 2 years ago

Here is an updated file for Unity 2021.2 and newer as the UnityAppController.mm file has been updated by Unity.

Dissonance-iOSFix-2021.2.zip

jlognn commented 2 years ago

Still running into this issue in 2021.2.18f. Have tried manually importing the plugin as advised by the docs, and also using @peterparnes script above. Everything seems to check out, both in Unity itself, and Xcode. Attached screenshot of the linked libraries in Xcode:

Screen Shot 2022-07-17 at 2 28 35 pm

All of the import directives are correct, and the code has been added to the .mm file as advised. Getting the following output in the console in Xcode 13.4.1.

Screen Shot 2022-07-17 at 2 30 49 pm

Has anyone else run into this?

peterparnes commented 2 years ago

Has anyone else run into this?

Hmm... no.... It works fine for me I think. I do not have access to a Mac right now (travelling) but when I did the package above it worked. Attached is the same but for 2022.1.5 which should work with 2021.x as well. Just replace the files in Dissonance-iOSfix/iOS/Editor with the ones in the zip-file and make sure you recompile (I suggest you delete everything in your Build-directory).

Dissonance-iOSFix-2022.zip

jlognn commented 2 years ago

Thanks for that @peterparnes - however I am getting the same error - "Dissonance Echo Cancellation could not be found".

As a sanity check, I again went through and ensured all of the correct files were in the project in Xcode, and that all of the additional code was in the .mm file, and it all checked out. I also tried building in Xcode under Rosetta (as I am using an M1 Mac) and got the same result.

I guess my next steps would be to try upgrading Unity to 2022.1.5 and trying again. I will let you know how that goes.

jlognn commented 2 years ago

So after more testing / experimenting on the M1:

  1. Tried Apple Silicon native Unity Editor 2021.2.18f => Various issues similar to other bug reports, specifically around DLL import errors for Opus and Dissonance.
  2. Tried Intel editor under Rosetta 2021.2.18f => Worked fine in the editor. Same issues when building for iOS however, even when running Xcode in Rosetta.
  3. Tried upgrading to Unity 2022.1.5 with the Intel editor. Same as above.

So my conclusion at the moment is that there is some incompatibility between the M1 and Dissonance, causing some problem somewhere in the build pipeline. Interested to see if anyone else here is using an M1 Mac and has had better results.

peterparnes commented 2 years ago

I have a M1 and I thought it worked but now I am uncertain. Unfortunately, I won’t be able to test for the coming 2 weeks.

I concur with the Silicon native compile problems.

mån 18 juli 2022 kl. 07:58 skrev Joe Logan @.***>:

So after more testing / experimenting on the M1:

  1. Tried Apple Silicon native Unity Editor 2021.2.18f => Various issues similar to other bug reports, specifically around DLL import errors for Opus and Dissonance.
  2. Tried Intel editor under Rosetta 2021.2.18f => Worked fine in the editor. Same issues when building for iOS however, even when running Xcode in Rosetta.
  3. Tried upgrading to Unity 2022.1.5 with the Intel editor. Same as above.

So my conclusion at the moment is that there is some incompatibility between the M1 and Dissonance, causing some problem somewhere in the build pipeline. Interested to see if anyone else here is using an M1 Mac and has had better results.

— Reply to this email directly, view it on GitHub https://github.com/Placeholder-Software/Dissonance/issues/80#issuecomment-1186797169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLF62EXV2TTMZTWDUFZV3VUTW73ANCNFSM4ESCKJGQ . You are receiving this because you were mentioned.Message ID: @.***>

-- /Peter

martindevans commented 2 years ago

Right now Dissonance does not have native support for the M1, so if you're compiling for that platform the linker will fail to find the audio plugin (since it doesn't exist!).

We have compiled in support for M1 and had it tested by someone with an M1 Mac, which we're planning to release very soon (within a week hopefully). If you'd rather not wait for that feel free to email martin@placeholder-software.co.uk your invoice number and I'll get you a copy of the updated binaries :)

jlognn commented 2 years ago

That's awesome, thanks so much Martin. I have just emailed you, and looking forward to getting the updated libraries and doing some testing at my end.

martindevans commented 2 years ago

I have just emailed you

I never received your email for some reason. If you try again perhaps copy in admin@placeholder-software.co.uk as well.

jlognn commented 2 years ago

Hi Martin,

Just resent and copied in admin.

martindevans commented 2 years ago

Hi Joe, really sorry but for some reason I'm still not receiving your emails. I've double checked the spam folders for both email accounts and there's nothing there :/

Fortunately it's not necessary any more, we pulled forward the planned release date a little, so 8.2.0 is now live on the asset store which includes the new plugins.

Please tell me if this fixes the it and I'll close this issue :)

jlognn commented 2 years ago

Hey @martindevans - I gave it a try and unfortunately still getting the Audio effect Dissonance Echo Cancellation could not be found. Check that the project contains the correct native audio plugin libraries and that the importer settings are set up correctly. error in the Xcode console.

On the positives, everything builds and runs fine on the Apple Silicon Unity Editor, although I needed to comment out one line - AudioPluginDissonanceNative.Dissonance_SetMinBandGain(handle.Value, gain); in WebRtcPreprocessingPipeline.cs to get it to compile.

However I am still running into the above error, and have tried numerous combinations of things to no avail.

If anyone out there has this working on iOS, I would be extremely grateful to have a look at how they have configured the plugin settings within Unity and Xcode, otherwise I am basically facing a lot of trial and error....

martindevans commented 2 years ago

On the positives, everything builds and runs fine on the Apple Silicon Unity Editor, although I needed to comment out one line - AudioPluginDissonanceNative.Dissonance_SetMinBandGain(handle.Value, gain); in WebRtcPreprocessingPipeline.cs to get it to compile.

On this one point it looks like we may have made a mistake with this release and pushed out the wrong version of a file. In Assets/Plugins/Dissonance/Core/Audio/Capture/AudioPluginDissonanceNative.cs on line 25 I think this line:

#if (!UNITY_EDITOR_OSX) && (UNITY_EDITOR_WIN || (UNITY_STANDALONE_WIN && !UNITY_WSA) || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID)

Should be:

#if (UNITY_EDITOR_WIN || (UNITY_STANDALONE_WIN && !UNITY_WSA) || UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX || UNITY_ANDROID || UNITY_EDITOR_OSX)

We'll be checking this in more detail tomorrow and will probably push out an urgent fix for it on Monday or Tuesday.

martindevans commented 2 years ago

Dissonance 8.2.1 should fix this problem, please reply here if not and I'll reopen the issue.