I agree with other replies that a 4 kHz sample rate will only capture 2 kHz of the voice spectrum which will result in loss of key sounds, or aliasing that will distort the sound even without any compression/decompression happening.
"But conversion time to compress 20 ms frame is around 60 ms if I want to use 3200kbps CODEC"
First thing to do is to make sure your 60 ms number is correct and a real limit.
How are you obtaining the audio samples? I presume the SAADC on the nRF52. Is that causing any delay other than copying a buffer? Can you use DMA to copy the buffer rather than memcpy()?
If you are truly limited by CPU cycles, then consider your choice of codec variant. The 3200 kbps codec will sound better than the 1600 kbps, but the lower bit rate codecs throw away bits that have lesser significance so your CPU will have less number crunching (maths) to do.
Lastly, your CPU has SIMD instructions that could really increase your computational power if you have the expertise and time to commit to re-coding all the maths.
Hi Glen,
My hardware bottleneck is for low speed . I am using nRF52 which is a CortexM4 microcontroller with 64MHz clock speed and 64 KB of RAM . The problem is if I use 8KHz sampling rate the frame size is 20 ms for 160 samples ( 3200 kbps) . But conversion time to compress 20 ms frame is around 60 ms if I want to use 3200kbps CODEC . So I am missing 3 frames for each compression . So I am using 4 KHz sampling rate because 4KHz sampling rate would give me 40ms frame for 160 samples .
kind regards
Anomadarshi
Nice one Jereon.
Anomadarshi,
where is your hardware bottleneck- why the sample rate limit- help us understand .
I thought that if you had a hardware bit rate limit, then going for 8 kHz sampling and 8 bit samples would be the same information rate as 4 Khz sampling and 16 bit samples.
As Jereon says, you will need to format to suit the buffers and structs.
regards
Post by Anomadarshi Barua ShuvroHi,
Thank you very much...You guys are doing really fantastic jobs..
kind regards
Anomadarshi
Hi Anomadarshi,
Post by Anomadarshi Barua ShuvroHi Glen,
Thank you very much for your reply . I have few confusions. If I would
use 8bit resolution per sample , then I would need to change line 3 in
the following piece of code , right ? If I would change line 3 to buf
= (char*)malloc(nsam*sizeof(char)) , will it work ? I mean do I need
to change anything inside of the codec ?
No, that won't work.
The codec expects a buffer of shorts. So even if you sample only bytes
you would still have to convert them to shorts.
void codec2_encode(struct CODEC2 *codec2_state, unsigned char * bits,
short speech_in[]);
It has not changed by your change.
Regards,
Jeroen
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports.
https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2