FamiTone2 audio library
Moderator: Moderators
FamiTone2 audio library
Download FamiTone2
The original FamiTone got a major update, with data formats change and player and tools code rewrite. The most important improvements are:
- Built-in FamiTracker text export support instead of the old TextExporter plug-in
- Faster code
- Smaller data size
- Tempo support
- Full NTSC/PAL support, with pitch and speed compensation
The original FamiTone got a major update, with data formats change and player and tools code rewrite. The most important improvements are:
- Built-in FamiTracker text export support instead of the old TextExporter plug-in
- Faster code
- Smaller data size
- Tempo support
- Full NTSC/PAL support, with pitch and speed compensation
Re: FamiTone2 audio library
Dendy support too?
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: FamiTone2 audio library
Which assemblers are supported, which expansion audio is supported, and can any other formats be imported (such as MML or Csound)?
[url=gopher://zzo38computer.org/].[/url]
Re: FamiTone2 audio library
From readme.txt:zzo38 wrote:Which assemblers are supported
From text2data.cpp:text2data outputs data in NESASM format by default, you can use -ca65 or -asm6 switches to get output for these assemblers.
Code: Select all
#define OUT_NESASM 0
#define OUT_CA65 1
#define OUT_ASM6 2
Doesn't look like any. From text2data.cpp:which expansion audio is supported
Code: Select all
#define MAX_PACKED_PATTERNS (5*MAX_ORDER*MAX_SUB_SONGS)
From nsf2data.cpp:
Code: Select all
if(nsf_data[0x7b])
{
printf("Expansion chips are not supported\n");
free(nsf_data);
return 1;
}
I see something that appears designed for sound effects in FamiTracker NSFs, but not much more.and can any other formats be imported (such as MML or Csound)?
Re: FamiTone2 audio library
Is it really necessary to quote random code pieces and make guesses when everything is clearly stated in the readme.txt, and is not changed since the original version? Please understand, I don't need any docs by myself, I spend quite some time and effort to write them for your convenience. Please read them.
line 14 of the readme.txt wrote:Expansion sound chips are not supported.
'How to use the library' section wrote:The main version of the FamiTone2 is written in NESASM. There are
versions for CA65 and ASM6 assemblers included in the package as well.
No. It is clearly explained in the readme.txt which formats are supported and how it all works. It is possible to use other import sources, but you'll have to write your own converter, which is a good half of the whole thing.zzo38 wrote:can any other formats be imported (such as MML or Csound)
Re: FamiTone2 audio library
I'm having trouble getting this to work with cc65. I have sound effects working fine, but I can't get music to work at all.
This line of code is what *SHOULD* play the music:
Here is the function definition for music_play (I DID modify it slightly):
Is there something I'm missing?
This line of code is what *SHOULD* play the music:
Code: Select all
if(controllerInput&PAD_START) music_play(music_test);
Code: Select all
_music_play:
stx <PTR
tax
ldy <PTR
jmp FamiToneMusicPlay
You know, the DevSound guy.
There are two kinds of people in this world: those who are convinced there are two kinds of people in this world, and those who aren't. - Unknown
There are two kinds of people in this world: those who are convinced there are two kinds of people in this world, and those who aren't. - Unknown
- rainwarrior
- Posts: 8006
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: FamiTone2 audio library
If music_play is a fastcall function with one parameter, that parameter is in A. What are you doing with X?
Re: FamiTone2 audio library
The confusion maybe stems from the fact that in FamiTone1, FamiToneMusicStart took a 16-bit parameter (pointer to the music data), whereas in FamiTone2 FamiToneMusicPlay takes a single byte (sub song number).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: FamiTone2 audio library
What exactly do I need to do in order to get a song to play with cc65?
You know, the DevSound guy.
There are two kinds of people in this world: those who are convinced there are two kinds of people in this world, and those who aren't. - Unknown
There are two kinds of people in this world: those who are convinced there are two kinds of people in this world, and those who aren't. - Unknown
- rainwarrior
- Posts: 8006
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: FamiTone2 audio library
Your _music_play function is broken, is what I was saying. I don't know where you got that from, as it does not appear to be part of FamiTone2.
The first question is whether it is declared correctly. If it takes one parameter in A, it should be declared like this:
The second problem is the contents of your _music_play routine. There is no useful value in X when it music_play is called from C, so storing it is counter-productive. Similarly, I don't know what you're doing with X or Y before you call FamiToneMusicPlay, which according to the readme takes a single parameter in A. Your _music_play should just look like this:
The rest of how to use it is in the readme, from what I can tell. Did you initialize it?
The first question is whether it is declared correctly. If it takes one parameter in A, it should be declared like this:
Code: Select all
extern void __fastcall__ music_play(unsigned char a);
Code: Select all
_music_play:
jmp FamiToneMusicPlay
Re: FamiTone2 audio library
Yes, thanks! I really didn't have any problems with version 1 but I appreciate the work that went in the text export support and better performance.
This is a block of text that can be added to posts you make. There is a 255 character limit.
Re: FamiTone2 audio library
With these changes, Dendy can be supported by separating out tempo and pitch. Note the different input spec of A for FamiToneInit
Edit: typo
Code: Select all
--- famitone2.s 2014-02-03 11:15:22.886592429 -0500
+++ famitone2-edit.s 2014-02-03 11:17:29.781515804 -0500
@@ -209,7 +209,7 @@
;------------------------------------------------------------------------------
; reset APU, initialize FamiTone
-; in: A 0 for PAL, not 0 for NTSC
+; in: A bit 7 is frame rate. bit 6 is pitch. 0 for PAL, 1 for NTSC
; X,Y pointer to music data
;------------------------------------------------------------------------------
@@ -221,10 +221,7 @@
sty <FT_TEMP_PTR_H
.if(FT_PITCH_FIX)
- tax ;set SZ flags for A
- beq @pal
- lda #64
-@pal:
+ and #192 ; mask out other bits
.else
.if(FT_PAL_SUPPORT)
lda #0
@@ -374,8 +371,8 @@
bne @set_channels
- lda FT_PAL_ADJUST ;read tempo for PAL or NTSC
- beq @pal
+ bit FT_PAL_ADJUST ;read tempo for PAL or NTSC
+ bpl @pal
iny
iny
@pal:
@@ -580,6 +577,7 @@
adc FT_CH1_NOTE_OFF
.if(FT_PITCH_FIX)
ora FT_PAL_ADJUST
+ and #127 ;zero out bit 7
.endif
tax
lda FT_CH1_PITCH_OFF
@@ -613,6 +611,7 @@
adc FT_CH2_NOTE_OFF
.if(FT_PITCH_FIX)
ora FT_PAL_ADJUST
+ and #127 ;zero out bit 7
.endif
tax
lda FT_CH2_PITCH_OFF
@@ -646,6 +645,7 @@
adc FT_CH3_NOTE_OFF
.if(FT_PITCH_FIX)
ora FT_PAL_ADJUST
+ and #127 ;zero out bit 7
.endif
tax
lda FT_CH3_PITCH_OFF
@@ -1010,8 +1010,8 @@
.if(FT_PITCH_FIX)
- lda FT_PAL_ADJUST ;add 2 to the sound list pointer for PAL
- bne @ntsc
+ bit FT_PAL_ADJUST ;add 2 to the sound list pointer for PAL tempo
+ bmi @ntsc
inx
bne @no_inc1
iny
Last edited by JRoatch on Wed Feb 05, 2014 11:15 am, edited 1 time in total.
Re: FamiTone2 audio library
Tempo support makes this a huge improvement. Thank you Shiru!
Re: FamiTone2 audio library
I translated the FamiTone2 library to the assembler format used by Ophis. Because Ophis does not support conditional compilation (ifdef, etc.), I simply left all features enabled.
Total library size is 1632 bytes, including 259 bytes of data. Song data for my project is 20% smaller than the previous version of FamiTone.
Total library size is 1632 bytes, including 259 bytes of data. Song data for my project is 20% smaller than the previous version of FamiTone.
- Attachments
-
- famitone2ophis.asm
- (27.16 KiB) Downloaded 251 times