Closed phil-andrews closed 6 years ago
The published module seems to be extremely outdated, and is just a single ~100 line file.
Could the maintainers please publish what’s in Git? This looks like a great project, and I’d love to try it out.
@natesilva I am working hard on making MVP before release, I'll announce & publish once ready, for now please stay tuned and use github repo as a dependency - highly experimental and unstable!
I am also having the same issue and not sure how to work around with it. I want to use the .slice function
@daniamurad @phil-andrews use
let Audio = require('audio')
Audio.load('https://s3.amazonaws.com/philandrews/hardwell.mp3').then(audio => {
audio.trim().save()
})
@dfcreative I just tried and it says: Audio.load is not a function I used npm install audio .. but I dont know if it downloaded the completed library or not ..
@daniamurad please install npm i audiojs/audio
for now. It is not published in npm yet. Please also note that it is highly experimental now, release is coming soon.
I got this now ..
speaker
package was not found. Using audio-sink
instead.
And error: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: this.buffer.fill is not a function
@daniamurad simple wav loading/slicing test should work now:
Audio.load('./file.wav').then(audio => {
audio.slice(.5, 1)
audio.save('chunk.wav')
})
Unfortunately it cannot handle mp3 for now, figuring out the reason.
Thanks alot it is working for slicing the audio file.
However if I try to slice same audio file two times for two different duration and save as different names, I get the following error on the second one:
(node:22448) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'getChannelData' of undefined
Or sometimes:
(node:1244) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Use audio.read(...)
instead of audio.getChannelData(...)
@daniamurad ok, this should work with https://github.com/audiojs/audio/commit/d685ad8c80c62c3d8707be4756e96201caebfc4a
Audio.load(localWav).then(a => a.slice(0, 1).save('x.wav'))
Audio.load(localWav, (err, audio) => {
audio.slice(1, 2).save('y.wav')
})
Also I modified slice
method to make it immutable (return a new fragment), so you can also do
Audio.load(localWav, (err, a) => {
a.slice(1, 2).save('x.wav')
a.slice(2, 3).save('y.wav')
})
Thanks alot @dfcreative its working great !
@daniamurad my pleasure, glad it helped!
Error: newAudio.load is not a function
What am I missing here?