Login
Back to forumReply to this topicGo to last reply

Posted By

MMS
on 2014-07-25
19:48:58
 Exact TED Frequency a for music beginners :-)

Here you can find a good overview about the freq-conversion of TED vs real sound. (and few worst about it's capabilities)
(I know there were some frq tables, but I have never seen negative frequences (missing bass sound)) and the precision of the evaluation was nice...

Have good music creation in BASIC, haha happy

http://www.dtech.lv/techarticles_plus4_freq.html

Posted By

MIK
on 2014-07-26
00:13:57
 Re: Exact TED Frequency a for music beginners :-)

Regardless of being correct or not the Devil's Chord will still sound "scary", or "evil" to human ears.
Some people coming from a Commodore 64 may think TED sounds like the devil's work any way. wink

But let us not forget... The game Diagon states on the back cover the game features, "sounds your mother will love". As long as my mum is happy then I am too.

Posted By

gerliczer
on 2014-07-26
11:19:35
 Re: Exact TED Frequency a for music beginners :-)

Hmm. I don't think these values are quite right. I calculated quite different numbers with the frequency formula TLC derived ages ago. It was somewhere in the late plus/4 mailing list, IIRC.

Anyway, here is the basic program I used to do the math. Feel free to find errors in it.

LIST

10 R=0:I=0
20 D=200000:J=R
30 F=110*(2^(I/12)):IF F>3520 THEN END
40 G=110840.46875/(1024-((R+1)AND1023))
41 REM G=111860.78125/(1024-((R+1)AND1023))
50 IF ABS(G-F) < ABS(D) THEN D=G-F:J=R:ELSE PRINTI;":",F,D,J:I=I+1:GOTO 20
60 R=R+1:IF R<1024 THEN 40

READY.
Line 40 is for the PAL machines, line 41 is obviously for the NTSC ones. And no line for the Drean machines.

I is an index, R is the register value, F is the frequency of the note we are trying to approximate, G is the generated frequency and D is the variable used to select the smallest difference. If I not screwed up too badly, this code will print those register values that generate frequencies having the smallest difference compared to the desired note frequencies.

Edit: To find the frequency formula open TLC's member page, click the link to his mailing list posts and find post #1550. You can find the formula after the sea of tabulated numbers in the part where he gives advice to emulator writers.

Edit 2: Part of the basic code somehow got interpreted as a kind of html tag and was messed up. I hope this change fixes it.

Posted By

George
on 2014-07-26
13:23:17
 Re: Exact TED Frequency a for music beginners :-)

I want to thank especially MMS for the tables. Now i have the missing link for converting midi-tunes, which i tried for so long, because i have no idea about musik notes.

@ gerlicer: the tables linked from MMS seem to be ok for me.

Your post inspired me to convert an old greek song from a mid-file, which i tried for so long time. Always failed so far. I had only the MIDI file. I wrote it in Basic. I hope you like it. Its my first conversion.

Tou Voutikou o mangas (old greek song)

Posted By

MMS
on 2014-07-27
17:51:40
 Re: Exact TED Frequency a for music beginners :-)

Hi,

just listened to it, and happy to help happy
BTW: How much time it took to write this, did you use Editor in PC, or just raw Plussy or Emulator? Pretty much likes the clean structure of the program, easy to understand. To be honest, I am rather weak in music area, just listening (and my kidsa and wife just told yesterday, all my musics I listen are like 2-3 drilling tools working in metal and some extra noise (KYUSS, Amon Amarth, and so) happy )

I have 2 comments/ideas.
1) In C128 there was a command "PLAY" that make the music writing much-much easier.
Is there any specific or similar program (I mean module) or sample PRG doing it in a similar way? You know, just telling in a string the notes, lenght and delays, and the Plussy converts them to Sound on the fly...
http://www.commodore.ca/manuals/128_system_guide/sect-07b.htm

2) The harmonics are good, and the linked music suond OK with those frequencies.
But I cannot help, I keep annoyed by the very small "plop" sounds when the note starts
I supposed first it was the Emulation, but then I remember, that it did exist in my childhood too, when I tried to make music in Basic. I do remember how nice it was to listen to PIGMY's Game Music did not have these plop sounds.
What is the cause of that in BASIC, and is there any way to prevent it, to have smoother music in basic? or could be linked again to RAM/ROM switching on bad lines? Then only raster and wait states, yeah?
How it could be prevented in C=128, or SID just take care of it by itself?

Posted By

George
on 2014-08-07
21:08:46
 Re: Exact TED Frequency a for music beginners :-)

Hi MMS,

I experimented very long to convert music from Midi. I am no musician. There are tools, which can analyse the midi files and export them into music-notes and give every tone a number from 1 to 12.. My problem was, to find out the right frequencies for the notes. The Artikel helped a lot, because all the notes are numbered from 1...N(n=48!?) (analogy to the keys on a piano). These numbers were the key. Now i could match the notes.

After knowing this, i wrote the tune in one hour. And i was amazed about the result (compared to my failures, it sounds like music now). I usually use the Editor "Notepad++" for coding and then copy and paste the code to Yape.

The "plops" must have their reason in the Basic commands. The problem i had, was that if you play the same note two times (lets say two half C), than it sounds like one note of double length. I resolved this by doing a loop between the notes, which makes the plops worse. I don't know how i make a pause with the sound command. Basic is not the best way to program music, but this was a first try from a beginner. If you use the second voice the plopping gets worse. I am sure, the Experts here, know many better ways of doing this.

Machine-Language is far better. You switch a tone on..after a period of time you switch it off. Thats how the MIDI format-works basically. Perhaps its better to use Pokes than the "Sound" command.

I link the original MIDI file for comparison. For Basic, I think ,it comes suprisingly close to the original (done from a beginner like me)
original Midi

Dont forget, that the Plus/4 "sound-chip" is more or less a cheap Buzzer.

*********************************************************************************************************
ADD (06.08.2014):
*********************************************************************************************************
I made a new famous music title in Basic: "To zeibekiko tis Eudokias" from Manos Loizos.

Actually i had a lot of fun setting note by note. It took me 2 days.

The pause i mentioned before is realized now by Sound 1, 1024, 1 (instead of the silly loop). This note you cannot hear with human ears. The finetuning (compared to my previous) in this song was to maintain the timing right, when playing the same note repatedly. I solved this by reducing the duration of the previous note by 1, everytime a pause is played.
Now enjoy the tune. I hope you like it as much i like it.

To zeibekiko ths eudokias

The source-Midi i used:
To zeibekiko ths eudokias (MIDI)

@MMS: Thanks again for starting this thread
@Experts: Sorry for boring you with this very basic stuff.

I will experiment to add a second track to the next song i have in mind.

*********************************************************************************************************
ADD (08.08.2014):
*********************************************************************************************************
For those who are interested. This is a two track song. The code is from one of the programmers' books.
In my opionion it sounds horrible.

100 VOL 8
110 DIM N1%(66), N2%(66), D1%(66),D2%(66)
120 I=0
130 READ N1%(I),D1%(I): IF N1%(I)<0 THEN 150
140 I=I+1: GOTO 130
150 T1=I: I=0
160 READ N2%(I),D2%(I): IF N2%(I)<0 THEN 180
170 I=I+1: GOTO 160
180 I1=-1: I2=-1
190 IF D1>0 then 220:ELSE SOUND 1,N1,0
200 I1=I1+1: IF I1210 IF N1>0 then SOUND 1,N1,300
220 IF D2>0 then 250: ELSE SOUND 2,N2,0
230 I2=I2+1: D2=D2%(I2): N2=N2%(I2)
240 IF N2>0 THEN SOUND 2,N2,300
250 D1=D1-1: D2=D2-1
260 FOR i=1TO80:NEXT I: Goto 190
270 VOL 0
280 DATA 0,1,685,1,770,1,810,1
290 DATA 798,1,685,1,798,1,834,1
300 DATA 810,2,854,2,775,2,854,2
310 DATA 770,1,685,1,770,1,810,1
320 DATA 798,1,685,1,798,1,834,1
330 DATA 810,2,770,2, 0,4
340 DATA 0,1,854,1,810,1,854,1
350 DATA 770,1,810,1,685,1,739,1
360 DATA 704,2,770,2,834,2,864,2
370 DATA 864,1,834,1,798,1,834,1
380 DATA 739,1,789,1,643,1,704,1
390 DATA 685,2,739,2,810,2,254,2
400 DATA 854,1,810,1,770,1,810,1
410 DATA 704,2,834,2,834,1,798,1
420 DATA 739,1,798,1,685,2,810,2
430 DATA 810,1,770,1,704,1,770,1
440 DATA 643,2,798,2,810,6
450 DATA -1,-1
460 DATA 7,2,516,4,485,2
470 DATA 516,1,345,1,516,1,596,1
480 DATA 571,1,345,1,571,1,643,1
490 DATA 596,2,516,2,485,2,345,2
500 DATA 516,1,345,1,516,1,596,1
510 DATA 571,1,345,1,571,1,643,1
520 DATA 596,2,516,2,596,2,516,2
530 DATA 643,1,516,1,383,1,516,1
540 DATA 262,1,383,1, 7,1,169,1
550 DATA 118,2,262,2,453,2,571,2
560 DATA 571,1,453,1,345,1,453,1
570 DATA 169,1,345,1,118,1,118,1
580 DATA 7,2,169,2,262,2,383,1
590 DATA 118,1,262,1,118,2,118,2
600 DATA 169,1,345,1, 7,1,169,1
610 DATA 7,2 7,2
620 DATA 118,1,453,1,383,1 453,1
630 DATA 596,6
640 DATA -1,-1




Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024