[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mac Sounds for Symbolics
Date: Fri, 7 Dec 90 11:45:39+0900
From: firstname.lastname@example.org (John K. Myers)
Trap: The array given to the ZL:AP-1 instruction, #<ART-FIXNUM-11808 123131417>,
is not allowed to be a numeric array. (called from:)
AUDIO:PUSH-ARRAY-OF-AUDIO-SAMPLES #<ART-FIXNUMetc> from:0 to:11520
(Honestly, if it doesn't take bytes, what does it want? p.503: "Each sample
pair is expected to be a fixnum." p.509, bottom: "A default audio command array
is provided as part of these audio support primitives. All of these primitives,
however, allow the specification of any suitable user-provided array as a
command array. Such an array must be a nonindirect, single-dimensional
sys:art-q array, with a fill pointer, allocated in a static area.")
Here's some translation for you:
SYS:ART-Q = :ELEMENT-TYPE T (It must store some pointers into the array).
(defvar *sound-area* (si:make-area :name '*sound-area* :gc :static))
... (make-array <size> :element-type t :area *sound-area* :fill-pointer 0)
Please help me translate the file into a format (play-disk-file) will like.
1) There actually seem to be at least three sound format files on the Mac:
MacRecorder, with an RCA dog icon; an unknown black waveform icon;
and an unknown Mac with Waveform Screen icon. Presumably these all
store data in 8-bit bytes, and differ only in the file header info,
which might contain length, speed info, etc. I'm currently willing
to allow these hypothetical few bytes of data to be played as noise;
however, if anyone has Mac sound format info, it would be appreciated.
You should be aware of the various Apple sound formats. These
are documented in Volume 5 of Inside Macintosh, under the Sound
Manager. If the file formats you mention are not based on these
formats, they will be convertible to them, since that's what the
Mac knows how to play.
The format is more complex than you suspect above, including
the ability to have looping (i.e. repeating a section of
the sound where it is relatively unchanging, instead of
storing redundant information).
Don't forget the issue of data compression. The recently
introduced version of the Sound Manager includes data compression.
However, you won't have to worry about that for existing programs.
Don't forget that Mac sound is only 8-bit sound; not very high
fidelity. If you need more fidelity, you can sample sounds using
a professional sampler. Most modern ones support the MIDI Sample
standard. You should be able to find any necessary documentation
on MIDI at your local music store, or you can order the standard
from the International Midi Association.
(I'd send you a copy, but I can't find my online documentation
of it. Your address looks like you're in Japan, so your local
Music store's documentation may be difficult for us gaijin. If
you do decide to go this route, let me know).
2) How can I trick ZMACS into editing a data file as HEX digit pairs
separated by spaces?
Just what do you want it to do?
3) Mac sounds come at different sampling speeds: 12Khz, 24Khz, etc.
I'm willing to supply the speed to my function as a second argument.
Not necessary, since the info is in the 'snd ' format.
However, apparently the Symbolics is hardwired to 50Khz.
It's impractical to expand the data-file; this conversion should be
done in software, at play-time, by playing some samples 2-4 times.
How to hack play-disk-file to do this?
You'll have to copy the data. There should be enough processor
power to do this, if you're careful about efficiency. Unroll
4) Under the FEP documentation, it says to not put lots of files onto the
FEP, especially small files, or else performance will slow.
Is there a way of squishing FEP files into one area of disk?
Conversely, can play-disk-file play LMFS files rapidly somehow?
Currently, I stick the sounds in a FEP:>Sound> subdirectory.
Putting them into a subdirectory doesn't help fragmentation.
Actually, if you create them all at once, and then delete them
all at once, it doesn't hurt fragmentation, but if you need to
replace one here, then one there, it will.
What you can do is to put them all into one file, with a
directory indicating where in the file each sound begins
and its size.
5) I'm unclear both on the requirements of the Symbolics, and on the
resulting format of the sound-files after they have been copied.
The Symbolics seems to want TWO voices' data for its input, each
voice being 16 unsigned bits packed into a 32-bit word; however, it
ignores the top voice, and the bottom four bits of the bottom voice.
I don't know whether copying a byte file from a Mac gives bytes,
single bytes put in words filled with zeros, 4 bytes packed into
a word, 2 bytes packed into a word filled with zeros, or something else.
'snd ' (i.e. Mac sound) files are 8-bit sound files; hence you should
open the file as :ELEMENT-TYPE '(UNSIGNED-BYTE 8), and should multiply
each sample by 256, and store it into 32-bit words.
Again, I need a hex-based ZMACS.
Again, I don't know why you want this hex-based Zmacs to do.
Do you just want a program to print out a file in Hex? Easy
6) Eventually I will want to play sequential, concatenated sounds.
Do you think play-disk-file and with-multi-disk-buffering is smart enough
not to step on its own toes, and wait until the audio facility is free,
if called multiple times in quick succession from one program?
It is if you use the stuff right. There's built-in primitives for
synchronization. AUDIO:RESERVE-AUDIO-FLAGS, AUDIO:WAIT-FOR-AUDIO-FLAG,
and AUDIO:PUSH-AUDIO-ZERO-FLAG use %AUDIO-COMMAND-ZERO to allow
synchronization. This is largely what the Playing Large Pieces Example
in the documentation is all about.
By the way, has anyone built a DX-7 emulator or other synthesizer
for the Symbolics?
Yes, when I was at Symbolics. I never did the work required to
duplicate the exact interpretation of the various DX-7 parameters
in terms of the FM algorithms, though. (The relationships between
the various 0-99 values and the actual values used in the calculations
isn't obvious, and usually isn't even linear). I don't know what
became of this code.
You can do this kind of thing on the Mac, with a commercial package
called SoftSynth or (more powerfully) TurboSynth, both from DigiDesign.
They also make add-in cards that let you do the calculations *IN REAL
I'd be happy to consult for anyone wanting to interface the MacIvory
to MIDI, or other Music/Lisp hacking. I even speak Japanese!