Closed johnrnelson closed 9 years ago
This could be due to wrong samplerate, maybe lame is outputting 44100KHz but you need 48000Khz.
You need to sample up or down your stream, there currently is no real stable library to do this, but you can use my wrapper for libsamplerate.
Is it fair to say that if the sample rate was wrong then it should be distorted on my speakers? This is my first real step in steaming so my ignorance might be the issue as well. :-)
Yes, for example:
Check how much channels you have and which samplerate your audio is.
I am no audio engineerer or physicist but this is what I figured out from my projects.
Yes I see. That makes sense. Per your suggestions, I tried changing a few settings on the decoder and think I have made progress.
Would adding to the project (manifest/json) the lame npm (or some other alternative) be out of the question? Working with mp3 files would certainly add to the overall value.
I'm having a ball working with this code.
I do not think this is needed, I would keep this in a seperate project.
I'm against adding lame as a dependency to node-mumble as well but we should certainly make sure it is easy to inter-operate the two libraries.
Perhaps adding to the examples folder a sample of playing a mp3 file to the current channel then?
As far as the issue is concerned; it looks closed. You have clearly shown me where the problem is and I do appreciate the schooling. :-)
@johnrnelson That sounds good :) I am not concerned about using node-samplerate though, it did not prove to be stable.
Improved the MumbleInputStreams to do resampling etc.
See: https://github.com/Rantanen/node-mumble/blob/master/examples/mp3.js
The resampling especially is very dirty sample duplication. Not the best quality but fast and it works.
@Prior99 If node-samplerate
is stable, feel free to replace the resampling in lib/util.js#resample
with your implementation.
@Rantanen Thanks for the new addition. Is the stdin on line 38 stream = process.stdin.pipe( decoder );
where you would read the file path for the mp3 file as in input = fs.createReadStream(FilePath); input.pipe(decoder)
Again, thanks for the code! :-)
Yeah. You can do that. Or just pipe it into the process with: node mp3 < file.mp3
I still get that same distortion. Seems to be at 1/4th the speed it should be. I'll try to pipe it but I'm afraid that will be just a band-aid as the overall solution will have multiple files that will, no doubtfully, come from fs.
Any chance you could share the mp3 file? I'm curious what it contains.
Sure. What is the best method? I've tried both music and audio books.
I've already forked the project but does not sound like the best method to share files. :-)
If the files you've used for testing are publicly available somewhere you could just link to them. If they aren't, you can always mail it with jubjub a jubjubnest net
@Rantanen I mainly want it to be a stream but I do not know about streams in node and currently do not have the time available working on it.
I am also not sure whether it supports any other platform than linux.
Also libsamplerate is GPL licensed so my wrapper had to be GPL also and is incompatible with our MIT license.
Ah, okay. Streaming on that level would be difficult as well as currently the processing is taking part on the frame-packet level where we only have 10ms buffer segments instead of streams.
Let's leave the quick solution in for now then. We can always implement proper resampling in JavaScript later. Also given we got lossy celt opus codec there, I'm not sure if the resampling artifacts are that noticeable.
okay
Perhaps open an issue for streaming if not now then for a later time?
I've put some files in my fork but network issues and smartgit are preventing me from pushing. Should be good by Monday though.
BTW: http://mumble-protocol.readthedocs.org/en/latest/voice_data.html#codecs was a good read for me.
Using lame npm assume the rough sudo code...
I hear the mp3 audio but it's very distorted. I checked the "lame" npm with "speaker" npm and can hear it just fine there so I am wondering if there is something special needed to fix the stream? Perhaps a connection option that I missing?