Sunday, October 01, 2006

XeO3: Sounds....V2

Weel, I've gotten 2 channels...almost - but good enough I think. Basically, I now have 2 full effects playing and both use ADSR envelopes, however channel 1 (Square wave only channel) will now check to see if its ADSR value is bigger than channel 2's sound. This means that either channel can get louder if sounds overlap, but you don't really notice that much, and having 2 channels is much nicer.

I'm also starting to feel the pinch, and memory is becoming tight. I've had to do my first code shuffle since code space was over running, so I've moved lots of local function variables into the games DATA area, which I've now expanded by 2k to make room for it. This isn't something thats gonna improve, it'll just get worse. It also leads me to wonder what the hell Im gonna do for a front end! Theres just NO space left for one, let alone character sets and all. I'm not a big fan of "loading" front ends since this is really bad news when you first start playing a game and get killed a lot, long load times don't make for a fun game.....

Speaking of long load times... I'm looking at the memory map and ralise that I'll need to load 3 seprate files per level; it would be much nicer if I could make it one big one, load times would drop quite a bit. I'll have to see if its possible to shuffle things around to be able to do that.

6 comments:

Anonymous said...

I'd like to see/hear that routine. I played around with something similar a long time ago, though, not for FX but for music, when I was trying to create two indepent envelopes.

My first approach was to allow envelope values 00-04 for each voice and simply add them. But the result was not really satisfying. Mainly because 00-04 puts strong limitations on the envelopes.
Then I used values 00-05 or even 00-06 and a "conversion table". Strictly technical not correct put sounded better.

Have you kept in mind TED's behaviour? I didn't and I never got around to code something that maybe takes care of that.
Even if the volume is supposed to be set for both channels together, the output get's noticeably louder when two voices play (at a different frequency). This effect is also used in the 4bit/5bit wave converters and several digi playback routines which are not using "volume only" only.

Maybe we should discuss this in the forum. It's an interesting topic and sound/music programming on the plus/4 has never been talked about much.

Cheers,
Chicken

Mike said...

I don't really pay attentions to any hardward thing, I just go with what sounds good. As I said each has an ADSR wave with a range of 0 to 7. When they play the values might be 1,2,3,4,5,6,7 and the other one might be 7,6,5,4,3,2,1.

The result would be these values put into the volume register...

7,6,5,4,5,6,7

Nothing more complex than that. however since the samples are "small" you don't really notice that its not right... you can sometimes tell its not "quite" right, but its hardly ever out and out wrong. This means its fine for spot effects - and much better than only one channel.

Anonymous said...

I see... the example to illustrate the routine helped. I wasn't exactly sure before. So whichever channel's ADSR has the highest value (at that moment), that one is used to set the volume.

So what about "8"? I don't see why you shouldn't use it :) I know that some docs say volume register is 3 bits only but that's not true.

Anyway, I'm curious to hear those FX then. And yes, to use what sounds good is the best approach :) Plus, using TED shouldn't take away too many cycles.

Mike said...

I didn't think there was any noticable increase in volume at 8, but your quite right there is. I could easily extend it to use 8, but to be honest, on the real machine you have tobring TED sound volume down a lot! The result being Im only really using 0-2 at the most! SID on the Plus/4 (Solder's one) is very quiet, so there no real worry about having more volume on the TED side. (YAPE on the other had could do with a little boost).

Anonymous said...

Yes, I remember that... when you listened to a SID tune and after that loaded a badly converted SID2TED freq tune and still had high volume. Ouch :)

Yeah, that's definitely something to be improved on a new SIDcard. When I experimented with "true stereo" I used an external amp and put the TED on the left channel and the SID on the right channel and used the balance control to make them sound equally loud. But not everybody has an amp nearby and usually you don't want FX from one side and music from the other side :)

Using "8" makes only sense if ADSR envelopes require it.
So with 0-2 only, can you still notice something like ADSR?

Mike said...

Yes - surprisingly!! My ADSR values are all 0-7, but I have an indirect volume table that lets me scale them down to what volume I want, and the resulting value (depending on volume) is pretty course.

But if I didn't use ADSR at all, you really DO notice... which is odd. Still, it might be because it is quiet and so you wouldn't notice anyway - which is the idea.

also...0-7 makes for a nice POW2 table, and only needs a few shifts, but 8 is *9 - yuck :)