OSDN Git Service

pythonモジュールの扱いに悩む
[sample-delphi/sample-DELPHI.git] / Unit2.dfm
1 object Form2: TForm2
2   Left = 0
3   Top = 0
4   Caption = 'Form2'
5   ClientHeight = 299
6   ClientWidth = 635
7   Color = clBtnFace
8   Font.Charset = DEFAULT_CHARSET
9   Font.Color = clWindowText
10   Font.Height = -11
11   Font.Name = 'Tahoma'
12   Font.Style = []
13   OldCreateOrder = False
14   OnCreate = FormCreate
15   PixelsPerInch = 96
16   TextHeight = 13
17   object SpeedButton1: TSpeedButton
18     Left = 439
19     Top = 46
20     Width = 42
21     Height = 23
22     OnClick = SpeedButton1Click
23   end
24   object MediaPlayer1: TMediaPlayer
25     Left = 80
26     Top = 125
27     Width = 85
28     Height = 30
29     VisibleButtons = [btPlay, btPause, btStop]
30     AutoOpen = True
31     DeviceType = dtWaveAudio
32     DoubleBuffered = True
33     ParentDoubleBuffered = False
34     TabOrder = 0
35     OnMouseEnter = MediaPlayer1MouseEnter
36   end
37   object Edit1: TEdit
38     Left = 64
39     Top = 48
40     Width = 369
41     Height = 21
42     TabOrder = 1
43   end
44   object Button1: TButton
45     Left = 320
46     Top = 125
47     Width = 75
48     Height = 25
49     Caption = 'GO'
50     TabOrder = 2
51     OnClick = Button1Click
52   end
53   object ListBox1: TListBox
54     Left = 439
55     Top = 120
56     Width = 170
57     Height = 161
58     ItemHeight = 13
59     TabOrder = 3
60   end
61   object Memo1: TMemo
62     Left = 248
63     Top = 178
64     Width = 185
65     Height = 89
66     Lines.Strings = (
67       'import pyaudio  #'#37682#38899#27231#33021#12434#20351#12358#12383#12417#12398#12521#12452#12502#12521#12522
68       'import wave     #wav'#12501#12449#12452#12523#12434#25201#12358#12383#12417#12398#12521#12452#12502#12521#12522
69       'import voice'
70       ''
71       'RECORD_SECONDS = 10 #'#37682#38899#12377#12427#26178#38291#12398#38263#12373#65288#31186#65289
72       'WAVE_OUTPUT_FILENAME = "temp.wav" #'#38899#22768#12434#20445#23384#12377#12427#12501#12449#12452#12523#21517
73       'iDeviceIndex = 0 #'#37682#38899#12487#12496#12452#12473#12398#12452#12531#12487#12483#12463#12473#30058#21495
74       ''
75       '#'#22522#26412#24773#22577#12398#35373#23450
76       'FORMAT = pyaudio.paInt16 #'#38899#22768#12398#12501#12457#12540#12510#12483#12488
77       'CHANNELS = 2             #'#12473#12486#12524#12458
78       'RATE = 44100             #'#12469#12531#12503#12523#12524#12540#12488
79       'CHUNK = 2**11            #'#12487#12540#12479#28857#25968
80       'audio = pyaudio.PyAudio() #pyaudio.PyAudio()'
81       ''
82       'stream = audio.open(format=FORMAT, channels=CHANNELS,'
83       '        rate=RATE, input=True,'
84       '        input_device_index = iDeviceIndex, #'#37682#38899#12487#12496#12452#12473#12398#12452#12531#12487#12483#12463#12473#30058#21495
85       '        frames_per_buffer=CHUNK)'
86       ''
87       '#--------------'#37682#38899#38283#22987'---------------'
88       ''
89       'print ("recording...")'
90       'frames = []'
91       '#for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):'
92       'while not varname1.Value:'
93       '    data = stream.read(CHUNK)'
94       '    frames.append(data)'
95       '    voice.proc()'
96       ''
97       ''
98       'print ("finished recording")'
99       ''
100       '#--------------'#37682#38899#32066#20102'---------------'
101       ''
102       'stream.stop_stream()'
103       'stream.close()'
104       'audio.terminate()'
105       ''
106       'waveFile = wave.open(WAVE_OUTPUT_FILENAME, '#39'wb'#39')'
107       'waveFile.setnchannels(CHANNELS)'
108       'waveFile.setsampwidth(audio.get_sample_size(FORMAT))'
109       'waveFile.setframerate(RATE)'
110       'waveFile.writeframes(b'#39#39'.join(frames))'
111       'waveFile.close()')
112     TabOrder = 4
113     Visible = False
114     WordWrap = False
115   end
116   object Button2: TButton
117     Left = 184
118     Top = 125
119     Width = 75
120     Height = 25
121     Caption = 'record/Stop'
122     TabOrder = 5
123     OnClick = Button2Click
124   end
125   object OpenDialog1: TOpenDialog
126     Filter = 'wav file|*.wav'
127     Left = 528
128     Top = 112
129   end
130   object SaveDialog1: TSaveDialog
131     DefaultExt = 'wav'
132     Filter = 'wav file|*.wav'
133     Left = 528
134     Top = 168
135   end
136   object PythonEngine1: TPythonEngine
137     DllPath = 'C:\Users\yamat\Anaconda2'
138     IO = PythonInputOutput1
139     Left = 432
140     Top = 168
141   end
142   object PythonInputOutput1: TPythonInputOutput
143     OnSendData = PythonInputOutput1SendData
144     UnicodeIO = False
145     RawOutput = False
146     Left = 432
147     Top = 216
148   end
149   object PythonModule1: TPythonModule
150     Engine = PythonEngine1
151     OnInitialization = PythonModule1Initialization
152     ModuleName = 'voice'
153     Errors = <>
154     Left = 520
155     Top = 16
156   end
157   object PythonDelphiVar1: TPythonDelphiVar
158     Engine = PythonEngine1
159     Module = '__main__'
160     VarName = 'varname1'
161     OnGetData = PythonDelphiVar1GetData
162     Left = 520
163     Top = 64
164   end
165 end