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

Distortion in ULAW #123

Open
mdgarrett opened this issue Mar 23, 2015 · 5 comments
Open

Distortion in ULAW #123

mdgarrett opened this issue Mar 23, 2015 · 5 comments

Comments

@mdgarrett
Copy link

Getting distortion when playing back a ulaw encoded wav file. I initially did this using a websocket connection to a server in order to make use of being able to stream and begin playback relatively quickly before having a complete buffer and playing back using AV.Player.fromBuffer. This is a telephony recording and you can hear everything being said, but there is artifacting/distortion that can be heard that is not in original audio (slight popping, etc). I then switched to do AV.Player.fromURL and it is also present. Given ulaw is a very simple codec, I do not believe this is related to tickets I've seen dealing with FLAC/CPU usage, so was curious if this was an issue in general?

@mdgarrett
Copy link
Author

For what it is worth, tested ulaw decoding and piped to xaudiojs and it sounds fine, none of the distortions mentioned above are present.

@crackofdusk
Copy link
Member

@mdgarrett Which browser are you using? Is the sound distorted in other browsers?

@mdgarrett
Copy link
Author

Was using Chrome, didn't test in FF. Will do so, but likely won't be till tomorrow. That said, it was brought to my attention by a colleague for code we were collaborating on, and he is more FF. So know it was happening on different PCs and believe browsers.

@ikorchynskyi
Copy link

Confirmed, I've faced with this issue too. I've created a sample build to demonstrate an issue: https://github.com/ikorchynskyi/aurora-test/

ULAW file from /prompts played correctly in vlc, but in browser sound is distorted. Tested in:

$ google-chrome --version
Google Chrome 43.0.2357.132 
$ firefox --version
Mozilla Firefox 38.0

Would you please give some advice? Maybe, some custom filter can helps?

@ikorchynskyi
Copy link

After a deep investigation:

  1. Decoded by aurora buffer played by xaudiojs w/o noise.
  2. AudioContext.createScriptProcessor in aurora called with bufferSize = 4096, in xaudiojs with bufferSize = 2048.

bufferSize
This value controls how frequently the audioprocess event is dispatched and how many sample-frames need to be processed each call. Lower values for bufferSize will result in a lower (better) latency. Higher values will be necessary to avoid audio breakup and glitches. It is recommended for authors to not specify this buffer size and allow the implementation to pick a good buffer size to balance between latency and audio quality.

Increasing bufferSize to 8192 or decreasing it to 2048 (sic!) completely removes clucks from output.

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

3 participants