PCM player using SCC

Pagina 20/33
13 | 14 | 15 | 16 | 17 | 18 | 19 | | 21 | 22 | 23 | 24 | 25

Van ARTRAG

Enlighted (6923)

afbeelding van ARTRAG

24-10-2007, 21:01

in Matlab notation you would also have

ph1 = Y(1:4:end)
ph2 = Y(2:4:end)
ph3 = Y(3:4:end)
ph4 = Y(4:4:end)

where Y is the input and phX is the sampled version by 4 at phase X
(indexes in matlab are like Fortran, from 1)

Van ARTRAG

Enlighted (6923)

afbeelding van ARTRAG

24-10-2007, 21:06

I'll give it a try and see how it goes.

In this case try to use FD9Ah as hook for the player, (it should be
before keyboard handling) - or better do your handler at 38h (to prevent jitters)
and correct the frequency by -1

The formula should be like:

Fs = Fc/(P+1)

so

P = Fc/Fs -1

with Fc = 3.578MHz

[EDIT]

and good work!!

Van dvik

Prophet (2200)

afbeelding van dvik

24-10-2007, 21:10

Matlab is no problem, at least not reading. I was pretty good at it at one time but haven't used in a long time.

Van ARTRAG

Enlighted (6923)

afbeelding van ARTRAG

24-10-2007, 21:56

Problem! The minimum update time for one wavetable is 576cycles and is given by

rept 32
ldi
end

This is longer than one sample at 7680Hz (466 cycles).

As we reset the PCM pointer by setting the freq. (to avoid frequency drifts and jitters),
in order to not have any click you should start the wavetable update exactly when
scc is playing sample 30,
Only in this way the reset will fall after sample 31 and is executed when the SCC is going
itself at sample 0...

Not bad as critical timing Smile
Tongue

Van dvik

Prophet (2200)

afbeelding van dvik

24-10-2007, 22:34

I've done some tests but the result so far is quite horrible (much worse than the previous demos). Its possible to hear the samples being played but there is a lot of clicks. I'll see if I can improve it somewhat and post a demo.

Van dvik

Prophet (2200)

afbeelding van dvik

24-10-2007, 23:14

I have a plan Hannibal

Van ARTRAG

Enlighted (6923)

afbeelding van ARTRAG

24-10-2007, 23:37

tell me!

Van ARTRAG

Enlighted (6923)

afbeelding van ARTRAG

24-10-2007, 23:45

my matlab tests

[Y,FS,NBITS,OPTS]=WAVREAD('handel3.wav');
%Y=Y(1:128);

ph1 = Y(1:4:end);
ph2 = Y(2:4:end);
ph3 = Y(3:4:end);
ph4 = Y(4:4:end);

ch1 = ph1;
ch2 = ph2 - ch1;
ch3 = ph3 - ch1 - ch2;
ch4 = ph4 - ch1 - ch2 - ch3;

for i=2:size(Y)/4
ch1(i) = ph1(i)-ch2(i-1)-ch3(i-1)-ch4(i-1);
ch2(i) = ph2(i)-ch1(i)-ch3(i-1)-ch4(i-1);
ch3(i) = ph3(i)-ch1(i)-ch2(i)-ch4(i-1);
ch4(i) = ph4(i)-ch1(i)-ch2(i)-ch3(i);
end


z = zeros(size(Y));

C1 = kron(ch1,[1;1;1;1]);
C2 = kron(ch2,[1;1;1;1]);
C3 = kron(ch3,[1;1;1;1]);
C4 = kron(ch4,[1;1;1;1]);

z = C1 + [0; C2(1:end-1)] + [0;0; C3(1:end-2)] + [0;0;0; C4(1:end-3)];

plot (Y)
hold
plot(z,'ro-')

Van dvik

Prophet (2200)

afbeelding van dvik

24-10-2007, 23:53

I wonder if some of the noise is because of overrun on these matlab calculations. Do you have any good ideas to make sure the values don't wrap?

The idea is very simple and I think it will give very good results (at least on paper). In VINT, we do:

1. Update ch1: sample 0-16
2. Reset ch1 phase (1 and 2 should take exactly 468 samples (or whatever it is)
3. Do same thing for ch2-ch4 (Now beginning of all waves are updated, note that sample 31 is still old value which we want)
4. Update remaining 16 samples for all channels (this will not impact playback since all channels are at sample 0 or 1

So this means that we can do all updates without any impact of playback (I think).

Van dvik

Prophet (2200)

afbeelding van dvik

24-10-2007, 23:57

That was indeed one big problem. For testing I divided the input samples by 16 and then most clicks went away (but noisy since now its only a 4 bit player). Any ideas on how to fix this without lowering the amplitude?

Pagina 20/33
13 | 14 | 15 | 16 | 17 | 18 | 19 | | 21 | 22 | 23 | 24 | 25