예제 #1
0
    def record(self, userName):
        """指定したユーザのライブを録画。

		:param userName: ユーザ名
		:type userName: str
		"""
        self.loadUserList()
        userInfo = self.getUserInfo(userName)
        if userInfo == None:
            return
        if userInfo["user"]["id"] in self.users.keys():
            if userInfo["user"]["is_live"]:
                movie = self.getCurrentLive(userInfo["user"]["screen_id"])
                if movie == None:
                    return
                r = recorder.Recorder(self, movie["movie"]["hls_url"],
                                      movie["broadcaster"]["screen_id"],
                                      movie["movie"]["created"],
                                      movie["movie"]["id"])
                if r.isRecordedByAnotherThread():
                    simpleDialog.errorDialog(_("このユーザのライブはすでに録画中です。"))
                    return
                r.start()
                return
            simpleDialog.errorDialog(_("このユーザはすでに登録されています。"))
            return
        self.users[userInfo["user"]["id"]] = {
            "user":
            userInfo["user"]["screen_id"],
            "name":
            userInfo["user"]["name"],
            "specific":
            True,
            "baloon":
            False,
            "record":
            True,
            "openBrowser":
            False,
            "sound":
            False,
            "soundFile":
            "",
            "remove": (datetime.datetime.now() +
                       datetime.timedelta(hours=10)).timestamp(),
        }
        self.saveUserList()
        wx.CallAfter(
            globalVars.app.hMainView.addLog, _("ユーザ名を指定して録画"),
            _("%sを、録画対象として追加しました。この登録は一定時間経過後に自動で削除されます。") %
            userInfo["user"]["screen_id"])
        if userInfo["user"]["is_live"]:
            movie = self.getCurrentLive(userName)
            if movie == None:
                return
            r = recorder.Recorder(self, movie["movie"]["hls_url"],
                                  movie["broadcaster"]["screen_id"],
                                  movie["movie"]["created"],
                                  movie["movie"]["id"])
            r.start()
예제 #2
0
def runExpt(ntrials):
    filename = '%s-%s_%d.txt' % (exptname, subjectid, sessionid)
    filepath = os.path.join(datapath, filename)

    mapping = [0, 1, 2, 3, 4, 5]
    random.shuffle(mapping)

    for t in range(0, ntrials):
        if mod(t, 30) == 29:
            showInstructions(os.path.join(confpath, 'instructions2.txt'))
        trialdata = dict(gensettings)
        trialdata['trial'] = t
        trialdata['type'] = 'train'
        for k, v in trialdata.iteritems():
            if isinstance(v, (list, tuple)):
                # print 'randomly sampling %s from '%k + str(v)
                trialdata[k] = random.sample(v, 1)[0]
        for i in range(0, 6):
            trialdata['SRmap_%d' % i] = mapping[i]
        trialdata = oneTrial(trialdata)
        if t == 0:
            trialwriter = recorder.Recorder(filepath, trialdata)
        trialwriter.write(trialdata)

    if gensettings['condition'] == 'E-' or gensettings['condition'] == 'H-':
        mapping = [0, 1, 2, 3, 4, 5]
        random.shuffle(mapping)

    showInstructions(os.path.join(confpath, 'instructions3.txt'))

    for t in range(ntrials, ntrials * 2):
        if mod(t, 30) == 29:
            showInstructions(os.path.join(confpath, 'instructions2.txt'))
        trialdata = dict(gensettings)
        trialdata['trial'] = t
        trialdata['type'] = 'test'
        for k, v in trialdata.iteritems():
            if isinstance(v, (list, tuple)):
                # print 'randomly sampling %s from '%k + str(v)
                trialdata[k] = random.sample(v, 1)[0]
        for i in range(0, 6):
            trialdata['SRmap_%d' % i] = mapping[i]
        trialdata = oneTrial(trialdata)
        if t == 0:
            trialwriter = recorder.Recorder(filepath, trialdata)
        trialwriter.write(trialdata)

    trialwriter.close()
예제 #3
0
def on_click(x, y, button, pressed):
    global grabando, recfile, numwav

    # Presionar el botón izquierdo para empezar a grabar.
    if pressed and button == mouse.Button.left:
        if not grabando:
            print('Empieza grabacion')
            recfile = recorder.Recorder(channels=2).open(
                'audio' + str(numwav) + '.wav', 'wb')
            grabando = True
            recfile.start_recording()
            numwav += 1

    # Soltar el botón izquierdo para dejar de grabar.
    if not pressed and button == mouse.Button.left:
        if grabando:
            print('Termina grabacion')
            recfile.stop_recording()
            recfile = None
            grabando = False
            # Acá ya se podría hacer algo con el archivo creado.

    # Presionar el botón derecho para terminar.
    if pressed and button == mouse.Button.right:
        if not grabando:
            return False
예제 #4
0
    def __init__(self):
        ## -----*----- コンストラクタ -----*----- ##
        self.config = yaml.load(open('config/wave.yml'),
                                Loader=yaml.SafeLoader)
        # ストリーマ
        pa = pyaudio.PyAudio()
        self.streamer = pa.open(
            format=pyaudio.paFloat32,
            channels=self.config['channels'],
            rate=self.config['rate'] * 2,
            input=True,
            output=False,
            frames_per_buffer=self.config['chunk'],
        )
        # 立ち上がり・下がり検出数
        self.cnt_edge = {'up': 0, 'down': 0}
        # 音量・閾値などの状態管理
        self.state = {
            'amp': 0,
            'total': 0,
            'n': 0,
            'border': 9999,
            'average': 0
        }
        # フラグを初期化
        self.is_stream = False
        self.is_exit = False
        self.talk_dajare = False
        # 録音器
        self.record = recorder.Recorder()
        # HEXAGONの返答
        self.msg = '話しかけてください。'

        self.start()
예제 #5
0
def main():
    rec = recorder.Recorder()
    processorThread = processor.run(rec)

    rec.start()
    rec.record(5)
    rec.stop()
예제 #6
0
def on_click(x, y, button, pressed):
    global grabando, recfile, numwav

    # Presionar el botón izquierdo para empezar a grabar.
    if pressed and button == mouse.Button.left:
        if not grabando:
            print('Empieza grabacion')
            recfile = recorder.Recorder(channels=1, rate=16000).open(
                'tmp/audio.wav', 'wb')
            grabando = True
            recfile.start_recording()
            #numwav += 1

    # Soltar el botón izquierdo para dejar de grabar.
    if not pressed and button == mouse.Button.left:
        if grabando:
            print('Termina grabacion')
            recfile.stop_recording()
            recfile.close()
            # create transformer
            #tfm = sox.Transformer()
            #tfm.convert(samplerate=16000, n_channels=1,bitdepth=16)
            #tfm.build('tmp/audio.wav', 'tmp/audio_final.wav')
            recfile = None
            grabando = False
            procesar('audio.wav')
            #os.remove('tmp/audio.wav')
            #os.remove('tmp/audio_final.wav')

    # Presionar el botón derecho para terminar.
    if pressed and button == mouse.Button.right:
        if not grabando:
            return False
예제 #7
0
 def recFromUrl(self, url):
     spaceId = self.getSpaceIdFromUrl(url)
     if spaceId is None:
         self.log.error("Space ID not found: " + url)
         return errorCodes.INVALID_URL
     metadata = self.getMetadata(spaceId)
     if metadata == errorCodes.INVALID_URL:
         return errorCodes.INVALID_URL
     if type(metadata) == int:
         self.showError(metadata)
         return
     if not metadata.isRunning():
         if metadata.isEnded():
             self.log.debug("is ended: %s" % metadata)
             return errorCodes.SPACE_ENDED
         if metadata.isNotStarted():
             self.log.debug("is not started: %s" % metadata)
             return errorCodes.SPACE_NOT_STARTED
     mediaKey = metadata.getMediaKey()
     if mediaKey == errorCodes.INVALID_RECEIVED:
         self.log.error("Media key not found: " + metadata)
         self.showError(errorCodes.INVALID_RECEIVED)
         return
     location = self.getMediaLocation(mediaKey)
     if type(location) == int:
         self.showError(location)
         return
     r = recorder.Recorder(self, location, metadata.getUserName(),
                           metadata.getStartedTime(), metadata.getSpaceId())
     r.start()
예제 #8
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        label = tk.Label(self,
                         text="Welcher Satz soll aufgenommen werden?",
                         font=controller.title_font)
        label.pack(side="top", fill="x", pady=10)
        self.running = None

        # options for the dropdown menu
        OPTIONS = list(utt.data['examples'].keys())
        variable = StringVar(self)
        variable.set(OPTIONS[0])

        # dropdown menu f
        w = OptionMenu(self, variable, *OPTIONS)
        w.pack()

        # show text button
        # would be nice to show the right away without having to click on 'show text' (TODO)
        button = Button(self,
                        text="Text anzeigen",
                        command=lambda: self.show_text(variable.get()))
        button.pack()

        # the final text corresponding to the user chosen title
        default = OPTIONS[0]
        self.var = utt.data['examples'][default][0]
        self.l = tk.Label(self, text=self.var, font=controller.body_font)
        self.l.pack({"anchor": 's'})

        # start record button
        self.button_rec = Button(self,
                                 text='Start Aufnahme',
                                 command=self.start)
        self.button_rec.pack({"anchor": 's'})

        # stop record button
        self.button_stop = Button(self,
                                  text='Stop Aufnahme',
                                  command=self.stop)
        self.button_stop.pack({"anchor": 's'})

        # analysis button
        button_ana = tk.Button(
            self,
            text="Analysieren",
            command=lambda: controller.show_frame("Analyze"))
        button_ana.pack({"anchor": 's'})

        # back button
        button_back = tk.Button(
            self,
            text="Zurück",
            command=lambda: controller.show_frame("StartPage"))
        button_back.pack({"anchor": 's'})

        # the recorder class comes from recorder.py (by Steven Loria)
        # every input device with it's id is printed to the console
        self.rec = reco.Recorder(channels=2, input_device_index=0)
예제 #9
0
def record_audio():
    logging.info("recording audio##")
    filename = config.local_audios_dir / '{}.wav'.format(
        datetime.now().strftime('%Y%m%d%H%M'))
    fd = open(bytes(filename), 'wb')
    rec = recorder.Recorder()
    with rec.open(fd, 'wb') as recfile:
        recfile.record(duration=180)
예제 #10
0
파일: world.py 프로젝트: chenymark/pupil
    def toggle_record_video():
        for p in g_pool.plugins:
            if isinstance(p, recorder.Recorder):
                p.alive = False
                return

        new_plugin = recorder.Recorder(g_pool, g_pool.rec_name, bar.fps.value,
                                       frame.img.shape, bar.record_eye.value,
                                       g_pool.eye_tx, bar.audio.value)
        g_pool.plugins.append(new_plugin)
        g_pool.plugins.sort(key=lambda p: p.order)
예제 #11
0
    def toggle_record_video():
        for p in g.plugins:
            if isinstance(p,recorder.Recorder):
                p.alive = False
                return
        # set up folder within recordings named by user input in atb
        if not bar.rec_name.value:
            bar.rec_name.value = recorder.get_auto_name()

        new_plugin = recorder.Recorder(g_pool,bar.rec_name.value, bar.fps.value, frame.img.shape, bar.record_eye.value, g_pool.eye_tx)
        g.plugins.append(new_plugin)
        g.plugins.sort(key=lambda p: p.order)
예제 #12
0
def login():
    rec = recorder.Recorder(channels=1)
    with rec.open('block.wav', 'wb') as recfile:
        recfile.record(duration=15.0)
    x = transcribe_file("/Users/brianha/hackbeanpot/block.wav")

    if request.method == 'POST':
        user = request.form['nm']
        return redirect(url_for('success', name=x))
    else:
        user = request.args.get('nm')
        return redirect(url_for('success', name=user))
예제 #13
0
파일: main.py 프로젝트: shinying/DanceLight
def sync_beats(file):
    FULL_FILE = file
    beats = detect_beats(FULL_FILE)

    # record from device
    rec = rc.Recorder(channels=MONO)
    with rec.open(SAMPLE_FILE, 'wb') as recfile:
        print("Start recording...")
        recfile.record(duration=DURATION)
    t_start = time.time()

    # locate sample file with in original audio track
    print("Start locating...")
    offset, _ = find_offset(FULL_FILE, SAMPLE_FILE, 44100, 5 * 60)
    # print("Record starts at:", offset)

    t_end = time.time()

    cur_time = offset + DURATION + t_end - t_start + 0.1
    # print("Calculation ends at:", cur_time)
    start_point = 0
    for i in range(len(beats)):
        if beats[i] >= cur_time:
            start_point = i
            break

    if start_point == 0:
        print("Error: Locating fail!")
        print("> ", end="")
        sys.stdout.flush()
        sys.exit(1)

    # print("Next beats:", beats[start_point])
    print("Start tracking...")
    print("> ", end="")  # to receive "stop"
    sys.stdout.flush()

    t_start = time.time()
    while playing_status and start_point < len(beats):
        if round(time.time() - t_start + cur_time, 2) == beats[start_point]:
            # t = threading.Thread(target=light)
            # t.start()
            ser.write(struct.pack('>B', 2))
            start_point += 1

    if not playing_status:
        print("> ", end="")
        sys.stdout.flush()
예제 #14
0
파일: mod.py 프로젝트: cnvogelg/raspi
  def setup(self, send, log, cfg, botopts):
    BotMod.setup(self, send, log, cfg, botopts)
    self._get_vumeter_cfg(cfg)

    self.ev = DetectorEventHandler(self.send_event, self.botopts)
    self.d = detector.Detector(self.botopts)
    self.rec = recorder.Recorder(self.sample_rate, self.interval, self.channels,
                                 self.rec, self.dev, self.tool, self.zero_range, self.sox_filter)
    self.sim = simulator.Simulator()

    self.log("init audio: cmd=", self.rec.cmd)
    self.log("options=",self.botopts.get_values())

    # setup threading
    self.queue = queue.Queue()
    self.thread = threading.Thread(target=self.thread_run, name="audiorec")
    self.do_run = True
    self.thread.start()
예제 #15
0
    def __init__(self, conf, event_iter):
        "conf is class Config"
        if not isinstance(conf, config.Config):
            raise TypeError("conf is not config.Config, it is {}".format(
                type(conf).__name__))

        self.conf = conf
        self.event_iter = event_iter

        # initialize recorder
        self.recorder = recorder.Recorder(
            output_target=self.conf['output_target'],
            output_directory=self.conf['result_dir'],
            verbose_level=self.conf['verbose_level'],
            print_when_finished=self.conf['print_when_finished'])

        if self.conf.has_key('enable_e2e_test'):
            raise RuntimeError("enable_e2e_test is deprecated")
예제 #16
0
def on_click(x, y, button, pressed):
    global grabando, recfile, numwav

    # Presionar el botón izquierdo para empezar a grabar.
    if pressed and button == mouse.Button.left and not grabando:
        print('Empieza grabacion')
        recfile = recorder.Recorder(channels=1,
                                    rate=48000).open('tmp/audio.wav', 'wb')
        grabando = True
        recfile.start_recording()

    # Soltar el botón izquierdo para dejar de grabar.
    if not pressed and button == mouse.Button.left and grabando:
        print('Termina grabacion')
        recfile.stop_recording()
        recfile.close()
        resample(16000, 'tmp/audio')
        recfile = None
        grabando = False
        procesar('audio_final.wav')
        return
예제 #17
0
def main():
  pygame.init()
  os.environ['SDL_VIDEO_CENTERED'] = '1'
  pygame.display.set_caption('Slide Puzzle')
  screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
  fpsclock = pygame.time.Clock()
  program = game.SlidePuzzle((4, 3), 160, 5)
  detect = recorder.Recorder()

  while True:
    dt = fpsclock.tick() / 1000
    screen.blit(program.background, (0, 0))
    program.draw(screen)
    pygame.display.flip()
    for event in pygame.event.get():
      if event.type == pygame.QUIT:
        pygame.quit()
        sys.exit()
      program.events(event)
    detect.listen()
    program.update(dt)
예제 #18
0
class AudioRecord():

    FORMAT = pyaudio.paInt16
    CHANNELS = 1
    RATE = 44100
    CHUNK = 10000
    RECORD_SECONDS = 100

    audio = pyaudio.PyAudio()

    path = '/home/pi/coughanalysis_ann/disease/vamshi/c1.wav'
    coughpath.set(path)
    rec = recorder.Recorder(channels=1)
    recfile2 = rec.open(path, 'wb')

    def start(self):
        #self.recfile2 = self.rec.open(self.path, 'wb')
        self.recfile2.start_recording()

    def stop(self):
        self.recfile2.stop_recording()
예제 #19
0
    def notify(self,
               source,
               userName,
               link,
               stream,
               time,
               config=None,
               movie=""):
        """新着ライブの通知

		:param source: SourceBaseクラスを継承したオブジェクト
		:param source: source
		:param userName: 配信者のユーザ名
		:type userName: str
		:param link: 配信ページへのリンク
		:type link: str
		:param stream: ストリーミングのURL
		:type stream: str
		:param time: 放送開始日時のUnixタイムスタンプまたはdatetime.datetimeオブジェクト
		:type time: int/datetime.datetime
		:param config: 通知条件の設定。指定しなければデフォルト値が読み込まれる。
		:type config: dict
		:param movie: 通知対象の動画を識別するための文字列
		:type movie: str
		"""
        self.loadSettings(config)
        if self.baloon:
            b = wx.adv.NotificationMessage(
                constants.APP_NAME,
                _("配信開始:%s、サービス:%s") % (userName, source.friendlyName))
            b.Show()
            b.Close()
        if self.sound:
            fxPlayer.playFx(self.soundFile)
        if self.openBrowser:
            webbrowser.open_new(link)
        if self.record:
            r = recorder.Recorder(source, stream, userName, time, movie)
            r.start()
예제 #20
0
class AudioRecord():

    FORMAT = pyaudio.paInt16
    CHANNELS = 1
    RATE = 44100
    CHUNK = 10000
    RECORD_SECONDS = 100

    audio = pyaudio.PyAudio()

    path = '/home/pi/recordings/' + patientID.get() + '/' + str(
        int(time.time())) + '.wav'
    coughpath.set(path)

    rec = recorder.Recorder(channels=1)

    def start(self):
        self.recfile2 = self.rec.open(self.path, 'wb')
        self.recfile2.start_recording()

    def stop(self):
        self.recfile2.stop_recording()
예제 #21
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        self.rec = recorder.Recorder(channels=2)
        self.running = None

        label = ttk.Label(self, text="Record audio", font=LARGE_FONT)
        label.place(x=300, y=10)

        Label_hebrew_name = ttk.Label(self, text='Write word in Hebrew')
        Label_hebrew_name.place(x=10, y=60)
        self.Entry_hebrew_name = tk.Entry(self, width=120)
        self.Entry_hebrew_name.place(x=10, y=90)
        Label_russian_name = ttk.Label(self, text='Write word in Russian')
        Label_russian_name.place(x=10, y=140)
        self.Entry_russian_name = tk.Entry(self, width=120)
        self.Entry_russian_name.place(x=10, y=170)
        Label_another_name = ttk.Label(self, text='Write word in another language')
        Label_another_name.place(x=10, y=210)
        self.Entry_another_name = tk.Entry(self, width=120)
        self.Entry_another_name.place(x=10, y=240)



        button_start_record = tk.Button(self, text="Start record",
                            command=self.start_record)
        button_start_record.place(x=330, y=310)

        button_stop_record = tk.Button(self, text="Stop record",
                                        command=self.stop_record)
        button_stop_record.place(x=430, y=310)

        button_save_record = tk.Button(self, text="Play record",
                                       command=self.play_record)
        button_save_record.place(x=530, y=310)

        button_start_page = tk.Button(self, text="Back to Home",
                            command=lambda: controller.show_frame(StartPage))
        button_start_page.place(x=700, y=10)
예제 #22
0
def runExpt(ntrials):
    filename = '%s-%s_%d.txt' % (exptname, subjectid, sessionid)
    filepath = os.path.join(datapath, filename)

    mapping = [0, 1, 2, 3, 4, 5]
    random.shuffle(mapping)

    for t in range(0, ntrials):
        trialdata = dict(gensettings)
        for k, v in trialdata.iteritems():
            if isinstance(v, (list, tuple)):
                # print 'randomly sampling %s from '%k + str(v)
                trialdata[k] = random.sample(v, 1)[0]
        for i in range(0, 6):
            trialdata['SRmap_%d' % i] = mapping[i]
        trialdata = oneTrial(trialdata)
        if t == 0:
            trialwriter = recorder.Recorder(filepath, trialdata)
        trialwriter.write(trialdata)

    trialwriter.close()
    print('Total points: %d' % scorer.view()[0])
예제 #23
0
    def downloadArchive(self, url, join=False, skipExisting=False):
        """過去ライブをダウンロード

		:param url: 再生ページのURL
		:type url: str
		"""
        movieInfo = self.getMovieInfoFromUrl(url)
        if movieInfo == None:
            return
        stream = self.getStreamFromUrl(url, movieInfo["movie"]["is_protected"])
        if stream == None:
            return
        r = recorder.Recorder(self,
                              stream,
                              movieInfo["broadcaster"]["screen_id"],
                              movieInfo["movie"]["created"],
                              movieInfo["movie"]["id"],
                              header="Origin: https://twitcasting.tv",
                              skipExisting=skipExisting)
        if r.shouldSkip():
            return errorCodes.RECORD_SKIPPED
        r.start()
        if join:
            r.join()
예제 #24
0
                             colordeep=1,
                             stride=3,
                             zlim=1)
        #TFgraphtool.plot2D3D(Hx, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)
        #TFgraphtool.plot2D3D(Hy, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)
        #TFgraphtool.plot2D3D(Hz, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)

        if TF.MPIrank == 0:

            interval_time = datetime.datetime.now()
            print((
                "time: %s, step: %05d, %5.2f%%" %
                (interval_time - start_time, tstep, 100. * tstep / TF.tsteps)))

#------------------------------------------------------------------#
#--------------------------- Data analysis ------------------------#
#------------------------------------------------------------------#

fap1.save_time_signal(binary=True, txt=False)
fap2.save_time_signal(binary=True, txt=False)
fap3.save_time_signal(binary=True, txt=False)
fap4.save_time_signal(binary=True, txt=False)
fap5.save_time_signal(binary=True, txt=False)

#------------------------------------------------------------------#
#------------------- Record simulation history --------------------#
#------------------------------------------------------------------#

if TF.MPIrank == 0:
    recording = recorder.Recorder(TF, start_time, "../record/")
예제 #25
0
        #SFgraphtool.plot2D3D(Hz, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)

        Ez = TFgraphtool.gather('Ez')
        #TFgraphtool.plot2D3D(Ex, tstep, xidx=TF.Nxc, colordeep=1e-2, stride=3, zlim=1e-2)
        #TFgraphtool.plot2D3D(Ey, tstep, yidx=TF.Nyc, colordeep=1., stride=2, zlim=1.)
        TFgraphtool.plot2D3D(Ez, tstep, xidx=TF.Nxc, colordeep=1e-2, stride=2, zlim=1e-2)
        #TFgraphtool.plot2D3D(Hx, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)
        #TFgraphtool.plot2D3D(Hy, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)
        #TFgraphtool.plot2D3D(Hz, tstep, xidx=TF.Nxc, colordeep=.1, stride=1, zlim=.1)

        if TF.MPIrank == 0:

            interval_time = datetime.datetime.now()
            print(("time: %s, step: %05d, %5.2f%%" %(interval_time-start_time, tstep, 100.*tstep/TF.tsteps)))

#------------------------------------------------------------------#
#--------------------------- Data analysis ------------------------#
#------------------------------------------------------------------#

fap1.save_time_signal(binary=True, txt=False)
fap2.save_time_signal(binary=True, txt=False)
fap3.save_time_signal(binary=True, txt=False)
fap4.save_time_signal(binary=True, txt=False)
fap5.save_time_signal(binary=True, txt=False)

#------------------------------------------------------------------#
#------------------- Record simulation history --------------------#
#------------------------------------------------------------------#

if TF.MPIrank == 0: recording = recorder.Recorder(TF, start_time, "../record/")
예제 #26
0
from transliteration import get_browser_context, transliterate
import os.path
from os import path
import tkinter as tk
import recorder
import csv
# --- functions ---
rec = recorder.Recorder(channels=2)
output_folder = "recorded_audio"
running = None
current = 1
checkpoint_file = 'checkpoint.txt'


def start_recording():
    global running
    global current_row
    global var
    global recording_var
    global current
    global start

    if running is not None:
        var.set("Not Recording: Currently viewing phrase #{}".format(start +
                                                                     current))
        running.stop_recording()
        running.close()
        running = None
        with open(checkpoint_file, 'w') as checkpointFile:
            checkpointFile.write(str(start + current))
예제 #27
0
 def __init__(self):
     self.rec = recorder.Recorder()
     self.reg = recognise.Recognition()
     self.sp = speeker.Speaker()
     self.ai = Alita()
     self.fenci = fenci.Fenci()
예제 #28
0
import recorder

addons = [recorder.Recorder("c")]
예제 #29
0
    def __init__(self):
        self.sc = scenario.Scenario()
        self.rec = recorder.Recorder()
        self.is_recording = False
        self.current_step = None
        self.step_counter = 1
        self.action_list_current_insert_index = None
        self.active_on_stop_group = []

        self.main_wnd = tkinter.Tk()
        self.main_wnd.title('Pywinauto test generator')

        box = tkinter.Frame(self.main_wnd)
        box.pack(fill=tkinter.BOTH, expand=1)

        frame = tkinter.Frame(box)
        frame.pack(fill=tkinter.X, expand=1)
        scrollbar = tkinter.Scrollbar(frame)
        scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
        self.action_list = tkinter.Listbox(frame,
                                           selectmode=tkinter.SINGLE,
                                           yscrollcommand=scrollbar.set)
        self.action_list.pack(fill=tkinter.X, expand=1)
        scrollbar.config(command=self.action_list.yview)

        self.record_btn = tkinter.Button(box,
                                         text='Start',
                                         command=self.on_start_record)
        self.record_btn.pack()
        btn = tkinter.Button(box, text='New', command=self.on_new_scenario)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box, text='Add Step...', command=self.on_add_step)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box, text='Delete', command=self.on_del_action)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box, text='Run', command=self.on_run_step)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box,
                             text='Load...',
                             command=self.on_load_scenario)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box,
                             text='Save...',
                             command=self.on_save_scenario)
        btn.pack()
        self.active_on_stop_group.append(btn)
        btn = tkinter.Button(box,
                             text='Tune...',
                             command=self.on_tune_item_path)
        btn.pack()
        self.active_on_stop_group.append(btn)

        frame = tkinter.Frame(box)
        frame.pack(fill=tkinter.X, expand=1)
        scrollbar = tkinter.Scrollbar(frame)
        scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
        self.status_area = tkinter.Text(frame,
                                        wrap=tkinter.WORD,
                                        yscrollcommand=scrollbar.set)
        self.status_area.pack(fill=tkinter.X, expand=1)
        scrollbar.config(command=self.status_area.yview)
예제 #30
0
import recorder

addons = [recorder.Recorder("a")]