<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[The 1-Bit Forum — Octode on Arduino]]></title>
		<link>http://randomflux.info/1bit/viewtopic.php?id=121</link>
		<atom:link href="https://randomflux.info/1bit/extern.php?action=feed&amp;tid=121&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Octode on Arduino.]]></description>
		<lastBuildDate>Tue, 18 Jan 2022 20:43:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=2496#p2496</link>
			<description><![CDATA[<div class="quotebox"><cite>Shiru wrote:</cite><blockquote><p>Sorry, I don&#039;t use Github, so unless some uploaded it there, it isn&#039;t there. And I doubt anyone did that.</p></blockquote></div><p>I did it, some time ago, probably with a few modifications:</p><p><a href="https://github.com/farvardin/garvuino/tree/master/arduino_sketches/beeper/arduino_octode">https://github.com/farvardin/garvuino/t … ino_octode</a></p>]]></description>
			<author><![CDATA[null@example.com (garvalf)]]></author>
			<pubDate>Tue, 18 Jan 2022 20:43:32 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=2496#p2496</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=2491#p2491</link>
			<description><![CDATA[<p>Sure, you can upload it. WTFPL/CC0 it is.</p>]]></description>
			<author><![CDATA[null@example.com (Shiru)]]></author>
			<pubDate>Thu, 13 Jan 2022 05:20:05 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=2491#p2491</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=2489#p2489</link>
			<description><![CDATA[<p>Is it ok for me to upload the source for this and the other two Arduino implementations you&#039;ve done?</p><p>In that case, what should the licensing rules be?</p>]]></description>
			<author><![CDATA[null@example.com (dennisl68)]]></author>
			<pubDate>Wed, 12 Jan 2022 19:29:14 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=2489#p2489</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=2484#p2484</link>
			<description><![CDATA[<p>Sorry, I don&#039;t use Github, so unless some uploaded it there, it isn&#039;t there. And I doubt anyone did that.</p>]]></description>
			<author><![CDATA[null@example.com (Shiru)]]></author>
			<pubDate>Tue, 11 Jan 2022 05:05:36 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=2484#p2484</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=2483#p2483</link>
			<description><![CDATA[<div class="quotebox"><cite>Shiru wrote:</cite><blockquote><p>[...] after some thoughts chose to start from the simplest thing possible - recreating the original Octode engine for Arudino Uno, in C. A very special kind of fun, should I say.[...]</p></blockquote></div><p>I really appreciate the work <img src="http://randomflux.info/1bit/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Can this source be found anywhere on Github?</p><p>I tried Googling but nothing obvious popped up...</p>]]></description>
			<author><![CDATA[null@example.com (dennisl68)]]></author>
			<pubDate>Mon, 10 Jan 2022 20:21:08 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=2483#p2483</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1690#p1690</link>
			<description><![CDATA[<p>more fun with this engine...</p><p>I&#039;ve added a knob and and I can slowdown the replay of the song:<br /></p><div class="codebox"><pre><code>  current_speed = constrain(map(knob_value,0,1023, 2, 20),2, 20);
/.../
  parser_sync=song_speed*(current_speed/2);</code></pre></div><p><a href="https://picosong.com/wekgx/">https://picosong.com/wekgx/</a></p>]]></description>
			<author><![CDATA[null@example.com (garvalf)]]></author>
			<pubDate>Sat, 31 Mar 2018 19:49:49 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1690#p1690</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1435#p1435</link>
			<description><![CDATA[<p>my skills are not that high, but I found it funny to add this in the arduino code:</p><div class="codebox"><pre><code>#define LED 8
/.../
if(!click_drum_len)
  {
     /.../
  }
  else
  {
    digitalWrite(LED,HIGH);
/.../
}</code></pre></div><p>so now I have a led which pulses during the drum beats!</p><p>I&#039;m still working on my AY+SID+1bit player PCB, I should send it soon to the maker!</p>]]></description>
			<author><![CDATA[null@example.com (garvalf)]]></author>
			<pubDate>Sat, 29 Jul 2017 21:07:03 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1435#p1435</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1434#p1434</link>
			<description><![CDATA[<div class="quotebox"><cite>AtariTufty wrote:</cite><blockquote><p>Very interesting discussion guys. </p><p>Welcome to the forum chupo_cro , it&#039;s great to see new faces here <img src="http://randomflux.info/1bit/img/smilies/smile.png" width="15" height="15" alt="smile" /></p></blockquote></div><p>Thank you very much for the welcome! :-) I am looking forward to learn from the works presented by forum members and I hope I could add a bit here and there. Although my &#039;first&#039; assember is Z80 I did write some 6502 code back in the 80s as well so I will be watching for those sound generation routines too.</p>]]></description>
			<author><![CDATA[null@example.com (chupo_cro)]]></author>
			<pubDate>Sat, 29 Jul 2017 02:50:56 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1434#p1434</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1433#p1433</link>
			<description><![CDATA[<div class="quotebox"><cite>utz wrote:</cite><blockquote><p>Well, let&#039;s just say everybody has their own goals and methods, alright? For my part, I&#039;m quite interested to hear about yours, chupo_cro (even though I&#039;m personally more interested in coding AVR asm than C). Either way, probably best to continue this discussion in a new thread.</p></blockquote></div><p>Yes, that would be great :-) I shall these days start a new thread where I&#039;ll write you an answer to this post (regarding data format and row transitions) and where we can discuss all kinds of possibilities that could be used for 1-bit sound generation using AVRs/Arduinos programmed in C, assembler or C + inline assembler.</p>]]></description>
			<author><![CDATA[null@example.com (chupo_cro)]]></author>
			<pubDate>Sat, 29 Jul 2017 02:30:15 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1433#p1433</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1432#p1432</link>
			<description><![CDATA[<p>Very interesting discussion guys. </p><p>Welcome to the forum chupo_cro , it&#039;s great to see new faces here <img src="http://randomflux.info/1bit/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[null@example.com (AtariTufty)]]></author>
			<pubDate>Fri, 28 Jul 2017 08:41:10 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1432#p1432</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1431#p1431</link>
			<description><![CDATA[<p>Well, let&#039;s just say everybody has their own goals and methods, alright? For my part, I&#039;m quite interested to hear about yours, chupo_cro (even though I&#039;m personally more interested in coding AVR asm than C). Either way, probably best to continue this discussion in a new thread.</p><div class="quotebox"><cite>chupo_cro wrote:</cite><blockquote><p>Something that might be interesting - my song data format is not tracker-like (patterns of tones/commands) but is rather an array of <strong>tone[|CMD], duration[,command][, parameter]</strong> per channel (array of uint8_t) so it is quite easy to enter the song by looking at the musical scores and typing the data. Some commands can be specified just by OR-ing the tone with the command and some need to be specified by using CMD flag and the additional byte as command specifier and maybe one more byte as a parameter. The durations are specified as <strong>t1</strong> (a whole note), <strong>t2</strong> (a half note), <strong>t4</strong> (a quarter note), <strong>t8</strong>, <strong>t16</strong> or as the combination - for example <strong>t4+t8</strong> is a quarter note with the dot.</p></blockquote></div><p>Now, while I see your reasoning behind it, I think this approach has some drawbacks. The main issue is that you will find few people who are willing to write music for your engine in a text-based format. While music markup languages have some fans (even around here <img src="http://randomflux.info/1bit/img/smilies/wink.png" width="15" height="15" alt="wink" />), the vast majority of users prefer trackers nowadays. And this kind of sheet-music oriented format does not lend itself well to a tracker implementation, since trackers don&#039;t care about note lengths. It might be worth considering to &quot;inverse&quot; the length format, so that <em>t1</em> would be the smallest unit (ie. semi-quaver). This way, it&#039;d be still relatively convenient for transcribing sheet music, while at the same time making tracker support a little easier. The other thing you have to worry about is row transition length. The more complex the data format, the more time you need to decode it - time that you can&#039;t spend on synthesis. It&#039;s normally not such a big issue with PFM-based synthesis, but once you get into pulse-interleaving/volume faking, you will notice a significant impact on the sound quality. Of course, with something like 10 channels, you have to start worrying about data size as well (so it would make sense to have patterns per channel instead of one pattern for all channels). But for 2 channels, I find split patterns aren&#039;t worth it in most cases.</p>]]></description>
			<author><![CDATA[null@example.com (utz)]]></author>
			<pubDate>Fri, 28 Jul 2017 07:21:44 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1431#p1431</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1430#p1430</link>
			<description><![CDATA[<p>Yeah, good luck with all that.</p>]]></description>
			<author><![CDATA[null@example.com (Shiru)]]></author>
			<pubDate>Thu, 27 Jul 2017 23:17:53 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1430#p1430</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1429#p1429</link>
			<description><![CDATA[<div class="quotebox"><cite>Shiru wrote:</cite><blockquote><p>For this particular application I didn&#039;t need to know exact cycle count or do assembly optimization. If I was to write AVR assembly code by hand, I sure would know how many cycles it takes - it is common practice to memorize opcode cycles (super easy on AVR), and count them in time critical parts when writing for 8/16 bit systems in assembler.</p></blockquote></div><p>AVRs are like a 8 bit computer <strong>+ peripherals</strong>, you might soon meet the situation where you would have to know the number of cycles between two <strong>events</strong> or between two <strong>conditions</strong> of the system.</p><p>I memorized a lot of Z80 opcode cycles and opcodes back in the 80s, I could write 20-30 byte long (or short? :-) ) routines directly in hex - without loading the assembler (Zeus or GENS). Now I still remember only #c9 and a few more opcodes.<br /></p><div class="quotebox"><cite>Shiru wrote:</cite><blockquote><p>What I needed was just to see compiler generated code, to check if particular changes in C code makes resulting code longer or shorter, which is totally enough to estimate efficiency of edits - another common practice when writing for 8/16 bit systems in C. It is super simple task, I don&#039;t see why it should be overcomplicated like that with all that porting to other environments, using simulators, debuggers, and stuff like that.</p></blockquote></div><p>Well... Could you notice the interrupt happening just in between loading or storing the 2-byte variable and ruining the result <strong>by just observing</strong> the code? ;-)</p>]]></description>
			<author><![CDATA[null@example.com (chupo_cro)]]></author>
			<pubDate>Thu, 27 Jul 2017 20:58:25 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1429#p1429</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1428#p1428</link>
			<description><![CDATA[<p>Proteus that costs like $1000 is certainly an overkill for this.</p><p>For this particular application I didn&#039;t need to know exact cycle count or do assembly optimization. If I was to write AVR assembly code by hand, I sure would know how many cycles it takes - it is common practice to memorize opcode cycles (super easy on AVR), and count them in time critical parts when writing for 8/16 bit systems in assembler.</p><p>What I needed was just to see compiler generated code, to check if particular changes in C code makes resulting code longer or shorter, which is totally enough to estimate efficiency of edits - another common practice when writing for 8/16 bit systems in C. It is super simple task, I don&#039;t see why it should be overcomplicated like that with all that porting to other environments, using simulators, debuggers, and stuff like that. All it really takes is just a quick glance at the compiler output, which is normally fully exposed to the user. It is just an Arduino IDE&#039;s quirk that it hides the intermediate assembly.</p>]]></description>
			<author><![CDATA[null@example.com (Shiru)]]></author>
			<pubDate>Thu, 27 Jul 2017 20:22:10 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1428#p1428</guid>
		</item>
		<item>
			<title><![CDATA[Re: Octode on Arduino]]></title>
			<link>http://randomflux.info/1bit/viewtopic.php?pid=1427#p1427</link>
			<description><![CDATA[<div class="quotebox"><cite>Shiru wrote:</cite><blockquote><p>Thanks for explaination of the issue.</p><p>As for looking up to the generated code, I have my doubts about these ideas. First, I just need to see what compiler spits out, in order to see how efficiently certain C code compiles with certain C compiler. That&#039;s purely software issue, normally you don&#039;t even have to do anything to just get the intermediate assembly output. Using simulators, switching platforms, using JTAG or any extra HW is all total overkill for this. Also, I doubt that latest Arduino and AVR Studio 4.18 use the same exact C compiler with same exact options, and if this is not the case, it just won&#039;t help at all.</p><p>I have no doubts that a lot more can be pulled off with Arduino or plain AVR. Something along the lines of Casio CZ series or Korg Poly 800 (with external filter) should be totally doable. We here not trying to squeeze out all that is possible, we&#039;re just playing with concepts of porting over ZX beeper engines, with all their quirks and specifics, and maybe applying some of this experience to do like &#039;super&#039; versions of those engines. And using Arduino over plain AVR is an important feature, because that&#039;s certainly more accessible platform for strangers and newcomers.</p></blockquote></div><p>Yes, I am aware the primary goal is to port the Spectrum&#039;s sound engines to Arduino. I agree JTAG might be an overkill but when I saw $7 Chineese JTAG ICEs that connect to USB port I just had to buy one to see how/<strong>if</strong> it works - despite I most of the time use just <a href="http://www.edaboard.com/thread86584.html#post378456">five wires as a &#039;programmer&#039;</a>.</p><p>While code generated by Arduino IDE and old AVR Studio is not the same, the compiler is - in both cases <strong>avr-gcc</strong> is used to compile the code (although in Arduino you can use C++ in addition to C). One of the reasons why I said it is better to use an old AVR studio than new Atmel Studio is because old compiler produces smaller and mostly faster code. Despite Arduino beeing a target platform it is much easier to develop/debug the routines using old AVR Studio (good simulator, disassembler and cheap in circuit debugger) and to make just a few small modifications to move the code to Arduino IDE when everything works as expected. When I modified your Phaser1 code to work with bare metal ATmegax, I just had to remove loop() and move the code to main(), insert a call to setup(), get rid of boolean, insert a few #includes and make cast from pointer to int. The other way would be as easy too. Then, if you noticed that Arduino&#039;s compiler produced worse code than old avr-gcc, you could just insert a few lines of inline assembler. But 16 MHz AVR with just 1-5 cycle instructions is fast enough so I don&#039;t think there would be a need for assembly optimizations.</p><p>But still, fast and precise count of the cycles between two instructions is something that should be available at all the times. For that you might use a simulator which is part of the AVR Studio, or an oscilloscope (toggle the pin upon entering and before leaving the interrupt routine) or use Proteus vith virtual oscilloscope.</p><p>Although I don&#039;t have Arduino I do use Arduino IDE to write code for ESP8266 so I was examining the Arduino sources. That way I know Arduino is using <strong>Timer0</strong> to do some things, the <strong>Timer0</strong> is used by <strong>delay()</strong>, <strong>millis()</strong>, <strong>micros()</strong> etc. I might be wrong but I believe the sound generation routines might work better if <strong>Timer0 interrupt</strong> would be disabled (unless not used by the sound routine itself). In that case the <strong>delay()</strong> wouldn&#039;t work but you can <strong>#include &lt;util/delay.h&gt;</strong> and use <strong>_delay_ms()</strong> which does not use interrupts. Although I don&#039;t think the delay needs to be used in a sound generation routine.</p>]]></description>
			<author><![CDATA[null@example.com (chupo_cro)]]></author>
			<pubDate>Thu, 27 Jul 2017 20:02:45 +0000</pubDate>
			<guid>http://randomflux.info/1bit/viewtopic.php?pid=1427#p1427</guid>
		</item>
	</channel>
</rss>
