Esempio n. 1
0
            def set_some_osc_params(osc_no):
                ''' Setting up oscillator 'osc_no'.
                '''
                
                if verbose:
                    print '---------'
                    print '- OSC %i -' % osc_no
                    print '---------'

                # let's mute everything excep 'osc_no'
                for i in [1,2,3]:
                    params['MIX%i_Level' % i].value = (1. if i == osc_no else 0.)
                    
                # selecting which type of wave
                listes = [range(1,6), range(0,6), range(0,6)+[8]] # it can only be sin, tri, rect, saw, table / + off / + noise
                RF.randomize_parameter(params["OSC%i_Wave" % osc_no], au, RF.uniform_list(listes[osc_no-1]))
                
                if verbose:
                    print 'Wave type : %s' % params["OSC%i_Wave" % osc_no].get_str_from_value()

                if params["OSC%i_Wave" % osc_no].value == 0: # if it's OFF we won't do nothing
                    return
                    
                # selecting other things
                while True : 
                    RF.randomize_parameter(params['OSC%i_Width' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['OSC%i_Stack' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['OSC%i_StackOffset' % osc_no], au, RF.uniform_custom(0., .55))
                    RF.randomize_parameter(params['SHP%i_FilterType' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['SHP%i_CutOff' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['SHP%i_Resonance' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['SHP%i_ShapeType' % osc_no], au, RF.uniform_list(range(4)+[5]))
                    if verbose: 
                        print 'Shape type : %s (%i)' % (params['SHP%i_ShapeType' % osc_no].get_str_from_value(), params['SHP%i_ShapeType' % osc_no].value), 
                        
                    if params['SHP%i_ShapeType' % osc_no].value == 3:
                        RF.randomize_parameter(params['SHP%i_Bias' % osc_no], au, RF.uniform_custom(0., .25))
                    else:
                        RF.randomize_parameter(params['SHP%i_Bias' % osc_no], au, RF.uniform)
                    RF.randomize_parameter(params['SHP%i_Drive' % osc_no], au, RF.uniform)
                    if verbose:
                        print 'and bias is %s' % params['SHP%i_Bias' % osc_no].get_str_from_value()
                        
                    
                    # some "not osc1" specific parameters
                    if osc_no != 1:
                        RF.randomize_parameter(params['OSC%i_Detune' % osc_no], au, RF.normal(.5, .05))
                        RF.randomize_parameter(params['OSC%i_SyncOffset' % osc_no], au, RF.uniform)
                        
                    if verbose:
                        print 'listening to OSC %i' % osc_no
                        #host.play()
                        
                    params["MIX%i_Level" % osc_no].value = .2
                    if check_volume(host, verbose=verbose) > .004:
                        break
                    if verbose:
                        print "Something doesn't sound good : let's do it again."
Esempio n. 2
0
 def randomize_parameters(self, nb_trials=10):
     """ Takes a random .aupreset 
         Returns the number of tries before getting a "good" sound, and -1 if it fails.
         But -1 be should very unusual.
         
         nb_trials : nb of time it will try before it stops and returns -1
     """
     for no_trial in range(nb_trials):
         current_aupreset = N.random.randint(len(self.aupresets))
         self.au.load_aupreset(self.aupresets[current_aupreset])
         vol = check_volume(self.host, verbose=False)
         if vol <= 0.:
             print "kontakt aupreset %s doesn't like midi file %s" % ( self.aupresets[current_aupreset], self.host.midifile )
         else:
             return no_trial
     return -1
Esempio n. 3
0
 def randomize_parameters(self, nb_trials=10):
     """ Takes a random .aupreset 
         Returns the number of tries before getting a "good" sound, and -1 if it fails.
         But -1 be should very unusual.
         
         nb_trials : nb of time it will try before it stops and returns -1
     """
     for no_trial in range(nb_trials):
         current_aupreset = N.random.randint(len(self.aupresets))
         self.au.load_aupreset(self.aupresets[current_aupreset])
         vol = check_volume(self.host, verbose=False)
         if vol <= 0.:
             print "kontakt aupreset %s doesn't like midi file %s" % (
                 self.aupresets[current_aupreset], self.host.midifile)
         else:
             return no_trial
     return -1