vgmrips

The forum about vgm files
It is currently 2018-11-13, 7:13:36

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 2018-10-16, 23:00:41 
Offline

Joined: 2016-05-13, 23:55:38
Posts: 69
For SNES OSTs for example, how do I check what the bit depth and sample rate are for each sample? As output by the system, not the original uncompressed sample.


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-16, 23:26:04 

Contributors Contributors
Staff Staff
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2013-07-17, 23:32:39
Posts: 336
I think you can formulate your question better. You're trying to ask many questions in one statement, it feels like.

SNES samples are always in BRR format. The output from the system is always 16-bit stereo PCM, 32khz.

The sample rate of each individual sample depends on the pitch. If you use SPCPlay you can see the raw pitch values sent to the DSP, if you go Settings >Information > Channel 1. The pitch values are represented in hex, convert to decimal and multiply by 7.8125 for the sample frequency in Hz.

In general, it's impossible to see the quality of each individual sample if you only have the mixed output. The best you can do, is to isolate the sample (find some sound bit where no other sample is playing) and do a FFT spectrum analysis, but even this is imperfect if there is additional processing.


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-16, 23:46:06 
Offline

Joined: 2016-05-13, 23:55:38
Posts: 69
Thanks. Well, I mean the quality of a single sample as it's playing in a track. On SNES they tend to be downsampled so I want to check by how much and see what I find to be the best sounding OSTs are using.

Checking the pitch doesn't seem to answer what I'm after (the quality of a specific instrument before it's decided or I guess regardless of what pitch it's playing at), so how do I do an FFT spectrum analysis?


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-17, 0:06:00 

Contributors Contributors
Staff Staff
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2013-07-17, 23:32:39
Posts: 336
If you want to get the "normalised" sample rate (or middle C frequency), you will still need to obtain the pitch value of the sample, but also the pitch itself (the note value), get the difference of semitones and use this table to obtain the C frequency.

the FFT you can get from for example audacity, in that case you'd pretty much look for a band stop frequency (common if the sample is resampled with an algorithm) or harmonics (typically caused by aliasing where there is no interpolation). But since the deduced sample rate STILL depends on the pitch for melodic instruments, you're not going to like that either.


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-17, 0:13:38 
Offline

Joined: 2016-05-13, 23:55:38
Posts: 69
Do you know how to extract the samples from the game rom instead? I figure those should be at the default pitch.


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-17, 0:27:46 

Contributors Contributors
Staff Staff
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2013-07-17, 23:32:39
Posts: 336
There is no default pitch, it depends on each sample and it is also defined in the sound program itself . You can find out how to extract samples from spc files by googling. But you will have to tune them yourself, some wave editors can do that for you.


But really, you can get exactly all you need regarding the "quality" of the sample from looking at the pitch value. Think about it like this. Game X uses a sample to play the note A5 and the sample pitch (=rate) is 8000 Hz. Looking at a table of piano key frequencies we can see that the frequency of A5 is 880 Hz. That gives about 9 sample points per full phase of the waveform. As this is not much to define the harmonics, it will probably not sound very well.


Top
 Profile  
 
 Post subject:
PostPosted: 2018-10-17, 3:46:53 

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

Joined: 2014-01-28, 5:51:54
Posts: 628
You can use a pitch detection algorithm on the original samples, such as autocorrelation, or counting the zero crossings. Perhaps the tool 'aubiopitch' from aubio?

_________________
Support me on patreon!.
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  [ 7 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