"Peace Audio Synthesizer" Scriptable NES sound emulation

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by thefox »

James wrote:I'm emulating the sound channels at 1.79MHz, low-pass filtering with a 512-tap FIR filter, and downsampling by 37 to get ~48kHz output. I suppose I haven't compared with a critical ear, but I don't notice any particularly scratchy differences between this method and the blipbuf method that I currently used.
Your method is fine, there's no audible aliasing when doing that. It's basically the same thing that the real NES is doing.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by lidnariq »

Blipbuf is basically a space-for-time optimization; by memoizing the result of all the lowpassed edges, you can just natively generate audio at the sample rate, rather than needing to generate all 1.8MS/s and lowpass it.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by blargg »

peacedev, bandlimited synthesis is key here. This is just emulating at the NES rate, lowpass filtering with cutoff below half the output sampling rate (Nyquist frequency), then decimating. James does this literally (going by his description), and blipbuf turns the algorithm inside-out and does the same thing with a fraction of the computing power. You have to do the lowpass before decimating (downsampling); yoiu can't just do it on the output, because aliasing has already corrupted the output with spurious frequencies all throughout the audible band.

Maybe someone could write an aliasing test that plays a clean frequency sweep up beyond audible.
peacedev
Posts: 10
Joined: Sat Feb 23, 2013 12:41 pm
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by peacedev »

Now with luck, I am able to integrate bandlimited to wave form generation.

Here is the result.
https://dl.dropbox.com/u/30815442/downl ... 08-0_3.mp3
and
https://dl.dropbox.com/u/30815442/downl ... -solid.mp3

May I ask for your opinion ?
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by blargg »

It's hard to tell with the material you're using. Can you do a simple mono frequency sweep from 100 Hz to 30000 Hz, lasting say 20 seconds? If you have a program to show the frequency spectrum, aliasing is really easy to spot (I've moved to Linux and am not familiar yet with one to do this). Try that with the square, and with the triangle (separately). I'm also curious as to how you've implemented bandlimiting.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by thefox »

blargg wrote:It's hard to tell with the material you're using.
What's obvious though, is that there's some other problem in your emulation not related to aliasing. The music sounds choppy (almost seems like timing is off, but could be just wrong note lengths or something playing with my ears).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by blargg »

Yeah, that's distracting when listening to familiar material like the beginning Castlevania. I take it that this thing is scripted at the command-line level, thus timing will necessarily be pretty jittery.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by lidnariq »

blargg wrote:If you have a program to show the frequency spectrum, aliasing is really easy to spot (I've moved to Linux and am not familiar yet with one to do this).
Audacity is cross-platform and works nicely for this. (Click on the name of the track in the upper-left corner of the waveform, and select "spectrogram")
peacedev
Posts: 10
Joined: Sat Feb 23, 2013 12:41 pm
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by peacedev »

blargg wrote:It's hard to tell with the material you're using. Can you do a simple mono frequency sweep from 100 Hz to 30000 Hz, lasting say 20 seconds? If you have a program to show the frequency spectrum, aliasing is really easy to spot (I've moved to Linux and am not familiar yet with one to do this). Try that with the square, and with the triangle (separately). I'm also curious as to how you've implemented bandlimiting.


Using Impulse training method with my own tweaks.
I already run tests in native square wave and alias was gone well.
I can see now wave shape was altered.

Like you said, In general (not by testing freq sweep) the alias thing is hard to detect by human ear.
I wonder if it really worth to use bandlimitting in typical conditions.
peacedev
Posts: 10
Joined: Sat Feb 23, 2013 12:41 pm
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by peacedev »

thefox wrote:
blargg wrote:It's hard to tell with the material you're using.
What's obvious though, is that there's some other problem in your emulation not related to aliasing. The music sounds choppy (almost seems like timing is off, but could be just wrong note lengths or something playing with my ears).

It is realtime parsing data. It cause latency some time.
I will improve this later with compile time. Thanks for notify.
peacedev
Posts: 10
Joined: Sat Feb 23, 2013 12:41 pm
Contact:

Re: "Peace Audio Synthesizer" Scriptable NES sound emulatio

Post by peacedev »

After Optimization !!!!


https://dl.dropbox.com/u/30815442/downl ... imized.mp3


Now I am very happy with the result after tuneup. Thank you very much for all comment !!!!!



:lol: :lol: :lol: :lol:
Post Reply