Playing saw waves on PSG

By Grauw

Ascended (10699)

Grauw's picture

25-07-2014, 16:48

It’s nothing new as I hear the effect in chip tunes sometimes (I think Vortex Tracker supports it too), however here’s a little test program to let the PSG make some sound other than the normal square wave; a nice (logarithmic) sawtooth wave:

10 SOUND 0,1
20 SOUND 1,0
30 SOUND 13,8
50 FOR N = -33 TO 15
60 F=440*2^(N/12)
70 I=3579545#/F/256-1+.5
80 SOUND 11,I AND 255
90 SOUND 12,I \ 256
100 SOUND 8,16
110 FOR J=0 TO 2000:NEXT
120 NEXT
130 SOUND 8,0
Login or register to post comments

By meits

Scribe (6530)

meits's picture

25-07-2014, 17:21

Nice... I'm not too deep into Trilo Tracker yet (still have to seriously give it a try), but these sounds would be a nice addition (if they're not implemented yet Wink )

By Grauw

Ascended (10699)

Grauw's picture

25-07-2014, 17:25

You can hear it in this tune from Night City: https://www.youtube.com/watch?v=deRZf7hVC0A

By Grauw

Ascended (10699)

Grauw's picture

25-07-2014, 19:17

(That tune is called Six miles high by Gasman from AY Riders.)

By hit9918

Prophet (2927)

hit9918's picture

26-07-2014, 02:21

BASIC code makes the rrrr sound of Turrican intro:
http://www.youtube.com/watch?v=wLxrN03QYyE

10 sound 13,14 : sound 8,16
20 sound 9,10
30 sound 0,0 : sound 1,0
40 B = 68
50 a = int(b)*32+8
60 sound 11,b mod 256
70 sound 12,b/256
80 sound 2,a mod 256
90 sound 3,a/256
100 b = b / 1.01
120 if b > 50 then 50
140 for i = 1 to 1000 : next
150 for i = 10 to 0 step - 0.1
160 sound 9,i
170 if (i < 8) then sound 8,0
180 next

Ok, rest of the tune is missing, sorry ;)
But the intro RRR is same sound, isn't it :)
It is a triangle wave combined with a square wave.

I forgot the details I am doing.
I think the int() is to make the square the same low resolution as the triangle.
so they really go with each other.
and the +8 is to disconnect them a bit. because I couldnt sync them.
when both channels go same, in unknown sync, they overlay random and make random loudness.

and doesnt it end in a nice fade out ADSR?
triangle has no loudness, I faked and let the square make that part.

the triangle actualy could do two different loudnesses.
when turning on/off the channel in register 7, somehow makes different loudness.