回答編集履歴
1
コメントへの回答
answer
CHANGED
@@ -18,4 +18,33 @@
|
|
18
18
|
|
19
19
|
上記のコードと同じようにprint(wavefile)を実行してみて、それがwave.Wave_write objectではなくtupleであるなら、ラズパイで動いているpythonがCPythonではなくwave.openがtupleを返していることになりますが、そういうことはないはずなのです。
|
20
20
|
|
21
|
-
print(wavefile)の結果を載せてもらえれば、もう少しアドバイスできるかもしれません。
|
21
|
+
print(wavefile)の結果を載せてもらえれば、もう少しアドバイスできるかもしれません。
|
22
|
+
|
23
|
+
(<module 'wave' from ' /usr/bin/lib/python3.7/wave.py'>,<_io.BufferedWriter name='test.wav'>)なのですか。確かにtupleですね。
|
24
|
+
以下を実行してその結果を教えてください。
|
25
|
+
|
26
|
+
```python
|
27
|
+
import wave
|
28
|
+
print(wave.__doc__)
|
29
|
+
```
|
30
|
+
Windowsで実行すると以下のように始まる71行のテキストが表示されます。
|
31
|
+
|
32
|
+
```python
|
33
|
+
>>> print(wave.__doc__)
|
34
|
+
Stuff to parse WAVE files.
|
35
|
+
|
36
|
+
Usage.
|
37
|
+
|
38
|
+
Reading WAVE files:
|
39
|
+
f = wave.open(file, 'r')
|
40
|
+
where file is either the name of a file or an open file pointer.
|
41
|
+
The open file pointer must have methods read(), seek(), and close().
|
42
|
+
When the setpos() and rewind() methods are not used, the seek()
|
43
|
+
method is not necessary.
|
44
|
+
|
45
|
+
This returns an instance of a class with the following public methods:
|
46
|
+
getnchannels() -- returns number of audio channels (1 for
|
47
|
+
mono, 2 for stereo)
|
48
|
+
getsampwidth() -- returns sample width in bytes
|
49
|
+
```
|
50
|
+
これが表示されないようだと、' /usr/bin/lib/python3.7/wave.py'が正しくないと言うことになります。
|