<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98335/nrf5340-audio-audio-frame-duration</link><description>My project base on NCS V2.2.0.BIS mode,gateway 
 
 My &amp;quot;AUDIO FRAME DURATION&amp;quot; is 10ms.But my audio source is not i2s or usb. 
 My audio come from uart,1M bit/s.It will take 2-3ms. 
 
 and Lc3 encode take 5-6 ms.then time is not enough. 
 
 Can I modify</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Apr 2023 12:05:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98335/nrf5340-audio-audio-frame-duration" /><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/421016?ContentTypeID=1</link><pubDate>Tue, 18 Apr 2023 12:05:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d726a98-db7c-437f-8a65-5e3a3173f6dc</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="huniu"]1.You are right,I fixed this.Now is not a problem.[/quote]
&lt;p&gt;Great, I am happy to hear that! :)&amp;nbsp;&lt;/p&gt;
[quote user="huniu"]2.I still confuse.Can BIS mode suport 44.1K biterate.My hardware only suport 44.1K biterate,So I need LC3 suprot 44.1K,but seems like LC3 not suport 44.1K in project NRF5340 Audio.[/quote]
&lt;p&gt;This is correct - there is unfortunately no support for 44.1 kHz in the nRF5340 Audio reference application as of now.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/420681?ContentTypeID=1</link><pubDate>Mon, 17 Apr 2023 08:12:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d8df1d3-44ef-4daf-bb05-8929763c5579</guid><dc:creator>huniu</dc:creator><description>&lt;p&gt;1.You are right,I fixed this.Now is not a problem.&lt;/p&gt;
&lt;p&gt;2.I still confuse.Can BIS mode suport 44.1K biterate.My hardware only suport 44.1K biterate,So I need LC3 suprot 44.1K,but seems like LC3 not suport 44.1K in project NRF5340 Audio.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/420504?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 12:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3aada85-15f8-4e22-a1a9-5d11e6457100</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;1. That is not an accurate way to measure the execution time, since the nRF Connect SDK is build on the Zephyr RTOS, and this process runs as a thread - i.e it may be interrupted so long as it fulfills its real-time constraints. The way you are measuring it indicates that it is blocking, but this is not the case - other tasks and threads can run inbetween, depending on their priority.&lt;br /&gt;&lt;br /&gt;You could instead use &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.99-dev1/zephyr/reference/kernel/threads/index.html#runtime-statistics"&gt;runtime statistics if you want to know what percent of the CPU is being used by a specific thread&lt;/a&gt;, for instance.&lt;br /&gt;&lt;br /&gt;2. Thank you for clarifying.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/420500?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 12:22:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:843e92e8-25d5-4824-89c9-b1651995c5d7</guid><dc:creator>huniu</dc:creator><description>&lt;p&gt;1.&lt;pre class="ui-code" data-mode="text"&gt;static void encoder_thread(void *arg1, void *arg2, void *arg3)
{
	int ret;
	uint32_t blocks_alloced_num;
	uint32_t blocks_locked_num;

	int debug_trans_count = 0;
	size_t encoded_data_size = 0;

	void *tmp_pcm_raw_data[CONFIG_FIFO_FRAME_SPLIT_NUM];
	char pcm_raw_data[FRAME_SIZE_BYTES];

	static uint8_t *encoded_data;
	static size_t pcm_block_size;
	static uint32_t test_tone_finite_pos;

	while (1) {
		/* Get PCM data from I2S */
		/* Since one audio frame is divided into a number of
		 * blocks, we need to fetch the pointers to all of these
		 * blocks before copying it to a continuous area of memory
		 * before sending it to the encoder
		 */
		for (int i = 0; i &amp;lt; CONFIG_FIFO_FRAME_SPLIT_NUM; i++) {
			ret = data_fifo_pointer_last_filled_get(&amp;amp;fifo_rx, &amp;amp;tmp_pcm_raw_data[i],
								&amp;amp;pcm_block_size, K_FOREVER);
			ERR_CHK(ret);
			memcpy(pcm_raw_data + (i * BLOCK_SIZE_BYTES), tmp_pcm_raw_data[i],
			       pcm_block_size);

			data_fifo_block_free(&amp;amp;fifo_rx, &amp;amp;tmp_pcm_raw_data[i]);
		}
		IO_invert();
		if (sw_codec_cfg.encoder.enabled) {
			if (test_tone_size) {
				/* Test tone takes over audio stream */
				uint32_t num_bytes;
				char tmp[FRAME_SIZE_BYTES / 2];

				ret = contin_array_create(tmp, FRAME_SIZE_BYTES / 2, test_tone_buf,
							  test_tone_size, &amp;amp;test_tone_finite_pos);
				ERR_CHK(ret);

				ret = pscm_copy_pad(tmp, FRAME_SIZE_BYTES / 2,
						    CONFIG_AUDIO_BIT_DEPTH_BITS, pcm_raw_data,
						    &amp;amp;num_bytes);
				ERR_CHK(ret);
			}

			ret = sw_codec_encode(pcm_raw_data, FRAME_SIZE_BYTES, &amp;amp;encoded_data,
					      &amp;amp;encoded_data_size);

			ERR_CHK_MSG(ret, &amp;quot;Encode failed&amp;quot;);
		}

		/* Print block usage */
		if (debug_trans_count == DEBUG_INTERVAL_NUM) {
			ret = data_fifo_num_used_get(&amp;amp;fifo_rx, &amp;amp;blocks_alloced_num,
						     &amp;amp;blocks_locked_num);
			ERR_CHK(ret);
			LOG_DBG(COLOR_CYAN &amp;quot;RX alloced: %d, locked: %d&amp;quot; COLOR_RESET,
				blocks_alloced_num, blocks_locked_num);
			debug_trans_count = 0;
		} else {
			debug_trans_count++;
		}

		if (sw_codec_cfg.encoder.enabled) {
			/* Send encoded data over IPM */
			streamctrl_encoded_data_send(encoded_data, encoded_data_size);
		}
		IO_invert();
		STACK_USAGE_PRINT(&amp;quot;encoder_thread&amp;quot;, &amp;amp;encoder_thread_data);
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;line 33 and line 72.IO&amp;nbsp;&lt;span&gt;invert,take about 6ms&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1680251312529v3.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.I mean&amp;nbsp;hardware codec.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/420483?ContentTypeID=1</link><pubDate>Fri, 14 Apr 2023 11:52:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f1b6cbe-c11a-4f59-b80f-73c7f5264a18</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Thank you for elaborating.&lt;/p&gt;
[quote user="huniu"]2.LC3 encode need 6ms,I invert IO in &amp;quot;encoder_thread&amp;quot;,it takes about 6ms.Then I have no time do my own work,such as another encode.[/quote]
&lt;p&gt;I am not sure that I understand what you mean when you say &amp;#39;I invert IO in &amp;#39;encoder_thread&amp;#39;&amp;#39;, could you clarify?&lt;br /&gt;The rule of thumb is that using the provided LC3 implementation it will require roughly 30% of the CPU time to encode a 96 kbps stream (at 48 kHz sampling), and roughly 15% to decode the same stream. So, if you are only encoding 1 or 2 streams you should still have ample time to do your own application work.&lt;/p&gt;
[quote user="huniu"]3.My codec only suport 44.1K,So I need 44.1K.[/quote]
&lt;p&gt;To be specific, is this a hardware codec you are referring to, or a software codec (like the LC3, or an equivalent)?&lt;br /&gt;In case of the latter please note that you must have the LC3 as the primary codec on your device if you intend to qualify as a LE Audio product (you are allowed to have proprietary secondary codecs in addition to the LC3, of course).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/420065?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2023 02:34:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:884b2510-df78-434d-a89d-1c0ba4172c58</guid><dc:creator>huniu</dc:creator><description>&lt;p&gt;1.Yes,My audio from uart.&lt;/p&gt;
&lt;p&gt;2.LC3 encode need 6ms,I invert IO in &amp;quot;encoder_thread&amp;quot;,it takes about 6ms.Then I have no time do my own work,such as another encode.&lt;/p&gt;
&lt;p&gt;3.My codec only suport 44.1K,So I need 44.1K.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/419928?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2023 11:20:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01bbf9e1-37ea-4291-9185-e8ae569d73ea</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="huniu"]Can I low down the i2s bitrate to 44.1K?[/quote]
&lt;p&gt;We currently do not have support for 44.1 kHz sampling frequency, no.&lt;br /&gt;Is there a particular reason why you would like to use 44.1kHz instead of 48?&lt;br /&gt;&lt;br /&gt;Please also see the question from my colleague Øyvind about elaborating on your requirements and constraints so that we may better be able to help you.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/419339?ContentTypeID=1</link><pubDate>Thu, 06 Apr 2023 03:06:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaaadfd0-aa4e-4cf4-a65e-3a8a75faf7d9</guid><dc:creator>huniu</dc:creator><description>&lt;p&gt;Can I low down the i2s bitrate to 44.1K?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/418939?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2023 06:56:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:336b42bc-51a7-43ae-b074-baf5d3cac320</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello again,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Here is the initial answers from our audio team:&lt;/p&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;em&gt;No, the audio frame duration is highly related with&lt;/em&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;The synchronization and drift compensation mechanism in audio_datapath module&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;The frame size setting for LC3 ENC/DEC&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;I2S sampling number&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;&lt;em&gt;And it is very strange that the customer needs 5~6ms for encoding the data.&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;There way to reduce the LC3 encoded time is to low down the bitrate.&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;But it is still hard to understand what would the customer want to achieve, seems the audio is not from I2S but from UART.&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;em&gt;In addition: The audio frame duration is set by the LE Audio standards. It is not user adjustable. (It is possible to choose other codecs and other frame sizes, but that is a proprietary extension and out side the specs. For a qualifiable solution, the standardized frame size must be supported.)&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div&gt;Would it be possible for you to share more&amp;nbsp;details of what you are trying to achieve? Our audio team&amp;nbsp;would like to assist, however, more details are needed.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 AUDIO ,AUDIO FRAME DURATION</title><link>https://devzone.nordicsemi.com/thread/418621?ContentTypeID=1</link><pubDate>Fri, 31 Mar 2023 13:30:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b33e08fd-28a7-4246-bbc6-2be4c254d2a0</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello, I have forwarded the question to our audio team and will get back to you on Tuesday. &lt;br /&gt;&lt;br /&gt;Note that due to Easter holidays we will have less staffing in the coming week, and some delays in answers must be expected.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>