<?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>Thingy audio streaming</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29425/thingy-audio-streaming</link><description>Hello, 
 I&amp;#39;m playing with two thingy and I&amp;#39;m trying to make a sort of walkie talkie with them. 
 I wrote the code for the sound service client, then modified other parts for making them scanning, connecting and discovering services, exchange mtu, and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 24 Mar 2018 15:31:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29425/thingy-audio-streaming" /><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/125848?ContentTypeID=1</link><pubDate>Sat, 24 Mar 2018 15:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d2ece77-5f06-445a-a188-46d75c8cad2a</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;Here we are, the source code of the ThingyTalkie project is available here:&amp;nbsp;&lt;a href="https://github.com/dgiovanelli/ThingyTalkie"&gt;https://github.com/dgiovanelli/ThingyTalkie&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To see what I changed/added just look at the last commit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/123931?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 13:16:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df3e8e9f-8c79-409b-9820-0785d2da4e5a</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;Hello Norin,&lt;/p&gt;
&lt;p&gt;sorry but you have to be patient for having the full code. Now it works but before sharing it I want to clean a bit the code. Within a week (but probably less) I will create a github project and I&amp;#39;ll share the link&amp;nbsp;in this conversation.&lt;/p&gt;
&lt;p&gt;The links and code I used as example for developing my code are those posted by Nordic guys in this conversation.&lt;/p&gt;
&lt;p&gt;Stay tuned!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/123879?ContentTypeID=1</link><pubDate>Mon, 12 Mar 2018 10:53:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f35d29cb-1589-4f0f-86cf-ae2f946bec00</guid><dc:creator>norin saiyed</dc:creator><description>&lt;p&gt;Hello davide. Can you provide some useful links and reference code?? As i am also working on similar kind of an application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/123364?ContentTypeID=1</link><pubDate>Thu, 08 Mar 2018 08:45:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bd56c1b-c8fd-4520-a486-9dbcef010a30</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;I reply myself because I did progress in the work and I&amp;nbsp;have understood some thing that were actually not clear.&lt;/p&gt;
&lt;p&gt;The Thingy can play 8bit PCM data at 8kHz. Although the mic outputs PDM data (1032kHz) the PDM interface of the nrf52834 includes a bandpass and decimation block which converts PDM@1032kHz to PCM 16bit@16.125kHz (data is downsampled by a factor of 64). Then to play the mic data into the speaker a further conversion from PCM 16kHz-16bit to PCM 8kHz-8bit is necessary.&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t realize the PDM interface includes the PDM-to-PCM decimation filter and that&amp;#39;s was the main reason of all my doubts.&lt;/p&gt;
&lt;p&gt;Now I manage to obtain some audio streamed between the two thingys, but it is still quite distorted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/120301?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 14:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e91fc1ce-282f-4afe-b3ff-e911a7f574e7</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;When it will work I&amp;#39;ll share it. I manage to stream something but it&amp;nbsp;is just noise, I have to dig deeper on how data is acquired/converted/compressed because for now I just have the speaker that play intermittent noise...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/120298?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 14:26:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9557550f-b3b2-4efb-8f07-2f1b2757b17f</guid><dc:creator>redsun</dc:creator><description>&lt;p&gt;Hello. Davide. Can you provide source code of your project, if it is not closed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117035?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 14:17:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6838ce20-34a5-4dcb-9864-c8fb69589e17</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Thanks. There was a typo, yes. :) Good that you still understood what I was trying to write.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117036?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 11:32:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51298fc3-dace-47ba-a3d9-d9496d3889f9</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;Ok, now it is clear, the mic driver outputs PCM data and not PDM.&lt;/p&gt;
&lt;p&gt;(I think there is a typo in your answer since it is quite difficult to output 8-bit pcm data with the mic, you probably intended to say &amp;quot;speaker&amp;quot;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117034?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 09:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2eff93c7-8e45-4e46-a5c7-1d5900fd4458</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Hi Davide, yes you are correct. Comparing the &lt;a href="http://www.cs.columbia.edu/%7Egskc/Code/AdvancedInternetServices/SoundNoiseRatio/dvi_adpcm.c"&gt;second link&lt;/a&gt; I sent you to the dvi_adpcm.c file in the Thingy_sdk_v2.1.0 shows that the two files are very similar (some small differences). Talked to an expert here at Nordic: the Thingy microphone uses ADPCM. The Thingy speaker uses 8-bit PCM.&lt;/p&gt;
&lt;p&gt;Two small examples to clarify: when you stream music from a smartphone to the Thingy:52 using the Thingy app, the smartphone mic picks up 16-bit PCM. This 16-bit PCM is converted to 8-bit PCM in the Thingy app &amp;amp; then sent to the Thingy &lt;strong&gt;speaker&lt;/strong&gt;, which outputs 8-bit PCM.&lt;/p&gt;
&lt;p&gt;Conversely, the Thingy mic uses ADPCM, which is then sent over to the smartphone. The Thingy app then decodes the ADPCM into 16-bit PCM, which is sent to the smartphone speaker.&lt;/p&gt;
&lt;p&gt;So to answer your question, the &lt;code&gt;drv_mic.c&lt;/code&gt; file is encoded in ADPCM. Since no encoding &amp;amp; decoding is done inside the Thingy device, it might be helpful for you to check out the Android or iOS Thingy app and look for the decoder function from ADPCM to PCM (&lt;a href="https://github.com/NordicSemiconductor/IOS-Nordic-Thingy/blob/develop/IOSThingyLibrary/Classes/Services/SoundService/ThingySoundService.swift"&gt;see the decodeADPCM() function&lt;/a&gt; in iOS for example).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117033?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 08:52:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:232a69de-265d-49c4-9a62-3dbe4e3ae093</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;Sorry Bjørn, I have a further question. The second link you passed me seems to be the starting point for the audio driver of the thingy firmware right? If so I have a doubt, the code at that link provides the routines for converting from PCM to ADPCM and vice versa, instead inside the drv_mic.c it seems that the routine is applied to PDM data.&lt;/p&gt;
&lt;p&gt;Now I&amp;#39;m a little bit confused, is the data in pdm_buf_t (drv_mic.c) encoded in PDM or PCM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117032?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 07:10:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdd6f545-25a0-4c75-9e73-d2d54e32d306</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;No worries. Good luck!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117037?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 15:43:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6436560-133d-46db-8486-87b114e36dbd</guid><dc:creator>Davide</dc:creator><description>&lt;p&gt;Super! Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Thingy audio streaming</title><link>https://devzone.nordicsemi.com/thread/117031?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 14:45:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f40d4d6-11ec-42d8-8c26-353c1114950c</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Talked to a few experts here at Nordic: you should use an ADPCM decoder, yes. You can take a look at &lt;a href="https://github.com/NordicPlayground/Nordic-Thingy52-Nodejs/blob/master/examples/microphone.js"&gt;this decoder&lt;/a&gt; written for Node.js. Otherwise, &lt;a href="http://www.cs.columbia.edu/%7Egskc/Code/AdvancedInternetServices/SoundNoiseRatio/dvi_adpcm.c"&gt;this decoder written in C might&lt;/a&gt; also be helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>