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
 
... 6 posts hidden. Click here to view all posts....
 
2010-12-29 13:30
Bago Zonde

Registered: Dec 2010
Posts: 29
So if it's just an illusion, I should switch off one of channels for a while then turn it on when SFX sound it's done. Something like priority.

However I don't know how to do it, but I'll try with some more practise and more diggin'.

Maybe somebody know how to do it with Goat Tracker subtunes?

I found only that for init SFX in GT manual:

LDA #<effect ;Start address of sound effect data
LDY #>effect
LDX #channel ;0, 7 or 14 for channels 1-3
JSR startaddress+6

But I don't know for now what will exactly happen.

Working with 2 voices is of course a good idea, but I want only a few SFX signals during gameplay (selecting options, opening doors, maybe some sounds when magic released) and music tunes are more important to me so it should be expanded to 3 voices for more interesting music. However I'm not so great to squeeze 3 channels into 2, that's job for masters of sounds :).
2010-12-29 14:13
Isildur

Registered: Sep 2006
Posts: 274
How about to skip playing routine for a sec during sfx?

little algorithm :)

if need sfx jump to skip:
...
...
jst $1003 ;play tune
...
...
skip: play SFX
...
...


2010-12-29 15:58
Bago Zonde

Registered: Dec 2010
Posts: 29
Yeah, but no need to switch off all voices, I should find solution for disabling one channel in that way You described.
2010-12-29 16:49
GT
Account closed

Registered: Sep 2008
Posts: 308
Adjust the music player to ignore writes to the SID register of the chosen voice/s you want to use for SFX when they occour. But keep the music player running.
2010-12-29 20:56
Hein

Registered: Apr 2004
Posts: 933
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: 541
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: 618
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: 933
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: 833
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
Oxbow/Xenon
CA$H/TRiAD
bOOZElEE
Dymo/G★P
aNdy/AL/Cosine
algorithm
Guests online: 167
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)

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