nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5.03k stars 488 forks source link

Possibility of incorporating NES white noise mode 1 for electric and metallic alike sound effects #1232

Closed Kyuchumimo closed 2 years ago

Kyuchumimo commented 3 years ago

Could it be possible that in a future update they will add this feature to TIC-80? or something similar

Noise output occurs when the waveform is empty (zero-filled). For this mode it occurred to me that could be activated when the waveform is full (full-filled) instead

nesbox commented 3 years ago

It's possible and I think we could play 16 different noises for every full-filled waveform line, not sure, have to recheck. Info from NESdev wiki (https://wiki.nesdev.com/w/index.php/APU#Noise_.28.24400C-400F.29):

If bit 7 of $400E is set, the period of the random bit generation is drastically shortened, 
producing a buzzing tone (e.g. the metalic ding during Solstice's gameplay).
The actual timbre produced depends on whatever bits happen to be in the generator when it is switched to periodic, 
and is somewhat random.
nesbox commented 3 years ago

Added 16 different types of noise here 23a6e7a697df39794c364e776327071e1804a986 Noise plays now for every full-filled waveform line. To check it, please paste this waveform cccccccccccccccccccccccccccccccc for example, and play

video12 Thank you for the idea :)

StinkerB06 commented 2 years ago

Wouldn't this break compatibility with existing carts?

There are 2 bits left in the SFX format, so here are possible suggestions:

Kyuchumimo commented 2 years ago

@StinkerB06 This does not affect the compatibility with previous game carts at all, nor does it affect RAM. Its use involves flattening the waveforms. This new feature is called periodic noise.

https://user-images.githubusercontent.com/74131798/141601704-9283e6a8-d245-4bdc-803e-b8724160e611.mp4

StinkerB06 commented 2 years ago

@StinkerB06 This does not affect the compatibility with previous game carts at all, nor does it affect RAM. Its use involves flattening the waveforms. This new feature is called periodic noise.

I know you need to flatten wavetables to get noise output. What I'm saying is this change could break compatibility with existing carts that play flat-line wavetables (that aren't an all-zeroes flat line) in any way, and they don't expect that noise output would happen at all for those other flat lines. It certainly might break software wavetable synthesis, a crucial part of the Fallspire sound engine.

Kyuchumimo commented 2 years ago

I don't hear any particular change from the Fallspire sound engine. TIC-80 0.90.1723 vs TIC-80 1.0.1770-dev Pro

https://user-images.githubusercontent.com/74131798/141653879-c3703e4b-c908-4062-9c1a-ccbfe5517e80.mp4

Kyuchumimo commented 2 years ago

The only carts that manipulate the waveforms and that in quiet parts could be affected are the following:

TIC-ROLL: https://tic80.com/play?cart=1754 MERCEDES BENZ: https://tic80.com/play?cart=2284

In the MERCEDES BENZ cart, there are parts where there is audible noise, and this even and using TIC-80 v0.90 which has not yet implemented the periodic noise

nesbox commented 2 years ago

@StinkerB06 you were right A lot of problems with the compatibility and it seems we have to use one of your suggestions. Thanks for that

nesbox commented 2 years ago

Reduced to two types of noise for the backward compatibility 8dbeba661e60e677ac31ddad7dc3bf729a41aa36

0x0-standart noise
0xf-periodic noise