MusicKit  0.0.0
params.h
00001 /*
00002   $Id$
00003   Defined In: The MusicKit
00004 
00005   Description:
00006     This file defines the MusicKit MKNote parameters. You can also create your
00007     own parameters using the MKNote method +parTagForName:. When an unrecognized
00008     parameter is found in a scorefile, it is created automatically.
00009 
00010     These parameters are not recognized by all MKSynthPatches. You must check
00011     the class description (or header file) for the individual MKSynthPatch to
00012     determine the parameters to which it responds.
00013 
00014   Original Author: David Jaffe
00015 
00016   Copyright (c) 1988-1992, NeXT Computer, Inc.
00017   Portions Copyright (c) 1994 NeXT Computer, Inc. and reproduced under license from NeXT
00018   Portions Copyright (c) 1994 Stanford University.
00019   Portions Copyright (c) 1999-2005, The MusicKit Project.
00020 */
00021 #ifndef __MK_params_H___
00022 #define __MK_params_H___
00023 
00037 typedef enum _MKPars {
00038     MK_noPar = 0,          
00040     /* MIDI opcodes are represented by the presence of one of the following
00041        12 parameters, along with the noteType */
00042 
00043     MK_keyPressure,     
00044     MK_afterTouch,      
00045     MK_controlChange,   
00046     MK_pitchBend,       
00048     MK_programChange,   
00049     MK_timeCodeQ,       
00050     MK_songPosition,    
00051     MK_songSelect,      
00052     MK_tuneRequest,     
00055     MK_sysExclusive,    
00057     MK_chanMode,        
00058     MK_sysRealTime,     
00060     /* The remaining MIDI parameters provide additional data needed to
00061        represent MIDI messages. */
00062 
00063     MK_basicChan,       
00064     MK_controlVal,      
00065     MK_monoChans,       
00067     /* The following are derived from MIDI but are used extensively in 
00068        MKOrchestra synthesis as well. Most MKSynthPatches support them. */
00069 
00070     MK_velocity,        
00072     MK_relVelocity,     
00073     MK_keyNum,          
00077     MK_velocitySensitivity,   
00078     MK_afterTouchSensitivity, 
00079     MK_modWheelSensitivity,   
00080     MK_breathSensitivity,     
00081     MK_footSensitivity,       
00082     MK_portamentoSensitivity, 
00083     MK_balanceSensitivity,    
00084     MK_panSensitivity,        
00085     MK_expressionSensitivity, 
00086     MK_pitchBendSensitivity,  
00088     /* The following are basic synthesis parameters, which should be 
00089        supported by all MKSynthPatch classes, if possible.  */ 
00090 
00091     MK_freq,          
00093     MK_amp,           
00095     MK_bearing,       
00096     MK_bright,        
00097     MK_portamento,    
00100     /* The following are supported by oscillator-based MKSynthPatch classes. */
00101 
00102     MK_waveform,        
00103     MK_waveLen,         
00104     MK_phase,           
00106     /* The following are supported by MKSynthPatch classes which use
00107        frequency modulation synthesis.  Parameters are predefined
00108        for three carriers and four modulators, enough to emulate
00109        the patches on 4-operator fm synthesizers.  For fm instruments, 
00110        the brightness parameter is usually a synonym for one or more of 
00111        the modulator indices. */
00112        
00113     MK_cRatio,        
00115     MK_c2Ratio,       
00116     MK_c2Amp,         
00117     MK_c2Waveform,    
00118     MK_c2Phase,       
00119     MK_c3Ratio,       
00120     MK_c3Amp,         
00121     MK_c3Waveform,    
00122     MK_c3Phase,       
00123     MK_m1Ratio,       
00124     MK_m1Ind,         
00125     MK_m1Waveform,    
00126     MK_m1Phase,       
00127     MK_m2Ratio,       
00128     MK_m2Ind,
00129     MK_m2Waveform,        
00130     MK_m2Phase,
00131     MK_m3Ratio,       
00132     MK_m3Ind,
00133     MK_m3Waveform,
00134     MK_m3Phase,
00135     MK_m4Ratio,       
00136     MK_m4Ind,
00137     MK_m4Waveform,
00138     MK_m4Phase,
00139     MK_feedback,      
00141     /* The following are recognized by the Pluck MKSynthPatch */
00142 
00143     MK_pickNoise,     
00144     MK_decay,         
00148     MK_sustain,       
00150     MK_lowestFreq,    
00155     /* The following vibrato parameters are supported by MKSynthPatches
00156        that allow vibrato of various kinds */
00157 
00158     MK_svibFreq,       
00159     MK_svibAmp,        
00161     MK_rvibFreq,       
00162     MK_rvibAmp,        
00164     MK_indSvibFreq,    
00165     MK_indSvibAmp,     
00167     MK_indRvibFreq,    
00168     MK_indRvibAmp,     
00171     /* A noise generator may play a role in some MKSynthPatches to create
00172        special effects or increase realism.  The following predefined 
00173        parameters are useful in these cases. Note that for MKSynthPatches where
00174        the noise generator is the primary source of sound (as in Pluck),
00175        the standard parameters MK_amp and MK_freq are used instead of 
00176        these parameters. */
00177 
00178     MK_noiseAmp,     
00179     MK_noiseFreq,    
00181     /* The following are commonly-used envelope parameters, which may be 
00182        supported by some MKSynthPatch classes.  Note that there are several
00183        alternative ways to use envelopes, among them:
00184        
00185      <ul>
00186        <li>Specify the desired values directly as the y values of the envelope.</li>  
00187        <li>Do the same, scaling by a normalized constant scaler.</li>
00188        <li>Do the same, adding a constant to the results.</li>
00189        <li>Normalize the envelope values, and multiply times a constant scaler.</li>
00190        <li>Do the same, adding a constant to the results.</li>
00191        <li>Use the envelope to interpolate between two specific values.</li>
00192      </ul>
00193       
00194        The MKSynthPatches provided with the MusicKit allow all of the above 
00195        situations for parameters which support envelopes, depending on what
00196        is supplied in the parameter list.  If a parameter is specified as a
00197        single value, that value is used.  If an envelope is supplied but no
00198        value, the envelope values are used directly.  If both are
00199        supplied, the envelope is scaled by the numeric value to produce the
00200        resulting values.  If two values and an envelope are supplied, the 
00201        resulting values are the first value plus the difference of the two 
00202        values times the envelope values (i.e., interpolation).  In other words
00203        
00204            <tt>frequency(t) == freq0 + (freq1 - freq0) * envelope(t)</tt>
00205       
00206        where freq0 defaults to 0, freq1 defaults to 1, and the envelope
00207        defaults to a constant value of 1.
00208       
00209     */ 
00210 
00211     MK_freqEnv,      
00212     MK_freq0,        
00215     MK_freqAtt,      
00216     MK_freqRel,      
00218     MK_ampEnv,       
00219     MK_amp0,         
00222     MK_ampAtt,       
00223     MK_ampRel,       
00225     MK_bearingEnv,   
00226     MK_bearing0,     
00230     MK_brightEnv,    
00231     MK_bright0,      
00234     MK_brightAtt,    
00235     MK_brightRel,    
00237     MK_waveformEnv,  
00238     MK_waveform0,    
00241     MK_waveformAtt,  
00242     MK_waveformRel,  
00244     /* Additional parameters needed for fm envelopes. */
00245     
00246     MK_c2AmpEnv,     
00248     MK_c2Amp0,       
00251     MK_c2AmpAtt,     
00252     MK_c2AmpRel,     
00253     MK_c3AmpEnv,     
00255     MK_c3Amp0,       
00258     MK_c3AmpAtt,     
00259     MK_c3AmpRel,     
00260     MK_m1IndEnv,     
00261     MK_m1Ind0,       
00264     MK_m1IndAtt,     
00265     MK_m1IndRel,     
00266     MK_m2IndEnv,     
00267     MK_m2Ind0,
00268     MK_m2IndAtt,    
00269     MK_m2IndRel,    
00270     MK_m3IndEnv,     /* etc. */
00271     MK_m3Ind0,
00272     MK_m3IndAtt,    
00273     MK_m3IndRel,    
00274     MK_m4IndEnv,
00275     MK_m4Ind0,
00276     MK_m4IndAtt,    
00277     MK_m4IndRel,
00278 
00279     /* Additional parameters needed when applying envelopes to vibrato */
00280                
00281     MK_svibFreqEnv,
00282     MK_svibFreq0,       
00283     MK_rvibFreqEnv,
00284     MK_rvibFreq0,       
00285     MK_indSvibFreqEnv,
00286     MK_indSvibFreq0,    
00287     MK_indRvibFreqEnv,
00288     MK_indRvibFreq0,    
00290     MK_svibAmpEnv,
00291     MK_svibAmp0,        
00292     MK_rvibAmpEnv,
00293     MK_rvibAmp0,        
00294     MK_indSvibAmpEnv,
00295     MK_indSvibAmp0,     
00296     MK_indRvibAmpEnv,
00297     MK_indRvibAmp0,     
00299     MK_noiseAmpEnv,
00300     MK_noiseAmp0,       
00303     MK_noiseAmpAtt,     
00304     MK_noiseAmpRel,
00305     MK_noiseFreqEnv,
00306     MK_noiseFreq0,      
00310     /* The following are currently not supported explicitly by any Musickit 
00311        class. However, by convention, they may appear in MKPart info notes to 
00312        associate information with a MKPart. */
00313 
00314     MK_synthPatch,        
00316     MK_synthPatchCount,   
00319     MK_midiChan,          
00321     MK_track,             
00323     /* The following are currently not supported explicitly by any Musickit 
00324        class. However, by convention, they may appear in MKScore info notes to 
00325        associate information with a MKScore. */
00326 
00327     MK_title,            
00329     MK_samplingRate,     
00333     MK_headroom,         
00337     MK_tempo,            
00342     MK_vibWaveform,      
00344     /* The following parameters are used primarily in reading/writing Standard 
00345        MIDI files. See Standard MIDI file 1.0 Specification for details. */
00346     MK_sequence,         
00347     MK_text,             
00348     MK_copyright,        
00349     MK_lyric,            
00350     MK_marker,           
00351     MK_cuePoint,         
00352     MK_smpteOffset,      
00355     MK_timeSignature,    
00357     MK_keySignature,     
00359     MK_instrumentName,   
00362     MK_restDur,          
00363 
00364     MK_alternativeSamplingRate, 
00369     MK_orchestraIndex,   
00370     MK_filename,         
00371     MK_privatePars,      
00373     MK_appPars  = 192    
00374   } MKPar;
00375 
00376 /* The following synonym parameters are defined for the sake of clarity.
00377    When envelopes are used, the "1" suffix parameter is used to indicate
00378    the value when the envelope is at 1.  The "0" suffix parameter indicates
00379    the value when the envelope is at 0.  */
00380    
00381 #define MK_freq1        MK_freq
00382 #define MK_amp1         MK_amp
00383 #define MK_bright1      MK_brightness
00384 #define MK_bearing1     MK_bearing
00385 #define MK_waveform1    MK_waveform
00386 #define MK_c1Ratio      MK_cRatio
00387 #define MK_c1Amp        MK_amp
00388 #define MK_c1AmpAtt     MK_ampAtt
00389 #define MK_c1AmpRel     MK_ampRel
00390 #define MK_c1Waveform   MK_waveform
00391 #define MK_c1Phase      MK_phase
00392 #define MK_c1Amp1       MK_c1Amp
00393 #define MK_c2Amp1       MK_c2Amp
00394 #define MK_c3Amp1       MK_c3Amp
00395 #define MK_m1Ind1       MK_m1Ind
00396 #define MK_m2Ind1       MK_m2Ind
00397 #define MK_m3Ind1       MK_m3Ind
00398 #define MK_m4Ind1       MK_m4Ind
00399 #define MK_svibFreq1    MK_svibFreq
00400 #define MK_rvibFreq1    MK_rvibFreq
00401 #define MK_indSvibFreq1 MK_indSvibFreq
00402 #define MK_indRvibFreq1 MK_indRvibFreq
00403 #define MK_svibAmp1     MK_svibAmp
00404 #define MK_rvibAmp1     MK_rvibAmp
00405 #define MK_indSvibAmp1  MK_indSvibAmp
00406 #define MK_indRvibAmp1  MK_indRvibAmp
00407 #define MK_noiseAmp1    MK_noiseAmp
00408 #define MK_noiseFreq1   MK_noiseFreq
00409 
00410 /* Some default parameter values */
00411 
00412 #define MK_DEFAULTAMP        0.1
00413 #define MK_DEFAULTSMOOTHING  1.0     /* Used by MKEnvelope */
00414 #define MK_DEFAULTBRIGHT     0.5     
00415 #define MK_DEFAULTFREQ       440.0
00416 #define MK_DEFAULTPORTAMENTO 0.1
00417 #define MK_DEFAULTCRATIO     1.0
00418 #define MK_DEFAULTMRATIO     1.0
00419 #define MK_DEFAULTINDEX      2.0
00420 #define MK_DEFAULTSVIBFREQ   4.0
00421 #define MK_DEFAULTSVIBAMP    0.01
00422 #define MK_DEFAULTRVIBFREQ   15.0
00423 #define MK_DEFAULTRVIBAMP    0.008
00424 #define MK_DEFAULTBEARING    0.0
00425 #define MK_DEFAULTSUSTAIN    0.0     /* Used by Pluck */
00426 #define MK_DEFAULTDECAY      0.0     /* Used by Pluck */
00427 #define MK_DEFAULTVELOCITY   64
00428 
00437 typedef enum _MKMidiParVal {  /* The order of these is taken from MIDI spec. */
00439     MK_resetControllers = 262,
00441     MK_localControlModeOn, 
00443     MK_localControlModeOff,
00445     MK_allNotesOff,    
00447     MK_omniModeOff,
00449     MK_omniModeOn,
00451     MK_monoMode,
00453     MK_polyMode,
00455     MK_sysClock,
00457     MK_sysUndefined0xf9,
00459     MK_sysStart,
00461     MK_sysContinue,
00463     MK_sysStop,
00465     MK_sysUndefined0xfd,
00467     MK_sysActiveSensing,
00469     MK_sysReset
00470 } MKMidiParVal;
00471 
00472 #endif