Jump to content
IGNORED

TailChao's HandyMusic on cc65


karri

Recommended Posts

I finally ported over HandyMusic to cc65. It is so different from anything I have experienced in Lynx sound earlier. A very strange and deterministic tool.

Creating sound effects is easy but I still have not got my head around how the instruments work.

It also has built in digitized sound that plays the samples directly from the cart. It also has a convenience function to load any tune directly from the cart to memory for playing.

Is anyone else playing around with it?

My big surprise is that it takes much less space than Chipper.

Here is my first effort with HandyMusic to create a special track for an upcoming game.

 

http://79.125.115.174/pics/untitled.mp3

 

It is still only the rhythm and no chord changes or melody. Perhaps it takes shape next week...

Edited by karri
  • Like 3
Link to comment
Share on other sites

Karri, is there a place where we can find the source code for this?

 

Yep. I just shared the source with you on bitbucket.

 

There is a few special things on my source. It has 3 different sound engines HANDYMUSIC, CHIPPER and NOMUSIC. Currently I have activated HANDYMUSIC.

The config file sets the HANDYMUSIC starting at A000. The sound effects have to be manually set in the config file AND they have to be set in the sounds directory Makefile as well. Otherwise the build fails.

 

You also need python3 installed for getting the tile engines to work correctly at compile time. If you are on Windows you need to remove the wine code in from of all exe files.

 

The game itself has not been released yet so please sshhhh.

Link to comment
Share on other sites

Yes. These are the ones I have ported to cc65.

 

The original ones are for BLL and lyxass.

 

The port also contains interrupt integration to the cc65 and use of the cart read routines available in cc65. So it is now fully compatible with C. You can call all HandyMusic routines from C-code like:

HandyMusic_PlaySFX(TypewriterSFX);

HandyMusic_StopAll();

HandyMusic_LoadPlayBGM(0);

if (*PCMActive == 0) {
    openn((int)&SAMPLES1_FILENR);
    PlayPCMSample(1);
}
The SFX elements are arranged in an array so you index the SFX samples starting from 0.
The music is stored on cart and you choose what to play starting with index 0.
The digitized sound is still under work. I had problems with overlapping sound effects. As they are streamed out from the cart instead of from RAM I had to invent some new guards to make it work. The value of PCMActive is the real BACKUP register for timer 3. But now everything seems to work ok.
PS. I just updated the sound sample in the first post. Now it contains all 3 elements: BGM (Background music) SFX (HandyMusic Sound Effects) PCM (Digitized speech)
Edited by karri
  • Like 2
Link to comment
Share on other sites

Mixing Chipper and HandyMusic is not a good idea.

 

But it is not so complicatred to push out digitized sound.

 

In "Shaken, not stirred" I wanted the phrase "Oh James, that was awesome" to be spoken in case you solved the game. Due to being lazy I did it completely from C.

 

        lynx_load((int)&OOJAMES_FILENR);
        musa = ohjames;
        CTLB_REG(0) = 0x0;
        CTLA_REG(0) = 0x10;
        STEREO_REG = 0;
        VOLUME_REG(0) = (char) 255;
        for (i = 0; i < 15880; i++) {
            for (j = 0; j < 15; j++) {
                isfrog = 0;
            }
            OUT_REG(0) = (char)*musa;
            musa++;
        }
        VOLUME_REG(0) = (char) 255;

The silly loop inside the bigger loop is just to have some delay to get the pitch of the sound right,

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

  • 3 weeks later...

Ah, I missed this. Thank you for doing the cc65 migration!

 

I haven't looked at HandyMusic in several years, I do not know if I will be able to come back to it and do a v2.0 - but it's nice to see it still in use.

 

I am really impressed by the SASS language. Easy to work on sound effects and it is also stable. You can create a sound and forget about it. No need to change it later.

 

One thing I would like to try out the PCM samples as part of my feelgood level. The idea is to create the tune Tequila. With the vocals at the end of the phrase. You seem to have this option available ;)

Link to comment
Share on other sites

 

Mixing Chipper and HandyMusic is not a good idea.

 

But it is not so complicatred to push out digitized sound.

 

In "Shaken, not stirred" I wanted the phrase "Oh James, that was awesome" to be spoken in case you solved the game. Due to being lazy I did it completely from C.

 

        lynx_load((int)&OOJAMES_FILENR);
        musa = ohjames;
        CTLB_REG(0) = 0x0;
        CTLA_REG(0) = 0x10;
        STEREO_REG = 0;
        VOLUME_REG(0) = (char) 255;
        for (i = 0; i < 15880; i++) {
            for (j = 0; j < 15; j++) {
                isfrog = 0;
            }
            OUT_REG(0) = (char)*musa;
            musa++;
        }
        VOLUME_REG(0) = (char) 255;

The silly loop inside the bigger loop is just to have some delay to get the pitch of the sound right,

 

 

I can't make it play the sample, The output is only odd sounds. I exported the samples as raw PCM 8kHz mono 8bit signed (using audacity). Is it right?

 

Also tryed 8bit unsigned, but it's the same..

Link to comment
Share on other sites

That's the setup in playsmp.asm (from BLL):

                stz $fd25
                stz $fd25+8
                stz $fd25+16
                stz $fd25+24
                stz $fd50
                lda #$F0
                sta $fd40
                sta $fd42
                lda #$0F
                sta $fd41
                sta $fd43
                stz $fd50
                lda #$ee
                sta $fd44

Maybe some registers were not setup correctly. Or the loop is too fast.

You may want to try the HBL (6240Hz at 60FPS or 7800Hz at 75FPS) to put out the data.

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