[Gambas-user] R: morse code sound ?

Kevin Fishburne kevinfishburne at ...1887...
Sat Feb 8 09:34:14 CET 2014


On 02/08/2014 02:55 AM, Randall Morgan wrote:
> I got 5F here. Looking forward to a possible 30F next week.
>
> True the old BASIC machines used the internal speakers, and those are hard
> to find. But almost every *nix box has a sound system. And we no-longer
> need to count clock cycles, we can use the the built-in timing routines or
> delay routines. The Sound and Play function where blocking functions. No
> need for anything fancy. But I do think adding a simple Play freq.,
> duration function would be a great addition to the language and would make
> it more complete. For anything more elaborate there is Sdl and such.
>
>
>
>
> On Fri, Feb 7, 2014 at 10:07 PM, Bruce <bbruen at ...2308...> wrote:
>
>> On Fri, 2014-02-07 at 18:15 -0800, Randall Morgan wrote:
>>> It seems like playing a simple tone is something that should be a
>> primitive
>>> in the Gambas Language... A simple Play(frequency, duration) type of
>>> function as was found in many of the early BASIC languages. Am I the only
>>> one who think like this?
>>>
>> Ah yes! But those magical sounds were made by dividing the clock signal
>> and sending the resultant wave directly out to the onboard speaker port.
>> I dont think any of the boxes here have a onboard speaker any more?
>>
>> "Leisure Suit Larry" anyone?
>>
>> cheers
>> Bruce
>

 From Wikipedia:

http://en.wikipedia.org/wiki/GW-BASIC#Syntax


GW-BASIC allowed use ofjoystick 
<http://en.wikipedia.org/wiki/Joystick>andlight pen 
<http://en.wikipedia.org/wiki/Light_pen>input devices. GW-BASIC can read 
from and write to files andCOM ports 
<http://en.wikipedia.org/wiki/Serial_port>; it can also do event 
trapping for ports. Since thecassette 
<http://en.wikipedia.org/wiki/Compact_cassette>port interface of the 
original IBM PC was never implemented on compatibles, cassette 
operations are not supported. GW-BASIC can play simple music using 
the|PLAY|statement, needing a string of notes represented in amusic 
macro language 
<http://en.wikipedia.org/wiki/Music_macro_language>(e.g.|PLAY 
"edcdeee2dfedc4"|). Morelow-level 
<http://en.wikipedia.org/wiki/Low-level>control is possible with 
the|SOUND|statement, which takes the arguments of afrequency 
<http://en.wikipedia.org/wiki/Frequency>inhertz 
<http://en.wikipedia.org/wiki/Hertz>and a length in clock ticks for the 
standard internalPC speaker <http://en.wikipedia.org/wiki/PC_speaker>in 
IBM machines. Consequently sound is limited to single channel beeps and 
whistles as befits a 'business' machine. Home-based PCs such as theTandy 
1000 <http://en.wikipedia.org/wiki/Tandy_1000>allowed up to three 
channels of sound for the|SOUND|and|PLAY|commands.^[5] 
<http://en.wikipedia.org/wiki/GW-BASIC#cite_note-Guide-5>

The first time I ever made music on a computer was using GW-BASIC, using 
PLAY. Later I figured out how to do loops and pass those values to 
SOUND. I even made a delayed vibrato by slightly modifying the frequency 
with a sine wave.  Experiences like that and similar keep me programming 
today; it's awesome.

I wonder if OpenAL has a tone generator. You could do perpendicular sine 
waves for source positioning (since it's 7.1 and all that). I'm looking 
forward to switching to it (from sdl.sound playback features) soon so 
hopefully it will kick ass.

If basic sound generation were to be implemented in GAMBAS, it would 
have to generate a tone that relied on a high frame rate to sound right 
(frequency) and optionally let it play in the background until stopped 
(duration). You could turn the channel on and off, but would leave it on 
when making sounds. I would keep it as simple and fast as possible, so 
frequencies would be heard exactly as set with an extremely high frame 
rate (2K - 24K FPS if only setting the frequency and duration?). One 
could use Timer to set a tempo and do some programmatic beats and 
frequency-switching.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list