General Info / News

Talk about your favorite PC games, Steam and building awesome custom rigs!

Moderator:Moderators

Post Reply
User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Sat Jan 27, 2007 1:52 pm

Progress with music!

A few days I wrote a rather simple chiptune and I got it playing on the N64.

The N64 uses a propretary format of compressed MIDI to store notation, and samples are stored as compressed AIFF sound files.

So, after mucking about with a half-dozen command line utils from the N64 sdk and writing a bunch of batch files, I got the samples converted from WAV to AIFC. Just for sake of comparison, MIDI conversion takes about 4 steps (export from MOD, convert to type 0, compress, add to sequence bank) and soundbank conversion takes even more (export to WAV, convert to AIFF, generate compression codebank, feed it into AIFF compressor, store the AIFC into a soundbank).

http://retroactive.be/playseq.v64

It sounds atrocious, but it works! That is enough for right now. So, using Nintendo's audio microcode is possible, but a PITA.
Image

Jongamer
Senior Member
Posts:2151
Joined:Wed Dec 13, 2006 2:43 pm
PSN Username:Geekystig790
360 GamerTag:Mesu Gitsune
Location:Fairborn, Ohio

Post by Jongamer » Sat Jan 27, 2007 2:09 pm

marshallh wrote:Progress with music!

A few days I wrote a rather simple chiptune and I got it playing on the N64.

The N64 uses a propretary format of compressed MIDI to store notation, and samples are stored as compressed AIFF sound files.

So, after mucking about with a half-dozen command line utils from the N64 sdk and writing a bunch of batch files, I got the samples converted from WAV to AIFC. Just for sake of comparison, MIDI conversion takes about 4 steps (export from MOD, convert to type 0, compress, add to sequence bank) and soundbank conversion takes even more (export to WAV, convert to AIFF, generate compression codebank, feed it into AIFF compressor, store the AIFC into a soundbank).

http://retroactive.be/playseq.v64

It sounds atrocious, but it works! That is enough for right now. So, using Nintendo's audio microcode is possible, but a PITA.
Not Bad, at least we know it can run on a N64.

User avatar
Skyone
Moderator
Posts:6390
Joined:Tue Nov 29, 2005 8:35 pm
Location:it is a mystery
Contact:

Post by Skyone » Sat Jan 27, 2007 6:27 pm

Jongamer wrote:Not Bad, at least we know it can run on a N64.
No, we know that we can run it on an N64 emulator.

Looking good, glad to see more progression.

Jongamer
Senior Member
Posts:2151
Joined:Wed Dec 13, 2006 2:43 pm
PSN Username:Geekystig790
360 GamerTag:Mesu Gitsune
Location:Fairborn, Ohio

Post by Jongamer » Sat Jan 27, 2007 6:40 pm

Skyone wrote:
Jongamer wrote:Not Bad, at least we know it can run on a N64.
No, we know that we can run it on an N64 emulator.

Looking good, glad to see more progression.
I know what he Means, how do you think I opened the file? With a Back-up device, I cant Find one, and if I could find em cheap I would get one in a Heart-beat.

User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Sat Jan 27, 2007 6:44 pm

It does run on the N64 :)
The hardest part with this kind of MOD-MIDI conversion is that while mod formats allow for post-strike volume changes (changing a sound's volume after it's started playing), MIDI doesn't seem to. However it does allow one to assign a custom volume envelope (attack/decay) so I might be able to get things to work that way.

If you're seeing lots of garbage when you run the ROM, that's good :) I was too lazy to zero out the framebuffer.

Will post more pics of the house models soon.
Image

User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Sat Feb 03, 2007 10:53 pm

Status update...
Although there are performance benefits to using the Nintendo MIDI method, converting songs is a painful process, and ModPlug Tracker has quite a few bugs in MIDI exporting.

I'm going to switch to a homebrew modplayer. I can just dump my songs into this player, recompile, and it plays right the first time. I've been trimming it down to work better.

Loom/CZN who originaly ported it didn't take any extra effort - check out this memory management:

Code: Select all

int free(char *memaddr)
{
    return(0);
}
Just one of the things I have to fix. :P

Bonus: playing around with some stuff in the dev kit.
Image
Cookie to who can identify what it is :P
Image

vb_master
Moderator
Posts:4793
Joined:Tue Jun 08, 2004 9:52 pm

Post by vb_master » Sat Feb 03, 2007 10:58 pm

marshallh wrote:Bonus: playing around with some stuff in the dev kit.
[image]
Cookie to who can identify what it is :P
64DD IPL ROM

User avatar
Unidentified Assilant
Senior Member
Posts:2531
Joined:Thu Oct 21, 2004 12:26 pm
Location:Yea I like machine head

Post by Unidentified Assilant » Sun Feb 04, 2007 7:48 am

I very much like the progress of this, nice to see you attempting a console project, do you think this will under SurrealXXX on Xbox?
Image

Somebody please buy my Dreamcast >_> £20+shipping :)

User avatar
Kurt_
Portablizer
Posts:5748
Joined:Thu Nov 24, 2005 10:32 am
Steam ID:kurbert
Location:Ontario, Canada
Contact:

Post by Kurt_ » Sun Feb 04, 2007 1:33 pm

Looks awesome still. Can't wait. Just like I couldn't for the last 15 or so years since you started it!!!

When can we expect it? End of summer? ENd of next summer?

(And the music is really really cheesy. It sounds kinda like skate or die from NES. Although I can picture that in some part of the game, somehow.)
Hey, sup?

User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Wed Feb 07, 2007 9:16 pm

Decided to write my own modplayer. The CZN port is a port of MikMod and it's pretty messy to work with, not to mention it hogs ram (like having two copies of the song in memory at once.)

Got a simple drumloop playing, by stuffing it into the AI buffer bit by bit.

Feel free to poke fun at my code.

Code: Select all

// general defs
#define		NUM_CHAN		4
#define		NUM_SAMPLES		1

// mixer output frequency
#define		OUTPUT_RATE		8000

// mixer buffer size
#define		BUFFER_SIZE		32768	// bytes

// temp mixing buffers
unsigned char	resampleBuff[BUFFER_SIZE][NUM_SAMPLES];
unsigned char	channelBuff[BUFFER_SIZE][NUM_CHAN];
unsigned char	finalBuff[BUFFER_SIZE];

// sample typedefs
struct sampleObj {
	int playCnt;	// playback position
	int *samplePtr;	// pointer to sample array
	int playing;	// 0 or 1
	int length;		// sample length
	int adjLength;	// new length after setting new playback frequency
};

struct sampleObj	samples[NUM_SAMPLES];


int initPlayer()
{
	int i = 0;

	// init the audio DAC with the mixer rate
	osAiSetFrequency(OUTPUT_RATE);

	samples[0].samplePtr = &drumloop;
	samples[0].length = DRUM_LENGTH;
	samples[0].adjLength = samples[0].length;

	for(i = 0; i < NUM_SAMPLES; i++)
	{
		samples[i].playCnt = 0;
		samples[i].playing = 0;
	}
}

void updatePlayer()
{
	int i = 0;
	// make sure no DMAs are in progress
	if(!(osAiGetStatus() & AI_STATUS_DMA_BUSY))
	{
		
		for(i = 0; i < NUM_SAMPLES; i++)
		{
			if(samples[i].playing == 1)
			{
				// sample is playing, let's spit it out through AI

				// are we reaching the end?
				if((samples[i].playCnt + BUFFER_SIZE) > samples[i].adjLength)
				{
					// not enough sample to fill the buffer, so only fill part of it
					osAiSetNextBuffer(samples[i].samplePtr+samples[i].playCnt, samples[i].adjLength-samples[i].playCnt);
				}
				else
				{
					// plenty of room, use max buffer size
					osAiSetNextBuffer(samples[i].samplePtr+samples[i].playCnt, BUFFER_SIZE);
				}
				// increment playing position
				samples[i].playCnt += BUFFER_SIZE;

				// are we past the end of the sample?
				if(samples[i].playCnt > samples[i].adjLength)
				{
					// stop playing it
					samples[i].playing = 0;
				}

			}
		}
	}
}

void playSample(int smp)
{
	if(samples[smp].playing != 1)
	{
		// reset play counter
		samples[smp].playCnt = 0;
		samples[smp].playing = 1;
		smp = 0;
	}

}

void setFreq(int smp)
{
	int i;
	for(i = 0; i < BUFFER_SIZE; i++)
	{
		//nothing here yet
	}

	
}

Image

User avatar
Master of Portables
Portablizer
Posts:335
Joined:Fri Aug 04, 2006 9:48 pm
Contact:

Post by Master of Portables » Wed Feb 07, 2007 10:04 pm

ill take a wild stab at the pic, is it mario talen paint studio for the n64 disc drive?
<img src="http://img168.imageshack.us/img168/1597 ... sigzg0.png">
ChronoTriggerfan wrote:you should focus all your energy on making a really pretty case
Dragon Force pwns every other band in the world!
:mrgreen:

User avatar
gamemasterAS
Senior Member
Posts:3309
Joined:Thu Nov 24, 2005 10:30 pm
Steam ID:lolz1337face
Location:Ohio
Contact:

Post by gamemasterAS » Thu Feb 08, 2007 4:53 pm

Unidentified Assilant wrote:I very much like the progress of this, nice to see you attempting a console project, do you think this will under SurrealXXX on Xbox?
Yah will we see grand theft portable playable on the sbox n64 emu ?
.

Jongamer
Senior Member
Posts:2151
Joined:Wed Dec 13, 2006 2:43 pm
PSN Username:Geekystig790
360 GamerTag:Mesu Gitsune
Location:Fairborn, Ohio

Post by Jongamer » Thu Feb 08, 2007 4:58 pm

gamemasterAS wrote:
Unidentified Assilant wrote:I very much like the progress of this, nice to see you attempting a console project, do you think this will under SurrealXXX on Xbox?
Yah will we see grand theft portable playable on the sbox n64 emu ?
Probably most N64 Emus will run it, because it sounds like very basic N64 programming, and thats what a lot of Emus have trouble with is with complicated Codeing that the Emu doesnt Reconize.

User avatar
marshallh
Moderator
Posts:2986
Joined:Sat Sep 10, 2005 2:17 pm
360 GamerTag:marshallh
Location:here and there
Contact:

Post by marshallh » Sat Feb 10, 2007 11:38 am

Bought a Xilinx Spart-3E fpga dev board.

Comes with several megs of flash memory, and 64MB sdram onboard. Should be good for cartridge emulation.
Image
Image

User avatar
Billybb347
Posts:55
Joined:Fri Feb 23, 2007 4:28 pm

Post by Billybb347 » Sun Feb 25, 2007 9:48 pm

Sword_Gun wrote:What about in cars? Car music is the best.
You could have Tetris going on in the background when in the car. That seems fitting music (it being a game about older game systems and all), and I don't think it would be that hard to create with MIDI since it was originally a MIDI(I think).

Post Reply