# Change Sample Rate to 16Khz

**URL:** <https://community.asterisk.org/t/change-sample-rate-to-16khz/73842>\
**Category:** Asterisk Support\
**Created:** [March 10, 2018, 9:32pm UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842 "2018-03-10T21:32:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Proper](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/proper/32/2825_2.png) [@Proper](https://community.asterisk.org/u/Proper)\
**Post date:** [March 10, 2018, 9:32pm UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/1 "2018-03-10T21:32:26Z")

</div>

I am using record function in asterisk AGI and saves output file has a sampling rate of 8k, I would like to get a higher rate at 16k.  
I understand that recording sampling rate reflects sampling rate of incoming audio and codec used but I lack understanding of how asterisk manages this and it may be the case of recording system downsampling the audio.

If you have ideas on how to get higher sampling rate implemented I will appreciate it.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [March 10, 2018, 11:20pm UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/2 "2018-03-10T23:20:54Z")

</div>

Select a 16kHz codec; most are 8kHz (e.g. alaw, mulaw and gsm are all 8kHz). Ensure that is used end to end on the call. Select the file type corresponding to that codec, for the recording.

---

<div class="post-metadata">

**Author:** ![Proper](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/proper/32/2825_2.png) [@Proper](https://community.asterisk.org/u/Proper)\
**Post date:** [March 11, 2018, 5:18am UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/3 "2018-03-11T05:18:46Z")

</div>

I guess this will only work if carrier supports higher the codec

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [March 11, 2018, 10:53am UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/4 "2018-03-11T10:53:46Z")

</div>

Which is unlikely, as the PSTN does not support them.

---

<div class="post-metadata">

**Author:** ![Pentium-5](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/pentium-5/32/1721_2.png) [@Pentium-5](https://community.asterisk.org/u/Pentium-5)\
**Post date:** [March 13, 2018, 7:44am UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/5 "2018-03-13T07:44:22Z")

</div>

G.722 samples at 16 kHz.  
However, it might not be supported by an ISP which would be a blocking factor if you are recording external calls.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [March 13, 2018, 8:43am UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/6 "2018-03-13T08:43:05Z")

</div>

Moreover any call that hits the PSTN is limited to 8kHz.

---

<div class="post-metadata">

**Author:** ![Proper](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/proper/32/2825_2.png) [@Proper](https://community.asterisk.org/u/Proper)\
**Post date:** [March 20, 2018, 12:44pm UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/7 "2018-03-20T12:44:28Z")

</div>

I was able to resample audio files to 16k using “sox rate 16k”

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [March 20, 2018, 4:22pm UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/8 "2018-03-20T16:22:00Z")

</div>

They will still be limited to about 3.4kHz bandwidth and the audio quality will be no better (probably very very slightly worse).

---

<div class="post-metadata">

**Author:** ![Proper](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/proper/32/2825_2.png) [@Proper](https://community.asterisk.org/u/Proper)\
**Post date:** [March 21, 2018, 3:39am UTC](https://community.asterisk.org/t/change-sample-rate-to-16khz/73842/9 "2018-03-21T03:39:03Z")

</div>

Sometimes you just need to end up with specific sample rate in the end so there is no need to resample in bulk later.

But I understand and agree that upsampling is not going to give anything, in terms of quality, what it does give is more of the same data by volume and sometimes that is what is needed.
