def shotgunfast(): sequencer = Sequencer(dna) # Sequencer for the clone library dna_slices = sequencer.sequence_all() reads = [] for block in dna_slices: # QUICK'N'DIRTY for kmer in block: reads.append(kmer) ld = float(levenshteinDistance(dna, C_Shotgun.perform(reads))) l = float(len(dna)) s[-1].sfast_acc += ((l - ld) / l) * 100
def compiler_test(): mmls = ("t115o5l8f2r8cfa>c<ar8fgr8ggr8d4r8gfr8ef2r8cfa>c<ar8fg-r8g-g-r8f1r8", "t115o4l8a2r8aa>cfcr8<ab-r8b-b-r8b-4r8b-b-r8b-a2r8aa>cfcr8<ab-r8b-b-r8a1r8", "t115o2l16v6f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4" "f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4" "f.r32f.r32f.r32f.r32r4f.r32f.r32f.r32f.r32r4" "f.r32f.r32f.r32f.r32r8f1r8") mml_compiler = MMLCompiler() sequences = [mml_compiler.to_sequence(mml) for mml in mmls] tones = [Tone(), Tone(), SquareWaveOscillator()] seq = Sequencer() seq.add_track(0, "track_0", tones[0], tones[0]) seq.add_track(1, "track_1", tones[1], tones[1]) seq.add_track(2, "track_3", tones[2], tones[2]) seq.add_sequence(0, sequences[0]) seq.add_sequence(1, sequences[1]) seq.add_sequence(2, sequences[2]) sink = WaveFileSink(output_file_name="output.wav") clock = Clock() renderer = Renderer(clock=clock, source=seq, sink=sink) renderer.do_rendering()
def main(): mml_compiler = MMLCompiler() music_sequence = mml_compiler.to_sequence(MML) osc = SquareWaveOscillator() sequencer = Sequencer() sequencer.add_track(0, "tone1", osc, osc) sequencer.add_sequence(0, music_sequence) sink = WaveFileSink(output_file_name="output.wav") clock = Clock() renderer = Renderer(clock=clock, source=sequencer, sink=sink) renderer.do_rendering()
def generateWavFile(yPosArray, tempo, volume): yPosMin = min(yPosArray) my_compiler = MyCompiler(yPosMin, tempo=tempo, volume=volume) sequencer = Sequencer() tone1 = Tone() sequencer.add_track(0, "manual", tone1, tone1) sequence = my_compiler.get_sequence(yPosArray) sequencer.add_sequence(0, sequence) sink = WaveFileSink(output_file_name=outputWavFileName) clock = Clock() renderer = Renderer(clock=clock, source=sequencer, sink=sink) renderer.do_rendering()
def __init__(self): if Config.FAKE_MODE == False: self.BPi = BleuettePi(Config.SERIAL_DEV) else: self.BPi = BleuettePi(SerialFake) self.Sequencer = Sequencer(self.BPi.Servo) self.Drive = Drive(self.Sequencer)
def get_sequencer(options): movement = get_movement(options) movement.blocks = [] movement.instruments = [] set_ensemble(options, movement) set_instrument(options, movement) blocks = get_blocks(options) visual = get_visualization(options) for block in blocks: set_ensemble(options, block) set_block_options(options,block) movement.add_block(block) set_progressions(options, movement) load_fluidsynth(options) if movement.instruments == []: raise OptionError, "No instruments or ensemble selected." for x in movement.instruments: x.no_fluidsynth = options.no_fluidsynth seq = Sequencer(movement) seq.verbose = options.verbose seq.no_fluidsynth = options.no_fluidsynth seq.output_file = options.midifile if visual != None: seq.paint_function = visual.paint_screen seq.tick_function = visual.tick seq.update_function = visual.update_screen return seq
def main(): mml_compiler1 = MMLCompiler() mml_compiler2 = MMLCompiler() mml_compiler3 = MMLCompiler() music_sequence1 = mml_compiler1.to_sequence(MML1) music_sequence2 = mml_compiler2.to_sequence(MML2) music_sequence3 = mml_compiler3.to_sequence(MML3) osc1 = SquareWaveOscillator() osc2 = SquareWaveOscillator() osc3 = SquareWaveOscillator() sequencer = Sequencer() sequencer.add_track(0, "tone1", osc1, osc1) # 一つ目のoscが周波数をかえる先(オシレーター)、2つ目はデータを取り出す元(通常ならばアンプとかミキサー) sequencer.add_track(1, "tone2", osc2, osc2) sequencer.add_track(2, "tone3", osc3, osc3) sequencer.add_sequence(0, music_sequence1) sequencer.add_sequence(1, music_sequence2) sequencer.add_sequence(2, music_sequence3) sink = WaveFileSink(output_file_name="output.wav") clock = Clock() renderer = Renderer(clock=clock, source=sequencer, sink=sink) renderer.do_rendering()
from SoundFile import SoundFile from Sequencer import Sequencer if __name__ == "__main__": x = 1 o = 0 sf1 = SoundFile("../sound/drums/1-kick/kick-allaboutyou-1.wav") sq1 = Sequencer(sf1, [x, o, o, o, x, o, o, o]) sq1.play(5) sf2 = SoundFile("../sound/drums/4-hihat/closedhh-allaboutyou.wav") sq2 = Sequencer(sf2, [x, o, x, o, x, o, x, o]) sq2.play(5) sf3 = SoundFile("../sound/drums/3-snare/snare-allaboutyou.wav") sq3 = Sequencer(sf3, [o, o, o, o, x, o, o, o]) sq3.play(5)
from SoundFile import SoundFile from Sequencer import Sequencer if __name__ == "__main__": # the path to your sound file sound = SoundFile("hello.wav") # sequencer takes a SoundFile as an argument; a list with the sequence; and the tempo in beats per minute (default 120) seq = Sequencer(sound,[1]) # number of times to play. 0 = infinite. CTRL+C to quit program. seq.play(1)
sequenceLeftDemoCircle.SetDelay(0.2) sequenceRightDemoCircle = SequenceLightSingle( pinMapping.GetAllPinsOfGroupInOrder('RIGHTSTICK') ) sequenceLeftDemoCircle.SetDelay(0.1) sequenceDemo = SequenceGroup() sequenceDemo.Add(sequenceLeftDemoCircle) sequenceDemo.Add(sequenceRightDemoCircle) sequenceDemo.SetDelay(0.1) marqueeOn = SequenceFlicker( pinMapping.GetAllPinsOfGroup('MARQUEE') ) marqueeFade = SequenceFadeUp( pinMapping.GetAllPinsOfGroup('MARQUEE') ) sequenceGame = SequenceFadeUp( pinMapping.GetAllPinsOfGroup('PANEL') ) sequenceGame.SetTarget(1.0) sequenceFan = SequenceFadeUp( pinMapping.GetAllPinsOfGroup('FAN') ) sequencer = Sequencer( devices ) sequencer.Add( sequenceDemo ) marqueeFade.SetTarget(1.0) sequencer.Add( marqueeFade ) #sequencer.Add( marqueeOn ) sequencer.start() ledwiz.ClearPins(False) class HttpHandler: def __init__(self): self.ledhttp = LedHttp(self) def StartServer(self): self.ledhttp.StartServer()
from SoundFile import SoundFile from Sequencer import Sequencer if __name__ == "__main__": # in simplified music notation, usually x = sound, o = no sound x = 1 o = 0 # the path to your sound file sf1 = SoundFile("../sound/drums/1-kick/kick-allaboutyou-1.wav") # sequencer takes a SoundFile as an argument; a list with the sequence; and the tempo in beats per minute (default 120) sq1 = Sequencer(sf1,[x,o,o,o,], 120) # number of times to play. 0 = infinite sq1.play(5) # have fun!