Rei-x / discord-speech-recognition

Speech to text extension for discord.js
https://npmjs.com/package/discord-speech-recognition
MIT License
56 stars 22 forks source link

Doesn't work on M1 #39

Closed wasianpower closed 1 year ago

wasianpower commented 1 year ago

When someone actually makes a voice input, the program instantly crashes with dyld[50404]: missing symbol called /var/folders/25/b6_q63592y7g21sc20h3jtx00000gn/T/start-cecd88d9.sh: line 1: 50404 Abort trap: 6 node index.js Here is the relevant code:

client.on('interactionCreate', async (interaction) => {
    if (!interaction.isChatInputCommand()) return;

    const { commandName } = interaction;

    if (commandName === 'join') {
    const voiceChannel = interaction.member?.voice.channel;
    if (voiceChannel) {
      await joinVoiceChannel({
        channelId: voiceChannel.id,
        guildId: voiceChannel.guild.id,
        adapterCreator: voiceChannel.guild.voiceAdapterCreator,
        selfDeaf: false,
      });
      await interaction.reply("Joined channel \"" + voiceChannel.name + "\"");
    } else {
      await interaction.reply("Please join a voice channel before using this command!");
    }
  }
});

client.on("speech", (msg) => {
  // If bot didn't recognize speech, content will be empty
  console.log("tea");
});

Some googling makes me think this is an issue with M1 mac processors and the binaries, but not 100% sure.

Rei-x commented 1 year ago

Can you show me your package.json file? Is there any stack trace when this error occurs?

wasianpower commented 1 year ago

Package.json:

{
  "name": "test-bot",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node deploy-commands.js; node index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@discordjs/opus": "^0.8.0",
    "@discordjs/rest": "^1.0.1",
    "@discordjs/voice": "^0.11.0",
    "discord-speech-recognition": "^3.0.1",
    "discord.js": "^14.2.0",
    "ffmpeg": "^0.0.4",
    "ffmpeg-static": "^5.0.2",
    "libsodium-wrappers": "^0.7.10"
  }
}

There is no stack track and no option for a full stack trace, all I get is:

dyld[53719]: missing symbol called
/var/folders/25/b6_q63592y7g21sc20h3jtx00000gn/T/start-d2531e69.sh: line 1: 53719 Abort trap: 6           node index.js

The number 53719 and the specific missing sh file it is referencing change every time the error comes up. Additionally, I manually went in and checked and verified that the file being referenced does not exist on my machine.

Rei-x commented 1 year ago

You can try to change libsodium-wrappers with tweetnacl or sodium - (more info here). I really don't know what is the cause of this issue, but maybe changing some dependencies will work. Also, make sure to use node version 16 or newer.

Rei-x commented 1 year ago

You can also try this: https://gist.github.com/adrienjoly/e29a6e73fb7e701eefd80ff9bde9abeb

wasianpower commented 1 year ago

You can also try this: https://gist.github.com/adrienjoly/e29a6e73fb7e701eefd80ff9bde9abeb

This worked! I had seen this during my initial debug search but it didn't work, it worked once I set up a rosetta terminal and used that: https://www.courier.com/blog/tips-and-tricks-to-setup-your-apple-m1-for-development/