[pulseaudio-discuss] Sample format spec with Linear 16bit 16kHz

Georg Chini georg at chini.tk
Fri Feb 9 07:42:39 UTC 2018

On 09.02.2018 07:17, Shinnosuke Suzuki wrote:
> Sorry, I didn't change the Subject.
> Hi, Thank you for prompt reply.
> > Can't you use a newer version? We are at 11.1 already and the
> > bluetooth code has changed significantly.
> I hope to do so, but I am developing on a embedded system (linux 
> kernel 3.10.49 Openwrt).
> And I use BlueZ 5.30.
> If pulseaudio 11.1 doesn't depend on kernel version, I would like to 
> install pulseaudio 11.1.
> Does it any dependency on this?

PA 11.1 should work fine with your kernel and bluez version.

> > When you record from the BT headset, the BT headset is set to HSP/HFP.
> > This means that recording and playback stream are at 8kHz, not 16kHz.
> > Pulseaudio only supports CVSD codec, not mSBC.
> Thank you, I understand what codec pulseaudio uses.
> So pulseaudio convert codec like this?
>  My app <- Linear 16bit 16kHz <- Pulseaudio  <-  CVSD codec ( 8kHz?) 
> <- Bluetooth Headset
> My application want to use a Linear 16bit 16kHz because of a DSP spec.
> From your point out, Do I have to set a sample format to PA_SAMPLE_U8?
> If so, Do I have to convert voice packet which I get from callback 
> from 8kHz to 16kHz?
> I thought pulseaudio do this.

yes, PA will do the re-sampling.

> And I could get a voice data by 96byte per 10ms.
> If stream is 8kHz, What codec could get in My app? PCM 8bit?
> I couldn't understand why My app get 96byte per 10ms.

You should not expect to get a fixed number of bytes in a fixed time
interval. This is only true on average but not for a single callback. Are
the 96 bytes an average value?
If your application needs constant size data packets, you may have to
buffer some data.
Did you take a look at the pacat code to see how reading data from
a stream is done correctly?

> >resample-method=trivial might result in bad audio quality.
> I did set because CPU load is extremely high. I don't know why CPU 
> load is high.
> So CPU load becomes low, I'll change configuration file.

Did you test other resample methods? There are quite a few available
and "trivial" is definitely the worst of them.

More information about the pulseaudio-discuss mailing list