It is currently Thu Oct 19, 2017 11:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: stereo sound effect?
PostPosted: Fri Aug 22, 2014 4:27 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Instead of separating the APU channels, how's possible to produce a stereo sound effect much like a few emulators do?


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 5:34 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
I guess an emulator could watch the memory of a particular game's sound engine and figure out where an action happened that caused the game to play a particular sound effect.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 7:27 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
Try playing your mono output through one channel (L/R) and a slightly delayed copy through the other.

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 7:53 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5718
Location: Canada
Which emulator are you referring to? There's a number of techniques to turn mono sound into stereo.

One way to do it is to implement a comb filter to put half the sound in each channel, separated by regularly-spaced frequency. Or you could build a more complicated filter with a fast fourier transform and tweak the separation frequencies to your liking.

Other techniques might involve delay or reverb.

I'd recommend that whatever you do, make it an option for the user. Personally, I would usually rather the authentic sound, but even when I want stereo, I much prefer simple panning on the sound channels than the "fake stereo" techniques I've seen.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 8:19 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Well, puNES is one of them.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 8:42 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5718
Location: Canada
Another thing you can do is run two noise generators in parallel starting from a different seed. This would let you have stereo noise, at least. You could also introduce panning based on the frequency setting.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 2:36 pm 
Offline
User avatar

Joined: Mon May 19, 2014 11:46 pm
Posts: 37
puNES uses the delay technique. The length of the delay is even configurable.

rainwarrior's first proposal of applying different filters to the two channels is interesting. That's what was done to the original official soundtrack CD for Final Fantasy I and II. The downside is it can be jarring and feel rather uncomfortable to have all the bass on one side and all the treble on the other. I think it would be kinda cool to have in an emulator if you could customize the filtering even if I don't think I'd use it much. Other people might like it.

Another thing you could do, although this might be violating the terms of your question, is to invert the phase of an APU channel. This is done in the NotSoFatso NSF player plugin for Winamp. You can set a frequency at which point any tone generated at or above it gets inverted in one channel which creates an extreme stereo effect when listening with speakers. However, if, for some reason, anybody had mono playback where both channels are mixed together that sound would get canceled out and be inaudible to them. I like to use it on the noise channel to make it stereo while I pan square 1 mostly to the right and square 2 mostly to the left and keep the triangle centered. I find that gives the ideal stereo NES sound to me and would love to see that capability in an emulator.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 4:33 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
Try a reverb, with the dry part in phase and the wet part 180 degrees out of phase. This way, mono listeners still hear the dry part, stereo listeners hear the music with stereo reverb, and surround listeners hear the dry part in front and the wet part in surround.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 5:14 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
I don't know how to do it. My emu generates +samples or -samples, then I update left/right sound stream channels.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 5:28 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6280
Location: Seattle
Reverb is echo with a comparatively short echo time, comparable to the human lower threshold of hearing (i.e. ≈ 50ms, or some less) (wikpedia:Reverberation)

To do an echo in a computer, keep a log of past samples calculated or emitted, and mix them back in.

There are two ways: FIR (mix a fixed number of previous calculated samples in). Usually sounds a little wrong, because most things don't just echo once or twice, but rather there's some feedback as the signal echoes back and forth. But is bounded and guaranteed to not be unstable (i.e. ring or clip forever). The other is IIR, where you instead mix in a previously emitted sample. This is more authentic, but can potentially produce feedback squeals.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Fri Aug 22, 2014 6:17 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
An echo effect that uses the formula for a digital IIR allpass filter won't produce squeals. Cascade three allpass delay lines with periods that are pairwise relatively prime, and this should give you a reasonable facsimile of reverb.

(And if the above was Hellenic to you, ask a DSP geek.)


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Sat Aug 23, 2014 12:23 am 
Offline
User avatar

Joined: Mon May 19, 2014 11:46 pm
Posts: 37
tepples wrote:
Try a reverb, with the dry part in phase and the wet part 180 degrees out of phase. This way, mono listeners still hear the dry part, stereo listeners hear the music with stereo reverb, and surround listeners hear the dry part in front and the wet part in surround.

That's a really cool idea. I think stereo panning is the best way to achieve stereo but I'd appreciate being able to add some subtle reverb too, even on top of that. I'm someone who has my computer hooked up to a home theater system using Dolby Pro Logic II. I've become very accustomed to having some sound in my rear speakers and find myself enjoying mono music much less because nothing comes out of the back when playing a mono source. It just seems distant. A little bit of reverb can make the music feel more full and enjoyable to me just by making a little bit of ambiance play in my back speakers. I also think NES and other largely mono game music, going as far as Sega Genesis or even some Game Boy Advance music, benefits in particular.

It seems to me the biggest issue is making a reverb algorithm that actually sounds good though. In my experience, if I try to add reverb to NES music very few presets/room simulations in plugins sound good. I find a fairly tough lowpass filter to be a necessity too, filtering from the reverb everything higher than several kHz or else it "sizzles" too much.

Adding reverb in an emulator might be getting a good ways removed from an authentic NES experience, but I generally believe in making things as good as they can be so I'd be happy to use it if it sounds better.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Sat Aug 23, 2014 10:13 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19102
Location: NE Indiana, USA (NTSC)
As a first approximation of what this sort of surround effect might sound like, try neoMAX (Surround Mix).
DM Ashura made "neoMAX", a tribute to the "Max" songs in Dance Dance Revolution, with a JRPG-ish sound font for a contest on a DDR forum. Later he remade it with a more Bemani-typical sound font. I put both of them in an audio editor and panned one of them out of phase so that it's sent back to surround.


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Sat Aug 23, 2014 1:35 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
Since nobody came with code, I had an idea... but it doesn't work as expected. Take the volume level of square#1 >> 1 AND 7 (same for #2) - this is the shifter. Take the current sample (example, Left) and apply the shifter. This is the gain. Add the gain level to the other channel. Here, if subtracting (or adding the negative), the effect is different.

Why it doesn't work well? Because most games use the same volume level for squares #1 and #2.
Any other idea? Comments?


Top
 Profile  
 
 Post subject: Re: stereo sound effect?
PostPosted: Sat Aug 23, 2014 3:49 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6280
Location: Seattle
I spent some time digging through Nestopia's source to try to figure out how it did stereo ... but mostly just found in an exercise in frustration because the C++ goo got all over everything and made it impossible to follow data flow.

In any case, the least wrong choice is probably a static pan effect, panning each of the 5 (or 6, 8, 11, or 13) channels by using a slightly different volume for left and right.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group