Jump to content

Photo

ABCMusic & sound effects


12 replies to this topic

#1 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • 538 posts
  • Location:Lurking in the Darkness

Posted Wed Oct 19, 2011 2:09 PM

I've been following the topics on here for better sound effects on the Lynx, and I gotta admit, some great sounds can be generated using those tools! However, I haven't been able to integrate any of it in my project.. as a matter of fact, I haven't been able to create any kind of sound out of the machine. Its been on low priority for a long while.

So I've been using the sketch template. With it comes abcmusic, which uses a simple notation for generating some tunes.

I can't seem to get it to work though... I got something as follows

int intro(void)
{
  tgi_install(&lynxtgi);
  tgi_init();
  CLI();

  silence();
  abcmusic(1,":A2GEcde>dcABGAGE/F/GA2GEcde>dcABGA3z::eae>deae>dcdefgf/g/ageae>deae>dcABGA3z:"); // channel and tune


  while(1) {
	/* some other stuff here*/
   abc_update();
  }
}

Apart from me not being able to make it work, I assume I cannot get those crazy cool sound effects that I heard from other tools with abcmusic?

Edited by Ninjabba, Wed Oct 19, 2011 2:15 PM.


#2 matashen OFFLINE  

matashen

    Moonsweeper

  • 461 posts

Posted Fri Oct 21, 2011 3:44 PM

in you string you must first set the instrument, volume etc

for example here the sound that make clicking dices in my game lynxopoly


_dicemusic0
dc.b "O3X4I1V100T7R100H2K20"
dc.b "zzddzzczzd"
dc.b 0
the first line is the instrument setting

sampo did a great job in space dance (Yastuna2)
i asked him about the abcmusic and i got this help


Noterna är CDEFGABcdefgab
high note =
low note ~
Pause z
Lenght 2 3 4
Tempo T (0..255)
Volym V (0..255)
Start block |:
Repetera :

Basically you create an ASCII description of what you want to play.

Like:
tune = "CDEFG";
channel = 0;
abcmusic(channel, tune);

You can also mix in instrument commands like
On = octave n=0..6
Xn = XOR taps n=0..511
In = integrate n=0..1
Vn = volume n=0..127
Tn = time n=0..255
Rn = ramp up (attack) n=0..127
Hn = hold n=0..255
Kn = kill sound (decay) n=0..127

To find good values for instruments use abccreator.o

You can then write your own tune like:

tune = "O1 X7 I0 V40 T22 R40 H2 K1 |:CCCE DDDG FFDD C4:"

The sounds you can use are:
CDEFGABcdefgab
~ - lower
= - higher

Length of a note can be extended by 2,3,4

|: = start of a chorus
: = repeat chorus
' ' = spaces are ignored. They are not required anywhere. I added them for readability.

The tune should end in character 0.

You can run tunes on multiple sound channels simultaneously by calling abcmusic several times:

silence();
abcmusic(0, tune0);
abcmusic(1, tune1);
abcmusic(2, tune2);
abcmusic(3, tune3);

#3 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Sat Oct 22, 2011 5:27 AM

Hi matashen, thanks for the reply! Gives me a better understanding of the notation of the music.

I've tried quite some things here using your description of setting up the instrument, volume, etc. but still I don't get any noise..

I read in another topic I need to set up some interruptors, but I thought these are setup by initializing lynxtgi (even though its a graphic driver)

#4 matashen OFFLINE  

matashen

    Moonsweeper

  • 461 posts

Posted Sat Oct 22, 2011 5:00 PM

no, you must put update_music or abc_update (dont know how it calls in karris new cc65) in a routine that works like a metronome. VBL is a good thing to put it in. the lynx hardware keeps the music going on.

#5 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Sun Oct 23, 2011 8:12 AM

I've managed to generate some noise when calling the abc_update function in the VBL routine. However, after initializing VBL other things like the joystick aren't working anymore...

I use install_irq(2, (int)&vbl) to setup the VBL counter which calls abc_update, but I'm also using tgi_install(&lynxtgi) and joy_install(&lynxjoy) to setup the screen and joypad. I read that lynxtgi sets up VBL and other interrupt handlers automatically, but I can't seem to have this working for a regular call to abc_update. Could it be that VBL is interfering other interrupters?

void start_irqs(void)
{
    init_irq();
    install_irq(2, (int)&vbl);
    enable_irq(2);
    tgi_install(&lynxtgi); // This will activate the Lynx screen
    joy_install(&lynxjoy); // This will activate the Lynx joypad
    tgi_init();
    CLI();
    tgi_clear();
    tgi_setpalette(pal);
}


#6 matashen OFFLINE  

matashen

    Moonsweeper

  • 461 posts

Posted Sun Oct 23, 2011 3:35 PM

oh, seems to be only a problem with karris compiler - sorry i dont know about - please ask karri, he creates the abc routines and the cc65 compiler. I think he knows the answer about. If you have a solution please post it.

#7 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Fri Nov 4, 2011 5:15 AM

It seems to be a problem with the abcmusic version I'm using. Its written in assembly so I have no idea how to work around this. Karri replied to me he might have a C version that could work in my project, but looks like he's a bit busy lately since I haven't heard from him since then.


When its figured out I'll post a small working project with music integrated. Hopefully soon, because I think I have something interesting to show the people on here once I have some sounds integrated :)

In the main time I can only ask: does someone have some sound library that would work with the latest cc65 compiler?

Thanks!

#8 sage OFFLINE  

sage

    Dragonstomper

  • 584 posts
  • Location:Germany

Posted Fri Nov 4, 2011 1:46 PM

In the main time I can only ask: does someone have some sound library that would work with the latest cc65 compiler?


Only a resource hungry modplayer.
And a simple effect player.
For sound player you have to stick to assembler.

#9 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Sat Nov 5, 2011 3:27 AM


In the main time I can only ask: does someone have some sound library that would work with the latest cc65 compiler?


Only a resource hungry modplayer.
And a simple effect player.
For sound player you have to stick to assembler.


I guess thats worth checking out. Could you maybe link me to them? My assembly skills are really poor, thats why I try to get around it..

Thanks!

#10 sage OFFLINE  

sage

    Dragonstomper

  • 584 posts
  • Location:Germany

Posted Sat Nov 5, 2011 11:00 AM

I guess thats worth checking out. Could you maybe link me to them? My assembly skills are really poor, thats why I try to get around it..


well i can give you a workign example, but as soon as you want to change things, you may need at least the ability to change the adresses in the assmbler code...

well were you find it... just have a guess...

#11 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Sun Nov 6, 2011 10:24 AM

hehe yeah that was a redundant question. I'm gonna experiment with those sources

#12 Turbo Laser Lynx OFFLINE  

Turbo Laser Lynx

    Star Raider

  • 83 posts
  • Location:Finland

Posted Mon Nov 21, 2011 2:27 PM

Ninjabba are you using the old newcc65 or the newer newcc65? The abc-notes sent to Matashen are my old notes for the older abc-music in the older newcc65. Here's my notes for abc-music in Karri's MegaPak template for the newer compiler.

New(er) Lynx abc notation for the new newcc65 compiler:

Octaves:
' one octave higher
, one octave lower

thus the range of the notes are:
"A,A,A,A, AAAA aaaa a'a'a'a'"

tones: CDEFGABcdefgab

^ sharp note
_ flat note

tone lengths (I'm not 100% sure if I remember this correctly).
1 = double length
2= x4
4= x8

z and x paus

I put the music (abc notation) in the music folder.

Channels and "play" in abcparser.c However I failed turning on the fourth channel when i made the music for "C-Gull", so that's why there's no drums in that one.

The instrument sounds can be altered in abcdriver.c
taps
backup
octave
intergrate
volume
attack
hold
decay

#13 Ninjabba OFFLINE  

Ninjabba

    Dragonstomper

  • Topic Starter
  • 538 posts
  • Location:Lurking in the Darkness

Posted Wed Nov 30, 2011 2:36 PM

Sorry, completely missed this post because of work pressure. I'm using the latest cc65 version from their website. Thanks for the schematics, once I have the sound working properly I'll have to study some notes :)




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users