<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - Help me find HEX waveforms plz]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/24241/"/>
	<updated>2019-03-09T02:19:28Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/24241/help-me-find-hex-waveforms-plz/</id>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261551/#p261551"/>
			<content type="html"><![CDATA[<p>oh, thanks. I&#039;ll check it out.</p><p>I have a few routines that I&#039;m working on simultaneously to see what works. Both are accessing a data array where the sample is stored and both are using in Interrupt Service Routine to control playback speed. One is using a ring buffer which makes it pretty easy to push multiple samples into at once. The other method doesn&#039;t store the sample in volatile RAM. It is actually pretty difficult for me to understand how to get playback tuned properly. <br />I&#039;m going to PM you some code and schematic for better understanding.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-09T02:19:28Z</updated>
			<id>https://chipmusic.org/forums/post/261551/#p261551</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261548/#p261548"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>Orgia Mode wrote:</cite><blockquote><p>I&#039;m looking for raw data to send to a PWM DAC, or R2R DAC. I have no clue on what these encoded formats are. <br />LIke this sine wave:<br /></p><div class="quotebox"><blockquote><p>128,140,152,165,176,188,198,208,218,226,234,240,245,250,253,254,255,254,253,250,245,240,234,226,218,208,198,188,176,165,152,140,128,115,103,90,79,67,57,47,37,29,21,15,10,5,2,1,0,1,2,5,10,15,21,29,37,47,57,67,79,90,103,115</p></blockquote></div><p>This has 64 bytes per period for example.</p></blockquote></div><p>Even with a PWM resistor-ladder DAC you can store the data in a few different ways. It really depends on your playback routine. What is your playback routine like? How does it read data and how does it control your output pins?</p><p>If you&#039;re using a 1-bit routine that wants a simple differential PWM byte stream you can use my tool below to generate that from any 8-bit WAV file and the readme has a little detail on how the playback routine would work.</p><p><a href="https://github.com/JeffAlyanak/pcm2pwm" target="_blank">https://github.com/JeffAlyanak/pcm2pwm</a></p>]]></content>
			<author>
				<name><![CDATA[jefftheworld]]></name>
				<uri>https://chipmusic.org/jefftheworld</uri>
			</author>
			<updated>2019-03-09T01:03:23Z</updated>
			<id>https://chipmusic.org/forums/post/261548/#p261548</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261542/#p261542"/>
			<content type="html"><![CDATA[<p>I over here pulling my hair out trying to program this ATtiny85. Im a hardware guy...</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-08T21:50:48Z</updated>
			<id>https://chipmusic.org/forums/post/261542/#p261542</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261541/#p261541"/>
			<content type="html"><![CDATA[<p>I&#039;m looking for raw data to send to a PWM DAC, or R2R DAC. I have no clue on what these encoded formats are. <br />LIke this sine wave:<br /></p><div class="quotebox"><blockquote><p>128,140,152,165,176,188,198,208,218,226,234,240,245,250,253,254,255,254,253,250,245,240,234,226,218,208,198,188,176,165,152,140,128,115,103,90,79,67,57,47,37,29,21,15,10,5,2,1,0,1,2,5,10,15,21,29,37,47,57,67,79,90,103,115</p></blockquote></div><p>This has 64 bytes per period for example.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-08T21:47:33Z</updated>
			<id>https://chipmusic.org/forums/post/261541/#p261541</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261539/#p261539"/>
			<content type="html"><![CDATA[<p>You can even read a WAV header yourself to confirm the format of the data.</p><p><em>note: keep in mind that RIFF/WAV format files are little-endian.</em></p><p><strong>First, check format value — 21st and 22nd bytes</strong>: If the value is 1, the format is PCM.<br /><strong>Second, check the 23rd and 24th bytes</strong>: This will be the number of channels, almost always just 1 or 2.<br /><strong>Third, check the 25th to 28th bytes</strong>: This will be the sample-rate as a 32-bit integer.<br /><strong>Fourth, check the 35th to 36th bytes</strong>: This will be the bits-per-sample.</p><p>The data itself will start at byte 55 and go until the end of the file.</p><p>Channels are interleaved in the data, so to illustrate let&#039;s look at how a 16-bit WAV with two channels would look. I&#039;ll give each value a letter — a for the first channel and b for the second — and a number representing which sample it is — the first sample would be 1, etc.</p><div class="codebox"><pre><code>a1 a1 b1 b1 a2 a2 b2 b2 a3 a3 b3 b3 a4 a4 b4 b4
a5 a5 b5 b5 a6 a6 b6 b6 a7 a7 b7 b7 a8 a8 b8 b8</code></pre></div><p>You&#039;ll see that it&#039;s actually rather easy to understand this simple PCM encoding as encapsulated by the WAV format since it&#039;s just a simple header followed by a byte-stream.</p>]]></content>
			<author>
				<name><![CDATA[jefftheworld]]></name>
				<uri>https://chipmusic.org/jefftheworld</uri>
			</author>
			<updated>2019-03-08T21:04:39Z</updated>
			<id>https://chipmusic.org/forums/post/261539/#p261539</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261537/#p261537"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>Orgia Mode wrote:</cite><blockquote><p>Anyone have a link to some waveforms in hex, decimal, binary or even octal, text-arrays?<br />Looking for the basics: tri, saw, squ, sin, etc. And maybe even a few more complex waveforms. <br />8-, 10-, or 12-bit would be ideal.</p></blockquote></div><p>What encoding do you want them in? Just asking for the base in which you represent them isn&#039;t really meaningful. Do you want DPCM? PWM? Some other more complex or more application-specific encoding?</p><p>If you&#039;re looking for something like (L)PCM then you can actually just open up most/all WAV files and read that data out directly. Aside from the preamble bytes it&#039;ll just be a byte stream at the bit-depth of the WAV that you can read and copy directly.</p>]]></content>
			<author>
				<name><![CDATA[jefftheworld]]></name>
				<uri>https://chipmusic.org/jefftheworld</uri>
			</author>
			<updated>2019-03-08T20:32:03Z</updated>
			<id>https://chipmusic.org/forums/post/261537/#p261537</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261507/#p261507"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>LotZo wrote:</cite><blockquote><p>The decimal tables for NES are in the famitracker source code. <a href="https://github.com/HertzDevil/famitracker-all/tree/master/Source/APU" target="_blank">https://github.com/HertzDevil/famitrack &#133; Source/APU</a></p></blockquote></div><p>Thats super helpful! Thanks for finding it.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-07T17:13:33Z</updated>
			<id>https://chipmusic.org/forums/post/261507/#p261507</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261501/#p261501"/>
			<content type="html"><![CDATA[<p>The decimal tables for NES are in the famitracker source code. <a href="https://github.com/HertzDevil/famitracker-all/tree/master/Source/APU" target="_blank">https://github.com/HertzDevil/famitrack &#133; Source/APU</a></p>]]></content>
			<author>
				<name><![CDATA[LotZo]]></name>
				<uri>https://chipmusic.org/LotZo</uri>
			</author>
			<updated>2019-03-07T12:18:00Z</updated>
			<id>https://chipmusic.org/forums/post/261501/#p261501</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261500/#p261500"/>
			<content type="html"><![CDATA[<p>Yeah, I have been exploring my options and I can either write a script to produce the tables that I want or write a function that will produce the values in real time.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-07T06:50:13Z</updated>
			<id>https://chipmusic.org/forums/post/261500/#p261500</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261499/#p261499"/>
			<content type="html"><![CDATA[<p>sounds like a fun little script to write to generate them <img src="https://chipmusic.org/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[Jophish]]></name>
				<uri>https://chipmusic.org/Jophish</uri>
			</author>
			<updated>2019-03-07T06:33:50Z</updated>
			<id>https://chipmusic.org/forums/post/261499/#p261499</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Help me find HEX waveforms plz]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/261486/#p261486"/>
			<content type="html"><![CDATA[<p>Anyone have a link to some waveforms in hex, decimal, binary or even octal, text-arrays?<br />Looking for the basics: tri, saw, squ, sin, etc. And maybe even a few more complex waveforms. <br />8-, 10-, or 12-bit would be ideal.</p>]]></content>
			<author>
				<name><![CDATA[Orgia Mode]]></name>
				<uri>https://chipmusic.org/Orgia+Mode</uri>
			</author>
			<updated>2019-03-06T01:03:06Z</updated>
			<id>https://chipmusic.org/forums/post/261486/#p261486</id>
		</entry>
</feed>
