PCM -> FM worth trying?

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
koilazka
Interested
Posts: 30
Joined: Mon Nov 30, 2009 1:51 am

PCM -> FM worth trying?

Post by koilazka » Tue Apr 27, 2010 4:06 pm

Hi again :/

I havnt tryed any sound programming yet on the mega drive, mabey someone knows if this is worth trying.

This all depends on how fast an FM channel can switch frequency (with a game runing).
And the ammount of data and sound quality for if its worth trying or not.

A 4Hz switch rate would sound like neo on the matrix after taking that pill (i think).
Would be usefull to know how much data one FM switch would take up in memory.

A convertor program would be easy enough to write PCM.wav -> MDFM, but is it worth trying?

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Tue Apr 27, 2010 4:28 pm

I can't get what you trying to achieve by changing FM channel frequency. If you meant volume instead of frequency, then it was discussed here already, and probably it would be worse than using DAC mode (which is there for a reason, isn't?).

koilazka
Interested
Posts: 30
Joined: Mon Nov 30, 2009 1:51 am

Post by koilazka » Wed Apr 28, 2010 7:59 am

Me elaborate, correct me if im wrong.

The megadrive has two different ways to generate sound.
One is the FM tone generators. The other is PCM.

To generate tone with PCM, you draw a waveform with points, max usually 48Khz (48,000 points per second)

With the FM tone generators, you select frequency + waveform (with the operators), and it generates the tone.

PCM -> FM convertor would translate segments of a wav file, into a string frequency numbers.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Apr 28, 2010 8:11 am

this would not work out since you can play only one freq on each channel, giving you 6 different freqs possible, though you have lot of possible waveforms but it will still not be viable. One coulsd use a special mode on Channel3 but 9 different freqs won't be enough.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Wed Apr 28, 2010 8:14 am

In real audio, there is no one certain frequency at one point, there is a large number of frequencies with different amplitudes. So with your method you can't get real audio, just some weird sound effect.

koilazka
Interested
Posts: 30
Joined: Mon Nov 30, 2009 1:51 am

Post by koilazka » Wed Apr 28, 2010 10:59 am

Me try again :/

So say this is a PCM.wav file, the pixels represent each pulse.
Image

Say you make the convertor program split the PCM.wav into 50 frequencies per second.
Image

So, every 20 miliseconds on the mega drive, one FM channel would change its frequency.

sound start: 640Hz
200ms later: 500Hz
400ms later: 320Hz
600ms later: 300Hz
800ms later: 300Hz

If you split the PCM into 5 frequencies per second, it would sound very jumpy, only changing the frequency of one FM channel 5 times a second.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Wed Apr 28, 2010 11:09 am

This will not work. In 20ms there is no just one dominant frequency in actual audio recording, it is very complex waveform. If something so simple could worked, you'd see it everythere. Unfortunately, you could only get weird sounding effects this way, nothing resembling the original audio.

This is how 20ms of the actual audio looks like:

Image

koilazka
Interested
Posts: 30
Joined: Mon Nov 30, 2009 1:51 am

Post by koilazka » Wed Apr 28, 2010 11:41 am

The convertor would convert the PCM.wav into one dominant frequency.

You would write a frequency decoder in the convertor, it would use the peeks of the waveform to determine the frequency.
Image

14 Hz reads in 20 ms, divide the reads by 20 = the average frequency.
On the mega drive it would convert the waveform into one frequency number.
Image

Every 20 miliseconds, the frequency would change.

This is why im asking, how fast can you change the frequency of one FM channel.
If you change the frequency every 5 miliseonds or quicker if possible, speech may not sound like a dying robot.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Wed Apr 28, 2010 11:48 am

In emulator you can change the frequency at any rate. So do the test and see the result by yourself, if you don't want to hear that others say.

Regarding voice, you should read about vocoders and LPC.

koilazka
Interested
Posts: 30
Joined: Mon Nov 30, 2009 1:51 am

Post by koilazka » Wed Apr 28, 2010 12:25 pm

I was just trying to explain what i was blabbering about, if we can change frequency at any rate thats awesome, dying robots ftw :(

ill read the wiki topics.

Post Reply