SD2SNES digital audio out (+ mixing to SNES digital audio)?

The place for all discussion on gaming hardware
Post Reply
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

SD2SNES digital audio out (+ mixing to SNES digital audio)?

Post by cr4zymanz0r »

So as some of you may know, by default the SD2SNES only outputs MSU1 audio over the cart pins as analog stereo audio. If you have a digital audio mod in your SNES you're out of luck getting those sweet MSU1 tunes over digital audio and are stuck with using analog audio if you want to hear them.

1.) Now it appears the SD2SNES has a DAC in it (marked U341 on the PCB), so I would assume we could tap the signals going into that to convert it to a usable format such as toslink optical audio (though I wouldn't know how go to about figuring out the required circuit). This would get us the MSU1 audio digitally, but we'd be missing the sound effects and everything else since it'd be separate from the SNES audio.

2.) So, if step 1 gets created how would we mix that with the SNES digital audio? My two theories are:
a.) an external device that can mix the two (in my case) toslink optical audio connections together. I have no idea if such a thing exists or if it's some bulky, expensive, impractical device if it does exist.
b.) Install pin headers or something similar on the SD2SNES and SNES to connect them together with a little cable so it sends the SD2SNES digital audio signals into the SNES for mixing. This would require a revised SNES digital audio PCB that has additional solder pads (and components?) to accept another digital audio signal to mix with the SNES's digital audio.

Anyone more knowledgeable than me about digital audio circuits want to help figure out how to make these theories into reality?
nmalinoski
Posts: 1974
Joined: Wed Jul 19, 2017 1:52 pm

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by nmalinoski »

cr4zymanz0r wrote:2.) So, if step 1 gets created how would we mix that with the SNES digital audio? My two theories are:
a.) an external device that can mix the two (in my case) toslink optical audio connections together. I have no idea if such a thing exists or if it's some bulky, expensive, impractical device if it does exist.
A cursory Googling shows that equipment does exist, but it's absolutely overkill and prohibitively expensive, assuming you can even source it.
cr4zymanz0r wrote:b.) Install pin headers or something similar on the SD2SNES and SNES to connect them together with a little cable so it sends the SD2SNES digital audio signals into the SNES for mixing. This would require a revised SNES digital audio PCB that has additional solder pads (and components?) to accept another digital audio signal to mix with the SNES's digital audio.
I'd be inclined to go the other way in order to favor those who already have consoles modded with TOSLINK or coax digital audio; add a mod board to the SD2SNES with one TOSLINK or coax input, one TOSLINK or coax output, and an S/PDIF mixing chip. That would result in fewer parts and cables, compared to a separate external box; would require no additional alteration to the console; and would not interfere with the normal analog audio functionality, allowing one to perform a side-by-side comparison/analysis on the same console; although it would probably require a 3D-printed backplate for the SD2SNES to accommodate the bulkiness of the additional components.

Something like this could also be done for expansion audio on the NES/Famicom. Might require the digital audio I/O to be on the top side of the N8 cart, though, so it could still be used with front-loaders.
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by cr4zymanz0r »

nmalinoski wrote: I'd be inclined to go the other way in order to favor those who already have consoles modded with TOSLINK or coax digital audio; add a mod board to the SD2SNES with one TOSLINK or coax input, one TOSLINK or coax output, and an S/PDIF mixing chip. That would result in fewer parts and cables, compared to a separate external box; would require no additional alteration to the console; and would not interfere with the normal analog audio functionality, allowing one to perform a side-by-side comparison/analysis on the same console; although it would probably require a 3D-printed backplate for the SD2SNES to accommodate the bulkiness of the additional components.
That is a possible approach (depending on how hard it'd be to decode the optical audio, mix the signals, then send as optical again since most people seem to be using optical). I wouldn't personally be a fan of this method for a couple of reasons:
1.) Like you already mentioned, you might need a custom backplate to fit the additional mod PCB and connectors into the SD2SNES.
2.) Anytime you go to remove the SD2SNES to use an actual cart (while using digital audio) you would need to a.) unplug the mixing cable from the SNES, b.) unplug the mixing cable from the SD2SNES, c.) unplug the main digital audio cable (that goes to your receiver/sound bar/whatever) from the SD2SNES, d.) plug the main digital audio cable into the SNES.
If it were doing mixing in the SNES itself, you'd only need to unplug the mixing cable from the SD2SNES.

Also, I was thinking more about my pin header idea and I think there's 2 possible approaches:
1.) No additional mod PCB needed in the SD2SNES: There's 5 signals (I think) that go in the SD2SNES DAC. These could be wired to a small 5 pin header and installed on the SD2SNES shell, install another 5 pin header on the SNES, then the (future revision) digital audio PCB in the SNES takes those 5 signals, encodes them to a usable format, and mixes with the SNES digital audio.
2.) Additional mod PCB in the SD2SNES: This could go ahead and encode the signals in the SD2SNES to a usable digital format. The only real difference this would make would be using a smaller pin header (1 pin?).

I know some people prefer to do the least amount of modifications to their console shells as possible, but I don't mind it too much when it's small and I can fit it in some non-visible location such as the backplate
nmalinoski
Posts: 1974
Joined: Wed Jul 19, 2017 1:52 pm

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by nmalinoski »

cr4zymanz0r wrote:2.) Anytime you go to remove the SD2SNES to use an actual cart (while using digital audio) you would need to a.) unplug the mixing cable from the SNES, b.) unplug the mixing cable from the SD2SNES, c.) unplug the main digital audio cable (that goes to your receiver/sound bar/whatever) from the SD2SNES, d.) plug the main digital audio cable into the SNES.
If it were doing mixing in the SNES itself, you'd only need to unplug the mixing cable from the SD2SNES.
What I was suggesting only involves two connection points on the SD2SNES: TOSLINK input from the console and TOSLINK output to a receiver; mixing would be done on an addon PCB living in the expanded SD2SNES.

And you have a point; I don't think the mixer PCB in that design would be able to pass-through the digital audio from the console when unpowered; so you couldn't just pull the SD2SNES out and use a different cart, you'd need to disconnect both TOSLINK cables from the SD2SNES and use a female/female coupler in order to use the digital audio with anything else.

After thinking about it more, I agree that the best of everything probably would have to be an internal mod. Sure, you'd have to cut the case to add a digital audio input (Probably coax for this), but the board could be designed to fall back on digitizing and mixing in the analog audio from the cart when nothing is connected to the digital input (and possibly some filtering to minimize or eliminate the analog noise floor if that's desirable).
Joelepain
Posts: 180
Joined: Wed Sep 12, 2012 7:40 pm

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by Joelepain »

nmalinoski wrote: A cursory Googling shows that equipment does exist, but it's absolutely overkill and prohibitively expensive, assuming you can even source it.
At this price point, isn't it more simple to just buy a good sound card which has at least two SPDIF input and one output ? Like in the range of what creative did with the Audigy Platinum or X-Fi Elite ? Or sometimes audio interfaces for instruments used by musicians have some SPDIF plugs. The only downside to this solution is that you need a computer to drive your soundcard everytime you need it. Maybe something like a raspberry pi is enough (in the case of an external usb interface) ?

I don't know I'm just throwing ideas that pass through my mind...
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by cr4zymanz0r »

So, I opened up my SD2SNES to do a little research. The DAC is marked on the PCB as U341. The DAC chip itself was marked:
344C
1635
This appears to be a CS4344 DAC https://www.mouser.com/ProductDetail/Ci ... 2bYIhSg%3d
The data sheet can be found on the same page.

So I'm wondering if I could just put a spare SNES digital audio mod board in the SD2SNES to process the digital audio. The spare one I have is borti's design https://oshpark.com/shared_projects/xFPfmlYx

DIT4096 datasheet: http://www.ti.com/lit/ds/symlink/dit4096.pdf
Now tracing the numbered input pads on that PCB to the corresponding pins on the DIT4096 digital audio transmitter chip I get this:
1: RST
2: SYNC
3: SDATA
4: SCLK
5: MCLK

Image

I'm decently confident of everything so far, though not 100% sure that LRCK to SYNC (green line) is correct, but I'm betting it is. I also don't know the way borti's PCB has the DIT4096 configured would work correctly with the SD2SNES MSU-1 digital audio signals going to the DAC.

The other thing I don't know is where I need to source the RST (reset) signal from on the SD2SNES. Would pin 26 of the cart be fine (/RESET from the SNES) be fine? That seems to be where the internal SNES digital audio mod is getting on the cart slot. (Maybe I mostly just answered that myself :P) Now if this is the case I can't just solder directly to that cart pin, so I don't know if anyone else knows where to tap it on the SD2SNES before I start blindly trying to find it with my multimeter.

Now, assuming all of this will work as currently stated that still only gives me MSU-1 digital audio (via TOSLINK) without the SNES digital audio mixed in. Now if I just remove the TOSLINK connector off of Borti's board I could tap the single signal from the 'Vin' connection on the board. That could then theoretically then be connected a single pin header installed on the SD2SNES that then connects to a single pin header installed on the back of the SNES then have a circuit inside that mixes both together. Now the SNES digital audio is 32khz and I'll make a logical guess that MSU-1 digital audio is probably 44.1khz, so I assume you'd have to resample one or both of them to the same sample rate to mix them together? I'm not knowledgeable at all on mixing digital audio signals so I'm hoping someone smarter can chime in.
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by cr4zymanz0r »

I soldered up a SNES digital audio board to my SD2SNES has show in my previous post and fired up a MSU-1 game. All I got was silence and my receiver didn't recognize any stream. I double checked my soldering with a multimeter and it showed everything was connected. Any ideas?
L-Train
Posts: 29
Joined: Wed Jun 11, 2014 6:09 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by L-Train »

Borti's board is configured for input data in left-justified format, while the SD2SNES outputs I2S format (the CS4344 seems to only accept this format). Try re-configuring borti's board to accept I2S by lifting pin 9 (the FMT0 pin) and tying it to Vcc. See Table V in the DIT4096 datasheet for more info.

Edit: You might also need to know the ratio of the master clock frequency to the sampling frequency and re-configure the CLK0 and CLK1 pins accordingly (see Table II). Borti's board is configured for 256*Fs.
User avatar
FBX
Posts: 2347
Joined: Wed Feb 18, 2015 10:18 am
Location: DFW area, Texas
Contact:

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by FBX »

This is something I entertained a while back, but unfortunately it requires knowledge of programming audio processors (that Cirrus Logic does make) in order to mix two digital signals into one. I simply don't know how to do that, so my solution was to make a mod board that mixes analog lines into digital with a toggle switch:

Switch position 1 = analog MSU-1 + analog SNES from both DACs converted to 48Khz digital Toslink output.

Switch position 2 = 32Khz raw SNES digital audio out the same Toslink output.

That was the best I could come up with that avoided programming. It can all be done with a crystal, hex inverter, ADC, and transmitter IC. I had most of the board completed, but shelved the idea because it seemed a bit expensive and 'fringe' for interest.
ElBartoME
Posts: 82
Joined: Tue Aug 07, 2018 5:55 pm
Location: Germany

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by ElBartoME »

Mixing two digital audio streams is going to be difficult as both streams need to be synchronised. You probably need to resample both audio streams to get a synchronised clock and then add and scale both streams. Not an easy task.
borti4938

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by borti4938 »

Not easy, indeed. You need: Serial to Parallel Converter (2x), Rate equaliser (2x), adder (+ divider), Parallel to Serial Converter.

I haven't searched for a ready to use IC, but I also doubt that this one exist. As the rate equaliser may need PLL and filtering, one has to use a small FPGA for that task.

And by the way: If one convert the I2S signal to S/PDIF inside the sd2snes one can use pin 2 of the cartridge slot to get the signal into the SNES.

However, FBXs approach is much simpler.
User avatar
citrus3000psi
Posts: 668
Joined: Wed Dec 25, 2013 11:56 pm
Location: Indiana

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by citrus3000psi »

borti4938 wrote:Not easy, indeed. You need: Serial to Parallel Converter (2x), Rate equaliser (2x), adder (+ divider), Parallel to Serial Converter.

I haven't searched for a ready to use IC, but I also doubt that this one exist. As the rate equaliser may need PLL and filtering, one has to use a small FPGA for that task.

And by the way: If one convert the I2S signal to S/PDIF inside the sd2snes one can use pin 2 of the cartridge slot to get the signal into the SNES.

However, FBXs approach is much simpler.

Borti, check out this IC: CS48520
User avatar
Unseen
Posts: 724
Joined: Sun May 25, 2014 8:12 pm
Contact:

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by Unseen »

borti4938 wrote:Not easy, indeed. You need: Serial to Parallel Converter (2x), Rate equaliser (2x), adder (+ divider), Parallel to Serial Converter.
Ignoring the component costs, I think you could get away with a single sample rate converter (e.g. TI SRC419x), a CPLD and an I2S-to-SPDIF converter. If you can choose an LSB-first serial transport between the sample rate converter, the programmable logic and the SPDIF converter, you may even be able to use a GAL instead of a CPLD. ;)
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by cr4zymanz0r »

L-Train wrote:Borti's board is configured for input data in left-justified format, while the SD2SNES outputs I2S format (the CS4344 seems to only accept this format). Try re-configuring borti's board to accept I2S by lifting pin 9 (the FMT0 pin) and tying it to Vcc. See Table V in the DIT4096 datasheet for more info.

Edit: You might also need to know the ratio of the master clock frequency to the sampling frequency and re-configure the CLK0 and CLK1 pins accordingly (see Table II). Borti's board is configured for 256*Fs.
After checking, Borti's board was configured for 16-Bit Right-Justified, so I had to lift pin 10 and connect to ground to select I2S format. This did not change my results at all. Would the wrong master clock setting also be expected to cause silence, or just bad/slow/fast audio? I don't know what the actual master clock is so I could just try the other 2 settings, though lifting these tiny pins is a pain. I wish I had a test board with configurable jumpers or something.

As for the actual digital audio mixing, everyone is making it sound waaaaaay harder than I thought lol. I just thought "people mix analog audio all the time. Surely people have made some reasonable circuits to do the same for digital audio". I can program in typical langauges like C++\C#\Java and even done a little Arduino programming, but I don't know anything about where to start about programming an audio processor, or what circuit to make to load the program data to it even if I wrote it.
L-Train
Posts: 29
Joined: Wed Jun 11, 2014 6:09 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by L-Train »

cr4zymanz0r wrote:After checking, Borti's board was configured for 16-Bit Right-Justified, so I had to lift pin 10 and connect to ground to select I2S format.
Ah my mistake, I had misremembered what the SNES' audio format was and only quickly glanced at borti's board layout to reference the DIT4096 datasheet, and assumed those pins were connected to ground. Glad you double checked :)
cr4zymanz0r wrote:This did not change my results at all. Would the wrong master clock setting also be expected to cause silence, or just bad/slow/fast audio? I don't know what the actual master clock is so I could just try the other 2 settings, though lifting these tiny pins is a pain. I wish I had a test board with configurable jumpers or something.
I think it could cause the silent audio. You'd need to look at the master clock with a scope to check its frequency. If it's 128*Fs you'd have to switch to using a CS8406 which offers that ratio.

I also noticed that borti's DIT4096 board has pin 14 (master/slave select) floating. The datasheet didn't specify if this was pulled high or low internally, but it should be connected to ground for slave operation.
User avatar
cr4zymanz0r
Posts: 356
Joined: Sat Oct 19, 2013 6:36 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by cr4zymanz0r »

L-Train wrote: You'd need to look at the master clock with a scope to check its frequency. If it's 128*Fs you'd have to switch to using a CS8406 which offers that ratio.
Hmm, I don't have a scope. Anyone here with one and a SD2SNES want to do me a favor? ;)
User avatar
FBX
Posts: 2347
Joined: Wed Feb 18, 2015 10:18 am
Location: DFW area, Texas
Contact:

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by FBX »

cr4zymanz0r wrote:
L-Train wrote: You'd need to look at the master clock with a scope to check its frequency. If it's 128*Fs you'd have to switch to using a CS8406 which offers that ratio.
Hmm, I don't have a scope. Anyone here with one and a SD2SNES want to do me a favor? ;)
I've got a Rigol I can test this on, but I'm a rank beginner at using the scope. I only know how to measure video signal amplitudes. I would need to know stuff like trigger settings and/or any other pertinent information for doing the test.
User avatar
Lawfer
Posts: 2283
Joined: Fri Dec 01, 2006 3:30 am

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by Lawfer »

FBX wrote:I had most of the board completed, but shelved the idea because it seemed a bit expensive and 'fringe' for interest.
Oh wait, so did you drop this project completely?
User avatar
FBX
Posts: 2347
Joined: Wed Feb 18, 2015 10:18 am
Location: DFW area, Texas
Contact:

Re: SD2SNES digital audio out (+ mixing to SNES digital audi

Post by FBX »

Lawfer wrote:
FBX wrote:I had most of the board completed, but shelved the idea because it seemed a bit expensive and 'fringe' for interest.
Oh wait, so did you drop this project completely?
I still have the files, but it's a thing where I have to finish the more immediate stuff I'm super busy with. Then I will look at it with a fresh perspective later this year. It's not going to be easy regardless. It will end up being a double-sided board that will have to mount to a sandoff, and that's going to require a lot of R&D when I get back to it.
Post Reply