Background Music  (a Kind of ASCII ART)


Author Message
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1485
Posted: 01:35pm 17 Oct 2022      

Hi Stanley,
a few comments:


Dim FRQ%(128)

there the Frequency Values from the Data are stored,

Dim notes%(4,255)
can be deleted, was from a previous attempt.

Dim ADSR%(10)=(25,25,25,24,22,20,18,13,7,3,0)
Dim ADSR2%(10)=(2,8,12,17,22,20,15,10,5,2,0)

The ADSR volume curve for the "Instruments"

the Sub is called 10 times per Note to process the ADSR volume curve,
Therefor mt% is counting, if it reaches 11 it is set to 1 and a new tone is read.

the Pseudo Chorus part detunes the lead voyce 1% up and down and uses 2 Oszilators to create a kind of chorus / flanging effect

Sub music
Local Fcent%,F1%,F2%,FL%,FR%
If mt%=1 Then
 nt%=Asc(Mid$(AA$,CNT%,1))
 If nt%=35 Then CNT%=1:nt%=Asc(Mid$(AA$,CNT%,1))
 Freq1%=FRQ%(nt%)
 Freq2%=FRQ%(Asc(Mid$(AB$,CNT%,1)))
Inc cnt%
EndIf
'Pseudo Chorus
Fcent%=Int(Freq1%/100)
FL%=Freq1% - Fcent%
FR%=Freq1% + Fcent%
EndIf
If Freq1%>1 Then Play sound 1,"L","q",FL%,adsr%(mt%):Play sound 3,"R","q",FR%,a
dsr%(mt%)
If Freq2%>1  Then Play sound 2,"B","w",Freq2%,adsr2%(mt%)
Inc mt%:If mt%>10 Then mt%=1
End Sub

Edited 2022-10-18 01:17 by Martin H.