Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > SFX while playing 3 voices
2010-12-28 20:28
Bago Zonde

Registered: Dec 2010
Posts: 29
SFX while playing 3 voices

Hello, this is my first post on this forum, so Hello everybody and a lot of greetings!!

I'm writing game for C64 in pure assembler and I want to ask You about some possibilities of sfx and digis. I'm newbie in assembler, just 2 month of programming (and few years with basic), but my progress with game called Meonlawel is really noticeable for me. There's usual loading, saving, move screen, changing chars (all in Hi-Res), playing music and controls so I see that assembler is really great, really :) !!! If somebody would to know more about Meonlawel, website will be available soon. However, due to this good progress and my growing faith in that project I'm curious about what sfx can do with bombarding $D418 while playing all 3 voices and how to do it? Music is playing from $8000 with IRQ. I was trying with some sounds e.g. nice & short (around one second perhaps) switch sound during main screen while selecting options.

So, can anyone could help me with easy procedure for test which can play primary SFX sound, because I was trying a little bit and I don't know if that's a good solution because only what I heard was stop playing one of voice channel and some truncate sounds.

I have no idea & experience what C64 could do for me in that category. I think that playing "fourth" channel simultaneously can't be done as one more voice in fact but it's possible in some ways to reach the target.

Sorry for my English and best wishes in upcoming 2011 ;).

Bartek
 
... 10 posts hidden. Click here to view all posts....
 
2010-12-29 20:56
Hein

Registered: Apr 2004
Posts: 954
Goattracker's SFX are limited, but if you read the paragraph about SFX in GT's manual, you'll figure it out.

Have you tried doing sfx without music? I mean, in order to play sfx at all, you'll need an sfx routine. If you're at a starting point of SID fiddling, I think trying Goattracker's sfx support is a good way to learn the basic SID writes. You can save GT instruments as small sfx tables and embed those into your game source code. Export your 3 channel GT music incl. sfx support. Use the lda #<sfx_in_source ldy #>sfx_in_source ldx #channel and jsr to the magical 4th channel init routine.

Once that's settled and working with 3 channel Goattracker music, you can write your own sfx routine and hack your way into your prefered music routine the way Geir proposes.
2010-12-29 21:16
TWW

Registered: Jul 2009
Posts: 545
Not exactly my strong field the SID but:

Isn't there a way to do music & digis by playing 3 bit digis on the 3 LSB's of $d418 and keeping bit #3 set?
2010-12-30 05:28
Fungus

Registered: Sep 2002
Posts: 686
I have a bit of a question regarding this too. Not exactly the same but sort of. Anywho...

Is it possible to "multiplex" the sid much like say a sprite multiplexer, and play a 3 voice tune, and 1 or 2 voice sound effects also (at a 50% difference in raster) to give the illusion of both sound effects and a full tune?
2010-12-30 09:14
Bago Zonde

Registered: Dec 2010
Posts: 29
Yesterday I managed to get sfx sound on a chosen channel and it's working quite well because subtune procedure can play sfx sound in easy way and when sfx is finished, subtune plays on automatically.

So, in Goat Tracker I packed subtune choosing Sound Effect support. Then I exported one of instruments to SND with INS2SND2.exe and opened output to rewrite sound table to code (at a given address e.g. $0E80). While a button key is pushed, there's a simple skip to play SFX which turns off one of chosen voice:

LDA #$80
LDY #$0E
LDX #$00 ;voice ($00 for #1, $07 for #2, $0E for #3)
JSR startaddress+6

(with SFX support, changing volume is possible from startaddress+9, not startaddress+6)

Of course on of voices is overrides for a while so it's not a magical fourth channel, but it's work quite well.

If anybody have some idea how to make that 4th channel more hearable/usable, that will be very interesting to know how to do it.
2010-12-30 11:05
Hein

Registered: Apr 2004
Posts: 954
Digis (4th channel) are quite simple to accomplish. Basicly it's this:

loop

lda #samplebyte
and #$0f
----only low nybble
sta $d418

pause....

lda #samplebyte
lsr
lsr
lsr
lsr
----high nybble is now low nybble
sta $d418

pause....

jmp loop

The pause-length does the pitch thing, 2 sample-nybbles in one byte save you some memory.

I never created a digi player other than some outside interrupt tests, but you can play digis best with timer interrupts (NMI preferably, because they have highest priority). So the timer triggers an interrupt that pokes the low nybble to $d418. Timer value is the pause-length and thus the pitch.

Digis are often not used, because you'll need to update $d418 alot of times per frame, eating CPU.

If you play digis outside interrupt, your game plays smoothly and all spare CPU time is used for your digis. But if your game uses alot of CPU, your spare CPU time is limited and the digis sound like crap.

That's why NMI is used in digi-music Savage, Outrun Turbo, Afterburner and such.

2010-12-30 23:26
Conrad

Registered: Nov 2006
Posts: 849
Quote: Not exactly my strong field the SID but:

Isn't there a way to do music & digis by playing 3 bit digis on the 3 LSB's of $d418 and keeping bit #3 set?


Ofcourse... Simply AND the value from $d418 with #$18, then ORA with the sample value that's 3 bits.

There's no real difference from having bit 3 set on or off, as the amplitude of the sample will always be in 3-bit range anyway. ... and you'll only get 75% of volume compared to 100% 4-bit digi'ing, making the sample output sound quieter. To save space you would also need to have an algo to read 3 bits of sample each time from each byte, which on the long run would use more cycles for processing a sample to output and losing the higher range of pitch.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Alakran_64
New Design/Excess
wil
Case/Padua
crayon/Hokuto Force
Spinball/Excess
Smasher/F4CG
Acidchild/Padua
iAN CooG/HVSC
Sulevi/Virtual Dreams
t0m3000/hf^boom!^ibx
tlr
Guests online: 100
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.7)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.038 sec.