gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Audio > PCM Specification

#6024 - bruadhin - Thu May 15, 2003 4:53 pm

I am looking for a specification for the PCM file and exactly what the data within looks like and represents.

I am trying to implement a MIDI player using .wav files as samples for the MIDI. This would be done through the DirectSound channels, however I first need to find out if PCM data can be modified for frequency to achieve the desired note.

Thanks.

#6027 - gb_feedback - Thu May 15, 2003 5:22 pm

Quote:
I am trying to implement a MIDI player using .wav files as samples for the MIDI.

Sounds like what I'm doing. You should find file format info at http://www.wotsit.org/.

(In case you haven't seen it you can download my first attempt from my site - it is in the form of a plug-in for Pogoshell).

To change the frequency of the sound sample you need to calculate a fractional number of samples to increment your sample pointer by, based on the frequency of the sound. If you use a fixed point number it doesn't take long to do the calculation. (I could have made that clearer - I'm sorry.)

I'm currently working on a windows app to build my instrument samples file from the various wave files I have found. The first time round I built the samples file by hand in a hex editor and I can't face doing it again. The challenge is to fit the samples and the engine into about 64k, else it wouldn't be much use as a plug-in.
_________________
http://www.bookreader.co.uk/

#6032 - tepples - Thu May 15, 2003 6:21 pm

Quote:
I'm currently working on a windows app to build my instrument samples file from the various wave files I have found.

If I were you I'd make it a command line app, so that it can be included in a makefile. Or are there other issues involved that require a GUI?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#6038 - gb_feedback - Thu May 15, 2003 6:52 pm

Quote:
If I were you I'd make it a command line app, so that it can be included in a makefile. Or are there other issues involved that require a GUI?

I take your point but this thing just grows and grows! I decided I needed a button to test-play each sample, with the defined envelope, loop size and volume before I committed it to a build cycle. And there are 128+47 samples to define on the fly. I think I am going to allow it to build the final gba bin file by automatically combining in the engine - so it's still a one press solution. I am thinking of displaying the wave next so that I can pick a good loop point visually. But I'll probably tire soon - it's been 10 days so far.

I think you have a file system which is a good idea. I have always been working with a program with a fairly well defined, small size. So to add
my binaries I copy a fixed sized engine (padded out to a standard size) followed by a project specific index table built into the data file, into the target bin file. I am usually either working on the engine, or on the data, but rarely both! So there's always a one keypress build. In other circumstances I'd probably do a file system like yours.
_________________
http://www.bookreader.co.uk/