本文整理匯總了Python中recorder.Recorder類的典型用法代碼示例。如果您正苦於以下問題:Python Recorder類的具體用法?Python Recorder怎麽用?Python Recorder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Recorder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main_button_click
def main_button_click(self):
self.play_beep()
self.tick_timer()
Recorder.start_recording()
self.full_file_path = "test.wav"
self.l_selected_file_name_var.set("[Selected file name]: " + "test.wav")
self.b_spectrogram['state'] = 'active'
示例2: main
def main():
parser = OptionParser()
parser.add_option('-v', '--verbose',
dest='verbose', action='store_true', default=False,
help='verbose output')
(options, args) = parser.parse_args()
verbose = options.verbose
if verbose:
print 'verbose output mode.'
if len(args) == 0:
print 'no input files.'
exit
filename = args[0]
if verbose:
print 'filename: ' + filename
p = Player(filename)
r = Recorder()
r.start()
pl = plotter(p, r)
th = Thread(target=pl)
th.daemon = True
th.start()
p.run()
示例3: test_SocketPair1
def test_SocketPair1(self):
rec = Recorder()
rec.createSocketPair(1,2)
socDetails = rec._getSocketDetails(1)
self.assertEqual(socDetails["socketPair"], 2)
self.assertEqual(socDetails["isForwardChannel"], False)
socDetails = rec._getSocketDetails(2)
self.assertEqual(socDetails["socketPair"], 1)
self.assertEqual(socDetails["isForwardChannel"], True)
示例4: test_record_when_title_and_command_given
def test_record_when_title_and_command_given(self):
recorder = Recorder(self.pty_recorder)
asciicast = recorder.record('ls -l', 'the title')
assert_equal('the title', asciicast.title)
assert_equal('ls -l', asciicast.command)
assert_equal(('ls -l',), self.pty_recorder.record_call_args())
assert_equal(123.45, asciicast.duration)
assert_equal(self.pty_recorder.stdout, asciicast.stdout)
示例5: start_recording
def start_recording():
try:
config = read_config()
r = Recorder(config.get('directories', 'sessions'))
r._run()
except KeyboardInterrupt:
logger.info("KeyboardInterrupt")
except:
logger.error(sys.exc_info()[1])
logger.info("Finished recording.")
示例6: test_record_when_no_title_nor_command_given
def test_record_when_no_title_nor_command_given(self):
env = { 'SHELL': '/bin/blush' }
recorder = Recorder(self.pty_recorder, env)
asciicast = recorder.record(None, None)
assert_equal(None, asciicast.title)
assert_equal(None, asciicast.command)
assert_equal(('/bin/blush',), self.pty_recorder.record_call_args())
assert_equal(123.45, asciicast.duration)
assert_equal(self.pty_recorder.stdout, asciicast.stdout)
示例7: main
def main():
# start recording -> 5 sec default
recorder = Recorder()
frames = recorder.start(5)
recorder.write_wav(frames, "input.wav")
# load the hum and process
hum = track_pitch("input.wav")
timeseries(hum)
process(hum)
"""
示例8: submit
def submit(self, table_name, form_obj, id):
db = self.db
r = Recorder(db, table_name)
updated = True
if id:
result_msg = r.update(id, form_obj)
form_obj['id'] = id
else:
result_msg = r.input(form_obj)
updated = False
form_obj['id'] = r.get_last_id()
self.submitted.emit(updated, table_name, form_obj)
return result_msg
示例9: MyApp
class MyApp( wxApp ):
def OnInit( self ):
self.recorder=Recorder()
self.res = wxXmlResource( GUI_FILENAME )
self.frame = self.res.LoadFrame( None, GUI_MAINFRAME_NAME )
self.frame.Show()
EVT_BUTTON(self.frame, XRCID("button_quit"), self.onClick)
EVT_BUTTON(self.frame, XRCID("button_start"), self.onClick)
EVT_BUTTON(self.frame, XRCID("button_stop"), self.onClick)
in_src = XRCCTRL(self.frame, "choice_inputsource")
for n in self.recorder.getDeviceNames():
in_src.Append(n)
in_src.SetSelection(0)
self.frame.Bind(EVT_IDLE, self.onIdle)
return 1
def onIdle(self, evt):
if self.recorder.status == RECORDING:
self.recorder.process()
XRCCTRL(self.frame, "main_frame_statusbar").SetStatusText("bytes written: " +str(self.recorder.bytesWritten()),0)
evt.Skip()
def onClick(self, evt):
btn = evt.GetEventObject()
name = evt.GetEventObject().GetName()
if name == "button_start":
self.startRecording()
btn.Disable()
XRCCTRL(self.frame, "button_stop").Enable()
elif name == "button_stop":
self.stopRecording()
btn.Disable()
XRCCTRL(self.frame, "button_start").Enable()
else:
self.quitApplication()
def quitApplication(self):
self.frame.Close(true)
def startRecording(self):
self.recorder.setDevice(XRCCTRL(self.frame, "choice_inputsource").GetStringSelection())
file = wxFileSelector("Select file to save mp3 audio to")
self.recorder.start(open(file,"wb"))
def stopRecording(self):
self.recorder.stop()
示例10: __init__
def __init__(self, config_path):
# read config file
config = ConfigParser.RawConfigParser()
config.read(config_path)
# general
self.tmp_file = config.get('general', 'tmp_file')
# gsr api
self.gsr_api_lang = config.get('gsr_api', 'language')
# moses
self.e = config.get('moses', 'e')
self.f = config.get('moses', 'f')
self.moses_config_orig = config.get('moses', 'config_orig')
self.moses_config_fix = config.get('moses', 'config_fix')
self.moses_dir = config.get('moses', 'moses_dir')
self.model_dir = config.get('moses', 'model_dir')
self.model_dir_jenkins = config.get('moses', 'model_dir_jenkins')
self.threads = config.getint('moses', 'threads')
# pyttsx
self.tts_voice_id = config.get('pyttsx', 'voice')
self.tts_voice_rate = config.getint('pyttsx', 'rate')
# create recorder
self.recorder = Recorder(language=self.gsr_api_lang)
示例11: __init__
def __init__(self,url):
self.url = url # 要分析的url
self.block_li = [] # 網頁所包含的文本塊列表
self.title = ''
#重置記錄
self.recorder = Recorder()
self.recorder.reset()
示例12: ButtonRecorder
class ButtonRecorder(object):
def __init__(self, filename):
self.filename = filename
gpio.setup(23, gpio.IN, pull_up_down=gpio.PUD_UP)
self.rec = Recorder(channels=2)
def start(self):
gpio.add_event_detect(23, gpio.FALLING, callback=self.falling, bouncetime=10)
def rising(self, channel):
gpio.remove_event_detect(23)
print 'Button up'
gpio.add_event_detect(23, gpio.FALLING, callback=self.falling, bouncetime=10)
#TODO: dim red LED
self.recfile.stop_recording()
self.recfile.close()
def falling(self, channel):
ts = time.time()
gpio.remove_event_detect(23)
print 'Button down'
gpio.add_event_detect(23, gpio.RISING, callback=self.rising, bouncetime=10)
#TODO: lit green LED
play = PlayFile(vloeken.keys()[random.randint(0,len(vloeken))])
play.start()
#TODO: dim green, lite red LED
vloeken[self.filename + str(ts) + '.wav'] = {'inputfor':[]}
with open('vloeken.log', 'wb') as handle:
pickle.dump(vloeken, handle)
self.recfile = self.rec.open(self.filename + str(ts) + '.wav', 'wb')
self.recfile.start_recording()
示例13: __init__
def __init__(self, pos = (0, 0)):
filename = datetime.datetime.fromtimestamp(time.time())\
.strftime('%Y-%m-%d %H.%M.%S')
from recorder import Recorder
self.path = Recorder.traceFileToPath(filename)
widget_pos = snapshot.snapWidgetFromPoint(pos, self.path)
# SmartClick does not support Orient
self.pos = (pos[0] - widget_pos[0], pos[1] - widget_pos[1])
示例14: __init__
def __init__(self, solve_continuous=False, **kwargs):
super(Control, self).__init__(**kwargs)
self.DOF = 2 # task space dimensionality
self.u = None
self.solve_continuous = solve_continuous
if self.write_to_file is True:
from recorder import Recorder
# set up recorders
self.u_recorder = Recorder('control signal', self.task, 'lqr')
self.xy_recorder = Recorder('end-effector position', self.task, 'lqr')
self.dist_recorder = Recorder('distance from target', self.task, 'lqr')
self.recorders = [self.u_recorder,
self.xy_recorder,
self.dist_recorder]
示例15: sendValue
def sendValue():
rec = Recorder()
data = rec.read()
vol = rec.rms(data) * 50
bam = np.fft.fft(data)
bam = rec.prepare_fft(data, CHUNK)
result_dict = {"volume": vol, "frequency": bam}
for client in clients:
# client.write_message(vol.__str__())
# client.write_message(bam.__str__())
# client.write_message(value.__str__())
client.write_message(tornado.escape.json_encode(result_dict))