I am trying to call some audio rendering code in K...
# webassembly
p
I am trying to call some audio rendering code in Kotlin from a WebAudio AudioWorkletProcessor in JavaScript. I tried this: https://kotlinlang.org/docs/wasm-js-interop.html#functions-with-the-jsexport-annotation
Copy code
//import exports from "./module.mjs"
import exports from "./composeApp.js"
console.log("Kotlin random code is " + exports.renderKotlinAudio());
But I always get: SyntaxError: Unexpected identifier 'exports' I am using Kotlin/Compose multi-platform code. My Kotlin WASM code has:
Copy code
@OptIn(ExperimentalJsExport::class)
@JsExport
fun renderKotlinAudio(): Float {
    return Random.nextFloat()
}
I spent a lot of time with Gemini giving me increasingly complex solutions that did not work. Has anyone actually done this successfully?