Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Estrada: Cross-Platform Microphone

Discussion in 'Assets and Asset Store' started by bluezzzy, Jan 10, 2023.

  1. bluezzzy

    bluezzzy

    Joined:
    Sep 5, 2021
    Posts:
    29

    Estrada is a drop-in replacement for Unity Microphone with WebGL support.

    Check out the online documentation and online demo.

    For all questions write to bluezzzy.dev@gmail.com.

    Features:
    • Full compatibility with Unity Microphone API
    • One line of code to switch from Unity Microphone to Estrada
    • WebGL support (with the limitations listed below)
    • Uniform microphone permission handling for all platforms
    • Automatic browser feature detection
    • Uses AudioWorkletNode in HTTPS mode and falls back to ScriptProcessorNode for local development

    WebGL limitations:
    • Application using Estrada must run in an HTTPS context (HTTP is allowed for local development)
    • Unity doesn't support AudioClip.GetData(). Use Estrada.Microphone.GetCurrentData() instead
    • Unity doesn't support AudioClip streaming, simultaneous audio recording and playback is not supported
    • Microphone permission is required to view available devices
    • Unity AudioClip supports only 44100 Hz sample rate. Estrada detects this limitation and limits the sample rates of the recording devices to this value. If you want to have access to the full range of sample rates of the recording device, define ESTRADA_ALLOW_SAMPLE_RATE_MISMATCH symbol (Project Settings -> Player -> Other Settings -> Scripting Define Symbols). In this case, AudioClip.frequency will still equal 44100 Hz, but AudioClip will store samples for the sample rate specified when calling Estrada.Microphone.Start().
     
    Last edited: Jan 12, 2023
  2. dan_soqqle

    dan_soqqle

    Joined:
    Feb 2, 2022
    Posts:
    114
    Hi any idea with this?

    Invoking error handler due to
    NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': createBuffer(1, 26460000, 44100) failed.
    Error: Failed to execute 'createBuffer' on 'BaseAudioContext': createBuffer(1, 26460000, 44100) failed.
    at jsAudioCreateUncompressedSoundClipFromPCM (http://localhost:56781/Build/WebGLBuild.framework.js:3032:37)
    at _JS_Sound_Load_PCM (http://localhost:56781/Build/WebGLBuild.framework.js:3046:14)
    at AudioClip_CUSTOM_SetData(Il2CppObject*, Il2CppArray*, int, int) (http://localhost:56781/Build/WebGLBuild.wasm:wasm-function[201641]:0x327f2b7)
    at AudioClip_SetData_mB49A9BC4639C62B9C8B22319D33D46AAD176BC3B (http://localhost:56781/Build/WebGLBuild.wasm:wasm-function[21601]:0x60bacd)
    at AudioClip_SetData_m7B473C614C11953D746770F4F89B44600B5A6AF3 (http://localhost:56781/Build/WebGLBuild.wasm:wasm-function[21618]:0x60bea9)
    at WebGLMicrophoneController_HandleNewSamples_mBCB97B156F419886FAB74F707965195CAD30B5DC (http://localhost:56781/Build/WebGLBuild.wasm:wasm-function[62416]:0xf1836f)
     
  3. bluezzzy

    bluezzzy

    Joined:
    Sep 5, 2021
    Posts:
    29
    The error you're seeing seems to be related to the size of the audio buffer being requested. Specifically, your application is trying to create a buffer with 26460000 samples at a sample rate of 44100 Hz. This amounts to about 10 minutes of audio data or roughly 100MB in size.

    Given the constraints of WebGL and browser environments, this buffer size may exceed the allowable memory limits.

    I suggest trying to process the audio in smaller chunks rather than attempting to handle it all at once.

    You can also email me with your script attached, contacts are in the opening post.
     
  4. JanetGilbertPraxis

    JanetGilbertPraxis

    Joined:
    May 6, 2022
    Posts:
    22
    Hi there! I have a question about these error messages we encounter while using Estrada as part of Recognissimo on WebGL on the Firefox browser. Any ideas?

    upload_2024-2-27_20-47-58.png

    Code (CSharp):
    1. resumeException https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    2.     ReversePInvokeWrapper_WebGLMicrophoneController_HandleNewSamples_mBCB97B156F419886FAB74F707965195CAD30B5DC https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:13312815
    3.     dynCall_v https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:36222860
    4.     newSamples https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    5.     audioCaptureNode https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    6.     onmessage https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    7.     (Async: EventHandlerNonNull)
    8.     createAudioWorklet https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    9.     AsyncFunctionNext self-hosted:852
    10.     (Async: async)
    11.     _Estrada_Start https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    12.     AsyncFunctionNext self-hosted:852
    13.     (Async: async)
    14.     WebGLMicrophoneController_Start_m06A40C6E30EB11098B8B55A0D7C45EFECD834B32 https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:13313742
    15.     Microphone_Start_mC084BC00E46E54CFCA3FDE6BF1FE01ABA0AA6F61 https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:13309708
    16.     U3CInitializeMicrophoneU3Ed__25_MoveNext_m42BA429C10100CB51DEF511833C26DDA049715FD https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:13377885
    17.     dynCall_iii https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:36222812
    18.     invoke_iii https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    19.     U3CWrapThrowingCoroutineU3Ed__7_MoveNext_m0B6BAA15A6A590FF260D84C7580EBA2E3873FE2F https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:13366782
    20.     SetupCoroutine_InvokeMoveNext_m72FC77384CAC3133B6EE650E0581D055B34B2F5F https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:18207611
    21.     RuntimeInvoker_FalseVoid_t4861ACF8F4594C3437BB48B6E56783494B843915_VoidU2A_t104EAEFBD2D237A8C29618913DA9B4D99355E965_Int32_t680FF22E76F6EFAD4375103CBBFFA0421349384C(void (*)(), MethodInfo const*, void*, void**, void*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:21881806
    22.     il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:21961509
    23.     dynCall_iiii https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:36222800
    24.     invoke_iiii https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    25.     il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:21957573
    26.     il2cpp_runtime_invoke https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:21966667
    27.     scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35879843
    28.     ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35235321
    29.     Coroutine::Run(bool*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35073921
    30.     MonoBehaviour::TryCreateAndRunCoroutine(ScriptingObjectPtr, ScriptingMethodPtr, Coroutine**) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:22749900
    31.     Coroutine::Run(bool*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35074859
    32.     Coroutine::ContinueCoroutine(Object*, void*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35073707
    33.     DelayedCallManager::Update(int) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35151250
    34.     InitPlayerLoopCallbacks()::PostLateUpdateScriptRunDelayedDynamicFrameRateRegistrator::Forward() https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:35029354
    35.     ExecutePlayerLoop(NativePlayerLoopSystem*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:22578117
    36.     ExecutePlayerLoop(NativePlayerLoopSystem*) https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:22578232
    37.     MainLoop() https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:36100019
    38.     dynCall_v https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.wasm.gz:36222860
    39.     browserIterationFunc https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    40.     callUserCallback https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    41.     runIter https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    42.     Browser_mainLoop_runner https://development-webgl.praxislabs.co/builds/moduleX/Build/moduleX.framework.js.gz:56
    43.     (Async: FrameRequestCallback)
    44.     requestAnimationFrame
     
  5. bluezzzy

    bluezzzy

    Joined:
    Sep 5, 2021
    Posts:
    29
    Hi. Could you email me at the address provided in the opening post to provide more details?