<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/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/"><channel><title>How to create sound data</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/24033/how-to-create-sound-data</link><description> 
hi, 

 
Look at the sample sound for ARM board MCB2130, how to make this
sound data (data.c)? in the sample DTMF &amp;quot;1&amp;quot;, &amp;quot;5&amp;quot;, &amp;quot;9&amp;quot; and &amp;quot;D&amp;quot; is in
SoundaData array variable. 

 
If I want to generate data for freq say 350Hz (single frequency)
how to make</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/103054?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2009 02:42:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e12635bd-109d-46d1-b347-a0694d54e2d1</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;I found that for single frequency sound, I don&amp;#39;t need to use
any data. What I do, only change the value of DAC from 0x0000 to
0xFFFF and back again from 0xFFFF to 0x0000 every interrupt on T0.
The triggered int time is the only key to change.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
A square wave is &lt;b&gt;not&lt;/b&gt; a single-frequency sound. It&amp;#39;s one
fundamental frequency with lots of harmonics. Depending on your
application, this might be relevant.&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;I tried to generate sound code using PC&amp;#39;s sound recorder, then
save it as in format of PCM, 8Khz, 8bit Mono. Extract the data in the
file and put it in the code, but the sound is not clear as in
PC.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Getting the sound to sound &amp;quot;clear&amp;quot; requires fairly strict timing
with little jitter. Even more so if your chip doesn&amp;#39;t have DMA
facilities to move the sound data to the DAC.&lt;/p&gt;

&lt;p&gt;
You might have to connect an oscilloscope (and/or a frequency
analyzer, or an oscilloscope that can calculate a spectrum) to the
DAC to examine the output waveform. Start with simple
sine/triangle/sawtooth waves and see if they a re-created without
distortion.&lt;/p&gt;

&lt;p&gt;
Personally, I&amp;#39;d use Matlab (expensive) or GNU Octave (free, and
for this purpose pretty much indistinguishable from Matlab, so don&amp;#39;t
buy a four- to five-figure Matlab license just for this purpose :) )
to generate the waveforms.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/103053?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2009 02:36:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:84e5242a-0407-4d34-af65-3d4a35a39bbe</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Note that emitting 0x0000 and 0xffff will emit a square wave.
Unless you have a low-pass filter, your output will contain large
amounts of energy in overtone frequencies, besides the base
frequency.&lt;/p&gt;

&lt;p&gt;
A problem when handling PCM data is to make sure that you don&amp;#39;t
have a signed/unsigned problem.&lt;/p&gt;

&lt;p&gt;
The sound recorder is one way, but best when you want to capture
speech messages or music. For DTMF or similar, it is normally easier
to just sum the sine waves in a C program, and let the program emit
the data in text form for direct inclusion in the source code. Wieh
you compute the frequencies matematically, it will also be trivial to
create a sound clip that has the perfect number of samples for looped
playback, i.e. where the clip has n samples and the n+1 sample should
have been identical to the first sample.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/77369?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2009 02:09:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cd5f3413-a975-4f03-af97-c7619092668b</guid><dc:creator>Rudy Moniaga</dc:creator><description>&lt;p&gt;&lt;p&gt;
Guys,&lt;/p&gt;

&lt;p&gt;
I found that for single frequency sound, I don&amp;#39;t need to use any
data. What I do, only change the value of DAC from 0x0000 to 0xFFFF
and back again from 0xFFFF to 0x0000 every interrupt on T0. The
triggered int time is the only key to change.&lt;/p&gt;

&lt;p&gt;
I tried to generate sound code using PC&amp;#39;s sound recorder, then
save it as in format of PCM, 8Khz, 8bit Mono. Extract the data in the
file and put it in the code, but the sound is not clear as in PC.&lt;/p&gt;

&lt;p&gt;
I am using following link for extract data (I wrote program in
delphi to extract data)&lt;br /&gt;
&lt;a href="http://www.lightlink.com/tjweber/StripWav/WAVE.html"&gt;www.lightlink.com/.../WAVE.html&lt;/a&gt;
(as suggested by Christoph Franck)&lt;br /&gt;
and&lt;br /&gt;
&lt;a href="http://ccrma.stanford.edu/courses/422/projects/WaveFormat/"&gt;ccrma.stanford.edu/.../&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Any one can help me?&lt;/p&gt;

&lt;p&gt;
best regards,&lt;br /&gt;
Rudy&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/125405?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2009 06:57:55 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:aac43f22-a91b-4e65-9d9a-12f0d0c1d7ca</guid><dc:creator>Rudy Moniaga</dc:creator><description>&lt;p&gt;&lt;p&gt;
Guys,&lt;/p&gt;

&lt;p&gt;
Thank you for the information. I will try it and update the
result.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/114852?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 14:38:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5ff68ce4-ec28-4e64-9aa4-b76d39802f0e</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;The trivial file format of normal WAV files would also allow
the generated curve form to be trivially tested with WinAmp or any
other available audio player&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
Or, in the other direction, any available audio recording software
could be used to capture &amp;quot;real&amp;quot; sounds to a WAV file, and then a
simple &amp;#39;C&amp;#39; program could extract the data samples...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/103051?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 13:57:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1f657eec-9deb-42f3-8dcb-ae765a6cfdb5</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
A lot of people - being developers - would probably consider using
a free compiler for Linux or Windows and write a few lines of code to
generate the required curve form and print as an initialized C array
for inclusion in the source code of the target firmware.&lt;/p&gt;

&lt;p&gt;
The trivial file format of normal WAV files would also allow the
generated curve form to be trivially tested with WinAmp or any other
available audio player.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/89690?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 13:51:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3bdafeb8-a3dc-4bf7-8022-df3f5268ac8d</guid><dc:creator>Christoph Franck</dc:creator><description>&lt;p&gt;&lt;p&gt;
Spreadsheet programs may work, but I don&amp;#39;t find them the tool of
choice.&lt;/p&gt;

&lt;p&gt;
Matlab or its free software lookalike GNU Octave work very
well.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/103050?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 12:19:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7a59bb44-e020-49b6-9cc4-09afefaa54e4</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
This page includes some information on how to read the samples
from a WAV file:&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.lightlink.com/tjweber/StripWav/WAVE.html"&gt;www.lightlink.com/.../WAVE.html&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/89691?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 12:00:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f0863989-f17b-40af-9233-ae88116337af</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
For a simple, dual-frequency, you could create the data using your
favourite spreadsheet program ;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create sound data</title><link>https://community.arm.com/thread/55873?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2009 10:16:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:407b5d0e-39df-4f67-bcf7-fda737ff3dfc</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
For a simple, single frequency, you could create the data using
your favourite spreadsheet program...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>