Ticket #78 (closed defect: worksforme)

Opened 12 years ago

Last modified 12 years ago

Noisy audio with upsampling in the conference bridge

Reported by: bennylp Owned by: bennyp
Priority: normal Milestone: release-0.5.10
Component: pjmedia Version: 0.5.9
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp) (diff)

There are two problems here:

  1. Problem with upsampling that introduces noise, and
  2. Problem with resampling/upsampling, specific when it's used in the conference bridge and only when two or more sources are mixed together.

For the first problem:

The following file was upsampled with pjsua, from the original WAV file of 22050 Hz to 44100 Hz. You can hear clearly about the noise:

http://www.pjsip.org/tmp/upsampling-noise.wav

For the second problem:

The following file was recorded by mixing two 16KHz sources and upsampled to 44.1KHz:

http://www.pjsip.org/tmp/conference_noise.wav

Change History

comment:1 Changed 12 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 12 years ago by bennylp

I identify so far the problem is related with the combination of clock_rate and ptime settings in the conference bridge. The resample algorithm is fine, because audio is playing fine with the resampleplay sample program.

So say for example, when clock_rate is 22050 and ptime is 10 msec (the default in pjsua_media.c), this gives samples_per_frame of 22050 * 10 / 1000 = 220.5, which is not a whole number! Setting the ptime to 20ms solved this for this particular clock_rate, but of course we'll still have this problem on 11025 clock rate.

Dunno yet what is the best solution for this, I guess temporarily we can use 20ms as the default ptime, and forbid users from using 11025 clock rate.

comment:3 Changed 12 years ago by bennylp

In r906: Changed PTIME in pjsua_media.c to 20ms (from 10ms).

comment:4 Changed 12 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to worksforme
  • Summary changed from Noisy audio with upsampling to Noisy audio with upsampling in the conference bridge

There is another problem, specific to when upsampling is done in conference bridge.

The conference uses the signal level of each sources as a parameter to the mixing algorithm. When the signal level changes significantly in the subsequent frame, this causes the subsequent frame to be misaligned with previous frame, and this would produce a noise.

This has been fixed in r931.

comment:5 Changed 12 years ago by bennylp

(Forgot the credit)

Thanks Norman Franke of myasd.com for reporting, analyzing, and suggesting potential fixes for this.

comment:6 Changed 12 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.