littledivy / deno_audio Goto Github PK
View Code? Open in Web Editor NEWAudio playback library for Deno
Audio playback library for Deno
In addition to passing filename it would be nice to have possibility use some kind of buffered data (for example Uint8Array) and may be stream.
Hey,
is there any way to modify the lib to play buffers instead of files?
Is there a way to grab internet streams with the library and also grab the metadata stored within those streams?
I am thinking about using this lib (which looks rad, by the way) with mod-player so I can have both efficient & small mods for music, and audio-files for sound effects (for like a game engine). Is there any interest in a PR for mod support? I could also see wrapping it with a separate deno module, but I feel like there might be some nice overlap if it were combined.
When we try to run the module in a macOS running in arm64 architecture:
deno run --allow-all --unstable index.ts
error: Uncaught (in promise) Error: Could not open library: Could not open library: dlopen(~/Library/Caches/deno/plug/https/github.com/f53f000ac09e54195c49f3ca7d32b3dcff62ed2a62e213f36a5a4e02875d7d7c.dylib, 0x0005): tried: '~/Library/Caches/deno/plug/https/github.com/f53f000ac09e54195c49f3ca7d32b3dcff62ed2a62e213f36a5a4e02875d7d7c.dylib'
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
return Deno.dlopen(file, symbols);
^
at new DynamicLibrary (deno:ext/ffi/00_ffi.js:274:39)
at Object.dlopen (deno:ext/ffi/00_ffi.js:368:12)
at prepare (https://deno.land/x/[email protected]/plug.ts:106:15)
at async https://deno.land/x/[email protected]/bindings/bindings.ts:28:14
Notice the error part: mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))
It would be really useful for me if I could stop a sound again after starting it. I am using this library to play music in the background, but between scenes the music needs to be changed to something else and that's impossible right now if I can't stop the one that's currently playing... Would there be a way to do this?
I tried to use your module with the latest deno version and stumbled upon the following error:
error: Uncaught (in promise) TypeError: Invalid FFI pointer type, expected null, integer or BigInt
await play("music.mp3");
This seems to be related to some type changes.
I could fix it by changing pointer
to buffer
here:
deno_audio/bindings/bindings.ts
Line 29 in ba12323
Trying my luck with this package...
I've installed the prerequisites. Then:
▶ deno_bindgen --release
Compiling proc-macro2 v1.0.76
Compiling unicode-ident v1.0.12
Compiling libc v0.2.152
Compiling serde v1.0.195
Compiling memchr v2.7.1
Compiling serde_json v1.0.111
Compiling pkg-config v0.3.28
Compiling thiserror v1.0.56
Compiling regex-syntax v0.8.2
Compiling quote v1.0.35
Compiling alsa-sys v0.3.1
Compiling syn v2.0.48
Compiling aho-corasick v1.1.2
Compiling nix v0.15.0
Compiling cfg-if v0.1.10
Compiling bitflags v1.3.2
Compiling void v1.0.2
Compiling syn v1.0.109
Compiling cc v1.0.83
Compiling regex-automata v0.4.3
Compiling minimp3-sys v0.3.2
Compiling lazy_static v1.4.0
Compiling cpal v0.12.1
Compiling ryu v1.0.16
Compiling tinyvec_macros v0.1.1
Compiling byteorder v1.5.0
Compiling itoa v1.0.10
Compiling tinyvec v1.6.0
Compiling ogg v0.8.0
Compiling regex v1.10.2
Compiling alsa v0.4.3
Compiling Inflector v0.11.4
Compiling slice-deque v0.3.0
Compiling lewton v0.10.2
Compiling hound v3.5.1
Compiling claxon v0.4.3
Compiling serde_derive v1.0.195
Compiling thiserror-impl v1.0.56
Compiling minimp3 v0.5.1
Compiling rodio v0.12.0
Compiling deno_bindgen_macro v0.5.1
Compiling deno_bindgen v0.5.1
Compiling deno_audio v0.1.0 (/home/me/deno_audio-main)
Finished release [optimized] target(s) in 10.75s
Initializing deno_audio
Error: Custom { kind: Other, error: "failed to load library: Could not obtain symbol from the library: /home/me/deno_audio-main/target/release/libdeno_audio.so: undefined symbol: init_deno_bindgen" }
Anything I might have forgotten?
Unfortunately searching init_deno_bindgen
on google returns zero result... Where does this come from?
Using the latest version (0.2.0) of deno_audio
, with a freshly installed rust, latest deno_bindgen_cli 0.1.0
, on Ubuntu 23.04
.
Examples
import { play, playSpatial } from '...';
await play('sound.mp3', { volume: 0.3 /* 30% volume */ });
await playSpatial('otherSound.mp3', {
soundPos: [1, 2, 3], // position of sound
pos: [1, 1, 1] // position of the user listening to the sound
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.