<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[ChipMusic.org - NES Audio Programming]]></title>
	<link rel="self" href="https://chipmusic.org:80/forums/feed/atom/topic/3181/"/>
	<updated>2011-02-21T14:50:53Z</updated>
	<generator>PunBB</generator>
	<id>https://chipmusic.org/forums/topic/3181/nes-audio-programming/</id>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/57313/#p57313"/>
			<content type="html"><![CDATA[<p>BIN in FamiTracker&#039;s export does not include the music player, so you should both incbin the BIN and also include the player&#039;s source, and before calling the player you should tell it where the BIN located - don&#039;t know how, check the player&#039;s source.</p><p>Actually you can use NSF in your NES program, the problem is that you can&#039;t choose where the code will be located, and you&#039;ll not be able to play sound effects. It is acceptable for a simple intro or a music disc. I guess there could be problems with expansion chips, because banking could be used, for &#039;linear&#039; memory model it is very simple:<br /></p><div class="codebox"><pre><code>  lda #0                ;init music, call it once, A is song number
  jsr $ac00
...
  jsr $ac03            ;play music, call it every frame
...
  .bank 1
  .org $a2e2-$80
  .incbin &quot;music.nsf&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Shiru]]></name>
				<uri>https://chipmusic.org/Shiru</uri>
			</author>
			<updated>2011-02-21T14:50:53Z</updated>
			<id>https://chipmusic.org/forums/post/57313/#p57313</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/57297/#p57297"/>
			<content type="html"><![CDATA[<p>if it is much like c64, you include the&nbsp; bin file with your assembler&nbsp; &nbsp;(there should definitely 100% a way to include bin files) and then jsr to it a lot of times (it probably wants to be called each time the screen refreshs)</p>]]></content>
			<author>
				<name><![CDATA[ant1]]></name>
				<uri>https://chipmusic.org/ant1</uri>
			</author>
			<updated>2011-02-21T13:32:39Z</updated>
			<id>https://chipmusic.org/forums/post/57297/#p57297</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/57291/#p57291"/>
			<content type="html"><![CDATA[<p>If the question is aimed at me Nick, I know very little about Famitracker.</p>]]></content>
			<author>
				<name><![CDATA[neilbaldwin]]></name>
				<uri>https://chipmusic.org/neilbaldwin</uri>
			</author>
			<updated>2011-02-21T13:01:25Z</updated>
			<id>https://chipmusic.org/forums/post/57291/#p57291</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/57271/#p57271"/>
			<content type="html"><![CDATA[<p>quick question.</p><p>i know you can export .bin files from famitracker, but how do you use that in your assembly code? is there a web page somewhere with a tutorial or code examples?</p>]]></content>
			<author>
				<name><![CDATA[nickmaynard]]></name>
				<uri>https://chipmusic.org/nickmaynard</uri>
			</author>
			<updated>2011-02-21T06:36:27Z</updated>
			<id>https://chipmusic.org/forums/post/57271/#p57271</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52922/#p52922"/>
			<content type="html"><![CDATA[<p>lol</p>]]></content>
			<author>
				<name><![CDATA[wedanced]]></name>
				<uri>https://chipmusic.org/wedanced</uri>
			</author>
			<updated>2011-01-31T21:06:25Z</updated>
			<id>https://chipmusic.org/forums/post/52922/#p52922</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52907/#p52907"/>
			<content type="html"><![CDATA[<p>I&#039;m like Mister Miyagi and Nick is Daniel-san...&nbsp; <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>&quot;DMC off! DMC on! DMC off! DMC on!&quot;</p>]]></content>
			<author>
				<name><![CDATA[neilbaldwin]]></name>
				<uri>https://chipmusic.org/neilbaldwin</uri>
			</author>
			<updated>2011-01-31T19:54:20Z</updated>
			<id>https://chipmusic.org/forums/post/52907/#p52907</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52902/#p52902"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>tRasH cAn maN wrote:</cite><blockquote><p>Neil and Nick sitting in a tree...<br /><img src="https://chipmusic.org/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p></blockquote></div><p>...N - E - S - and - D - M -G!</p>]]></content>
			<author>
				<name><![CDATA[jefftheworld]]></name>
				<uri>https://chipmusic.org/jefftheworld</uri>
			</author>
			<updated>2011-01-31T19:41:26Z</updated>
			<id>https://chipmusic.org/forums/post/52902/#p52902</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52879/#p52879"/>
			<content type="html"><![CDATA[<p>Neil and Nick sitting in a tree...<br /><img src="https://chipmusic.org/forums/img/smilies/tongue.png" width="15" height="15" alt="tongue" /></p>]]></content>
			<author>
				<name><![CDATA[tRasH cAn maN]]></name>
				<uri>https://chipmusic.org/tRasH+cAn+maN</uri>
			</author>
			<updated>2011-01-31T15:53:07Z</updated>
			<id>https://chipmusic.org/forums/post/52879/#p52879</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52843/#p52843"/>
			<content type="html"><![CDATA[<p>wow. thank you 2 for this public conversation. i have no idea what just happend but maybe when i learn more coding i will figure this out and actually post something relevant.</p>]]></content>
			<author>
				<name><![CDATA[wedanced]]></name>
				<uri>https://chipmusic.org/wedanced</uri>
			</author>
			<updated>2011-01-30T20:49:55Z</updated>
			<id>https://chipmusic.org/forums/post/52843/#p52843</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52830/#p52830"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>nickmaynard wrote:</cite><blockquote><p>yes, that makes perfect sense. i&#039;ll try it out and post my results.</p><p>and seriously, thank you so much for helping me out.</p></blockquote></div><p>No worries Nick <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[neilbaldwin]]></name>
				<uri>https://chipmusic.org/neilbaldwin</uri>
			</author>
			<updated>2011-01-30T17:14:46Z</updated>
			<id>https://chipmusic.org/forums/post/52830/#p52830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52822/#p52822"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>neilbaldwin wrote:</cite><blockquote><p>$4015 is the voice enable register and uses bits 0 to 4 to enable Pulse 1, Pulse 2, Triangle, Noise and DCM respectively.</p><div class="codebox"><pre><code>Binary    Hex Voice
%00000001 $01 Pulse 1
%00000010 $02 Pulse 2
%00000100 $04 Triangle
%00001000 $08 Noise
%00010000 $10 DCM</code></pre></div><p>To figure out the value to write to $4015 just add up the values. For example, to enable the two Pulse voices, you write $03 to $4015 ($01 + $02). The APU is generally initialised with a value of $0F which enables the first four voices ($01 + $02 +$04 +$08 = $0F).</p><p>DCM differs slightly in that it requires you to turn the voice off and back on again to actually play the sample. In Don&#039;s code, he&#039;s not using any of the other voices so he doesn&#039;t need to turn them on, hence the $00 write (and probably $10 somewhere further down the code to start the sample playing).</p><p>So for you, instead of writing #$00 to $4015, write #$0F. This leaves the first four voices on but clears the enable bit for DCM, as is required. Then to start the sample write #$1F to $4015.</p><p>Make sense?</p></blockquote></div><p>yes, that makes perfect sense. i&#039;ll try it out and post my results.</p><p>and seriously, thank you so much for helping me out.</p>]]></content>
			<author>
				<name><![CDATA[nickmaynard]]></name>
				<uri>https://chipmusic.org/nickmaynard</uri>
			</author>
			<updated>2011-01-30T14:36:43Z</updated>
			<id>https://chipmusic.org/forums/post/52822/#p52822</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52812/#p52812"/>
			<content type="html"><![CDATA[<p>$4015 is the voice enable register and uses bits 0 to 4 to enable Pulse 1, Pulse 2, Triangle, Noise and DCM respectively.</p><div class="codebox"><pre><code>Binary    Hex Voice
%00000001 $01 Pulse 1
%00000010 $02 Pulse 2
%00000100 $04 Triangle
%00001000 $08 Noise
%00010000 $10 DCM</code></pre></div><p>To figure out the value to write to $4015 just add up the values. For example, to enable the two Pulse voices, you write $03 to $4015 ($01 + $02). The APU is generally initialised with a value of $0F which enables the first four voices ($01 + $02 +$04 +$08 = $0F).</p><p>DCM differs slightly in that it requires you to turn the voice off and back on again to actually play the sample. In Don&#039;s code, he&#039;s not using any of the other voices so he doesn&#039;t need to turn them on, hence the $00 write (and probably $10 somewhere further down the code to start the sample playing).</p><p>So for you, instead of writing #$00 to $4015, write #$0F. This leaves the first four voices on but clears the enable bit for DCM, as is required. Then to start the sample write #$1F to $4015.</p><p>Make sense?</p>]]></content>
			<author>
				<name><![CDATA[neilbaldwin]]></name>
				<uri>https://chipmusic.org/neilbaldwin</uri>
			</author>
			<updated>2011-01-30T09:05:23Z</updated>
			<id>https://chipmusic.org/forums/post/52812/#p52812</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/52809/#p52809"/>
			<content type="html"><![CDATA[<p>hey neil, if you&#039;ve got a second i have a quick question.</p><p>i want to include some dpcm samples in one of my programs. so, i checked out the source code of no carrier&#039;s program &quot;lickshot&quot; - <a href="http://www.no-carrier.com/index.php?/lickshot/" target="_blank">http://www.no-carrier.com/index.php?/lickshot/</a></p><p>it seems pretty easy to understand and i was able to get it working in my program just fine. but here&#039;s my problem. no carrier&#039;s code starts off by writing #$00 to $4015. this ends up muting whatever other audio i have going on in my program at that point. </p><p>i was working on a simple program where the buttons of the first player controller would play chords and single notes on the pulse and triangle channels, while the buttons of the second player controller would play drum sounds on the noise and dpcm channels. so, if the first player wants to hold a note out for an extended period of time, it gets silenced whenever the second player triggers one of the samples.</p><p>i was wondering what you&#039;d suggest in this instance. i&#039;m probably missing something extremely obvious. thanks for the help in advance!</p>]]></content>
			<author>
				<name><![CDATA[nickmaynard]]></name>
				<uri>https://chipmusic.org/nickmaynard</uri>
			</author>
			<updated>2011-01-30T07:31:12Z</updated>
			<id>https://chipmusic.org/forums/post/52809/#p52809</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/51540/#p51540"/>
			<content type="html"><![CDATA[<div class="quotebox"><cite>neilbaldwin wrote:</cite><blockquote><p>Looks like you&#039;ve got a grasp of it <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Reading and writing to the .sav file is pretty straightforward. One of the big advantages of using them is that it massively expands the available RAM. You can treat it like all the other RAM in the NES - just remember that any variables you put in there will be restored to the last saved value, unlike &#039;normal&#039; RAM which is volatile.</p></blockquote></div><p>woo! next step - adding this feature to my music programs. <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[nickmaynard]]></name>
				<uri>https://chipmusic.org/nickmaynard</uri>
			</author>
			<updated>2011-01-17T00:43:51Z</updated>
			<id>https://chipmusic.org/forums/post/51540/#p51540</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: NES Audio Programming]]></title>
			<link rel="alternate" href="https://chipmusic.org/forums/post/51536/#p51536"/>
			<content type="html"><![CDATA[<p>Looks like you&#039;ve got a grasp of it <img src="https://chipmusic.org/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>Reading and writing to the .sav file is pretty straightforward. One of the big advantages of using them is that it massively expands the available RAM. You can treat it like all the other RAM in the NES - just remember that any variables you put in there will be restored to the last saved value, unlike &#039;normal&#039; RAM which is volatile.</p>]]></content>
			<author>
				<name><![CDATA[neilbaldwin]]></name>
				<uri>https://chipmusic.org/neilbaldwin</uri>
			</author>
			<updated>2011-01-17T00:23:06Z</updated>
			<id>https://chipmusic.org/forums/post/51536/#p51536</id>
		</entry>
</feed>
