Comments (11)
@roccomuso does bpm.js work with your createAudioStream()
function?
Please post a stack trace of the error you're getting.
from sox-stream.
@ArtskydJ it works with the createAudioStream()
function.
The code I'm trying to execute is this:
var sox = require('sox-stream')
var fs = require('fs')
var src = fs.createReadStream('hellberg.mp3')
var transcode = sox({
input: {
type: 'mp3',
encoding: 'float',
rate: 44100,
channels: 1
},
output: {
type: 'mp3'
}
})
src.pipe(transcode)
and returns this error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: sox WARN formats: can't set 1 channels; using 2
at Socket.<anonymous> (/tmp/hello/node_modules/sox-stream/index.js:33:23)
Changing channel to 2 apparently i got a valid stream.
But when piped to bpm.js
after a while you get this:
/tmp/bpm.js/index.js:0
RangeError: Index out of range
at checkOffset (buffer.js:830:11)
at Buffer.readFloatLE (buffer.js:1007:5)
at bufRead (/tmp/bpm.js/index.js:129:14)
at DestroyableTransform.write [as _transform] (/tmp/bpm.js/index.js:148:15)
at DestroyableTransform.Transform._read (/tmp/bpm.js/node_modules/readable-stream/lib/_stream_transform.js:182:10)
at DestroyableTransform.Transform._write (/tmp/bpm.js/node_modules/readable-stream/lib/_stream_transform.js:170:83)
at doWrite (/tmp/bpm.js/node_modules/readable-stream/lib/_stream_writable.js:406:64)
at writeOrBuffer (/tmp/bpm.js/node_modules/readable-stream/lib/_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (/tmp/bpm.js/node_modules/readable-stream/lib/_stream_writable.js:322:11)
at Stream.ondata (stream.js:31:26)
from sox-stream.
If you use sox-stream with 2 channels, and pipe it to fs.createWriteStream('mynewfile.mp3')
, and then run your bpm code with fs.createReadStream('mynewfile.mp3')
, then does bpm.js accept it?
My guess is that sox doesn't like mono audio, and bpm.js doesn't like stereo?
from sox-stream.
@roccomuso since I haven't heard from you, I'm gonna close this issue. @ reply if you have any questions.
from sox-stream.
Sorry, 've been busy lately.
I did what you said. bpm.js
keeps saying "Range Error: Index out of range".
NB. mynewfile.mp3
is 725159 bytes. The original mp3 is 725240. We have 81 bytes of difference.
from sox-stream.
With the original sox
from CLI (using this cmd: sox wave.mp3 -t raw -r 44100 -e float -c 2 out.mp3
), the output file size is: 15980544.
With the cli tool I'm also able to set -c 1, with sox-stream it throws: Error: sox WARN formats: can't set 1 channels; using 2
from sox-stream.
I looked at bpm.js
code, and this line return arr.readFloatLE(i*4);
appears to be erroring.
Maybe run the mp3 through sox-stream
, and then write it to the file system. Then read it from the file system and pipe it through bpm.js
? If that works, then it is an issue with the interface of sox-stream and bpm.js aren't compatible. (Which would be weird since they're both streams.) But if that's the case, you might just want to use sox.js
instead of sox-stream
.
from sox-stream.
It's exactly what i did Range Error: Index out of range
.
It's some other issue.
from sox-stream.
So if you run the file through sox using the command line using the same options you used with sox-stream
, and then you read the file using bpm.js, are you getting the Range Error: Index out of range
error then too?
Maybe try an assortment of mp3s?
from sox-stream.
yes. I should try with different mp3..
from sox-stream.
Closing since this has been inactive for over half of a year. Reply or re-open if this is still an issue.
from sox-stream.
Related Issues (20)
- VBR on MP3 files HOT 2
- Breaks with newer versions of node HOT 1
- spawn sox ENOENT HOT 9
- Error: sox WARN mp3-util HOT 5
- Problem with MP3 files in OSX HOT 3
- Why write to temp file? HOT 3
- Pipe to on data HOT 3
- Segmentation fault in sox results in a zero-byte stream.
- Error: write EPIPE on use of trim effect HOT 2
- sox-stream does not work with file descriptor HOT 1
- replay-gain is required in typescript, but should not be HOT 1
- How create realtime reading stream ? HOT 1
- Streams & Pipe resulting in ENOENT HOT 5
- sox FAIL formats: no handler for detected file type `opus' HOT 1
- How to pass additional parameter (ex. the "-s" for "sox tempo -s 0.5") HOT 5
- A readme probable fix
- sox: invalid option -- - HOT 11
- How to connect additional output streams? HOT 2
- Empty file HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sox-stream.