Skip to content

Commit 27ea919

Browse files
committed
Audio
1 parent 61b142b commit 27ea919

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,13 +1533,13 @@ Audio
15331533
#### Saves a list of floats with values between 0 and 1 to a WAV file:
15341534
```python
15351535
import wave, struct
1536-
frames = [struct.pack('h', int((a-0.5)*60000)) for a in <list>]
1537-
wf = wave.open(<filename>, 'wb')
1538-
wf.setnchannels(1)
1539-
wf.setsampwidth(4)
1540-
wf.setframerate(44100)
1541-
wf.writeframes(b''.join(frames))
1542-
wf.close()
1536+
samples = [struct.pack('h', int((a-0.5)*60000)) for a in <list>]
1537+
wav = wave.open(<filename>, 'wb')
1538+
wav.setnchannels(1)
1539+
wav.setsampwidth(4)
1540+
wav.setframerate(44100)
1541+
wav.writeframes(b''.join(samples))
1542+
wav.close()
15431543
```
15441544

15451545

0 commit comments

Comments
 (0)