Greetings All and Happy 2014!

FamiSlayer is a slave player for NSF files exported from FamiTracker.

All information is on the website, too lazy to retype all the features here.

Check out the video to see how I was able to use it to sync LSDJ with the NSF playing on the NES using just original hardware and 2 alligator clips.

Disclaimer: I am no expert.

It seems to have been working with the different NSF's during testing, but would love to see if someone else can duplicate the results.

Would also be cool to see what else could be used to clock the NES with as well.

Last edited by HeavyW8bit (January 12, 2014 3:41 pm)

HeavyW8bit wrote:

Would also be cool to see what else could be used to clock the NES with as well.

Sweet! ...it would be easy to tweak the code in my FamiiDI project to take MIDI clock messages and translate them into 'trigger' button presses for FamiSlayer!

Also, by tweaking the FamiSlayer code a little to read control messages from Controller 2 as well, I could easily assign MIDI Start / Stop etc messages to:

    A    Play/Pause
    B    Stop
    UP    Increase Song Number
    DOWN    Decrease Song Number
    START    *Restart Song from begining
    RIGHT    *Fast Forward (Jumps to the begining of the next frame)
    LEFT    *Rewind (Resets back to the begining of the current frame)

(and I guess move the 'trigger' button to be Select instead of Start)

Enclaimer: I'm an expert. (I'm an expert at making up words as well.)

Another thing that could be used for syncing is the DIN sync output of a drum machine or TB-303.

I was going to suggest reading the joypad more often than the regular every VBlank, but you're already doing that. Good. However, I think (from reading the source code) that your joypad check routine is buggy in how it handles multiple, For example, I think if you say, hold up permanently pressed, and then press start, that the start button press will be registered as an up press.

There's a way to solve this to create a trigger mask sing XOR then AND. Pseudo code, in a more Z80-ish syntax:

call READPAD         ; Let's sy this function returns the currently pressed keys in A
ld   B,A             ; Save current mask for later (copy to B)
ld   A,[OLDJOYPAD]   ; Get previous joypad state (load to A)
xor  A,B             ; XOR with current state to detect any changed buttons (target: A)
and  A,B             ; AND with current state to only store currently pressed (ie newly pressed) buttons
ld   [JOYTRIGGER],A  ; Save trigger mask
ld   A,B             ; Load B into A
ld   [OLDJOYPAD],A   ; Save current state as old state for the next comparison

Now check all bits in JOYTRIGGER.

Another idea: You could make the program have a master mode as well. In this mode, the joypad is only checked once every frame (or more exactly, once every player tick, if a song should happen to use a different sync source than VSync (NMI). (The sync source must be internal in this mode.) This would read out the controller like normal, but it would also have the side effect of ending out 8 clock pulses, one per bit that is being read. If you connect the NES controller clock line to the Gameboy's clock line, (and ground-ground of course) these 8 bits will be read by the Ganeboy as an incoming byte on the serial port. In LSDj's MIDI mode, this will be enough to synch the song.

WOW! this rocks! any options for syncing NSFs made with ppMCK? or is it fami only? Also what kind of clock is nano mode producing? Any way of simplifying it into just a small circuit? I ask cause I don't need or care to use lsdj but would like to be able to control the tempo manually like that.

Great work!

TylerBarnes wrote:

what kind of clock is nano mode producing? Any way of simplifying it into just a small circuit? I ask cause I don't need or care to use lsdj but would like to be able to control the tempo manually like that.

nanoloop sync has 12 clock pulses per quarter note, so it's basically an analogue clock signal.
i'd guess any super simple square wave oscillator (eg 40106 or 555) can be hooked up instead of the gameboy, so you can turn a pot to change speed. Won't be tunable to exact BPMs tho.  Hell, maybe even two NES can be hooked up at the same time to beatmatch and DJ...

shizcake wrote:

Hell, maybe even two NES can be hooked up at the same time to beatmatch and DJ...

That's my plan exactly ;P

40106 generator was my hope, glad to hear that's a possibility. I wonder what the duty cycle is like, or if it even cares how wide it is.

i don't think it cares, but i'm not sure. I found that nanoloop is just looking for a rising edge, but this may not be relevant here.

but as lsdj is set to nanosync, it'll probably put out something this: http://gieskes.nl/master-clock-generato … ignals.php
so 50/50 pulsewidth should be ok.

btw, in case you want the whole shebang midi sync'd, PM me. I have recently whipped up something using little-scales excellent midi sync tutorial. The box has 4 midi thrus and 5 analog clock outputs, one of which sends nanoclock.

Thanks everyone for checking it out.

@uxe Your FamiiDI project is awesome! When I saw your post, it totally inspired me to get the ENIO board. It just came in the mail today, cant wait to mass around with it.  Moving the controls to controller 2 to work with FamiiDi should be easy enough.

@nitro2k01: Great idea on the master option.  I see what you are saying about checking against the old button state code.  But I think that if they press start while pressing up, then it will register the New state as Up & Start and will then pass the check because it is a different button state I think. I believe in that case then both the Start and Up code would both get triggered when ANDing the button state against each button.  I will def try out your algorithm, thanks for the heads up!

@TylerBarnes Try it with your NSF's.  Only the Rewind, Fast Forward and Restart options were developed specifically for FamiTracker NSF driver.  But the sync and change of song number should still work I think.

@DSC Thanks man!  I know I still owe you a beatbox!

This is too awesome! With uXe's AVR hardware and your sync code it's like the 'Perfect Storm', rolling in your Atari Seq Kit mod and my head is swimming smile What a New Years
Yogi

yogi wrote:

This is too awesome! With uXe's AVR hardware and your sync code it's like the 'Perfect Storm', rolling in your Atari Seq Kit mod and my head is swimming smile What a New Years
Yogi

Yogi, when / if you do end up building an interface based on that code we finally settled on in the FamiiDI thread, all you'd need to add to generate Nanoloop clock (12 pulses per quarter note) from MIDI clock (24 ppqn) is:

if (MIDI.getType() == Clock)
  DDRB ^= bitMask[0]; // Toggle 'Start Button' Bit

big_smile

Edit: Oh, and get rid of the 'MIDI.getType() < B11110000' condition! (I added that in to filter out System messages because I was only interested in Note / Pitch Bend messages)

Last edited by uXe (January 7, 2014 12:26 am)

uXe wrote:
yogi wrote:

This is too awesome! With uXe's AVR hardware and your sync code it's like the 'Perfect Storm', rolling in your Atari Seq Kit mod and my head is swimming smile What a New Years
Yogi

Yogi, when / if you do end up building an interface based on that code we finally settled on in the FamiiDI thread, all you'd need to add to generate Nanoloop clock (12 pulses per quarter note) from MIDI clock (24 ppqn) is:

if (MIDI.getType() == Clock)
  DDRB ^= bitMask[0]; // Toggle 'Start Button' Bit

big_smile

Edit: Oh, and get rid of the 'MIDI.getType() < B11110000' condition! (I added that in to filter out System messages because I was only interested in Note / Pitch Bend messages)

Thanks for the heads up. Yes, I'm building but waiting on the 'Arduinos' from HK (think  they'r here but waiting on my postman to re-deliver. left a re-deliver slip on Sat. Didn't even try to knock on the door!!).
Yogi

Quick update, was able to get the Commodore 64 to clock the NES using the user port on the C64.  Will post the code after I get a chance to clean it up a bit.

So far I am loving how this combo sounds. Think this might end up being my new live setup.

Really helpful, nice job. Sounding awesome too... Might be an idea to look into creating small kits excluding most of the junky DIY (other wires from the link cable, what you can of the NES controller), could be more reliable (no open connections).

Sorry if this is a dumb question but what program are you running on the commodore?

dc6v wrote:

Really helpful, nice job. Sounding awesome too... Might be an idea to look into creating small kits excluding most of the junky DIY (other wires from the link cable, what you can of the NES controller), could be more reliable (no open connections).

@dc6v: Thanks! Sounds like a good idea.  I'm still experimenting, but after that is done def want to make some more permanent type connectors between the systems.

Adil Soubki wrote:

Sorry if this is a dumb question but what program are you running on the commodore?

@Adil Soubki: I use Goattracker to write the music, and the 1541 Ultimate II to load the file on the C64.  To sync it with the NES, just had to write a playback program that sends a pulse out through the user port with each step of the song.