Skip to content

Instantly share code, notes, and snippets.

@dtinth
Created December 29, 2010 16:56
Show Gist options
  • Save dtinth/758737 to your computer and use it in GitHub Desktop.
Save dtinth/758737 to your computer and use it in GitHub Desktop.
Using BASS from Python.
from ctypes import *
bass = cdll.LoadLibrary('./libbass.so')
# init bass
bass.BASS_Init(-1, 44100, 0, 0, None)
# load sample
file = '/path/to/wav/file.wav'
sample = bass.BASS_SampleLoad(False, file, c_longlong(0), 0, 2, 0x20000)
# get channel
channel = bass.BASS_SampleGetChannel(sample, False)
# play
bass.BASS_ChannelPlay(channel, True)
# free sample and bass
bass.BASS_SampleFree(sample)
bass.BASS_Free()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment