Intentional PPU hum...

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Intentional PPU hum...
by on (#45103)
I've been playing around with the concept of using the 2C02 PPU hum intentionally.

So far I've created a flickering BG0 test ROM that yields no noise. I've also used NO CARRIER's GlitchNES; then modified it so that the APU and all channels are turned on. All I get is a small pop when the APU turns on and a click when the NES is shut off.

Does anyone have any idea about which part of the PPU would be producing the hum and what would be done to purposefully make the hum? (Speaking strictly via software that is.)

Furthermore, what frequencies are achieved and are they consistent?

I'll be messing about with this a bit further.

by on (#45113)
Haha, great idea. Hours later, here's a demo that plays the first few notes of the SMB theme through the PPU. Run on a NES and plug your audio RCA cable into the VIDEO output to hear (turn down volume first, as the buzz is kind of loud).

ppu_tune.mp3
ppu_tune.zip with NES ROM and ca65 source

I got side-tracked trying to play 6-bit PCM out of the PPU (couldn't get the output levels to match what they should have). I did get 3-bit PCM working, but lack the RAM on my devcart to put any decent-length sample on it. Had to settle for a simple square wave. It just plays it by loading the palette with black and white, and toggling between the two entries by changing the PPU address (with rendering disabled). Connect NES normally to "see" the waveforms on screen.

by on (#45116)
creativity at its best :)
I'm gonna try it on the TMS9129.

by on (#45121)
It seems like the brightest colors are the loudest and the darkest are the most quiet.

blargg: I'm using the ppu_tune and a PowerPak. It doesn't work. A white screen pops up and it goes black and quiet. (Yes. I do have the audio cable in the video. :))

What kind of devcart are you using?

by on (#45131)
I tried compiling the ROM and it yielded the same results as your compile. It compiled without bitching, but in the binary there is a string:

"Passed..Done.Failed..Failed #..Internal error" @ 0x67BD w/ header.

by on (#45132)
And I thought this thread was going to be about the audible interference from the PPU that you can hear.
Especially noticeable in Wizards and Warriors 3 in areas with black and white tiled floors.

by on (#45133)
Doesnt work for me either :-/

by on (#45134)
Dwedit wrote:
And I thought this thread was going to be about the audible interference from the PPU that you can hear.
Especially noticeable in Wizards and Warriors 3 in areas with black and white tiled floors.

Well, that's what was intented, but either way this is a development I'd like to run with for now.

by on (#45143)
blargg's example is the same as you describe Dwedit, it's just (much) clearer if you switch the cables.

On another note, it shouldn't be too hard to add this PPU noise as simulation to emulators, provided that the emulator supports borders, not just the 256 pixels per line.

by on (#45146)
hi

by on (#45149)
hap wrote:
On another note, it shouldn't be too hard to add this PPU noise as simulation to emulators, provided that the emulator supports borders, not just the 256 pixels per line.


At that point, you'd might as well get some kind of TV emulator going, because you very well could use that as input for it, and possibly get the most accurate-ever picture that the nes emulation scene has ever seen. :P

by on (#45155)
What is the upscaler in an HDTV other than a "TV emulator"?

by on (#45158)
Crap, I had made a stupid little change just before releasing it. Should work now (same link).

by on (#45161)
Nice! Works now. Thanks, blargg. Time to experiment. ;D

by on (#45164)
After a few minutes of experimentation, I've been able to cover NESdev's venerable anthem.

http://average.truechiptilldeath.com/ne ... anthem.zip

by on (#45166)
How about an audio recording of nesdev_anthem.zip B00daW? :)

yay, the same concept on TMS9918 family graphics chip, as you can see, amplitude can be changed by changing brightness.
http://www.youtube.com/watch?v=rGA_fVegAb4
I spent most of the time creating note- and lengthtables. :(

sourcecode here if anyone's interested: http://samor.nl/hap/crap/vdpmusic.zip (the .com is not for PC)

by on (#45187)
This is all very nice, but is it also possible to make some video out of audio signals?

by on (#45188)
Probably not, seeing as you'd need HBLANK and VBLANK in order to have video frames.

by on (#45201)
Dwedit wrote:
Probably not, seeing as you'd need HBLANK and VBLANK in order to have video frames.

And there's no way to simulate those with audio? I'm just curious, I know nothing about audio and video signals.

by on (#45207)
tokumaru wrote:
And there's no way to simulate those with audio? I'm just curious, I know nothing about audio and video signals.


Sure you could. You just need a ~60/50Hz pulse wave and a ~15723/15625Hz pulse wave. Only problem is that the NES has a maximum pulse wave frequency of 14kHz, which most TVs won't sync to. Depending on the television, you might be able to drive at the first undertone (~8kHz) and have it sync.

Drawing things in addition to generating sync will be nontrivial, however.

by on (#45210)
lidnariq wrote:
Drawing things in addition to generating sync will be nontrivial, however.

I was just curious as to what kind of things would be possible. The resolution of whatever was generated would probably be laughable.

by on (#45215)
You might be able to generate something like a TI83+ can if you're lucky, but a TI83+ has a 6MHz Z80. Is the NES fast enough for generating anything visible through PCM output?

by on (#45217)
lidnariq wrote:
tokumaru wrote:
And there's no way to simulate those with audio? I'm just curious, I know nothing about audio and video signals.

Sure you could. You just need a ~60/50Hz pulse wave and a ~15723/15625Hz pulse wave. Only problem is that the NES has a maximum pulse wave frequency of 14kHz, which most TVs won't sync to. Depending on the television, you might be able to drive at the first undertone (~8kHz) and have it sync.

$4011 can be used to generate frequencies of up to ~447 kHz.

by on (#45230)
nesdev anthem is a cover of that really annoying mouser.nes song. ;P

by on (#45243)
B00daW wrote:
nesdev anthem is a cover of that really annoying mouser.nes song. ;P

Which in turn is a cover of E2M3.
Re: Intentional PPU hum...
by on (#112068)
Since emulators aren't very good at showing this off, I made a video of nesdev_anthem.nes:

Image
http://www.youtube.com/watch?v=xjrFJbN5iCc
Re: Intentional PPU hum...
by on (#112069)
I think I know how to get more bit depth. Vertical mirroring, black nametable 0, white nametable 1, use $2005 as if it were $4011. What this ends up doing is using the scroll to create pulse width modulation.
Re: Intentional PPU hum...
by on (#112070)
I thought you just outputted the 1-bit waveform to $2007. I take it this approach is to have the PPU hardware output a continuous tone without CPU assistance.
Re:
by on (#112079)
hap wrote:
On another note, it shouldn't be too hard to add this PPU noise as simulation to emulators...
Yes, if it actually makes the NTSC signals (rather than RGB mode), it will work.

Can you make music through the tape output? Can you make a music combining the video out, 2A03 audio out, mapper audio, and tape?
Re: Intentional PPU hum...
by on (#112115)
When I was experimenting with it, I noticed using other color and brightness values it made louder or softer waveforms. If someone were to experiment, they could create a look-up table of the loudest to softest or softest to loudest to create PCM waveforms.

...It would also be prettier.
Re: Intentional PPU hum...
by on (#118833)
I don't know much about the signal levels on RCA cables, but what would happen if you took a Y cable (I've got one I use to split the mono audio to left and right), and used it to mix the audio out and video out together? Would this be safe? Would the levels be such that you could usefully combine PPU and APU audio output?

Even if that didn't work, you could use a Y cable to send the video out to both the audio and video, so that you can see and hear this hack at the same time. I wonder if it'd be possible add some more interesting content to the video signal without compromising the sound quality too much. If so, it might make for some unusual demos. (Or even games?)
Re: Intentional PPU hum...
by on (#118835)
Yes, I used a Y cable to split the video signal to make the video I posted. I wouldn't suggest that this will work in all cases (probably depends a lot on the video and audio inputs you connect to), but it was good enough in my particular case to make that recording. If you were doing it properly you'd want an active splitter that can buffer the two outputs, not just a passive Y cable.
Re: Intentional PPU hum...
by on (#118839)
I think the video would overpower the audio if you connected them. For one, it has 68-ohm impedance, while audio has 150 ohms. And the video signal is mostly a full-modulation pulse wave at low frequency, very loud.
Re: Intentional PPU hum...
by on (#120615)
Could you put some custom code into say SMB that would play what is actually on screen instead of standard Mario tunes in similar way this does? Would like to hear how SMB playthrough sounds like.
Re: Intentional PPU hum...
by on (#120616)
Why would you need code? Just connect the video out to your audio in and you will hear what's on the screen.

For the most part it's just going to be some kinda 60hz buzz with a timbre that varies as the visuals change. (Maybe I'll try making a video of this to demonstrate once I've got some other stuff finished.)
Re: Intentional PPU hum...
by on (#120618)
You're basically not going to be able to hear any difference as to where things are on the left or right side of the screen; your ears can't hear at those frequencies. All-in-all, it'll sound like a bunch of overtones of 60.1Hz, at varying strengths, and there will a strong correlation with total screen brightness and loudness.
Re: Intentional PPU hum...
by on (#120633)
Image

It ended up sounding even less interesting than I'd expected, and my expectations were low.
Re: Intentional PPU hum...
by on (#120978)
rainwarrior wrote:
Why would you need code? Just connect the video out to your audio in and you will hear what's on the screen.

For the most part it's just going to be some kinda 60hz buzz with a timbre that varies as the visuals change. (Maybe I'll try making a video of this to demonstrate once I've got some other stuff finished.)


My idea was to add code that interprets pattern/name/attribute table data as sounds and send those into APU instead of playing standard music. Not something silly like connecting video out into speaker.
Re: Intentional PPU hum...
by on (#120981)
Oh, well I guess you could do something like that, but this thread is about using the PPU for sound!
Re: Intentional PPU hum...
by on (#120983)
Well, it'll still use PPU for sound, just differently :P.
Re: Intentional PPU hum...
by on (#121012)
"Music that has something to do with what you see" has a long standing history in game use, but the specific bit about using the PPU implies using the one thing the PPU can do well: be a 4 bit DAC at 5MHz.

Playing (optionally transformed) level data as sound is about as relevant to the PPU as it is to a beverage one might drink while playing.