[comp.sys.amiga.programmer] Need a way to manipulate Sonix Synthesizer files

mykes@sega0.SF-Bay.ORG (Mike Schwartz) (03/25/91)

In article <1991Mar23.132334.4291@mailer.cc.fsu.edu> prem@geomag.gly.fsu.edu (Prem Subrahmanyam) writes:
>
>   Hi, I don't know if this has been done or even can be done, but what
>   I need is the ability to digitize the sounds of a Sonix synthesized
>   sound (i.e. the one that you play around with all the sliders and
>   waveform to generate interesting sounds).  Basically, I need a program
>   that can "listen" to what comes out of the audio circuitry and digitize
>   an image of this.  The reason for this:  I would like to be able to
>   combine different frequencies of the same sound into a single digital
>   sample so as to make a chord which can then be loaded back into Sonix
>   and used as an instrument.
>
>   Note, I can easily enough use AudioMaster to combine various sampled
>   sounds into a chord, so that's not what I'm after.
>   ---Prem Subrahmanyam

You can't listen to what is being played out the audio channels, but you
can predict what will be played.  For example, if you know that you are
going to make a chord, you can precompute the required sample and then
play the chord out of one audio channel.  To add two waveforms (mix)
together, you can use 'C' code that looks like this:

UWORD	sum;
UBYTE	*sample1, *sample2, *result;

UBYTE	*ps1, *ps2, *dst;

	ps1 = sample1;
	ps2 = sample2;
	dst = result;
	for (i=0; i<SAMPLE_LENGTH; i++) {
		sum = *ps1++ + *ps2++;
		sum >>= 1;
		*dst = sum;
	}

That's all there is to it.  You can use 3, 4, or more samples to mix
together, but you are going to need to make 'sum' the average of each
byte in the result.

There are other techinques, too, but this is the simplest.

--
*******************************************************
* Assembler Language separates the men from the boys. *
*******************************************************