Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Source other than Mic results in distorted audio #57

Open
pboyd04 opened this issue May 17, 2020 · 3 comments
Open

Audio Source other than Mic results in distorted audio #57

pboyd04 opened this issue May 17, 2020 · 3 comments

Comments

@pboyd04
Copy link

pboyd04 commented May 17, 2020

I'm trying to take a PCM stream from another source and pipe it to Mumble. However, I get weird sort of sped up audio when I do this despite the fact that the audio is in 48kHz format. I've managed to get sample code pretty small:

WaveFileReader wfr = new WaveFileReader("c:\\temp\\mumble.wav");
byte[] data = new byte[wfr.Length];
wfr.Read(data, 0, data.Length);
protocol.LocalUser.Channel.SendVoice(new ArraySegment<byte>(data, 0, data.Length));
wfr.Close();

The source file is here: http://pboyd.org/mumble.wav
What it sounds like when I get it out of another mumble client is this: http://pboyd.org/result.wav

According to the data in the wav file it's PCM, 16-bit samples, 48000 Hz, and 1 channel which seems to match all the defaults in the Constants file. So what am I doing wrong?

@martindevans
Copy link
Owner

I'm not sure how mumble will handle trying to send a large amount of audio in a single packet - usually it's sent in small packets (960 samples at a time, or 20ms). It might be that causing the issue.

@pboyd04
Copy link
Author

pboyd04 commented May 20, 2020

If I try dividing it up into 20ms segments it doesn't help. Any other ideas?

@martindevans
Copy link
Owner

Possibly the file is in the wrong endianness. I'm not sure what byte order WaveFileReader provides or what Mumble needs, but it should be easy enough to just try swapping the 2 bytes in each 16 bit sample to see if it makes a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants