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

Shinnosuke Suzuki suzukisn at gmail.com
Wed Feb 14 07:29:11 UTC 2018


Hi

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

Although it maybe depend on CPU, Is there any recommend setting for
resampling-method?
Could you tell me a character for each parameters in resampling-method?


> Sorry, currently I have no idea what goes wrong. The number of 96 bytes /
> 10ms
> sounds weird and does not match any of the involved sample rates / formats.
> Is your code available somewhere so that I can take a look?
>

I attached source code to control pulseaudio.Could you take a look my code?
start function
 usbbtf_hs_start()
read callback
 usbbtf_hs_stream_read_cb()

I got 96bytes voice data as a parameter of usbbtf_hs_stream_read_cb().
So I didn't have a clue to find any hint on this code.

Is there any sample code for implement to control pulseaudio?
Is it possibly code for parec and another command for pulseaudio?
I refered to Linux Sound Programming.

Best Regards,
Shinnosuke Suzuki
2018-02-11 6:12 GMT+09:00 Georg Chini <georg at chini.tk>:

> On 10.02.2018 02:11, Shinnosuke Suzuki wrote:
>
> Hi
>
> PA 11.1 should work fine with your kernel and bluez version.
>
>
> Thank you, I’ll try that.
>
> 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.
>
>
> I want to handle voice packet as Linear 16bit little endian 16000Hz,
> I configure stream as follows.
>
>  static pa_sample_spec samplespec = {
>      .format = PA_SAMPLE_S16LE, /* Linear 16bit */
>      .rate = 16000, /* 16000Hz */
>      .channels = 1 /* mono */
>  }
>
> Does it means .rate should be 8000?
>
>
> It should work if you specify 16kHz because PA will do the resampling.
> But I would try with 8kHz, just to see if something changes.
> Did you try another source? Does parecord work with your headset?
>
>
> 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?
>
>
> I don’t expect fixed number of bytes. So, I implemented to  buffer voice
> packets in read callback.
> However I got voice packet on my callback at 96 bytes per 10ms constantly.
> It means I couldn’t get sufficient voice packet because voice packet needs
> at least 320bytes per 10ms in case of Linear 16bit little endian 16000Hz.
>
> I read pacat how to handle voice packet in read callback.
> I implemented like pacat except silence hole using pa_silence_memory().
>
>
> Sorry, currently I have no idea what goes wrong. The number of 96 bytes /
> 10ms
> sounds weird and does not match any of the involved sample rates / formats.
> Is your code available somewhere so that I can take a look?
>


-- 
--
Shinnosuke Suzuki
E-mail : suzukisn at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180214/6d24c1ef/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pulse.c
Type: text/x-csrc
Size: 9117 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20180214/6d24c1ef/attachment-0001.c>


More information about the pulseaudio-discuss mailing list