<?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>Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10082/play-audio-snippet-via-nrf51-52</link><description>I am working on a device which also needs to give audio feedback to the user.
The app on the mobile phone needs to send a wav (or similar) file (mono, speech) to the device and the device needs to play it through a small speaker. 
 Is this possible</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Oct 2019 22:52:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10082/play-audio-snippet-via-nrf51-52" /><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/213272?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2019 22:52:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46f196e2-7b1c-4853-a4b6-a82543270442</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Hi, you can have a look at this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52878/pwm-audio-driver" rel="noopener noreferrer" target="_blank"&gt;PWM audio&lt;/a&gt; thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37383?ContentTypeID=1</link><pubDate>Fri, 06 Nov 2015 10:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb2abf25-2f55-4f75-94d2-8323ad3d580a</guid><dc:creator>JohnBrown</dc:creator><description>&lt;p&gt;Having taken a quick look at the nRF52 datasheet, I think it would be perfectly viable to do this using the PWM in conjunction with the DMA. In fact, Nordic were demonstrating some drum noises at the nRF51 on tour event last week. If you need any help with this, I&amp;#39;d be happy to look into it, but I don&amp;#39;t know what the guidelines are re. soliciting for work on these forums.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37379?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 14:31:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2755344e-d768-486e-84be-ea8063c419c0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The two you link to are listed as supporting SPI, which is also a perfectly good alternative.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37378?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 14:24:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a49fed1-4e11-43e6-8a38-e4b8bd1639e1</guid><dc:creator>Frits Jan</dc:creator><description>&lt;p&gt;When looking for a DAC through mouser I could not find i2S anywhere... Can you tell me if one of these support i2S ?
&lt;a href="http://eu.mouser.com/ProductDetail/Microchip-Technology/MCP4921-E-SN/"&gt;eu.mouser.com/.../&lt;/a&gt;
or
&lt;a href="http://eu.mouser.com/ProductDetail/Texas-Instruments/DAC8411IDCKT"&gt;eu.mouser.com/.../DAC8411IDCKT&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37377?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 14:02:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32ee70bb-5c2f-488f-97e8-a9b657db4f36</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I think you should be able to do this. If the data is stored on a SD card you could use the SPIM peripheral of nRF52 to read the data and write it to the DAC over I2S using the I2S peripheral. Both the SPIM and I2S peripherals of the nRF52 support EasyDMA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37376?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:37:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddd75fdb-8eee-4c52-bd05-90c59bab0f16</guid><dc:creator>Frits Jan</dc:creator><description>&lt;p&gt;My guess was that when it could be done on an 8bit micro like arduino, the nRF51/52 would cope with this easily.
So something similar like this:
&lt;a href="https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino"&gt;learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37382?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:32:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7791f66-e5f3-4039-bf62-8076165c0e0d</guid><dc:creator>JohnBrown</dc:creator><description>&lt;p&gt;I am not able to answer that in any competent way, except to say that I think you will stand more of a chance if you move up to the nRF52 with its improved performance and DMA capabilities.&lt;/p&gt;
&lt;p&gt;I minute of wave file is a lot of data, even if only 8 bits and 8kHz, which is barely &amp;quot;telephone&amp;quot; quality.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37375?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:26:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29c7436d-dcb4-4445-84f2-7206a21904df</guid><dc:creator>Frits Jan</dc:creator><description>&lt;p&gt;Lets say 22kHz and 12-16bit.
Speech with a little bit of background music files.
snippets of audio of say max 30 seconds long&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37374?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77f7f315-d130-4266-80a1-1d34f1b17f3c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It should be possible on the nRF51, using a low sampling rate. The details depend on the DAC, how you communicate with it, the sample rate, the bits per sample etc. Moreover, unless you can transfer data to the DAC using DMA you will get gaps in the sound. You can also try to use PWM as described by JohnBrown on the nRF51. On the nRF52 you have more options and EasyDMA on most relevant peripherals regardless of going with an external DAC or the internal PWM peripheral. I think you need to specify the level of quality etc. you need (sampling rate, bits per sample) and duration of the sound clip in order to say anything about advantages/disadvantages of the various solutions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37381?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:21:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2adee88-56dc-4ea6-80a2-8a2fbf43afdc</guid><dc:creator>Frits Jan</dc:creator><description>&lt;p&gt;So the main problem would be timing issues because the SOC is busy with BT handling?
In my case I first wanted to get the wav data from the mobile phone onto the device and then play it. But now I am looking into putting all wav files I need on an SD card and then just get a trigger message over BT to play a certain file.
Let&amp;#39;s say the wav file is 1 minute long, would this be a problem? Or can this run in a separate process so  I can still connect to the device via BLE to control it?
(I am talking about SPI interface now not PWM).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37380?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 13:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20c66bd0-88ed-4678-862e-ebcd5bce44b7</guid><dc:creator>JohnBrown</dc:creator><description>&lt;p&gt;I believe it would be possible to play a basic sound on the nRF51 using PWM via the on-chip timers, but not while the soft device is running( I say this having successfully generated DTMF tones via PWM). I also believe I have read stuff recently relating to timeslots being available between SD operations, so I guess if your sound sample was very short, it might be possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37373?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 12:39:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7072958e-fac9-4ac1-b7cf-90226f99c74d</guid><dc:creator>Frits Jan</dc:creator><description>&lt;p&gt;Thank you for your answer.
I came across this site: &lt;a href="https://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/"&gt;developer.mbed.org/.../&lt;/a&gt;
Where there is an example of playing a .wav file from an SD via DAC output and a transistor (or amp) to a speaker.
Is something like this possible with the nRF51 (it doesn not have DAC output right, so I need an external DAC)?
And what could be the drawbacks?&lt;/p&gt;
&lt;p&gt;What will be the advantage of i2S on the nRF52 versus i2C or SPI on the nRF51 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Play audio snippet via nRF51/52</title><link>https://devzone.nordicsemi.com/thread/37372?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2015 12:10:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f67490c-4a90-49bc-ae5b-256fe6f66355</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;We do not have any recommendations when it come to audio playback. This is not a common use-case for the nRF51. However there are several thread on DevZone that ask similar questions, such as &lt;a href="https://devzone.nordicsemi.com/question/561/dac-for-use-with-nrf51822/"&gt;this one&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I think you have already listed the main components you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DAC&lt;/li&gt;
&lt;li&gt;Amplifier&lt;/li&gt;
&lt;li&gt;External memory&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;a href="http://infocenter.nordicsemi.com/topic/nrf52.v1.7/Chunk1134629720.html?cp=1_1_0_40#concept_z2v_24y_vr"&gt;nRF52 has I2S&lt;/a&gt;, which may be the best option for communicating with the DAC, depending on which DAC you choose. You should use EasyDMA so that you do not experience dropouts of the audio when the CPU is busy doing something else. I2C and SPI are other alternatives.&lt;/p&gt;
&lt;p&gt;A alternative for very basic sounds can be to use the &lt;a href="http://infocenter.nordicsemi.com/topic/nrf52.v1.7/Chunk579441394.html?resultof=%22%4e%52%46%5f%50%57%4d%30%22%20"&gt;PWM peripheral&lt;/a&gt; on the nRF52.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>