Offline
Texas

I've been looking at various ways of doing things - From trying to find a MIDI sync option for NSFs to looking at the projects that rip out the 2A03 from the NES.

I noticed ninstrument lists Pulsar and MCTRL as working together. While I prefer Famitracker over LSDJ, I think this might be workable at this point. I'm missing the NES too much.

So I was mostly curious as to if folks are able to use MIDI sync via MCTRL with Pulsar in much the same way LSDJ works using various ArduinoBoy incarnations (basically play/stop and clock sync)? Or does anyone know of a method to do the same thing with NSFs, say, using the PowerPak?

Offline
Los Angeles, CA

Famislayer plus FamiiDI

Has been explored, and would probably work, I know I'm interested.

Offline
Jelly Stone park, MD USA

Hi mOOdawg
Don't know if you are aware of FamiSync by HeavyW8bit. it's a mod to VegaPlay by No-Carrier. Both versions allow you to load a NSF file into a NES prg rom that can be flashed to a cart (or used with a EMU or PowerPak).
http://www.heavyw8bit.com/famislayer.php
FamiSync adds control of the NSF frame playback as well as transport. The sync is triggered by input to a controller button. So by adjusting the rate of the pulse stream to the GamePad you can change the Tempo of the NSF.

The MCTRL is configurable so it should be able to do the Midi Clock to Trigger conversion (it may already be an option, I don't know).
Also uXe has a Arduino shield, FamiDi, that allows midi messages to trigger GamePad buttons much like the MCTRL. This also could be used.
http://chipmusic.org/forums/topic/12998 … interface/

If you are looking to use a NFS directly on the PowerPak you would have to mod the NSF mapper code to allow sync input I believe. And Pulsar may use a different technique, don't know the specifics they worked out (Pulsar has a refresh rate of 180Hz where as most NSFs are 60Hz)
yogi

Offline
Texas

Hi Yogi!

Yep I've reached a similar conclusion after Mrwinner provided some links. I think FamiSync + PowerPak + FamiDI would work well! I wonder if I can sort of combine efforts and use 1 Arduino for both ArduinoBoy and the pulse output to the NES. It's too soon to say though. I use a stage-hardened custom ArduinoBoy with a noise rejection circuit for the GB called StageBoy and being able to add in NES support in a revision 2 would be awesome, and also keep things less cluttered on stage.

Anyways don't want to get off-topic - this solution sounds like it is exactly what I'm looking for! I still need to read through all the information but yeah it looks like a workable solution exists. That makes me stoked! I love the GB and LSDJ but I've been missing that NES sound for our live shows and have been really wanting it back.

Offline
Unsubscribe

You could also always do an audio to midi clock thing:

http://www.redsound.com/products/SoundBITEMicro.html

Save on all the devices.

Offline
Texas

I'm not entirely sure what that thing actually does tongue Is it listening to audio and then matching BPM to a sync out?

Our setup is kinda complex - we use a GameBoy (LSDJ) with a MidiBox SID and MidiBox FM and then also do live playing of (usually acoustic) instruments on top. As a result, I need some level of MIDI sync, which is usually handled right now via Reaper. I'd like to switch to using a hardware playback device, like a MidiBox MIDIO128 but I haven't made too much headway on that yet.

Adding in the NES to the MIDI chain won't be really a big deal. As it's just clock sync I'll probably mod my current StageBoy to see if I can use MIDI Thru and then hook up whatever interface I end up with on the NES to that. The primary blocker was an NSF player that could respond to a clock, preferably with some transport controls (so it starts playing when it sees the first clock pulse).

Offline
Jelly Stone park, MD USA
m00dawg wrote:

Hi Yogi!

Yep I've reached a similar conclusion after Mrwinner provided some links. I think FamiSync + PowerPak + FamiDI would work well! I wonder if I can sort of combine efforts and use 1 Arduino for both ArduinoBoy and the pulse output to the NES. It's too soon to say though. I use a stage-hardened custom ArduinoBoy with a noise rejection circuit for the GB called StageBoy and being able to add in NES support in a revision 2 would be awesome, and also keep things less cluttered on stage.

Not being familiar with the Arduinoboy code it's hard for me to judge, but for Sync only you would only need a single pin, if you add Start/Stop control another pin.
If Adrinoboy does a Thru function, could maybe have a function that watches the bytes being sent to the Tx buffer and trigger on 0xF8 (midi clock Tick) or 0xFA, 0xFB or 0xFC (midi Start, Continue or Stop).
On the hardware side I'm working on a 16F628 interface for a game pad similar to uXe's but lower cost. As well as a re-written Vega/Sync Play package for a SNROM, 7-32K NSFs per 256K PRG; it's still in a testing phase. so more to come!! Here is a preview test post @ NESDEV
http://forums.nesdev.com/viewtopic.php?f=6&t=11322
https://www.dropbox.com/sh/g6osy6uozook … -yjh_7WJUa
Yogi

Offline
Texas

Yeah I'm trying to compile all this somewhat disparate data together. It looks like most solutions are just sending pulses? So all I would need is to add in the NES output section to the routine that handles LSDJ slave output to the GameBoy, maybe plus start/stop - I think smile

While I've made some updates to the ArduinoBoy code to better fit my needs for my custom one, I haven't dug super deep. But it looks like there is room to spare as far as code size and processing power to add in the NES functions.

Last edited by m00dawg (Jun 27, 2014 4:44 pm)

Offline
Unsubscribe
m00dawg wrote:

I'm not entirely sure what that thing actually does tongue Is it listening to audio and then matching BPM to a sync out?

Thats right. You can have the nes be clock master, and then sync midi clocked devices down the chain. It also has a lil sampler in it as well.

Offline
Jelly Stone park, MD USA
m00dawg wrote:

Yeah I'm trying to compile all this somewhat disparate data together. It looks like most solutions are just sending pulses? So all I would need is to add in the NES output section to the routine that handles LSDJ slave output to the GameBoy, maybe plus start/stop - I think smile

Well I was thinking that by watching the bytes sent out (if midi Thru is part of Arduinoboy code) a sync function would work with both the Arduinoboy in Master or Slave mode. Otherwise you will only output sync when the GB is slave, which may be fine also (?).

The basics of the timing:
Most NSFs are played within the NMI at a refresh of 60Hz. which works out to 3600 calls to the play frame address per Min.
This is the same as a Midi clock running at 150 BPM. The midi Clock messages occur at 24 ppqn, so at 150 BPM: 150 x 24 (ppqn) = 3600 tick bytes per Min. What I'm driving at is with a Clock running at 150 BPM your NSF should sound 'normal'. So there is no heavy math in the firmware, just detect the Midi Tick byte and pulse the trigger button.

The other issue is the connection to the CD4021 in the GamePad. The Buttons are active low logic; I.E. when 'Open' a 10K R pulls the pin high, Closed to GND. So to drive the 4021 pin we need to setup our uC for Open Drain: a 1 = Pin as Input, 0 = active GND. To press a button we Output a 0 and to release, idle the Pin as a Input (neither sourcing or sinking);
1. During Init, set output Pin latch data to 0 for each GamePad button we want.
2. Then switch Pin between Input and Output for triggering a button (output to trigger, input for release). Beware: with the PIC, there are issues with the Read-Modify-Write structure of the ports, but I don't think the AVRs suffer from this.

For Start/Continue/Stop just need to switch the 2nd Pin direction according to the received message; Start/Continue = button pressed, Stop = Button released. FamiSync handles this manually but its a easy change.

The Tick pulse width is still up in the air, but I am starting with 2-3mS. It really depends on the NES code; how responsive the code is reading the controller. Once I get all the hardware running together I'll have a better idea.

m00dawg wrote:

While I've made some updates to the ArduinoBoy code to better fit my needs for my custom one, I haven't dug super deep. But it looks like there is room to spare as far as RAM and processing power to add in the NES functions.

The ASM  for my 'F628 is like 400 words and uses about 5 ram bytes ATM. So I would guess the Arduino code would be similar.
Yogi

Offline
Jelly Stone park, MD USA
m00dawg wrote:

Adding in the NES to the MIDI chain won't be really a big deal. As it's just clock sync I'll probably mod my current StageBoy to see if I can use MIDI Thru and then hook up whatever interface I end up with on the NES to that. The primary blocker was an NSF player that could respond to a clock, preferably with some transport controls (so it starts playing when it sees the first clock pulse).

If you want to go this route I would tap the TTL midi in from the opto and freed a 74hc00 for a midi thru, ala MB LTC. No code needed!
yogi

Offline
Texas

Wow thanks so much for all that awesome info, yogi!

Hmm so timing wise, if I'm at a BPM other than 150, I should generally be ok although going above 150 I might have issues? I actually don't know how much of the timing has been looked at in FamiSlayer or how much that would be an issue.

I'm also a bit confused on having to set the pin to INPUT or OUTPUT mode - is this is due to the CD4021? Bypassing it won't necessarily fix the issue directly will it and just hitting the serial interface directly?

Good call on Midi Thru. I new it was a simple mod, though I've never actually had to do it yet smile

Offline
Jelly Stone park, MD USA
m00dawg wrote:

Wow thanks so much for all that awesome info, yogi!

Hmm so timing wise, if I'm at a BPM other than 150, I should generally be ok although going above 150 I might have issues? I actually don't know how much of the timing has been looked at in FamiSlayer or how much that would be an issue.

I'm also a bit confused on having to set the pin to INPUT or OUTPUT mode - is this is due to the CD4021? Bypassing it won't necessarily fix the issue directly will it and just hitting the serial interface directly?

Good call on Midi Thru. I new it was a simple mod, though I've never actually had to do it yet smile

With a midi clock higher or lower, you change the Tempo of the playback from what it sounded like in FamiTracker. What I was trying to say was: the standard playback rate is equal to 150 BPM regardless of the NSF's internal tempo. The recommended FamiTracker setting is to set for 150 BPM and adjust the Speed for the desired Tempo. This way the NSF matches with the NMI calling frequency. Now FamiSlayer is not tied to the NMI so even if the NSF was written for a Tempo of 80 BPM, it will only sound like that internal Tempo with a sync pulse stream equal to a clock BPM of 150.
How this will effect you is if you are syncing to a PC or LSDJ they should be close to that 150 BPM and the NES will sound normal. But if the master is running at a much slower tempo, like 75 BPM, the NSF would play back slower (not Pitch shifted. just much slower). So a 1/4 note will be as long as a 1/2 note and Bars will be longer. The same would happen in reverse for like 300 BPM.
So when composing you will have to preview on the HW to get the sound you want at the much slower or faster Clock BPM you'r using. May be able to adjust the Speed setting in FamiTracker to raise the effective tempo within the NSF, for when it's played slower.

With the CD4021. The GamePad circuit: a open button has the pin pulled to 5v, pressing the button = GND. If you use a bare 4021 you could drive it's pins with TTL signals, but active low logic. If you mod a GamePad you need to disable the Pull-Up Rs or use Open Drain. Most uCs don't have Open Drain outputs so we can simulate with the Port direction trick. Also by using the Open Drain, you can still use the GamePad for manual input.
The NES reads the GamePad with a SPI like interface. To directly connect from the Nes to the uC you need to set it as a SPI slave. I think this should be doable but the extra expense of a 50 cent chip to buffer things seems OK also. smile
Code wise there really isn't much difference between Set/Clr the Port.Pin direction bit or the Port.Pin data bit.
Yogi

Offline
Melbourne, Australia

+1 to everything yogi said, just have one comment to make...

yogi wrote:

The other issue is the connection to the CD4021 in the GamePad. The Buttons are active low logic; I.E. when 'Open' a 10K R pulls the pin high, Closed to GND.

The 'resistors' (actually just lumps of 'resistive material') in a NES GamePad are actually 38K, not 10K. Here's an old Ben Heck article with some more detail:

http://www.extremetech.com/extreme/7468 … ent-system

and here's an example of 10K resistors not working in a project:

http://forums.modretro.com/viewtopic.ph … mp;t=10742

Offline
Jelly Stone park, MD USA
uXe wrote:

The 'resistors' (actually just lumps of 'resistive material') in a NES GamePad are actually 38K, not 10K. Here's an old Ben Heck article with some more detail:

http://www.extremetech.com/extreme/7468 … ent-system

and here's an example of 10K resistors not working in a project:

http://forums.modretro.com/viewtopic.ph … mp;t=10742

Yes thanks, it's been a while since I measured them but now that you pointed it out I remember a high value.

Did not know that they had to be so high to work properly. Wonder if that is due to a current limit on the 5v line to the Pad? Or a current limit with the 4021's pins? A smaller pull up would have faster switching between Low to High or High to Low but wouldn't think that would be an issue. Perhaps lower values sag the Vdd to the chip too much?

Will have to look into this, had planned to power my interface from the controller port but may have to self power it.
yogi

Offline
Texas

Aha ok. Mostly makes sense (re the BPM) but I think I'll have to try it out and see to really know how it will affect things in practice but now I see what you're referring to.

If the input/output trick works on Arduino there probably isn't much worry to do any other shenanigans so I think I'll try that first since I have all the stuff I need to get it going I think and I can go from there. Since this would be for stage and studio, I'll want to built something that is hardy enough. On that note, it sounds like MCTRL is doing very similar things so I'm guessing it would be useful for controlling FamiSlayer if I wanted to buy over build?

By the way, thanks again! I've been wanting to do this for years now and the detail and time taken to explain all this is much appreciated!

Last edited by m00dawg (Jun 28, 2014 4:35 pm)