flat assembler
Message board for the users of flat assembler.

Index > Main > How to implement Qbasic's Sound and Play Statement?

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng
How to implement Qbasic's Sound and Play Statement which can let the PC speaker sound some music?
Post 11 Mar 2004, 15:50
View user's profile Send private message Reply with quote
eet_1024



Joined: 22 Jul 2003
Posts: 59
eet_1024
Those were implemented using a BIOS interrupt (between 0x10 and 0x21).

Do a search for Programable Interval Timer (PIT), it is the thing that makes the tones.
Post 31 Mar 2004, 04:18
View user's profile Send private message Reply with quote
Cas



Joined: 26 Feb 2004
Posts: 82
Location: Argentina
Cas
I remember there was a port.... forty-something hex, which controled the frequency of the speaker, then another one lets you enable or disable it... but it's been a long time that I don't check that.
Anyway, when you want to develop a PLAY routine, you must do something more complex: remember that musical notes do NOT grow lineally with frequency. Suppose note 0 is LA440, then:

frequency = 440*(root(12;2)^note)

That is, if the frequency of a note is F and you want to get the frequency of a note which is one semitone higher, you must multiply F by the twelveth root of two. The same way, to get the frequency of that note, but in the next octavia, you simply multiply F by 2.

Hope this is useful to you.
Post 05 Apr 2004, 05:24
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng
Thank you! I know this, what you said is Equal Temperament, there are already many programs.
But I would prefer Just Scale(harmonic tuning), that's why I want to do it by myself.

see more info at :
http://www.phy.mtu.edu/~suits/scales.html
Post 05 Apr 2004, 13:01
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.