vgmrips

The forum about vgm files
It is currently 2019-09-22, 21:02:16

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 2019-09-13, 14:26:38 

Staff Staff
Programmers Programmers
Contributors Contributors
Ball Fondlers Ball Fondlers
Offline
User avatar

Joined: 2014-01-28, 5:51:54
Posts: 684
Y'all happen to have a formula or some code that converts from the OPN Block + F-Num to a floating point frequency value? And maybe the same for OPM? Thanks

_________________
Follow me on twitter.

If you like this post, give it a big thumbs up and hit that subscribe button down below! And as always, thanks for reading, and see you next post.


Top
 Profile  
 
 Post subject:
PostPosted: 2019-09-13, 18:32:59 

Contributors Contributors
Staff Staff
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2013-07-17, 23:32:39
Posts: 385
For OPN series this might work based on the datasheet (though really not tested):
Code:
Fc / 144 / 2^(10-Block) * Fnum / 2048

8000000 / 144 / Math.pow(2,10-4) * 1038 / 2048 = 439.9617513020833


For OPM you'll need a lookup table to convert the keycode to MIDI notes then you can do something like
Code:
440 * 2^((kc - 56 + kf / 64)/12)

this example assumes note count starts at C#0 and A4 freq is 440hz. For this you might need to define a different reference frequency based on the chip clock. If you want to be completely accurate you need to use yet another lookup table that converts it to the internal F-num/block.


Top
 Profile  
 
 Post subject:
PostPosted: 2019-09-14, 3:04:43 

Staff Staff
Programmers Programmers
Contributors Contributors
Ball Fondlers Ball Fondlers
Offline
User avatar

Joined: 2014-01-28, 5:51:54
Posts: 684
Thx, that seems to work for OPN, haven't tried the OPM formula yet.

_________________
Follow me on twitter.

If you like this post, give it a big thumbs up and hit that subscribe button down below! And as always, thanks for reading, and see you next post.


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

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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
[ Time : 0.261s | 15 Queries | GZIP : On ]