feross / feross/timidity

Can I use it in node environment.

オープン
#26 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Shell
スター
403
フォーク
44
PR マージ指標
30日以内にマージされた PR はありません

説明

I tried to run the demo code on readme using node. But I got the following errors.

```js
// timidity_example_1.js
const Timidity = require('timidity')

const player = new Timidity()
player.load('/my-file.mid')
player.play()

player.on('playing', () => {
console.log(player.duration) // => 351.521
})
```

```shell
D:\code\node\midi>node timidity_example_1.js
D:\code\node\midi\node_modules\timidity\index.js:32
this._baseUrl = new URL(baseUrl, window.location.origin).href
^

ReferenceError: window is not defined
at new Timidity (D:\code\node\midi\node_modules\timidity\index.js:32:38)
at Object. (D:\code\node\midi\timidity_example_1.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.12.1

D:\code\node\midi>
```

I noticed that the readme.

> **Play MIDI files in the browser w/ Web Audio, WebAssembly, and libtimidity**
> Play MIDI files in a browser with a simple API.

Is there any chances that it will support for running in node/deno?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。