ftp.nice.ch/pub/next/audio/converter/Csnd.2.0.NI.tar.gz

Csnd.v2.0.app/
 
README.Csnd.app.v2.0
 
README.csound.newopcodes
 
csound
 

README.Csnd.app.v2.0

/********   Csnd.app v2.0  README   ********/

			Stephen David Beck
			School of Music
			Louisiana State University
			Baton Rouge, LA  70803
			USA
			voice: 1-(504)-388-3261
			fax:   1-(504)-388-2562
			email: sdb@comp.music.lsu.edu

This is a beta release of Csnd.v2.0.app, a NEXTSTEP GUI to MIT/Bath Csound.  This distribution contains the following:

1)	A fat binary (NeXT/Intel only) Csnd.v2.0.app application
2)	A fat csound binary (NeXT/Intel only) compiled using the MIT/Bath sources
	(v3.41)
3)	The file README.csound.newopcodes
4)	This README file

To install, login as root, place Csnd.v2.0.app.tar.gz in your /LocalApps directory and unzip the file with the following commands:

		cd /LocalApps
		gunzip -cd Csnd.v2.0.app.tar.gz | tar -xf -

Place the Csnd.v2.0.app in your /LocalApps directory.  Be sure your system has the Csound binary located in a public path (i.e., /usr/local/bin).

This is strictly a beta release.  No warranties, no guarantees, no nothin'!  I don't have access to an Intel NEXTSTEP machine, so I'm only about 80% confident that the MAB files work. (i.e. I hope it works...) 

Our NeXT cube is on its last legs, and so is the development of this program.  It has not been tested by my students, and I haven't done much work on it since Fall (1995).  But I've had a few days to finish up some stuff, and to make sure everything works.

On the other hand, Csnd.v2.0.app has some really cool improvements, like a file inspector (sound files, text files, lpc analysis files), a compiler module (will automatically set flags for midi, extract and scot files), and a much improved GUI for soundfile analysis.  Please send your comments, your thanks, and any suggestions.  

If GNUstep/OPENSTEP takes off, or someone donates an Intel box to the school (wink, wink, nudge, nudge), I might work on it further.

Changes since v1.6
- file inspector built-in (sound, text and lpc analysis files)
- separate compiler module (will automatically set flags for midi, 
	extract and scot files if present)
- improved interface for soundfile analysis
- fixed bug of /tmp/score.srt problems (important if multiple users 
	on one machine)
- added kill buttons for compiler


Changes since 1.5 
- MAB csound binary 
- Preliminary version of info panel for lpc anal files (shows graphs 
	of Pitch, RMS (original and residual) and Error, and displays 
	header data) 
- More bug fixes

Changes since 1.1

- Support of AIFF files for analysis and playback (read-only)
- Improved Preferences Manager 
- MAB for Intel and NeXT hardware
	(Csnd.app only; csound binary is machine specific) 
- Messages selected editor for MIDI files 
- Many bug fixes (I'm sure there are still more)

Changes since 1.0

- Compile sounds to floating point 
- Use Midi files & extract files in compile 
- Import Midi files into project 
- Upgrade to March 1994 csound binary 
- Bug fixes in subprocess manager

Csnd.app has several distinct differences from Snd.app:

- It can access files from any available directory;
- Csnd.app creates a separate process to compile files, 
	returning control to the user as soon as the compiling 
	begins; 
- It has services to send the following messages from Edit to
	Csnd.app:
	- recompile last orc & sco file import file to project
	- search MIT Csound Quick Reference for selection
	- open standard NeXT help with MIT Csound Manual
- Double-click on browser calls appropriate edit program for file

Csnd.app also takes advantage of the analysis programs built-in to
MIT Csound, and provides an intuitive interface to them.  Some of
the analysis features are:

- Soundfile display and playback 
- Analysing all or only selected portion of soundfile 
- Analysis generated by Csound are automatically imported to 
	projects upon completion.

For more information, e-mail: sdb@comp.music.lsu.edu

Stephen David Beck
School of Music
Louisiana State University

README.csound.newopcodes

------------------------------------------------------------------------
		  Appendix 7 : Newest Csound opcodes
				  by
			   Paris Smaragdis
		       Berklee College of Music

	This appendix describes recent additions to Csound.  These
additions include a granular synthesis synthesizer, a new set of
filters, a new variable delay, a multitap delay, a new reverb, an
envelope follower, various noise generators, a power function
generator and two gen routines, GEN20 and GEN21.


1) Granular synthesizer.

ar   grain   xamp, xpitch, xdens, kampoff, kpitchoff, kgdur, igfn, iwfn, imgdur

Generates granular synthesis textures.

INITIALIZATION

igfn, igdur - igfn is the ftable number of the grain waveform.  This
can be just a sine wave or a sampled sound of any length.  Each grain
will start from a random table position and sustain for igdur seconds.

iwfn - Ftable number of the amplitude envelope used for the grains
(see also GEN20).

imgdur - Maximum grain duration in seconds.  This the biggest value to
be assigned on kgdur.

PERFORMANCE

xamp - Total amplitude of the sound.

xpitch  - Grain frequency in cps.

xdens - Density of grains measured in grains per second.  If this is
constant then the output is synchronous granular synthesis, very
similar to fof.  If xdens has a random element (like added noise),
then the result is more like asynchronous granular synthesis.

kampoff - Maximum amplitude deviation from kamp.  This means that the
maximum amplitude a grain can have is kamp + kampoff and the minimum
is kamp.  If kampoff is set to zero then there is no random amplitude
for each grain.

kpitchoff - Maximum pitch deviation from kpitch in cps.  Similar to
kampoff.

kgdur - Grain duration in seconds.  The maximum value for this should
be declared in imgdur.  If kgdur at any point becomes greater than
imgdur, it will be truncated to imgdur.


2) Butterworth filters.

		ar	butterhp	asig, kfreq
		ar	butterlp	asig, kfreq
		ar	butterbp	asig, kfreq, kband
		ar	butterbr	asig, kfreq, kband

Implementations of second-order hipass, lopass, bandpass and
bandreject Butterworth filters.

PERFORMANCE

These new filters are butterworth second-order IIR filters.  They are
slightly slower than the original filters in Csound, but they offer an
almost flat passband and very good precision and stopband attenuation.

asig  - Input signal to be filtered.

kfreq  - Cuttoff or center frequency for each of the filters.

kband  - Bandwidth of the bandpass and bandreject filters.

EXAMPLE

	asig	rand		10000	      ; White noise signal
	alpf	butterlp	asig, 1000    ; cutting frequencies above1K
	ahpf	butterhp	asig, 500     ; passing frequencies above 500Hz
	abpf	butterbp	asig, 2000, 100 ; passing only 1950 to 2050 Hz
	abrf	butterbr	asig, 4500, 200 ; cutting only 4400 to 4600 Hz


3) Vdelay

		ar	vdelay	asig, adel, imaxdel

This is an interpolating variable time delay, it is not very different
from the existing implementation (deltapi), it is only easier to use.

INITIALIZATION

imaxdel - Maximum value of delay in samples.  If adel gains a value
greater than imaxdel it is folded around imaxdel.  This should not
happen.

PERFORMANCE

With this unit generator it is possible to do Doppler effects or
chorusing and flanging.

asig  - Input signal.

adel - Current value of delay in samples.  Note that linear functions
have no pitch change effects.  Fast changing values of adel will cause
discontinuities in the waveform resulting noise.

Example

	f1 0 8192 10 1

	ims = 100			; Maximum delay time in msec
	a1	oscil	10000, 1737, 1	; Make a signal
	a2	oscil	ims/2, 1/p3, 1	; Make an LFO
	a2	=	a2 + ims/2	; Offset the LFO so that it is positive
	a3	vdelay	a1, a2, ims	; Use the LFO to control delay time
	out	a3

Two important points here.  First, the delay time must be always
positive.  And second, even though the delay time can be controlled in
k-rate, it is not advised to do so, since sudden time changes will
create clicks.


4) Multitap delay

	ar	multitap	asig, itime1, igain1, itime2, igain2 . . . 

Multitap delay line implementation.

INITIALIZATION

The arguments itime and igain set the position and gain of each tap.
The delay line is fed by asig.

Example:

	a1	oscil		1000, 100, 1
	a2	multitap	a1, 1.2, .5, 1.4, .2
	out	a2

This results in two delays, one with length of 1.2 and gain of .5, and
one with length of 1.4 and gain of .2.


5) Reverb2

	ar	reverb2	asig, ktime, khdif

This is a reverberator consisting of 6 parallel comb-lowpass filters
being fed into a series of 5 allpass filters.

PERFORMANCE

The input signal asig is reverberated for ktime seconds.  The
parameter khdif controls the high frequency diffusion amount.  The
values of khdif should be from 0 to 1.  If khdif is set to 0 the all
the frequencies decay with the same speed.  If khdif is 1, high
frequencies decay faster that lower ones.

Example:

	a1	oscil		10000, 100, 1
	a2	reverb2	a1, 2.5, .3
	out	a1 + a2 * .2

This results in a 2.5 sec reverb with faster high frequency
attenuation.


6) Envelope follower

	kr	follow	asig,  idt
Envelope follower unit generator.

INITIALIZATION

idt - This is the period, in seconds, that the average amplitude of
asig is reported.  If the frequency of asig is low then idt must be
large (more than half the period of asig )

PERFORMANCE

asig  - This is the signal from which to extract the envelope.

Example

	k1	line	0, p3, 30000	; Make k1 a simple envelope
	a1	oscil	k1, 1000, 1	; Make a simple signal using k1
	ak1	follow	a1, .02		; ak1 is now like k1
	a2	oscil	ak1, 1000, 1	; Make a simple signal using ak1
	out	a2			; Both a1 and a2 are the same

To avoid zipper noise, by discontinuities produced from complex
envelope tracking, a lowpass filter could be used, to smooth the
estimated envelope.


7) Noise generators

All of the following opcodes operate in i-, k- and a-rate.  The output
rate depends on the first letter of the opcode, a for a-rate, k for k-
rate and i for i-rate.

xlinrand krange - Linear distribution random number generator.  krange
is the range of the random numbers [0 - krange).  Outputs only
positive numbers.

xtrirand krange  -  Same as above only ouputs both negative and 
positive numbers.

xexprand krange - Exponential distribution random number generator.
krange is the range of the random numbers [0 - krange).  Outputs only
positive numbers.

xbexprnd krange - Same as above, only extends to negative numbers too
with an exponential distribution.

xcauchy kalpha - Cauchy distribution random number generator.  kalpha
controls the spread from zero (big kalpha => big spread).  Outputs
both positive and negative numbers.

xpcauchy  kalpha  -  Same as above,  ouputs positive numbers only.

xpoisson klambda - Poisson distribution random number generator.
klambda is the mean of the distribution.  Outputs only positive
numbers.

xgauss krange - Gaussian distribution random number generator.  krange
is the range of the random numbers (-krange - 0 - krange).  Outputs
both positive and negative numbers.

xweibull ksigma, ktau - Weibull distribution random number generator.
ksigma scales the spread of the distribution and ktau, if greater
than one numbers near ksigma are favored, if smaller than one small
values are favored and if t equals 1 the distribution is exponential.
Outputs only positive numbers.

xbeta krange, kalpha, kbeta - Beta distribution random number
generator.  krange is the range of the random numbers [0 - krange).  If
kalpha is smaller than one, smaller values favor values near 0.  If
kbeta is smaller than one, smaller values favor values near krange.
If both kalpha and kbeta equal one we have uniform distribution.  If
both kalpha and kbeta are greater than one we have a sort of gaussian
distribution.  Outputs only positive numbers.


For more detailed explanation of these distributions, see:

1. C. Dodge - T.A. Jerse 1985. Computer music.  Schirmer books. 
pp.265 - 286

2. D. Lorrain. "A panoply of stochastic cannons".  In C. Roads, ed. 
1989. Music machine .  Cambridge, Massachusetts: MIT press, pp. 351 
- 379.

Examples:

	a1  atrirand  32000	; Audio noise with triangle distribution
	k1  kcauchy  10000	; Control noise with Cauchy dist.
	i1  ibetarand  30000, .5, .5 ; i-time random value, beta dist.


8) Power functions

		ir	ipow	iarg, kpow
		kr	kpow	karg, kpow, [inorm]
		ar	apow	aarg, kpow, [inorm]

Computes xarg  to the power of kpow  and scales the result by inorm.

INITIALIZATION

inorm - The number to divide the result (default to 1).  This is
especially useful if you are doing powers of a- or k- signals where
samples out of range are extremely common!

iarg  - If you are using ipow this is the base.

PERFORMANCE

karg  - If you are using kpow this is the base.

aarg  - If you are using apow this is the base.

EXAMPLES:

1.	i2t2	ipow		2,2		; Computes 2^2.

2.	kline	line		0, 1, 4
	kexp	kpow	kline, 2, 4

This feeds a linear function to kpow and scales that to the line's
peak value.  The output will be an exponential curve with the same
range as the input line.

3.	iamp ipow		10, 2
	a1	oscil		iamp, 100, 1
	a2	apow	a1, 2, iamp
	out a2

This will output a sine with its negative part folded over the amp
axis.  The peak value will be iamp = 10^2 = 100.


9) GEN20

This subroutine generates functions of different windows.  These
windows are usually used for spectrum analysis or for grain envelopes.

	f #	time	size	20	window	max	opt

size  - number of points in the table.  Must be a power of 2 ( + 1).

window  - Type of window to generate.
		1 - Hamming
		2 - Hanning
		3 - Bartlett ( triangle)
		4 - Blackman ( 3 - term)
		5 - Blackman - Harris ( 4 - term)
		6 - Gaussian
		7 - Kaiser
		8 - Rectangle
		9 - Sinc

max - For negative p4 this will be the absolute value at window peak
point.  If p4 is positive or p4 is negative and p6 is missing the
table will be post-rescaled to a maximum value of 1.

opt - Optional argument required by the Kaiser window.

Examples:

	f	1	0	1024	20	5
This creates a function which contains a 4 - term Blackman - Harris 
window with maximum value of 1.

	f	1	0	1024	-20	2	456
This creates a function that contains a Hanning window with a maximum 
value of 456.

	f	1	0	1024	-20	1
This creates a function that contains a Hamming window with a maximum 
value of 1.

	f	1	0	1024	20	7	1	2
This creates a function that contains a Kaiser window with a maximum 
value of 1.  The extra argument specifies how `open' the window is, for 
example a value of 0 results in a rectangular window and a value of 10 in 
a Hamming like window.


10) GEN21

This generates tables of different random distributions. (see also noise 
generators, above).

	f #	time	size	21	type	lvl arg1 arg2

Time and size are the usual Gen function arguments.  Type defines the 
distribution to be used.

	1   - Uniform
	2   - Linear
	3   - Triangular
	4   - Exponential
	5   - Biexponential
	6   - Gaussian
	7   - Cauchy
	8   - Positive Cauchy
	9   - Beta
	10  - Weibull
	11  - Poison

Of all these cases only 9 (Beta) and 10 (Weibull) need extra
arguments.  Beta needs two arguments and Weibull one.

Examples:

	f1 0 1024 21 1		; Uniform (white noise)
	f1 0 1024 21 6		; Gaussian
	f1 0 1024 21 9 1 1 2	; Beta (note that level precedes arguments)
	f1 0 1024 21 10 1 2   	; Weibull


	All of the above additions were designed by the author between
May and December 1994, under the supervision of Dr. Richard Boulanger.

This appendix was written on 20 December 1994 by
Paris Smaragdis, Berklee College of Music.
Internet:  psmaragdis@aol.com

------------------------------------------------------------------------
AUTHOR: Greg Sullivan, sullivan@aussie.enet.dec.com
        (Based on algorithm given in 'Elements Of Computer Music', by
        F. Richard Moore.

CVANAL - Impulse Response Fourier Analysis for CONVOLVE operator

csound -U cvanal [flags] infilename outfilename

cvanal converts a soundfile into a single Fourier transform frame. The 
output file can be used by the CONVOLVE operator to perform Fast
Convolution between an input signal and the original impulse response.
Analysis is conditioned by the flags below. A space is optional between 
the flag and its argument.

-s<rate>        sampling rate of the audio input file. This will over-ride
                the srate of the soundfile header, which otherwise applies.
                If neither is present, the default is 10000.

-c<channel>     channel number sought. If omitted, the default is to  
                process all channels. If a value is given, only the
                selected channel will be processed.
                
-b<begin>       beginning time (in seconds) of the audio segment to be
                analysed. The default is 0.0
                
-d<duration>    duration (in seconds) of the audio segment to be analysed.
                The default of 0.0 means to the end of the file.
                
EXAMPLE
                cvanal asound cvfile
will analyse the soundfile "asound" to produce the file "cvfile" for the
use with CONVOLVE.

HINT: To use data that is not already contained in a soundfile, 
      a soundfile converter that accepts text files may be used to
      create a standard audio file. E.g, the .DAT format for SOX.
      This is useful for implementing FIR filters.

FILES
The output file has a special CONVOLVE header, containing details of the
source audio file. The analysis data is stored as 'float', in rectangular
(real/imaginary) form. 

***NOTE***: The analysis file is NOT system independent! Ensure that
            the original impulse recording/data is retained. If/when required,
            the analysis file can be recreated.

AUTHOR: Greg Sullivan, sullivan@aussie.enet.dec.com
        (Based on algorithm given in 'Elements Of Computer Music', by
        F. Richard Moore.
        
------------------------------------------------------------------------------
CONVOLVE unit generator:

ar1[,ar2[,ar3[,ar4]]]  convolve  ain,ifilcod,channel

Output is the convolution of signal ain and the impulse response
contained in ifilcod.  Note that it is considerably more efficient to
use one instance of the operator when processing a mono input to
create stereo, or quad, outputs.

INITIALISATION

ifilcod - integer or character-string denoting an impulse response data
file. An integer denotes the suffix of a file convolve.m; a character
string (in double quotes) gives a filename, optionally a full pathname. 
If not a fullpath, the file is sought first in the the current directory,
then in the one given by the environment variable SADIR (if defined).
The data file contains the Fourier transform of an impulse response.
Memory usage depends on the size of the data file, which is read and
held entirely in memory during computation, but which is shared
by multiple calls.

channel - integer denoting the channel of the impulse response to be used
          for the convolution. 0 (the default) means to use all channels.
          For multi-channel output, the number of channels in the impulse 
          response must match the number of output signals.

PERFORMANCE

CONVOLVE implements Fast Convolution. The output of this
operator is delayed with respect to the input. The following
formulas should be used to calculate the delay:

For (1/kr) <= IRdur:

Delay = ceil(IRdur * kr) / kr


For (1/kr) > IRdur: 

Delay = IRdur * ceil(1/(kr*IRdur))

Where:

kr  = Csound control rate
IRdur = duration, in seconds, of impulse response
ceil(n) = smallest integer not smaller than n

One should be careful to also take into account the initial delay,
if any, of the impulse response. For example, if an impulse response
is created from a recording, the soundfile may not have the initial
delay included. Thus, one should either ensure that the soundfile
has the correct amount of zero padding at the start, or, preferably,
compensate for this delay in the orchestra. (the latter method
is more efficient). To compensate for the delay in the 
orchestra, _subtract_ the initial delay from the result
calculated using the above formula(s), when calculating the required
delay to introduce into the 'dry' audio path. 

For typical applications, such as reverb, the delay will be in 
the order of 0.5 to 1.5 seconds, or even longer. This renders
the current implementation unsuitable for real time applications.
It could conceivably be used for real time filtering however, if 
the number of taps is is small enough.

Example:

- Create frequency domain impulse response file:
  c:\> csound -Ucvanal l1_44.wav l1_44.cv

- Determine duration of impulse response. For high accuracy,
  determine the number of sample frames in the impulse 
  response soundfile, and then compute the duration with:

  duration = (sample frames)/(sample rate of soundfile)

  This is due to the fact that the SNDINFO utility only
  reports the duration to the nearest 10ms. If you have a 
  utility that reports the duration to the required accuracy,
  then you can simply use the reported value directly.

  c:\> sndinfo l1_44.wav 
  length = 60822 samples, sample rate = 44100
 
  Duration = 60822/44100 = 1.379s.

- Determine initial delay, if any, of impulse response. 
  If the impulse response has not had the initial 
  delay removed, then you can skip this step. If it has
  been removed, then the only way you will know the initial
  delay is if the information has been provided separately.
  For this example, let's assume that the initial delay is
  60ms. (0.06s)

- Determine the required delay to apply to the dry signal, to align
  it with the convolved signal:
  
  If kr = 441:

  1/kr = 0.0023, which is <= IRdur (1.379s), so:

  Delay1 = ceil(IRdur * kr) / kr
        = ceil(608.14) / 441
        = 609/441
        = 1.38s
        
  Accounting for the initial delay:
  delay2 = 0.06s
  Total delay = delay1 - delay2
              = 1.38 - 0.06
              = 1.32s

- Create .orc file, e.g:
----CUT----
; Simple demonstration of CONVOLVE operator, to apply reverb.

        sr = 44100
        kr = 441
        ksmps = 100
        nchnls = 2

        instr   1

imix = 0.22 ; Wet/dry mix. Vary as desired.
            ; NB: 'Small' reverbs often require a much higher
            ; percentage of wet signal to sound interesting. 'Large'
            ; reverbs seem require less. Experiment! The wet/dry mix is
            ; very important - a small change can make a large difference. 
ivol = 0.9  ; Overall volume level of reverb. May need to adjust 
            ; when wet/dry mix is changed, to avoid clipping.
idel = 1.32 ; Required delay to align dry audio with output of convolve.
            ; This can be automatically calculated within the orc file, 
            ; if desired.

adry          soundin "anechoic.wav"      ; input (dry) audio
awet1,awet2   convolve adry,"l1_44.cv"    ; stereo convolved (wet) audio
adrydel       delay   (1-imix)*adry,idel  ; Delay dry signal, to align it with 
                                          ; convolved signal. Apply level 
                                          ; adjustment here too.

             outs    ivol*(adrydel+imix*awet1),ivol*(adrydel+imix*awet2) 
                                          ; Mix wet & dry signals, and output
        endin
---CUT----

The granule unit generator (Allan Lee) is more complex than grain
(above), but does add new possibilities.  This is a shorten manual,
without the pictures,

NAME
granule - Granular synthesis unit generator for Csound.

SYNOPSIS
 granule xamp ivoice iratio imode ithd ifn ipshift igskip \
	 igskip_os ilength kgap igap_os kgsize igsize_os iatt idec [iseed] \
	 [ipitch1] [ipitch2] [ipitch3] [ipitch4] [ifnenv]

DESCRIPTION
granule is a Csound unit generator which employs a wavetable as input
to produce granularly synthesized audio output.  Wavetable data may be
generated by any of the gen subroutines such as gen01 which reads an
audio data file into a wavetable.  This enable a sampled sound to be
used as the source for the grains.  Up to 128 voices are implemented
internally.The maximum number of voices can be increased by redefining
the variable MAXVOICE in the grain4.h file.  granule has a build-in
random number generator to handle all the random offset parameters.
Thresholding is also implemented to scan the source function table at
initialization stage.  This facilitates features such as skipping
silence passage between sentences.

The characteristics of the synthesis are controlled by 22
parameters. xamp is the amplitude of the output and it can be either
audio rate or control rate variable. All parameters with prefix i must
be valid at Init time, parameters with prefix k can be either control
or Init values.

SUMMARY OF PARAMETERS

xamp - amplitude.

ivoice - number of voices.

iratio - ratio of the speed of the gskip pointer relative to output
audio sample rate. eg. 0.5 will be half speed.

imode - +1 grain pointer move forward (same direction of the gskip
pointer), -1 backward (oppose direction to the gskip pointer) or 0 for
random.

ithd - threshold, if the sampled signal in the wavetable is smaller
then ithd, it will be skipped.

ifn - function table number of sound source.

ipshift - pitch shift control. If ipshift is 0, pitch will be set
randomly up and down an octave. If ipshift is 1, 2, 3 or 4, up to four
different pitches can be set amount the number of voices definded in
ivoice. The optional parameters ipitch1, ipitch2, ipitch3 and ipitch4
are used to quantify the pitch shifts.

igskip - initial skip from the beginning of the function table in sec.

igskip_os - gskip pointer random offset in sec, 0 will be no offset.

ilength - length of the table to be used starting from igskip in sec.

kgap - gap between grains in sec.

igap_os - gap random offset in % of the gap size, 0 gives no offset.

kgsize - grain size in sec.

igsize_os - grain size random offset in % of grain size, 0 gives no
offset.

iatt - attack of the grain envelope in % of grain size.

idec - decade of the grain envelope in % of grain size.

[iseed] - optional, seed for the random number generator, default is
0.5.

[ipitch1], [ipitch2], [ipitch3], [ipitch4] - optional, pitch shift
parameter, used when ipshift is set to 1, 2, 3 or 4. Time scaling
technique is used in pitch shift with linear interpolation between
data points. Default value is 1, the original pitch.

EXAMPLE
Listing of orchestra file.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

instr 1

;
k1 linseg 0,0.5,1,(p3-p2-1),1,0.5,0
a1 granule p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,
	p20,p21,p22,p23,p24
a2 granule p4*k1,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,
	p20+0.17,p21,p22,p23,p24

outs a1,a2 
endin

Listing of score file.

; f statement read sound file sine.aiff in the SFDIR directory into f-table 1
f 1 0 524288 1 "sine.aiff" 1 0
i1 0 10 2000 64 0.5 0 0 1 4 0 0.005 10 0.01 50 0.02 50 30 30 0.39 1 1.42 0.29 2
e

The above example reads a sound file called sine.aiff into wavetable
number 1 with 524,288 samples. It generates 10 seconds of stereo audio
output using the wavetable. In the orchestra file, all parameters
required to control the synthesis are passed from the score file. A
linseg function generator is used to generate an envelope with 0.5
second of linear attack and decade. Stereo effect is generated by
using different seeds for the two granule function calls. In the
example, 0.17 is added to p20 before passing into the second granule
call to ensure that all of the random offset events are different from
the first one.

In the score file, the parameters are interpreted as:
p5 (ivoice) the number of voices is set to 64
p6 (iratio) is set to 0.5, it scan the wavetable at half of the speed
   of the audio output rate
p7 (imode) is set to 0, the grain pointer only move forward
p8 (ithd) is set to 0, skipping the thresholding process
p9 (ifn) is set to 1, function table number 1 is used
p10 (ipshift) is set to 4, four different pitches are going to be
    generated
p11 (igskip) is set to 0 and p12 (igskip_os) is set to 0.005, no
    skipping into the wavetable and a 5 mSec random offset is used
p13 (ilength) is set to 10, 10 seconds of the wavetable is to be used
p14 (kgap) is set to 0.01 and p15 (igap_os) is set to 50, 10 mSec gap
    with 50% random offset is to be used
p16 (kgsize) is set to 0.02 and p17 (igsize_os) is set to 50, 20 mSec
    grain with 50% random offset is used
p18 (iatt) and p19 (idec) are set to 30, 30% of linear attack and
    decade is applied to the grain
p20 (iseed) seed for the random number generator is set to 0.39
p21 - p 24 are pitches set to 1 which is the original pitch, 1.42
    which is a 5th up, 0.29 which is a 7th down and finally 2 which is
    an octave up.







































Csound is developed by Barry L. Vercoe at the Experimental Music Studio, Media Laboratory, M.I.T., Cambridge, Massachusetts.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.