What the PSG also can sound like...

صفحة 5/7
1 | 2 | 3 | 4 | | 6 | 7

بواسطة hit9918

Prophet (2932)

صورة hit9918

23-06-2017, 03:47

This one is like when AY envelope and square make rrrrr. in one SCC channel.
rapid hardware vibrato.
modulate a triangle with a sine.

10 poke &hf677,&hc2 : poke &hf676,&h01 : poke &hc200,0
20 run"loader.bas"
10 screen 0 : width 40 : key off : ?:?:?:?"SCC TEST CENTER :)"
20 b3 = &h9000 'bank3

31 w1 = &h9800
32 w2 = &h9820
33 w3 = &h9840
34 w4 = &h9860

41 f1 = &h9880
42 f2 = &h9882
43 f3 = &h9884
44 f4 = &h9886
45 f5 = &h9888

51 v1 = &h988a
52 v2 = &h988b
53 v3 = &h988c
54 v4 = &h988d
55 v5 = &h988e

60 o  = &h988f 'on/off bits
70 d  = &h98E0 'deformation register

100 restore 9200 : read a : defusr = a : gosub 9000 : x=usr(0) 'scc subslot
101 'restore 9300 : read a : defusr1 = a : gosub 9000 'write wave, addr in defusr

120 poke b3,&h3f
140 poke o,&b11111  'all channels on
150 poke v4,0

1000 for i = 0 to 31
1081 a1 = 8 * (-8 + (i mod 16))
1082 a2 = (1+cos(i/32*2*3.1415926-3.1415926))
1083 a = a1 * a2
1086 if a > 127 then a = 127
1087 if a < -128 then a = -128
1090 poke w4+i,a and 255
1100 next

2000 poke f4,0 : poke f4+1,8



2100 input a
2110 for i = 0 to 15 step 1 : poke v4,i : next
2112 for i = 15 to 14 step -0.05 : poke v4,i : next
2114 for i = 14 to 8 step 1 : poke v4,i : next
2120 for i = 7 to 0 step -0.08 : poke v4,i : next
2130 goto 2100


8900 poke v1,0 : poke v2,0 : poke v3,0 : poke v4,0 : poke v5,0 : poke d,0
8910 ?":)":end

9000 a$ = ""
9020 if a$="" then read a$

9032 if left$(a$,1)="$" then b$=left$(a$,1) : a$=mid$(a$,2) : return
9034 if left$(a$,1)="_" then b$=left$(a$,1) : a$=mid$(a$,2) : goto 9020
9040 if left$(a$,2)="1>" then b$=left$(a$,2) : a$=mid$(a$,3) : l1 = a : goto 9020
9042 if left$(a$,2)="2>" then b$=left$(a$,2) : a$=mid$(a$,3) : l2 = a : goto 9020
9050 if left$(a$,2)="<1" then b$=left$(a$,2) : a$=mid$(a$,3) : b$ = hex$((l1-a-1)AND255) : goto 9110
9052 if left$(a$,2)="<2" then b$=left$(a$,2) : a$=mid$(a$,3) : b$ = hex$((l2-a-1)AND255) : goto 9110

9100 b$=left$(a$,2) : a$=mid$(a$,3)
9110 poke a,val("&h"+b$) : a = a + 1
9120 goto 9020


9200 data &hc000
9210 data 3E01_210080_CD2400_C9$

9300 data &hc100
9310 data 2A9AF3_3E00_0620_1>7723C60810<1c9$


بواسطة JohnHassink

Ambassador (5684)

صورة JohnHassink

23-06-2017, 04:08

Morphing waveforms has been done by Konami on their later SCC soundtracks (and yes, it's featured in TT).
Some examples which are quick and easy to check:

SD Snatcher:
1st intro, briefly at the beginning and more predominantly at the part where Gillian is standing on the rooftop (just not when the harmonica lead is playing).
Also briefly during the 2nd intro, before the 'guitar lead' kicks in.

Metal Gear 2: Solid Snake
1st intro, during the 'climax' of the song. This is not such a complicated one;
The waveform that plays the accompaniment (on two channels) gradually morphs from a single sawtooth into double saws from every new tone that is played. Effectively, the difference between those two is an octave in pitch.
Also, the dramatic "duuuuuhhhhhnnnnn" at the game's title showcases the effect, but with more elaborate waveforms.
Furthermore, the first two tunes in the game itself (the codec conversation with Campbell and the first 'sneaking' song) have the effect, too.

If you'd like a visual representation on-the-fly of how the waveforms morph, the "SCC Viewer" feature of openMSX is a nice way to study that.
Just enter
toggle_scc_viewer
in the command line.

About the filter thing - If I understand it correctly (so for instance multiplying or mixing waveforms with others) - that could be done manually (and sometimes painstakingly), but there's a nice cross-development tool in development for that.
I'm not sure if I'm allowed to talk about that yet. :)

بواسطة Grauw

Ascended (10820)

صورة Grauw

23-06-2017, 11:14

SCC can do amazing things, mixing waveforms (e.g. square + sine), octaving, low/high pass filtering, etc. Some tools operate on SCC waveforms on the additive synthesis level (with FFT, in the frequency domain) sounds like it would be very useful for the musicians. Like to be able to generate a series of waveforms which apply a cut-off filter on a base waveform.

I think currently people are mostly just messing about a bit, simply morphing between two waveforms or manually modifying the waveform in the time domain (which is hard to get useful results from), and not truly tapping into the synthesis potential of the SCC.

However the topic is PSG... Wink

بواسطة o.geerdink

Hero (588)

صورة o.geerdink

23-06-2017, 10:07

Without reading the whole discussion, back in the day M.Spoor from Tyfoon developped a SMF player and he showed me how he could create other time intervals from the VDP by using line interrupts. Normally you would get a interrupt of 50 of 60hz, but using line interrupts you could create shorter interrupts. Ofcourse the normal MSX lacks the speed to do a lot with this segmented interrupt, but it is possible to for instance use a timer that does 100hz/200hz (or 120/240hz).

By changing the backgroundcolor in screen 0 during that interrupt and changing it back to normal color at the end he showed me how long his interrupt routine was taking (before the next interrupt). Pretty cool stuff.

بواسطة Grauw

Ascended (10820)

صورة Grauw

23-06-2017, 11:17

The easiest timer to create is 300 Hz, which works on both 50 Hz and 60 Hz and can be very useful as an equalizer between the two frequencies (common divider). I use this in VGMPlay. (Tip: increment line number by 51 at 50 Hz, and by 52 at 60Hz, reset to 0 when it overflows.)

Higher frequencies are difficult on 50 Hz because the screen is 313 lines high while the line interrupt register only goes up to 255, so there’s a large gap in the upper end which limits the max frequency.

To go higher you need to enforce 60 Hz which isn’t super great, and actually at 60 Hz line interrupts also only work up to a certain line, 240-something I believe, you can’t go all the way up to line 255, so the max frequency lies somewhere in the 600-800 Hz range.

If you do not rely on interrupts, you can have a 15700 Hz timer by synchronizing the CPU to the HR flag. But since there is only this flag which toggles, your code needs to run in 228 cycles or less to be able to catch it in time, which makes things quite tricky. The turboR’s timer also doesn’t generate interrupts but is simpler to use because you can read out the counter value, and runs at 255682 Hz.

Of course there are actually a lot of really useful variable rate timers available on MSX, in MSX-AUDIO, OPL4, MIDI interfaces, RS232 interfaces, etc. But they’re not exactly unified so to support all of these depending on which is available is quite a job (for a nice library :)), and not available by default. Also it would be kind of lame to require an MSX-AUDIO to be able to play some nice PSG sounds :D. But just for testing purposes, to see what we can achieve, it may still be useful to try to leverage one of these.

بواسطة hit9918

Prophet (2932)

صورة hit9918

23-06-2017, 17:19

on the AY there too is a synthesizer topic.
"pulse width on the AY in a standard tracker"
one can mimic the pulse width in 2 channels, simply "octave chord" (second channel must have precisely same ADSR. but can have different master volume).
it doesnt matter that this is no pulse width, the point is that it is hell a lot more close than the AY flute.
when you put an arpeggio on that whole thing, maybe 95% of the audience cant tell that it is not a SID, who knows. be the first in the entire AY scene to ever have done it.

بواسطة Grauw

Ascended (10820)

صورة Grauw

23-06-2017, 17:37

Playing the same note on two channels with slightly different frequencies kinda sounds similar to PWM if that’s what you mean. The final waveform is different but the effect is comparable. You can hear it in a bunch of games.

E.g. in the first 30 seconds of the Auf Wiedersehen Monty theme. There’s a PWM-like throb, particularly in the higher notes. (Probably because they use a fixed offset on the period to achieve the detune, which alters the frequency much more audibly on the higher notes.)

Also at the start of the Venom Strikes Back theme. You can clearly hear the difference when the note on the second channel disappears after 10 seconds because it is used for something else.

بواسطة hit9918

Prophet (2932)

صورة hit9918

23-06-2017, 17:37

the SCC church organ in the BASIC listing, it needed care to get a 16x frequency overtone at all.
because there are only two sample bytes, asked to be 1,-1 and it happened that the cosinus does 1,-1 while the sinus did 0,0 and then the 16x disappeared.
taking care of this made a difference like a DAC that has twice the hz.

بواسطة hit9918

Prophet (2932)

صورة hit9918

23-06-2017, 18:12

Quote:

Playing the same note on two channels with slightly different frequencies kinda sounds similar to PWM if that’s what you mean.

not slightly different, an octave up! Big smile
if one put pwm in artrags tool then it will say "there is something at double the hz". because there always is. no matter whether pulse or triangle.
then the octave chord is hell a lot more truthful mimic than making music with the square wave flute.

Quote:

There’s a PWM-like throb

I wouldnt have noticed that it is no square wave.
maybe it sounds different every reboot because in lack of phase control it is totaly random.
the octave is tidy, not random, not scratchy.

بواسطة hit9918

Prophet (2932)

صورة hit9918

23-06-2017, 21:54

this is a good example of what I mean, NES sounds on the AY
https://www.youtube.com/watch?v=_FtEQXeDvrw&t=1m50s
here is told how it was made with artrag tool
https://www.msx.org/forum/msx-talk/development/voice-synthes...

those squeak sounds, that's the NES triangle.
but it was not made with envelope mode but combine the square wave channels.
the freuqency slides soft, the accuracy of the square wave channels. and one can have ADSR.

صفحة 5/7
1 | 2 | 3 | 4 | | 6 | 7