<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi<br class=""><div><br class=""></div><div><blockquote type="cite" class="">PA 11.1 should work fine with your kernel and bluez version.<br class=""></blockquote><br class=""></div><div>Thank you, I’ll try that.</div><div><br class=""></div><div><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">When you record from the BT headset, the BT headset is set to HSP/HFP.<br class="">This means that recording and playback stream are at 8kHz, not 16kHz.<br class=""></blockquote></blockquote></blockquote></div><div><br class=""></div><div>I want to handle voice packet as <span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">Linear 16bit little endian 16000Hz,</span></div><div>I configure stream as follows.</div><div><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""> static pa_sample_spec samplespec = {
     .format = PA_SAMPLE_S16LE, /* Linear 16bit */
     .rate = 16000, /* 16000Hz */
     .channels = 1 /* mono */
 }</pre><div class="">Does it means .rate should be 8000?</div><div class=""><br class=""></div></div><div><blockquote type="cite" class="">You should not expect to get a fixed number of bytes in a fixed time<br class="">interval. This is only true on average but not for a single callback. Are<br class="">the 96 bytes an average value?<br class="">If your application needs constant size data packets, you may have to<br class="">buffer some data.<br class="">Did you take a look at the pacat code to see how reading data from<br class="">a stream is done correctly?<br class=""></blockquote><br class=""></div><div>I don’t expect fixed number of bytes. So, I implemented to  buffer voice packets in read callback.</div><div>However I got voice packet on my callback at 96 bytes per 10ms constantly.</div><div>It means I couldn’t get sufficient voice packet because voice packet needs </div><div>at least 320bytes per 10ms in case of <span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">Linear 16bit little endian 16000Hz</span>.</div><div><br class=""></div><div>I read pacat how to handle voice packet in read callback.</div><div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class="">I implemented like pacat except silence hole using pa_silence_memory().</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><blockquote type="cite" style="font-family: Helvetica;" class="">Did you test other resample methods? There are quite a few available<br class="">and "trivial" is definitely the worst of them.<br class=""></blockquote><div class=""><br class=""></div><div class="">No I didn’t. I’ll change the coniguration.</div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class="">Best Regards,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: "Helvetica Neue"; color: rgb(69, 69, 69);" class="">Shinnosuke Suzuki.</div></div><div><blockquote type="cite" class=""><div class="">Date: Fri, 9 Feb 2018 08:42:39 +0100</div><div class=""><div class="">From: Georg Chini <<a href="mailto:georg@chini.tk" class="">georg@chini.tk</a>><br class="">To: General PulseAudio Discussion<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><<a href="mailto:pulseaudio-discuss@lists.freedesktop.org" class="">pulseaudio-discuss@lists.freedesktop.org</a>>,  Shinnosuke Suzuki<br class=""><span class="Apple-tab-span" style="white-space:pre">       </span><<a href="mailto:suzukisn@gmail.com" class="">suzukisn@gmail.com</a>><br class="">Subject: Re: [pulseaudio-discuss] Sample format spec with Linear 16bit<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>16kHz<br class="">Message-ID: <<a href="mailto:c16ab184-45a0-9401-523d-009d1e9dd33f@chini.tk" class="">c16ab184-45a0-9401-523d-009d1e9dd33f@chini.tk</a>><br class="">Content-Type: text/plain; charset=utf-8; format=flowed<br class=""><br class="">On 09.02.2018 07:17, Shinnosuke Suzuki wrote:<br class=""><blockquote type="cite" class="">Sorry, I didn't change the Subject.<br class=""><br class="">Hi, Thank you for prompt reply.<br class=""><br class=""><blockquote type="cite" class="">Can't you use a newer version? We are at 11.1 already and the<br class="">bluetooth code has changed significantly.<br class=""></blockquote><br class="">I hope to do so, but I am developing on a embedded system (linux <br class="">kernel 3.10.49 Openwrt).<br class="">And I use BlueZ 5.30.<br class="">If pulseaudio 11.1 doesn't depend on kernel version, I would like to <br class="">install pulseaudio 11.1.<br class="">Does it any dependency on this?<br class=""></blockquote><br class="">PA 11.1 should work fine with your kernel and bluez version.<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">When you record from the BT headset, the BT headset is set to HSP/HFP.<br class="">This means that recording and playback stream are at 8kHz, not 16kHz.<br class="">Pulseaudio only supports CVSD codec, not mSBC.<br class=""></blockquote><br class="">Thank you, I understand what codec pulseaudio uses.<br class="">So pulseaudio convert codec like this?<br class=""> My app <- Linear 16bit 16kHz <- Pulseaudio  <-  CVSD codec ( 8kHz?) <br class=""><- Bluetooth Headset<br class="">My application want to use a Linear 16bit 16kHz because of a DSP spec.<br class="">From your point out, Do I have to set a sample format to PA_SAMPLE_U8?<br class="">If so, Do I have to convert voice packet which I get from callback <br class="">from 8kHz to 16kHz?<br class="">I thought pulseaudio do this.<br class=""></blockquote><br class="">yes, PA will do the re-sampling.<br class=""><br class=""><blockquote type="cite" class="">And I could get a voice data by 96byte per 10ms.<br class="">If stream is 8kHz, What codec could get in My app? PCM 8bit?<br class="">I couldn't understand why My app get 96byte per 10ms.<br class=""></blockquote><br class="">You should not expect to get a fixed number of bytes in a fixed time<br class="">interval. This is only true on average but not for a single callback. Are<br class="">the 96 bytes an average value?<br class="">If your application needs constant size data packets, you may have to<br class="">buffer some data.<br class="">Did you take a look at the pacat code to see how reading data from<br class="">a stream is done correctly?<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">resample-method=trivial might result in bad audio quality.<br class=""></blockquote>I did set because CPU load is extremely high. I don't know why CPU <br class="">load is high.<br class="">So CPU load becomes low, I'll change configuration file.<br class=""></blockquote><br class="">Did you test other resample methods? There are quite a few available<br class="">and "trivial" is definitely the worst of them.<br class=""></div></div></blockquote><br class=""></div><br class=""></body></html>