Problems with Famitone

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Problems with Famitone

Post by andreasswf »

Hi there! This is my first post in this forum. I have just started trying to learn to program in assembly and I would like to add a simple background music into my game.
I have composed a song in famitracker and exported it as a .txt. On the readme file of famitone it says to run text2data.exe and it would create a .asm of my music.
When I try to launch text2data.exe a cmd window pops up and dissapears in the blink of an eye and no files are created. What am I doing wrong?
I just want to add code to my project to make my short music play and loop constantly. Simple as that.

Please help me!
Attachments
source.zip
(166.31 KiB) Downloaded 125 times
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Problems with Famitone

Post by tepples »

andreasswf wrote:When I try to launch text2data.exe a cmd window pops up and dissapears in the blink of an eye and no files are created. What am I doing wrong?
More than likely you aren't providing any file names on the command line.

How do I shot Command Prompt?
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Problems with Famitone

Post by GradualGames »

It's good advice to learn how to use the commandline, but for simple tools that require only a single file name as an argument, you might be able to drag your txt file to the exe. Depending on the utility, it'll drop your asm file either in the directory of the file you converted, or in the directory of the exe itself. (those are two common cases anyway)
andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Re: Problems with Famitone

Post by andreasswf »

I cant write anything on the command line because cmd shuts down as I open it. I've tried draggin the .txt onto text2data.exe but that doesnt do jack :/
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: Problems with Famitone

Post by Kasumi »

You mean that if you open an actual command prompt window, it closes automatically?

i.e. start, run, cmd, enter either doesn't give you a window, or it just closes immediately once it has opened? (Note that these instructions are not the same as double clicking an exe.) That's... potentially a larger a problem. But context (the fact that you've used NESASM to build a rom) suggests nothing should prevent you from using text2data. In fact double clicking NESASM3 will have the exact same result as double clicking text2data. That's why you have background.bat created.

You could try making a .bat for text2data. As a test, create a new .txt file in the same folder as text2data.exe. In the txt file, type

Code: Select all

text2data
PAUSE
and save it as "test.bat".

Double click it. What happens?

Edit: More things. Is there any reason you're using famitone and not famitone2? You can get famitone2 from here if there's not a specific reason you're using regular famitone. I was only able to get famitone's text2data to work (using a different song) with an old version of famitracker (0.3.6), and your file cannot be opened with it as it was created in a newer version of famitracker. The .txt output format seems to have changed, and the plugin gives unhandled exceptions when used with the latest famitracker on my computer.

Regardless of that, you're using the effects column when you shouldn't be. That is that your V62 and V01 effects on the first row, and all similar things throughout the song aren't in the famitone standard. After removing all of those effect and reexporting the text I was able to successfully get a music.asm file from it using famitone2's text2data. You can even click and drag, but that only works if there's no errors. Learning command prompt or using a .bat allows you to see the errors so you can fix them. For instance, when you give your music.txt to famitone2's exporter, it says this:

Code: Select all

Output format: NESASM, all songs in single file
Input format: FamiTracker export
4Parsing error (song:01 pos:00 row:00 chn 0): Unsupported effect
Edit2: Obviously removing all the effects greatly changes how the song sounds. The idea with famitone(2) is to use the instruments and not the effects columns. For instance, your instrument 00 could have the Duty/Noise box checked, with a sequence that sets Duty to one. Then V01 in your Pulse 1 column could be removed. But this will also affect your noise channel, since that also uses instrument 00, so you need to make a new instrument without this change and set your noise channel notes to this instrument. Your vibratos will need to be recreated with pitch envelopes, etc.
andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Re: Problems with Famitone

Post by andreasswf »

Okay, so I should download an older version of famitracker and a newer version of famitone? And remove all my effects on my song? Too bad effects can't be used on famitone... Will make a pretty dull song when I choose to load one of my more complex songs...
User avatar
dougeff
Posts: 2876
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Problems with Famitone

Post by dougeff »

Famitone2 's text2data converter should work with the 2 most current versions of famitracker...as long as you remove unsupported effects. (I think the 'older version' was specific to Famitone 1).

I think you can simulate a volume column by writing additional volume envelopes that peak at 8 or 4 (for example) rather than f. Maybe.

What effects do you need? (just curious because we have been talking about music code lately).
nesdoug.com -- blog/tutorial on programming for the NES
andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Re: Problems with Famitone

Post by andreasswf »

Kasumi wrote:You mean that if you open an actual command prompt window, it closes automatically?

i.e. start, run, cmd, enter either doesn't give you a window, or it just closes immediately once it has opened? (Note that these instructions are not the same as double clicking an exe.) That's... potentially a larger a problem. But context (the fact that you've used NESASM to build a rom) suggests nothing should prevent you from using text2data. In fact double clicking NESASM3 will have the exact same result as double clicking text2data. That's why you have background.bat created.

You could try making a .bat for text2data. As a test, create a new .txt file in the same folder as text2data.exe. In the txt file, type

Code: Select all

text2data
PAUSE
and save it as "test.bat".

Double click it. What happens?

Edit: More things. Is there any reason you're using famitone and not famitone2? You can get famitone2 from here if there's not a specific reason you're using regular famitone. I was only able to get famitone's text2data to work (using a different song) with an old version of famitracker (0.3.6), and your file cannot be opened with it as it was created in a newer version of famitracker. The .txt output format seems to have changed, and the plugin gives unhandled exceptions when used with the latest famitracker on my computer.

Regardless of that, you're using the effects column when you shouldn't be. That is that your V62 and V01 effects on the first row, and all similar things throughout the song aren't in the famitone standard. After removing all of those effect and reexporting the text I was able to successfully get a music.asm file from it using famitone2's text2data. You can even click and drag, but that only works if there's no errors. Learning command prompt or using a .bat allows you to see the errors so you can fix them. For instance, when you give your music.txt to famitone2's exporter, it says this:

Code: Select all

Output format: NESASM, all songs in single file
Input format: FamiTracker export
4Parsing error (song:01 pos:00 row:00 chn 0): Unsupported effect
Edit2: Obviously removing all the effects greatly changes how the song sounds. The idea with famitone(2) is to use the instruments and not the effects columns. For instance, your instrument 00 could have the Duty/Noise box checked, with a sequence that sets Duty to one. Then V01 in your Pulse 1 column could be removed. But this will also affect your noise channel, since that also uses instrument 00, so you need to make a new instrument without this change and set your noise channel notes to this instrument. Your vibratos will need to be recreated with pitch envelopes, etc.
I would like to say thank you for the tip in creating a bat file with a simple command, which made me understand that in the readme file of famitone2 where it says (text2data music.txt) it means that i should type that in a.txt and save it as a .bat.
I now have a music.asm with my music code in it! Now I'm going to work out how to make it into my background.asm (my game code) and make the music load and play in the rom!

Dougeff, well 4xx makes vibrato, which is nice, and sometimes i use the 0xx for some nice chords to accompany melody :)
User avatar
dougeff
Posts: 2876
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Problems with Famitone

Post by dougeff »

I think effect 0xx (arpeggio) is supported.And Kasumi said "Your vibratos will need to be recreated with pitch envelopes". So, you could be ok.

Edit: no arp effects
Last edited by dougeff on Fri Dec 04, 2015 4:12 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Re: Problems with Famitone

Post by andreasswf »

Okay, cool =) Now I'm just going to figure out how to get this into my main code/ my main .asm which is background.asm. It says in the readme to include music.asm and famitone.asm. When i type .include "music.asm" i get no problems, but when i also do .include "famitone.asm" it shows up compile errors UNDEFINED SYMBOL IN OPERAND FIELD :/
Attachments
source.zip
(200.41 KiB) Downloaded 97 times
User avatar
dougeff
Posts: 2876
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Problems with Famitone

Post by dougeff »

Actually, I misread the readme....

Arpeggio sequences are supported.

Arpeggio effects are not. (0xx won't work).
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 2876
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Problems with Famitone

Post by dougeff »

UNDEFINED SYMBOL IN OPERAND FIELD
Yeah, you have to 'uncomment' some of the variable definitions to get it to work. Let me see if I have a working file to show you...
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
dougeff
Posts: 2876
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Problems with Famitone

Post by dougeff »

OK, I only spent a few minutes on this, (and I use asm6), but this is essentially how you get the music to work.

uncomment all the variables at the top of famitone2.asm...(remove the semicolons), like this...

Code: Select all

 FT_BASE_ADR		= $0300	
 FT_TEMP			= $00	
 FT_DPCM_OFF		= $c000	
 FT_SFX_STREAMS	= 4		
 FT_DPCM_ENABLE	= 0 ;if no samples
 FT_SFX_ENABLE	= 0 ;if no sfx
 FT_THREAD		= 1
 FT_PAL_SUPPORT	= 1	
 FT_NTSC_SUPPORT	= 1


Then at the startup code insert this...

Code: Select all

	lda #1 ;not 0 for NTSC
	ldx #<Song ;low
	ldy #>Song ;high
	jsr FamiToneInit
	lda #0
	jsr FamiToneMusicPlay
Sorry (edit) you're using NESASM, it should look like this...

Code: Select all

LDX #low(Song)
LDY #high(Song)
Somewhere below the code include your song data with the label "Song:".

And somewhere in the infinite loop, to be done once per v-blank (perhaps in the NMI code, since your code goes like this Forever: JMP Forever...do this...

Code: Select all

jsr FamiToneUpdate
Hope that helps.

Also, I got a pitch sequence to work like a vibrato...
5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5

It could use some adjustment to make it sound a little better.
Last edited by dougeff on Mon Dec 14, 2015 1:27 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: Problems with Famitone

Post by Kasumi »

andreasswf wrote:I would like to say thank you for the tip in creating a bat file with a simple command, which made me understand that in the readme file of famitone2 where it says (text2data music.txt) it means that i should type that in a.txt and save it as a .bat.
For completeness, that's not exactly what it means. It's just one way to do it. What a .bat does is send things one line at a time to command prompt.

If you open command prompt and type the things, you get the same result.
Image
Tepples' link explains this in more detail.
andreasswf
Posts: 17
Joined: Thu Dec 03, 2015 3:44 am
Location: Sweden

Re: Problems with Famitone

Post by andreasswf »

dougeff wrote:OK, I only spent a few minutes on this, (and I use asm6), but this is essentially how you get the music to work.

uncomment all the variables at the top of famitone2.asm...(remove the semicolons), like this...

Code: Select all

 FT_BASE_ADR		= $0300	
 FT_TEMP			= $00	
 FT_DPCM_OFF		= $c000	
 FT_SFX_STREAMS	= 4		
 FT_DPCM_ENABLE			
 FT_SFX_ENABLE			
 FT_THREAD				
 FT_PAL_SUPPORT			
 FT_NTSC_SUPPORT


Then at the startup code insert this...

Code: Select all

	lda #1 ;not 0 for NTSC
	ldx #<Song ;low
	ldy #>Song ;high
	jsr FamiToneInit
	lda #0
	jsr FamiToneMusicPlay
Sorry (edit) you're using NESASM, it should look like this...

Code: Select all

LDX #low(Song)
LDY #high(Song)
Somewhere below the code include your song data with the label "Song:".

And somewhere in the infinite loop, to be done once per v-blank (perhaps in the NMI code, since your code goes like this Forever: JMP Forever...do this...

Code: Select all

jsr FamiToneUpdate
Hope that helps.

Also, I got a pitch sequence to work like a vibrato...
5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5 5 3 0 -3 -5 -5 -3 0 3 5

It could use some adjustment to make it sound a little better.
Thank you for putting the time to make me understand what to do.. I am making progress for sure :P
When you said "Somewhere below the code include your song data with the label "Song:"."
How would i type this? Not like .include "music.asm"? (I've named my music data .asm "music.asm"
and on

Code: Select all

LDX #low(Song)
LDY #high(Song)
should I make it

Code: Select all

LDX #low(music)
LDY #high(music)
Post Reply