Jump to content
IGNORED

HOWTO Get Music into a Game


glurk

Recommended Posts

I'm asking this for me, but I'm sure it would help others as well.  I'm still playing around with an 'Antarctic Adventure' Atari port, and I've gotten to a point I'd like to get the intro/gamestart music in there.  Just some simple VBlank-driven POKEY player, which I'll write from scratch if need be.

 

My question is how to get the music in there, without MANUALLY typing in the note freq. values, and timing, etc.  I already have the music.  I have it as sheet music, and as a MIDI file, and as a VGM file, and as an NSF file.  And I could probably convert some of those to some yet-another-format if needed.  (What IS the best format to use????) And I'm definitely not looking for some super high quality memory hog XE/XL only music tracker thing.

 

Just looking for a way to get a short 7-second (35 note!) bit of music into byte values, hopefully in a nice compact way.  Is there an existing converter/player out there for such a use?  I really searched, and came up empty.  I'm not asking anyone to do any of this for me, I simply want to know how to do it myself.  So any pointer are appreciated, and if a drop-in free player exists, that would be cool as well.  In ASM, no BASIC.

Link to comment
Share on other sites

In the modern day, use a tracker such as RMT.  It differs from most in that you can import and compose using the Windows application then generate source or executables.

 

Once you have the source you can incorporate it into your own program then there's generally an init call and a player call every VBlank.  Generally the done thing is compose the music with PAL as the target system.  Then have your program check the system type - if it's NTSC just skip the player call every 6th frame.

Link to comment
Share on other sites

There is also my music routine in ASM which was hacked from the 7800 Mrs. Pac Man but has been heavily modified, which is my current weapon of choice.  Unfortunately, it does require the typing of note values and durations.  Which if it's just standard $Ax distortion at 64 khz, I have that table virtually committed to memory by now. :)  Otherwise, you will need POKEY note tables handy (I have posted one such over on the 7800 forum).  It's also less memory intensive than RMT but has the limitation that every POKEY channel is hardcoded to the same distortion (i.e. you can't change from $Ax to $Cx distortion in the same channel).  Every note also has a standard decay built in, which is controlled from a universal decay table.

 

Failing that though, RMT is your best bet.

Edited by Synthpopalooza
Link to comment
Share on other sites

I download the RMT thing, and it looks like trying to swat a gnat with a supramechanical sledgehammer.  And it only imports MOD files, which is another step, and means samples, and blah, blah...  And this is such a simple little bit of music.  It's literally this:

 

AAGSt.thumb.png.6b0c8c57ff7143cfa4de6fb224ea58e1.png

All I really want to do is get this music into some byte values.  Hopefully without too much pain, such as looking up all the freq. values from a table, etc.  Again, not asking for anyone to do it for me, but just "if you were me, and you wanted the above music to play on POKEY, how would you..."

 

Someone has surely faced this same thing before.  Other's stories, anedotes are fine.  I don't mind doing the "work" or programming, whatever, I enjoy it.  But at this point, I don't even know where to begin.  I guess I could use "Music Construction Set" or something, and put it in that way, but does it even output anything usable?  I don't know.  What format SHOULD I be using?  I don't know.

 

And I "AM" a musician, but not an 'electronic' one.  So I have little experience with this stuff...  If I could figure out some kind of a "workflow" to even begin, that would be a great start! 

Link to comment
Share on other sites

In my opinion RMT is the easiest to use for this purpose.

 

The annoying part is to actually make the music itself if you are not familiar with music tracker programs, but playing it back is really not too bad.

 

it's pretty much just a matter of calling the player somewhere in the code once per frame to play a tune, slap a stripped .rmt module somewhere in memory, usually $4000 based on the .rmt format itself, and have the calls for pause, stop, etc when they are needed.

 

Now I won't start claiming things that may be incorrect since I am only a beginner programmer, but as far as I could understand from a project I am working on, it's just a matter calling the player at least once per frame and have a module in memory play about anything you want at any given time.

Link to comment
Share on other sites

I also think the RMT is the easiest solution and will allow easy addition of sound effects on one channel. There are examples in RMT how to play music and sfxes. The hard part can be learning RMT, because the user interface even for a music tracker is a bit clunky. On the other hand community here is helpful and if you have any questions, you will get answers for sure. Meanwhile search through the forum because tips for the beginners were given in different threads e.g. 

 

Link to comment
Share on other sites

1 hour ago, glurk said:

Someone has surely faced this same thing before.  Other's stories, anedotes are fine.  I don't mind doing the "work" or programming, whatever, I enjoy it.  But at this point, I don't even know where to begin.  I guess I could use "Music Construction Set" or something, and put it in that way, but does it even output anything usable?  I don't know.  What format SHOULD I be using?  I don't know.

You may like to try out "The Soundmachine", which IMHO fits your needs quite well:

 

Sound Machine - main screen

Edited by Irgendwer
Link to comment
Share on other sites

3 hours ago, Wrathchild said:

Do any RMT musicians utilise the MIDI in feature?

I do so, but it's not as practical as it seems, since the timing/length of note will not be recorded - only the key. So it's only a bit more convenient than the computer keyboard simulating the piano key layout.

Link to comment
Share on other sites

I still think my ASM music routine can work for you, if you don't mind the programming work.  I am overdue about making a "POKEY for beginners" post in here anyway with examples using it to do simple short tunes and game sfx.

 

As examples, I used it in Gibstov's Adventure Ponies game, and the recent Intellidiscs tron game.  

 

Edited by Synthpopalooza
  • Like 1
Link to comment
Share on other sites

6 hours ago, glurk said:

I download the RMT thing, and it looks like trying to swat a gnat with a supramechanical sledgehammer.  And it only imports MOD files, which is another step, and means samples, and blah, blah...  And this is such a simple little bit of music.  It's literally this:

 

AAGSt.thumb.png.6b0c8c57ff7143cfa4de6fb224ea58e1.png

All I really want to do is get this music into some byte values.  Hopefully without too much pain, such as looking up all the freq. values from a table, etc.  Again, not asking for anyone to do it for me, but just "if you were me, and you wanted the above music to play on POKEY, how would you..."

 

Someone has surely faced this same thing before.  Other's stories, anedotes are fine.  I don't mind doing the "work" or programming, whatever, I enjoy it.  But at this point, I don't even know where to begin.  I guess I could use "Music Construction Set" or something, and put it in that way, but does it even output anything usable?  I don't know.  What format SHOULD I be using?  I don't know.

 

And I "AM" a musician, but not an 'electronic' one.  So I have little experience with this stuff...  If I could figure out some kind of a "workflow" to even begin, that would be a great start! 

It might be a good start to use a program that allows inputting musical notation and export it to a midi file.   From there,  you should be able to find a converter to the format you need.

Link to comment
Share on other sites

I have a MIDI file.  And an NSF, and a VGM.  But I don't even know what format it should be in.  Just to feel like I was doing something with it, I got a program called "Macrotune" and inputted it as MML notation.  And it plays and sounds pretty darn good, too.  But I don't know that this helps me in any way whatsoever....

 

I've tried RMT, and the "bassline" for this is just a descending A Major scale x3, with a tag at the end.  And I can't even figure out how to enter that much...  Sigh.

 

aastart.thumb.png.0fad49ce6425ed354ff55085f47e6b31.png

Link to comment
Share on other sites

Ok, so I took your sheet music (which is notated in a somewhat bizarre format, IMHO) and entered into OctaMED on the Amiga as it is my preferred tool. From there I exported it as a ProTracker MOD which then could be imported amazingly fluidly into RMT. However your choice of key, A major is not ideal since bass only goes down to C-2 from what I can tell so you would probably want to transpose it from A to C major.

 

I tried to do that in RMT but despite following the English instructions, I didn't make anything happen except changing the octave I type in music, so all three parts are probably at least a sixth, perhaps an octave higher than you intended.

 

Edit: I found out that first you select a range of notes with Shift + Up/Down, then set the instrument with Shift + Left/Right, then hold down Ctrl + Shift and press Page Up/Down to transpose the range and instrument you selected. A bit cumbersome but at least I got it working.

 

antarctic.rmt

Edited by carlsson
  • Like 1
Link to comment
Share on other sites

Well, thank you for that, that is it.  I'll have to figure out how to change volumes/tones, etc...  I wish it could import MML.  That notation I posted IS screwy, it was done with an automated tool.

 

I wondered about those low bass notes.  POKEY can't go below C2?  I'm sure I've heard lower bass than that?  I'm no expert on ANY of this stuff....

Link to comment
Share on other sites

You can use the distorted channel $Cx which has low bass tones.  I've not tried it, but you can combine 2 AudFx  and AudCx registers into a 16 bit audio channel, perhaps it has lower range of pure tones? Can't recall since it's been years that I read about it. 

 

There were notes charts for clear $Ax and distorted $Cx channels,  posted in AA threads over the years, very helpful. 

Link to comment
Share on other sites

I would recommend to not use RMT expecting easy automation (eg importing a mod) because 99% of the time things sound wrong.

 

I can help a bit with rmt if you want, I have been working with this program for a good amount of time now, there are many tricks that help get decent sounds from it.

Link to comment
Share on other sites

Just for fun I just gave it a shot and transcribed the NES version of that tune, I dunno if that's good enough, it sounds really simplistic for being a pretty early game from that time too.
So here's the module if you think it may be useful.

This uses my patched version of RMT btw, which does improve a bunch of tuning tables, among few other things, so it may sound a little off in the original version.

 


 

antarctic title.rmt

  • Like 1
Link to comment
Share on other sites

Hehe, that's great!  I can use that as-is probably.  It's "supposed" to be simplistic, anyway.  Maybe with that as a start, I can figure out how to do some of this stuff myself.

 

How did you get the notes in there?  Type them in all one-by-one?  That's what I can't quite figure out.  It would be SO MUCH simpler to import MIDI tracks, one by one if needed, but it seems it can't do that.  Or even MML, which I do know how to use...

  • Thanks 1
Link to comment
Share on other sites

15 minutes ago, glurk said:

Hehe, that's great!  I can use that as-is probably.  It's "supposed" to be simplistic, anyway.  Maybe with that as a start, I can figure out how to do some of this stuff myself.

You're welcome :)

if you need more tunes converted, feel free to ask me, they are few and very easy to transcribe.

16 minutes ago, glurk said:

How did you get the notes in there?  Type them in all one-by-one?

Yep that is exactly what I did.

To get the best possible accuracy, I used a modified version of famitracker called nsfimport to get the most accurate register dump as tracker notation, then I simply copied the notes over in the rmt window, that was very quick and simple to do.

17 minutes ago, glurk said:

It would be SO MUCH simpler to import MIDI tracks, one by one if needed, but it seems it can't do that.  Or even MML, which I do know how to use...

I agree for midi, a little cheat never hurts to save some time and headaches converting the musics, haha

I don't understand MML so I will just agree with you :P

  • Like 1
Link to comment
Share on other sites

21 minutes ago, carlsson said:

By the way, do you need the Skater's Waltz as well? While I never tracked that one, I happen to recently have tracked six other contemporary waltzes for the Intellivision AY which I could make available if you want.

Today I learn something new, I did not even know the music in-game was this until you posted that message.
Very nicely surprised how good the original piece is, and I think it was indeed very appropriate for the game too, hahaha

Link to comment
Share on other sites

21 hours ago, glurk said:

Well, thank you for that, that is it.  I'll have to figure out how to change volumes/tones, etc...  I wish it could import MML.  That notation I posted IS screwy, it was done with an automated tool.

 

I wondered about those low bass notes.  POKEY can't go below C2?  I'm sure I've heard lower bass than that?  I'm no expert on ANY of this stuff....

Simple explanation:

 

Standard 8-bit mode, AUDCTL=$00:  4 channels.  $Ax distortion only goes down to B2=$FF, while $Cx will give you the lower bass ranges:  frequencies non-divisible by 3 go all the way to C0, while ones divisible by 3 get you down to G#1 and make a less harsh bass.  Other settings are useless for musical notes

 

By engaging bit 1 of AUDCTL, the base clock is changed to 15khz, allowing bass frequencies in $Ax distortion down to B0=$FF, and the smooth $Cx bass gets three stable timbres all the way to C0.  To play above C3, set a 1.79 clock on first or third channel and play $2x distortion 

 

16-bit mode is done by setting bit 4 or 5 of AUDCTL.  It joins two channels into a 16-bit channel and gives you 65536 divisors for greater range and accuracy.  This is typically accompanied by a 1.79 clock on the joined channel (bits 6 or 7 of AUDCTL) to put everything into a playable range.

 

I have a full POKEY table with frequencies for all these settings in the 7800 forum, should you wish to look.

Edited by Synthpopalooza
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...