FM synth BRR sample generator

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: FM synth BRR sample generator

Post by KungFuFurby »

TOUKO wrote:
lidnariq wrote:KFF made a demo of using the SPC700's pitch modulation for FM-ish sound...
Wahoo, terrific sound,but does it run on a real snes, or needs an hacked emulator ??
The pitch modulation feature existed on an actual SPC700 (and thus, on a real SNES). See Oracle from Secret of Mana, several songs from Packy and Marlon, and Dark Jungle from Jurassic Park (you'll have to wait about a minute or two on this one) for a few examples.

Amusingly, it's not a hacked emulator that I used, but a hacked sound driver. I hacked SNESMod, which never had pitch modulation support to begin with. Later versions were produced by Augustus Blackheart, and I sometimes contributed fixes.
User avatar
TOUKO
Posts: 306
Joined: Mon Mar 30, 2015 10:14 am
Location: FRANCE

Re: FM synth BRR sample generator

Post by TOUKO »

thanks for the infos, and sorry for the mistake (hacked emulator rather than audio driver :oops: )
BTW, i listened the others song you posted and i like very much, good job .
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: FM synth BRR sample generator

Post by psycopathicteen »

How do you know how an MOD file is going to sound before you convert it?
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: FM synth BRR sample generator

Post by KungFuFurby »

Depends on what I'm making. Usually I can just rely on Schism Tracker, but this doesn't work as well when pitch modulation and/or noise generation is involved (thankfully I assigned these to unused IDs, to the original Impulse Tracker's standards...). Sometimes I have to convert them while they're incomplete to make sure my pitch modulation (and/or noise generation) is working correctly. Other times I convert them only when they're finished and ready to go.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: FM synth BRR sample generator

Post by psycopathicteen »

Do you know what settings you use for electric guitar sounds?
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: FM synth BRR sample generator

Post by Bregalad »

rainwarrior wrote:Okay, since you do seem interested, I will try to explain with more detail:


When the frequency of an oscillator stays constant, its wavelength stays constant.

With phase modulation synthesis, both carrier and modulator stay at the same frequency always. Their wavelengths always match, they always stay synchronized.

With frequency modulation, the frequency of the modulator is constant, but the frequency of the carrier is always changing. The wavelength of the carrier is much more complicated in this case, it is an integral related to the changing frequency over time.

So, with a perfect sine wave modulator, the "ideal" mathematical version, the wavelength of the carrier adds back up to where it started; there's equal time spent in lower frequency and higher frequency and it balances out.

With an integer approximation of a sine wave modulator, they only approximately balance. It's similar to how Euler integration step by step of a physical trajectory will have an error compared to the ideal continuous integral.

What happens when the wavelength of the modulator does not match the wavelength of the carrier? Its phase shifts a little bit each wavelength. How much it shifts depends on how much error. The amount of error is a bit chaotic with these kinds of systems, which is what I mean when I say every different note is going to have a different speed of phase shifting.

Anyhow, if the phase shifts, the timbre of the sound changes. If the phase is shifting slowly, you get a slowly changing sound. If it shifts quickly, you get a quickly changing sound.

There do exist ways to make integer approximations where the errors will balance (and even systems that don't tend to have a few "lucky" notes that are stable), but it requires careful design with this in mind. You're not likely going to get something that does that in the SNES or FDS.

Does this explain what the problem is and how it occurs?
Thank you very much for the detailed explaination, Rainwarrior. This is very much appreciated.

So the problem does not come from FM itself, but from the rounding necessary to store a digital sine wave. Isn't is possible to make the error perfectly symetric, for example by having a sine table which is perfectly symetric ?

About the FDS; I undetsand there is less bits for the modulator, however it is still possible to have a perfecly symetric signal for the modulator despite the lower precision, isn't it? The issue is that I do not think it is possible to amplitude of the modulator dynamically as a note sustain, so this cannot approach what FM synthesis does, I guess, even without accounting the shifting from accumulating errors.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: FM synth BRR sample generator

Post by psycopathicteen »

I think he means there is always going to be some aliasing on the modulator that causes a distorted sound.
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: FM synth BRR sample generator

Post by rainwarrior »

Bregalad wrote:Isn't is possible to make the error perfectly symetric, for example by having a sine table which is perfectly symetric ?

About the FDS; I undetsand there is less bits for the modulator, however it is still possible to have a perfecly symetric signal for the modulator despite the lower precision, isn't it? The issue is that I do not think it is possible to amplitude of the modulator dynamically as a note sustain, so this cannot approach what FM synthesis does, I guess, even without accounting the shifting from accumulating errors.
Yes, being an approximation doesn't mean you can't balance. It just means it requires careful design of the algorithm.

With the FDS you're fighting against other factors besides its extremely coarse control (like how the modulator multiplies against the pitch value, trying to adjust it pseudo-logarithmically instead of linearly). If you do enough analysis work you might be able to find some combination that balances for at least a subset of pitches, but I don't know if there's a practical way to do it.

On the SNES, it seems that the modulation amount might be linear, so I think there is a much better possibility here. (Maybe even the naive approach is close enough.)
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: FM synth BRR sample generator

Post by KungFuFurby »

psycopathicteen wrote:Do you know what settings you use for electric guitar sounds?
Usually a square wave on the carrier, and a sine wave (usually one octave down, although sometimes I fool around to limited effect) on the modulator (if I'm using the terminology right). Psuedo-feedback effects can be achieved by simply dialing the modulator's gain (gradually) to zero.

I also have used two square waves, although I usually prefer them at the same frequency.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: FM synth BRR sample generator

Post by psycopathicteen »

Thanks. I've been trying to figure how to make synthy electric guitar sound for a long time.
User avatar
Señor Ventura
Posts: 233
Joined: Sat Aug 20, 2016 3:58 am

Re: FM synth BRR sample generator

Post by Señor Ventura »

lidnariq wrote:KFF made a demo of using the SPC700's pitch modulation for FM-ish sound...
What is the frequencie of that example?, in the link doesn't described...
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: FM synth BRR sample generator

Post by KungFuFurby »

That one's a mixed bag. Sine waves, square waves and saw waves are all used in varying fashions as carriers and modulators.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: FM synth BRR sample generator

Post by psycopathicteen »

What octaves are they sampled at?
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: FM synth BRR sample generator

Post by KungFuFurby »

Also a mixed bag. I was experimenting with up to two octave's difference, and in at least one case I used a five-semitone pitch difference rather than an octave.
User avatar
Augustus Blackheart
Posts: 61
Joined: Sat Jul 26, 2014 9:50 am

Re: FM synth BRR sample generator

Post by Augustus Blackheart »

psycopathicteen wrote:This time I changed the carrier wave from a triangle, to a half-triangle half-square wave.

...and also an LFO modulating the modulator's amplitude.
Sounds cool! I often use 4-6 channels just for one sound. It would be nice to continue doing so when I have the tracks to spare but then switch to this method when I don't.
How do you know how an MOD file is going to sound before you convert it?
For me it doesn't sound much different in the MOD file unless I'm using pitch modulation or noise. The first thing I did when I started messing about with pitch modulation was try different combinations of samples/octaves in one file. Then I made a note of the combinations I liked best. I should just add SNES emulation for sound playback in my tracker but it would be even more useful to add it to a cross platform tracker so more people could make use of it. As an added attraction I'd have it ignore/map commands based on the sound driver or native IT mode (like my hacked tracker does.)

I've attached a ROM* with some songs in case anybody needs more examples of songs using pitch modulation.

*slightly buggy, SNESMod doesn't stop playing tracks that have ADSR enabled. Whoops.
Attachments
ablackheart.sfc
Cheesy fm songs, updated with additional songs.
(512 KiB) Downloaded 141 times
Last edited by Augustus Blackheart on Mon Feb 20, 2017 9:59 pm, edited 1 time in total.
Post Reply