Saw Wave on DPCM channel w/ Famitracker

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

I want to get these waveforms on DPCM, and I want to know how to do that FamiTracker. If anyone can tell me how it would be cool and nice. :)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Saw Wave on DPCM channel w/ Famitracker

Post by lidnariq »

There's no prepackaged way to get that. However, Zeta0134 recently wrote a game and playback engine that pretends that a 1-channel Namco-163 using Famitracker module is the blargg-saw channel. See: https://github.com/zeta0134/z-saw
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Saw Wave on DPCM channel w/ Famitracker

Post by tepples »

You're in luck, as zeta0134 has prototyped a library called Z-Saw for turning blargg's sawtooth prototype into a practical solution usable in games. It's used for the background music in the game Tactus.

edit: beaten to it
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

Alright, I'll try Z Saw and see what happens
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

Uhh, so it's says to run "jsr zsaw_init" where is that? I assumed I'd find it using a debugger, but there was no luck
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Memblers »

It's awesome to see this being used, I think about blargg's DMC synth demo all the time.
FloResolution wrote: Tue Dec 27, 2022 9:40 am Uhh, so it's says to run "jsr zsaw_init" where is that? I assumed I'd find it using a debugger, but there was no luck
I found it searching github, line 41 of zsaw.s is the code. zsaw.inc is where zsaw_init is declared with .global
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

Memblers wrote: Tue Dec 27, 2022 3:59 pm I found it searching github, line 41 of zsaw.s is the code. zsaw.inc is where zsaw_init is declared with .global
How do I make it declare? Or initialize the code on zsaw.s
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Memblers »

FloResolution wrote: Tue Dec 27, 2022 5:20 pm
Memblers wrote: Tue Dec 27, 2022 3:59 pm I found it searching github, line 41 of zsaw.s is the code. zsaw.inc is where zsaw_init is declared with .global
How do I make it declare? Or initialize the code on zsaw.s
demo.s shows how to use zsaw.s, though most of it is the note sequence and video stuff, everything else is there, too.

When you include zsaw.inc in your program, that allows all the label names. zsaw.s will be assembled separately into .o files, then linked by ld65 (as shown in build.sh).
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

Oh wait, so I guess on zsaw.s, zsaw_init needs to be declared. On zsaw.inc it's declared globally.

Now I want to figure out how the nmi_handler is exported, to be imported to zsaw.s
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Memblers »

FloResolution wrote: Fri Dec 30, 2022 10:07 pm Now I want to figure out how the nmi_handler is exported, to be imported to zsaw.s
In demo.s that happens at line 91, .export nmi_handler, after nmi_handler is defined.
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

Well I'm still stuck, can some give me an explanation on how I'm supposed to (run jsr zsaw_init) bc it's just really confusing me :(
User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 569
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Jarhmander »

Just in case, what are you trying to achieve? Whatever you want to do has to be in a NES program (*.nes file); you can't do this in an NSF file, because you can't use (*) IRQs in NSF files, and the DMC sawtooth waves heavily relies on them.

*: being pedantic, but in an NSF file you can rely on IRQ flags being set (example: frame IRQ flag), but you have no control over the IRQ vector, and you shouldn't play with IRQs or even use any sei/cli instructions. It's not allowed, and will likely break any hardware player.
((λ (x) (x x)) (λ (x) (x x)))
FloResolution
Posts: 20
Joined: Mon Dec 26, 2022 7:00 pm
Location: Maryland, U.S

Re: Saw Wave on DPCM channel w/ Famitracker

Post by FloResolution »

I was mentioning the last step on the zsaw setup
User avatar
Jarhmander
Formerly ~J-@D!~
Posts: 569
Joined: Sun Mar 12, 2006 12:36 am
Location: Rive nord de Montréal

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Jarhmander »

I understood that bit, but I was making sure you didn't attempt to make an NSF out of it.
((λ (x) (x x)) (λ (x) (x x)))
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Saw Wave on DPCM channel w/ Famitracker

Post by Memblers »

Can you post the error message you get from CA65 or LD65, and the commands used to build the program?

CA65 will surely complain if you don't .include "zsaw.inc". And LD65 will surely complain if you don't link your program with zsaw.o. I'm not sure in this case, but you might need to list zsaw.o before your own .o file. Like "ld65 -o mytest.nes -C nrom.cfg zsaw.o mytest.o"
Post Reply