TeamPyOgg / PyOgg

Simple OGG Vorbis, Opus and FLAC bindings for Python
The Unlicense
63 stars 27 forks source link

opus_file.bytes_per_sample missing #103

Open kdulep opened 1 year ago

kdulep commented 1 year ago
import wave
import pyogg

AUDIO_FILE = 'voice.ogg'
AUDIO_WAV = 'voice.wav'

opus_file = pyogg.OpusFile(AUDIO_FILE)
print(opus_file.bytes_per_sample)

wave_out = wave.open(AUDIO_WAV, "wb")
wave_out.setnchannels(opus_file.channels)
wave_out.setsampwidth(opus_file.bytes_per_sample)
wave_out.setframerate(opus_file.frequency)
wave_out.writeframes(opus_file.buffer)

AttributeError: 'OpusFile' object has no attribute 'bytes_per_sample'