Jump to content
IGNORED

HandyMusic


TailChao

Recommended Posts

Hi all,

I've been using this sound driver for my projects for a little over a year now. I was going to wait until I had a good tracker working or at least a sound script compiler, but I have not had much free time to work on these things. So I am releasing the driver and auditioning software now in case anyone wants to try and use it (or at least learn from it), and hopefully I will be able to finish some PC-side composition tools to make life easier.

The driver itself is based upon macro instruments, so instruments are simply sound effects played with a frequency offset. This allows you to get much more complex envelopes than just ADSR. Stereo panning and attenuation is supported, as is streaming of small samples from the cart. The driver is not very large and expects to live in $A000-$A6AF, and uses $A6B0-$BFFFF for sound effects and music data.

If anyone would like to try using the driver, or hear a demo, things have been uploaded here.

Enjoy.

Edited by TailChao
Link to comment
Share on other sites

Well thats good that there are now several music tools for usage available. Bad only nobody wants to use them :-b

As long as the tools eventually get good enough for people to move away from ugly sounding MODs, that's all I care. Lynx stuff is so behind NES in terms of tools that are actually usable in games.

 

Waveform preview in your music suite is a nice idea, by the by :)

Link to comment
Share on other sites

  • 1 month later...

I tried to play a bit with your engine, but I have a problem converting actual notes to the values which your driver accepps. at least it seems what it plays is not want I wanted it too.

 

Maybe you can help by providing the function which you used to convert a note (=frequency) into your 16.8 format

Link to comment
Share on other sites

I tried to play a bit with your engine, but I have a problem converting actual notes to the values which your driver accepps. at least it seems what it plays is not want I wanted it too.

 

Maybe you can help by providing the function which you used to convert a note (=frequency) into your 16.8 format

 

Sorry things are a bit vague with no PC tools finished yet, but it is something like this in the software:

 

F= Desired Frequency

p= Number of Poly Counter clocks for one full period of the waveform (example : 2 for a 50% duty cycle pulse using feedback setting $01, 3 for a 33% duty cycle pulse using feedback setting $3)

 

Fp = F*p;

if(Fp > 1000000.0) div = 0;
else if(Fp > 3906.25) div = (1000000/Fp)-1;
else if(Fp > 1953.13) div = (500000/Fp)+128;
else if(Fp > 976.563) div = (250000/Fp)+256;
else if(Fp > 488.281) div = (125000/Fp)+384;
else if(Fp > 244.141) div = (62500/Fp)+512;
else if(Fp > 122.07) div = (31250/Fp)+640;
else if(Fp > 61.0352) div = (15625/Fp)+768;
else div = 1023;

 

Where "div" is your frequency value for HandyMusic used in bits 0-9 in the 16.8 format. Decimal is used only internally, and top bits are ignored (so things will wrap around).

I hope this helps.

Link to comment
Share on other sites

 

Where "div" is your frequency value for HandyMusic used in bits 0-9 in the 16.8 format. Decimal is used only internally, and top bits are ignored (so things will wrap around).

I hope this helps.

 

Yes it did.

 

Other thing:

In an instrument script, is the first command in the script parsed at time zero or one after note on?

Link to comment
Share on other sites

Other thing:

In an instrument script, is the first command in the script parsed at time zero or one after note on?

 

The first command in an instrument script is processed one frame after the music script's note on. But the channel in hardware is not turned on until this time as well, so there is no distortion from setting things the previous frame.

Link to comment
Share on other sites

Other thing:

In an instrument script, is the first command in the script parsed at time zero or one after note on?

 

The first command in an instrument script is processed one frame after the music script's note on. But the channel in hardware is not turned on until this time as well, so there is no distortion from setting things the previous frame.

 

O.k. thus setting the volume in the header has no effect if the first command is a change volume command, right?

Link to comment
Share on other sites

O.k. thus setting the volume in the header has no effect if the first command is a change volume command, right?

 

Yes, exactly. So crazy things can be done with that if needed.

 

Good.

 

Now I need to change the replay frequency.

Are there any traps or is it enought to move the player to another timer?

 

Next: I need more space for the music, can I (in your example programm) just change the adresses or will that have some side effects?

Link to comment
Share on other sites

O.k. thus setting the volume in the header has no effect if the first command is a change volume command, right?

 

Yes, exactly. So crazy things can be done with that if needed.

 

Ah, and will an "embedded" delay of 0 wait for 0 or 256 ticks?

Link to comment
Share on other sites

Now I need to change the replay frequency.

Are there any traps or is it enought to move the player to another timer?

 

Next: I need more space for the music, can I (in your example programm) just change the adresses or will that have some side effects?

The only thing HandyMusic reserves is Timer 3 for sample playback on channel 0. The driver can be called from wherever you like. I did some tests at 120Hz and 240Hz and it seemed fine with it. 60Hz is used as the default since it's adequate for most game music without crazy arpeggios.

 

As for moving the music to a different address, just change the line :

HandyMusic_Song_BaseAddress	EQU $B000

In the top of HandyMusic/HandyMusic.asm to some free region and it should work. $200+ should be open. All of the music decoding is done with ZP-indirect addressing, so it should be fine.

 

Ah, and will an "embedded" delay of 0 wait for 0 or 256 ticks?

A delay of zero will be skipped (0). But if you need really long delays, you can just use loops in your instruments or music. Loops can be four-deep, so there's no real heavy restrictions.

Link to comment
Share on other sites

Thanks for the information.

 

Seems I have understood most of it -> see PM

It certainly sounds like you figured it out. Those examples are really great!

 

If I look in your code, you reset the Timer every tick, even so the replay freq has not changed, which disturbes the freq a bit.

Yes, this did not seem to cause too many problems to my ears. But I am not the best with music, so I'll add a check for it in the next version. There are some things to fix in samples anyway.

Link to comment
Share on other sites

  • 2 weeks later...

Yes, this did not seem to cause too many problems to my ears. But I am not the best with music, so I'll add a check for it in the next version. There are some things to fix in samples anyway.

 

I have some more wishes for a future version ;-)

Call Pattern/Return would be one of them

Link to comment
Share on other sites

  • 2 weeks later...

 

 


I have some more wishes for a future version icon_winking.gif
Call Pattern/Return would be one of them

Added in v1.2 (hastily). No compatibility changes with old MUS/SFX data or driver use, and not many other changes in general. Busy working on compiler.

I've also put up gerber files for 2MB Cart PCBs with 2x27C801s, which is what the example program is designed for. You can also get the same banking setup with something like a 29F016 and a NOR gate to combine both cart strobes, and use /CART0 as the high address bit. Edited by TailChao
Link to comment
Share on other sites

Hi all,

 

I've been using this sound driver for my projects for a little over a year now. I was going to wait until I had a good tracker working or at least a sound script compiler, but I have not had much free time to work on these things. So I am releasing the driver and auditioning software now in case anyone wants to try and use it (or at least learn from it), and hopefully I will be able to finish some PC-side composition tools to make life easier.

 

The driver itself is based upon macro instruments, so instruments are simply sound effects played with a frequency offset. This allows you to get much more complex envelopes than just ADSR. Stereo panning and attenuation is supported, as is streaming of small samples from the cart. The driver is not very large and expects to live in $A000-$A6AF, and uses $A6B0-$BFFFF for sound effects and music data.

 

If anyone would like to try using the driver, or hear a demo, things have been uploaded here.

 

Enjoy.

 

I hope the tracker gets finished, I can't wait to bang out some lynx tunes!

Link to comment
Share on other sites

  • 2 weeks later...

that would be a great thing, cause i can add simply the driver in c code.

 

maybe rockfistus can help you to improve chipper.

 

updated version at http://lynxdev.atari.org even so not mentioned in the text.

 

TailChao: I added the updated player code, but seems there is a bug in it ... will send you details later.

 

Time to write a documentation.... :-/

Link to comment
Share on other sites

Hey guys, so how good was the Lynx sound hardware compared to the Game Boy and Game Gear? I remember Atari advertising that the Lynx has 32 bit sound, which as usual must just be Atari doing its math thing, hehe.

Some games have really good music, like Lemmings, but other have no music at all, or some terrible compositions. But judging from the games with good soundtracks, i have to say i really like the Lynx music, its pretty unique compared with other systems from its era.

Link to comment
Share on other sites

TailChao: I added the updated player code, but seems there is a bug in it ... will send you details later.

 

Time to write a documentation.... :-/

I will fix things as soon as I figure out what's wrong.

Nice job with the tracker as usual. :)

 

it dosnt compile

 

D:\LYNX\sound\chipper (beta)\lynxtc>lyxass handymusic.asm

HandyMusic PCM IRQ Address: $3277

Sound Engine IRQ Address: $3644

HandyMusic Memory left: $3F60

handymusic.asm: 721:ERROR:

Unsolved labels !

 

whats going wrong?

HandyMusic.asm needs to be added to your own game software, or used with the demo program (HandyAudition). By itself, it's only a library, not a player. If you would like to use HandyAudition, the buildable file in Sage's tracker is "HAud_Knl.asm" in the main folder.

 

Hey guys, so how good was the Lynx sound hardware compared to the Game Boy and Game Gear? I remember Atari advertising that the Lynx has 32 bit sound, which as usual must just be Atari doing its math thing, hehe.

Some games have really good music, like Lemmings, but other have no music at all, or some terrible compositions. But judging from the games with good soundtracks, i have to say i really like the Lynx music, its pretty unique compared with other systems from its era.

You cannot really pick a best, since it all depends upon what kind of music you'd like to compose. The three work very differently.

 

GameBoy has very well rounded sound, with two pulse waves, noise, and a small sample channel. I cannot really complain about anything here, Nintendo knew what they were doing. Its big advantages are that little sample channel, different duty cycles on the pulse waves that stay in tune, and a very good frequency range. Sound hardware helps out with some things like sweeps and envelopes as well, to keep the CPU free. The DACs are a bit poor though, only 4-Bit.

 

Lynx is like an Atari 800 on enhancement pills, you can make some really crazy waveforms. Pulse with different duty cycles, triangles, noise, and other patterns that make no sense can be made on any of the four channels. Advantages here are that all channels in the hardware are identical, which saves some headache. The DACs are also extremely good (8-Bit), giving you great volume envelopes and sample playback (with CPU help). Stereo in the Lynxes that support it is also given a much finer control than both the GB and GG, you get real attenuation. If you want to spend all of your processor time on sound, Lynx can do some really amazing stuff. But for most game scenarios it can keep up with the GameBoy. However, it is much more difficult to work with than both of those two since all your waveforms have different tuning.

 

Game Gear has three boring square pulses and a similarly boring noise channel. Compared to the other two, there is not much there (and you can really hear the difference in most music). But regardless, I am very impressed with the results many composers got out of this very flat beeper.

 

In short, the Lynx has a very good, but somewhat complicated noisemaker. I just wish it had twice the channels, since it looks like there's four timer slots unused in the hardware...

Most Lynx games probably leave out sound since it saves money from not having to pay a composer, and keeping a smaller ROM size.

Link to comment
Share on other sites

Damn, thats a great breakdown of the 3 systems audio hardware TailChao, even i understood it, hehe :) , its very interesting. Thanks :thumbsup: .

I have read many times about how weak/boring the SMS/GG soundchip is, but you are right, there are some awesome tracks on their libraries, some that i really love. From Phantasy Star, R Type, Sonic 1, Monster World 3, Golvellius, etc.

Sorry for derailing the thread guys, that was it.

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...