[comp.sys.amiga] SendMorse

joe@dayton.UUCP (Joseph P. Larson) (11/17/88)

I sent a program called "SendMorse" to Bob Page several days ago.  But
as I'm cleaning up a little, I get the feeling I forgot to include a
very short .h file.  Thus, if Bob tried to build it, it ain't gonna work.
Thus, I don't know if he's going to post it.

In any case, if he DOES post it, the include file you'll need, called
"sound.h" is as follows:

#include "stdio.h"
#include "exec/types.h"
#include "exec/memory.h"
#include "devices/audio.h"

I do this so that I can pre-compile my include files, thus saving a LOT of
time on rebuilds.

For all it's worth, SendMorse is a little Morse code generator.  You feed
it a file and it makes wonderful noise on your speakers.  I posted it
mostly 'cause I thought maybe SOMEONE out there would like an example of
the audio.device.

If you don't get SendMorse but would like it, drop me a line. -Joe
-- 
          When you fall on your head do you land on your feet?
UUCP: rutgers!dayton!joe   (Feed my      Dayton Hudson Department Store Company
ATT : (612) 375-3537       picture       Joe Larson/MIS 1060
(standard disclaimer...)   collection)   700 on the Mall      Mpls, Mn. 55402

iphwk%MTSUNIX1.BITNET@cunyvm.cuny.edu (Bill Kinnersley) (11/20/88)

[In "SendMorse (oops -- I forgot a file)", "Joseph P. Larson" said:]
:
: For all it's worth, SendMorse is a little Morse code generator.  You feed
: it a file and it makes wonderful noise on your speakers.  I posted it
: mostly 'cause I thought maybe SOMEONE out there would like an example of
: the audio.device.
:
I surely would like to see an audio example in which two channels are
"attached", so that the output of one modulates the output of the other.
Any chances of that?

--Bill Kinnersley
  IPHWK@MTSUNIX1.BITNET
  iphwk@terra.oscs.montana.edu

joe@dayton.UUCP (Joseph P. Larson) (11/22/88)

[If this seems like a non-sequitur, see the included text at bottom]

Like, well. Maybe.  Do you mean that you want 2 speakers, non-stereo?  That
is, send them both the same stuff?  Or are you looking for some soundly
wonders?

If you just want to allocate 2 channels and modulate them equally, all I
would have to do with SendMorse is change one subroutine call and reinsert
some code from Rob Peck's book.  That is, I call something like
"AllocateAnyChannel" and what I should have used to begin with was
"AllocateAnyStereoPair" (they're called something more reasonable, but I
don't remember and you get the general idea anyways).

Then, if I'm not mistaken, one audio.device request would (or at least
could) modulate both channels equally.

If this is what you want, lemme know and I'll send you a copy.


In reply to one of my messages, Bill Kinnersley writes:
>[In "SendMorse (oops -- I forgot a file)", "Joseph P. Larson" said:]
>:
>: For all it's worth, SendMorse is a little Morse code generator.  You feed
>: it a file and it makes wonderful noise on your speakers.  I posted it
>: mostly 'cause I thought maybe SOMEONE out there would like an example of
>: the audio.device.
>:
>I surely would like to see an audio example in which two channels are
>"attached", so that the output of one modulates the output of the other.
>Any chances of that?
-- 
          When you fall on your head do you land on your feet?
UUCP: rutgers!dayton!joe   (Feed my      Dayton Hudson Department Store Company
ATT : (612) 375-3537       picture       Joe Larson/MIS 1060
(standard disclaimer...)   collection)   700 on the Mall      Mpls, Mn. 55402

rap@ardent.UUCP (Rob Peck) (11/24/88)

In article <6283@dayton.UUCP>, joe@dayton.UUCP (Joseph P. Larson) writes:
> In reply to one of my messages, Bill Kinnersley writes:
> >:
> >I surely would like to see an audio example in which two channels are
> >"attached", so that the output of one modulates the output of the other.
> >Any chances of that?

> If you just want to allocate 2 channels and modulate them equally, all I
> would have to do with SendMorse is change one subroutine call and reinsert
> some code from Rob Peck's book.  That is, I call something like
> "AllocateAnyChannel" and what I should have used to begin with was
> "AllocateAnyStereoPair" (they're called something more reasonable, but I
> don't remember and you get the general idea anyways).
> 
> Then, if I'm not mistaken, one audio.device request would (or at least
> could) modulate both channels equally.

For doing cross-channel modulation, you have to allocate "special" stereo
pairs.  The cross-channel modulation is set up so that each channel, if
attached, can modulate the output of the next-higher-numbered channel.
So channel 0 can modulate channel 1, and/or channel 1 modulates channel 2,
and/or channel 2 modulates channel3 (but I don't remember if channel 3
can modulate channel 0, someone will have to check the Hardware Manual
for that.).  I THINK so but I don't remember for sure.

Once you have a compatible cross-modulating pair, you have to go directly
to the hardware to set the attach-bit.  The output of the modulaTOR 
(he who is doing the modulating) is disabled, so you automatically 
lose one channel of real output in the process.  

The sampling rate of the modulaTOR channel determines how often the 
output of the modulaTOR channel is fed to the moduLEE (hehe, new 
term for he who is modulated) in the form of alternating AMPLITUTE 
VALUE, PERIOD VALUE for the modulee.  In other words, it no longer 
matters WHAT value you have given to the Amplitude and Sampling 
rate of the moduLEE when you first started its output because it 
will be replaced by the modulaTOR at HIS sampling rate.  

So, assuming that the Amplitude values are the odd words of the
modulator's data stream and the Period values are the even words
of the modulators data stream (odd/even may be swapped, check hdw man):

  To do amplitute modulation only, modify the odd words of
  the modulaTOR's data stream to reflect the amplitude modulation.
  This will then affect the volume control (max range 0-64).
  Keep the period values exactly the same for each even word,
  that is, the same value at which you started the output of
  the moduLEE.

  To do frequency modulation only, modify the even words of
  the modulaTOR's data stream to reflect the frequency modulation
  to be performed on the moduLEE.  This will then affect the period
  value of the moduLEE.  Keep the Amplitude values exactly the same 
  for each even word, that is, the same value at which you started
  the output of the moduLEE.

  To do both amplitude and frequency modulation, modify both.

  And the rate at which the modulation changes are applied is
  dependent on the period value (sampling rate) of the ModulaTOR.


So you can see, it is NOT a simple sine-wave data that is contained
in the ModulaTOR's data stream, but actually a full amplitude and
freqency control data stream.  A bit more complicated, but very
versatile.


I'll be adding attached-channel modulation functions to the
AudioTools, but I cannot squish out any time for that until
at least February.   At that time, I can probably post an 
example, as well.

By the way, the reason that I added "GetStereoPair" to the tools 
as contained in the Programmers' Guide To The Amiga was to enable 
me to start or stop "ControlChannel" both channels at the same 
time.  This way the same "secret code" would apply to both channels 
and a single command could control both.  I temporarily dropped
"GetStereoPair", I believe, from the current version of the
Audiotools because I was trying to make certain commands work
alike whether they were working on a stereo pair or a single
channel.  Something got in the way of this compatibility and
rather than deal with it, I temporarily suspended the idea.
Note that the Audiotools are a considerable extension to the
material I included in chapter 8(?) of the Programmers' Guide
and got a LOT more testing (which is why some of the functions
changed at least a little bit).

If, before February, someone else adapts the Audiotools to include
an attached-channel function, I would be pleased to accept it
for inclusion in my own distribution.  Additionally, those who
were at DEVCON have the latest version of the Audiotools and
the docs indicate which other functions I would like to add or
see added to the tools.  Again, I am open to accepting any help
I can get on those suggested additions.  So few folks are working
with Amiga audio.  Seems that the tools have inspired SOME
action and some folks are using them but I get very little
direct feedback on the Audiotools, so I figure most folks must
either not know they exist or are perfectly satisfied with
the functionality they provide.  (sigh).  Well, no news is
good news, right?

Rob Peck

page@swan.ulowell.edu (Bob Page) (11/24/88)

I haven't posted SendMorse because it contains a lot of code that
appeared in Rob Peck's book, which is copyrighted.  I've sent a note
and the source off to Rob for his inspection - if he gives me the OK
I'll post it.

By the way, I'm buried in Amiga sources and binaries.  Keep 'em coming!

..Bob
-- 
Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
Have five nice days.

rap@ardent.UUCP (Rob Peck) (11/29/88)

In article <10298@swan.ulowell.edu>, page@swan.ulowell.edu (Bob Page) writes:
> I haven't posted SendMorse because it contains a lot of code that
> appeared in Rob Peck's book, which is copyrighted.  I've sent a note...

In the disk that I provide, accompanying the Programmers' Guide, I have
given explicit permission to use the code or portions of the code in
user programs -- just a caveat that "it is yours now, you are responsible
to see that it suits your own application... and so on."  I had gotten
permission from SYBEX to do this.  So as far as I would guess, anyone
who types the stuff in from the book should also be covered by that
same permission.  My disclaimer was simply to avoid problems if the
code were to be incorporated into commercial applications.  It was a
"this does something for me, maybe it will help you too" kind of notice,
but with no guarantees.  You know what I mean.

Anyway, feel free to post code that includes any of my stuff.  My only
request is that somewhere in a comment, you say that part came from 
(or maybe even 'inspired by') the Programmers' Guide To The Amiga,
Sybex, 1987, by Rob Peck.  That way, a programmer new to the Amiga,
who may not even know the book EXISTS, might be goaded into looking
for it in the local bookstores or Amiga dealers (some of whom actually
carry it).

Rob Peck