opus icon indicating copy to clipboard operation
opus copied to clipboard

MacBook Pro M2: dyld[7797]: missing symbol called

Open objectkuan opened this issue 1 year ago • 2 comments

Issue description

  1. Prepare some PCM data. In my case it's 16kHz mono, 16bits.
  2. Encode it with 960 bytes per frame.
  3. Watch the crash

After digging into the missing symbols, I managed to fix that by adding "opus/silk/arm/NSQ_neon.c" to the "target_arch==\"arm64\"" condition in @discordjs/opus/deps/binding.gyp .

Code sample

import { OpusEncoder } from '@discordjs/opus';

const buffer = ...;
const bytesPerFrame = 960;
const frame = buffer.subarray(0, bytesPerFrame);
const encoder = new OpusEncoder(16000, 1);
const opus = encoder.encode(frame);

Versions

  • @discordjs/opus: 0.9.0
  • nodejs: v22.11.0
  • typescript: 5.6.3
  • OS: macOS 14.6.1 (23G93)
  • Chip: Apple M2

Issue priority

Medium (should be fixed soon)

objectkuan avatar Nov 20 '24 09:11 objectkuan

getting same error on macos, M2 pro encoding pcm16, 24kHz mono

deepso7 avatar Dec 03 '24 09:12 deepso7

Since this is yet to be reviewed, I have prepared a list of alternative opus libs for node which could work for the people having issues:

1. mediaplex

mediaplex has opus api which is exactly the same as @discordjs/opus but is written in rust instead of c++ which makes the installation easier.

2. @evan/opus

@evan/opus has different api but gets the job done and author claims it to be faster than other alternatives. This one has native and wasm versions.

3. opusscript

opusscript is similar to @discordjs/opus but uses webassembly.

4. opus-decoder

If you only need a decoder, there's opus-decoder which uses webassembly.

5. @evan/wasm

@evan/wasm contains bunch of stuff but also has opus encoder/decoder. It is also a webassembly module.

twlite avatar Dec 28 '24 05:12 twlite