Skip to content

Commit 765b315

Browse files
committed
Fix #58: binary file open mode for MIDI and WAVE files
1 parent 3cceaa0 commit 765b315

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

mingus/extra/fft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def find_notes(freqTable, maxNote=100):
129129
def data_from_file(file):
130130
"""Return (first channel data, sample frequency, sample width) from a .wav
131131
file."""
132-
fp = wave.open(file, "r")
132+
fp = wave.open(file, "rb")
133133
data = fp.readframes(fp.getnframes())
134134
channels = fp.getnchannels()
135135
freq = fp.getframerate()

mingus/midi/midi_file_in.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def parse_midi_file(self, file):
372372
track data and the number of bytes read.
373373
"""
374374
try:
375-
f = open(file, "r")
375+
f = open(file, "rb")
376376
except:
377377
raise IOError("File not found")
378378
self.bytes_read = 0

0 commit comments

Comments
 (0)