Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

gerliczer
on 2019-04-03
13:47:06
 Re: Mixing raster interrupt with timer interrupt?

Well, I think you are knocking on the wrong door with questions about SID sample replay, as it is not a native device in 264 series machines.

However, 4th voice samples are usually played in 3 bits resolution with register values ranging from 8 to 15. That way most of the volume will be retained in the three native channels. The other way is doing waveform digi and sacrificing one channel for 8-bit sample playback sometimes with mixing digi channels.

Posted By

urias
on 2019-04-03
06:24:52
 Re: Mixing raster interrupt with timer interrupt?

Funny I did the same thing yesterday.
Making pulsewaves with NMI irq is pretty easy, (and $d418)
and take very little rastertime.
But my question (if you 've already solved it)....

I can get nice sounds out of it, like a 4th Sid voice. Not much distortion at all!
But.... it distorts the other Sid sounds. 'cause in fact it is amplitude modulating the other voices.
That's a pitty....
Someone has a solution ?

Sampleplayers will have the same problem.

Posted By

Spektro
on 2014-11-13
12:33:33
 Re: Mixing raster interrupt with timer interrupt?

OK, thanks!

Posted By

gerliczer
on 2014-11-11
16:08:50
 Re: Mixing raster interrupt with timer interrupt?

Hi Spektro,

I ran out of ideas, so I suggest you take a peek at the source of Vancouver 2010 by Csabo. It has a digiplayer part, which might give you an idea what you are doing wrong.

Posted By

Spektro
on 2014-11-11
14:16:42
 Re: Mixing raster interrupt with timer interrupt?

I was using timer 3. I changed to timer 1 and made the playback routine simpler. (The timer interrupt is the only interrupt I'm using.)

The sample I'm playing is a pulse waveform sample, so I'm writing just 0s and 8s to the volume register. This is how it sounds:

https://www.dropbox.com/s/kmohleicgvcfj30/220hz.wav?dl=0
https://www.dropbox.com/s/xgk4xf2kxclnz7u/higher.wav?dl=0

The higher the playback rate, the more the sound distorts.

Posted By

gerliczer
on 2014-11-09
11:37:42
 Re: Mixing raster interrupt with timer interrupt?

TED timers are driven by the system clock. They are 1/8th of the single clock, AFAIR.

It is hard to diagnose some code without seeing it, but either you are using the wrong timer (not the first at $FF00/01), using it wrong (if not the first, it must be set again and again) or TED DMA jitters your timing. Or even it gets mixed up with raster interrupt if you are using both.

Edit: Yet another idea. Are you playing full 4 bit samples or did you normalize it to the 0..8 domain?

Posted By

Spektro
on 2014-11-09
07:14:29
 Re: Mixing raster interrupt with timer interrupt?

Out of interest, how accurate TED clock timers are? I tried to write a sample playback routine using a clock timer and I noticed that the signal gets distorted because the playback rate isn't constant. Is it a bug in my routine or does the interrupt rate vary?

Posted By

siz
on 2014-11-08
10:51:57
 Re: Mixing raster interrupt with timer interrupt?

Here is an example of using TED raster interrupts together with timer interrupts:

ted = $ff00
ted_irqsource = ted + $09
ted_irqmask = ted + $0a

sei
lda #<17734
ldx #>17734
sta ted_timer1lo
stx ted_timer1hi
lda #%00001010
sta ted_irqmask
lda #<irq
ldx #>irq
sta $0314
stx $0315
cli
jmp *
irq lda ted_irqsource
sta ted_irqsource
pha
and #%00001000
beq nottimer
; do timer tasks
nottimer
pla
and #%00000010
beq notraster
; do raster tasks
notraster
pla
tay
pla
tax
pla
rti

This is not very useful in this state because the timer frequency is the exact value of the PAL display refresh so you should use some other value.
I use this code in my SID player where I use timer to play music and raster to increment the clock.
I had an example somewhere which used 2 timers but that's a bit difficult because TED second and third timers always start counting back from $ffff so you have to set new values in every interrupt and you have to time the initial setup of the timer well. (You have to count the elapsed cycles until you get to to write the registers)

Posted By

Luca
on 2014-11-08
03:21:16
 Re: Mixing raster interrupt with timer interrupt?

Err...maybe I'm wrong: are you seeking for something that works like C64 NMI when you refer to 'timer interrupt'? Like $DC04 or $FFFA? Or did you mean the TED's clock timers $FF00-$FF05?

Posted By

gerliczer
on 2014-11-08
02:53:58
 Re: Mixing raster interrupt with timer interrupt?

There is a useful example in this thread. Although it is not exactly the same thing you are looking for.

Posted By

icbrkr
on 2014-11-07
18:34:18
 Mixing raster interrupt with timer interrupt?

I've got my raster happily working perfectly, and now I want to inject an IRQ based music driver into the code. I know I can call another raster interrupt from within the first one, but how do I setup the timer based one at the same time as the raster IRQ?

Code snippets would be awesome.


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon