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

Shinnosuke Suzuki suzukisn at gmail.com
Fri Feb 9 06:17:32 UTC 2018


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?

> 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.
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.

>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.

Best Regards,
Shinnosuke Suzuki


Date: Thu, 8 Feb 2018 13:24:49 +0100
>
> From: Georg Chini <georg at chini.tk>
> To: General PulseAudio Discussion
>         <pulseaudio-discuss at lists.freedesktop.org>,  Shinnosuke Suzuki
>         <suzukisn at gmail.com>
> Subject: Re: [pulseaudio-discuss] Sample format spec with Linear 16bit
>         16kHz
> Message-ID: <3ba83b18-c006-bf24-7f84-7ebeac5fbba5 at chini.tk>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 08.02.2018 12:06, Shinnosuke Suzuki wrote:
> > Hi
> >
> > I am developing a phone app using pulseaudio 6.0 with asynchronous API
> > using Bluetooth Headset.
>
> Can't you use a newer version? We are at 11.1 already and the
> bluetooth code has changed significantly.
>
> >
> > I create a record stream with pa_stream_new() with this parameter.
> >  static pa_sample_spec samplespec = {
> >      .format = PA_SAMPLE_S16LE, /* Linear 16bit */
> >      .rate = 16000, /* 16000Hz */
> >      .channels = 1 /* mono */
> >  }
> > And I set a callback function by pa_stream_set_read_callback().
> > After the stream created, I could get a voice data by 96byte per 10ms
> > in this callback.I checked a log with clock_gettime() in this callback.
> >
> > I think I get voice packet by 320Byte per 10ms.
> > 16000Hz * 1 * 16bit = 256kbps = 32KBps
> > This means that I can get 320Byte per 10ms.
> > So I need to get 320Byte per 10ms.
> >
> > I set sample format above, but I got different voice packet from
callback.
> > I would like to get a voice with Linear 16bit 16kHz mono.
> > Is there additional configuration to this codec?
> >
> > For confirmation, when I use a bluetooth headset, Is this correct the
> > pulseaudio convert codec from SBC to Linear as follows?
> > My app <- Linear 16bit 16kHz <- Pulseaudio  <- SBC codec <- Bluetooth
> > Headset
>
> 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.
>
> >
> > And addition to that, After stream connected, CPU load for pulseaudio
> > rose up 50%-60%.CPU load for MyAPP rose up 20%-30%.
> > In order to reduce CPU load, I conigure as follows:
> >  high-priority = no
> >  realtime-scheduling = no
> >  resample-method=trivial
> >
> resample-method=trivial might result in bad audio quality.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180209/9f4212d5/attachment-0001.html>


More information about the pulseaudio-discuss mailing list