Skip to content

Commit

Permalink
chore: use OggDemuxer at new AudioResource
Browse files Browse the repository at this point in the history
  • Loading branch information
yuimarudev committed Nov 30, 2024
1 parent 60246c7 commit d5ff7cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"etcd3": "^1.1.2",
"lefthook": "^1.8.4",
"libsodium-wrappers": "^0.7.15",
"prism-media": "1.3.5",
"prisma": "^5.22.0",
"typescript": "^5.6.3"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/voice/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "@discordjs/voice";
import { WebSocketManager } from "@discordjs/ws";
import { Mutex } from "async-mutex";
import { opus } from "prism-media";
import { channels, members, users } from "../commons/cache.js";
import cleanContent from "../commons/cleanContent.js";
import constructSpeakableMessage from "../commons/constructSpeakableMessage.js";
Expand Down Expand Up @@ -82,7 +83,11 @@ export default class Room {

const resource = new AudioResource(
[],
[Readable.fromWeb(await synthesizer.synthesis(content))],
[
Readable.fromWeb(await synthesizer.synthesis(content)).pipe(
new opus.OggDemuxer(),
),
],
{},
5,
);
Expand Down

0 comments on commit d5ff7cf

Please sign in to comment.