From 8adfb3bd99b4dcff2459756af090a640fd7a4b4a Mon Sep 17 00:00:00 2001 From: yo mama Date: Fri, 19 Jun 2015 16:24:27 -0400 Subject: clone --- soundtouch/.hg/00changelog.i | Bin 0 -> 57 bytes soundtouch/.hg/branch | 1 + soundtouch/.hg/cache/branch2-served | 2 + soundtouch/.hg/cache/rbc-names-v1 | 1 + soundtouch/.hg/cache/rbc-revs-v1 | Bin 0 -> 16 bytes soundtouch/.hg/dirstate | Bin 0 -> 113 bytes soundtouch/.hg/hgrc | 14 ++ soundtouch/.hg/requires | 4 + soundtouch/.hg/store/00changelog.i | Bin 0 -> 343 bytes soundtouch/.hg/store/00manifest.i | Bin 0 -> 310 bytes soundtouch/.hg/store/data/trunk/_sound_touch.dll.i | Bin 0 -> 59417 bytes soundtouch/.hg/store/data/trunk/soundtouch.py.i | Bin 0 -> 2351 bytes soundtouch/.hg/store/fncache | 2 + soundtouch/.hg/store/phaseroots | 0 soundtouch/.hg/store/undo | Bin 0 -> 90 bytes soundtouch/.hg/store/undo.backupfiles | Bin 0 -> 29 bytes soundtouch/.hg/store/undo.phaseroots | 0 soundtouch/.hg/undo.bookmarks | 0 soundtouch/.hg/undo.branch | 1 + soundtouch/.hg/undo.desc | 3 + soundtouch/.hg/undo.dirstate | 0 soundtouch/trunk/SoundTouch.dll | Bin 0 -> 115712 bytes soundtouch/trunk/SoundTouch.so | 1 + soundtouch/trunk/libSoundTouch.so | 1 + soundtouch/trunk/soundtouch.py | 176 +++++++++++++++++++++ 25 files changed, 206 insertions(+) create mode 100644 soundtouch/.hg/00changelog.i create mode 100644 soundtouch/.hg/branch create mode 100644 soundtouch/.hg/cache/branch2-served create mode 100644 soundtouch/.hg/cache/rbc-names-v1 create mode 100644 soundtouch/.hg/cache/rbc-revs-v1 create mode 100644 soundtouch/.hg/dirstate create mode 100644 soundtouch/.hg/hgrc create mode 100644 soundtouch/.hg/requires create mode 100644 soundtouch/.hg/store/00changelog.i create mode 100644 soundtouch/.hg/store/00manifest.i create mode 100644 soundtouch/.hg/store/data/trunk/_sound_touch.dll.i create mode 100644 soundtouch/.hg/store/data/trunk/soundtouch.py.i create mode 100644 soundtouch/.hg/store/fncache create mode 100644 soundtouch/.hg/store/phaseroots create mode 100644 soundtouch/.hg/store/undo create mode 100644 soundtouch/.hg/store/undo.backupfiles create mode 100644 soundtouch/.hg/store/undo.phaseroots create mode 100644 soundtouch/.hg/undo.bookmarks create mode 100644 soundtouch/.hg/undo.branch create mode 100644 soundtouch/.hg/undo.desc create mode 100644 soundtouch/.hg/undo.dirstate create mode 100644 soundtouch/trunk/SoundTouch.dll create mode 120000 soundtouch/trunk/SoundTouch.so create mode 120000 soundtouch/trunk/libSoundTouch.so create mode 100644 soundtouch/trunk/soundtouch.py (limited to 'soundtouch') diff --git a/soundtouch/.hg/00changelog.i b/soundtouch/.hg/00changelog.i new file mode 100644 index 0000000..d3a8311 Binary files /dev/null and b/soundtouch/.hg/00changelog.i differ diff --git a/soundtouch/.hg/branch b/soundtouch/.hg/branch new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/soundtouch/.hg/branch @@ -0,0 +1 @@ +default diff --git a/soundtouch/.hg/cache/branch2-served b/soundtouch/.hg/cache/branch2-served new file mode 100644 index 0000000..88fdd08 --- /dev/null +++ b/soundtouch/.hg/cache/branch2-served @@ -0,0 +1,2 @@ +40a147d16ab41c0fabc435aedad01e016268354a 1 +40a147d16ab41c0fabc435aedad01e016268354a o default diff --git a/soundtouch/.hg/cache/rbc-names-v1 b/soundtouch/.hg/cache/rbc-names-v1 new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/soundtouch/.hg/cache/rbc-names-v1 @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/soundtouch/.hg/cache/rbc-revs-v1 b/soundtouch/.hg/cache/rbc-revs-v1 new file mode 100644 index 0000000..0d302f1 Binary files /dev/null and b/soundtouch/.hg/cache/rbc-revs-v1 differ diff --git a/soundtouch/.hg/dirstate b/soundtouch/.hg/dirstate new file mode 100644 index 0000000..f923ec4 Binary files /dev/null and b/soundtouch/.hg/dirstate differ diff --git a/soundtouch/.hg/hgrc b/soundtouch/.hg/hgrc new file mode 100644 index 0000000..28a247f --- /dev/null +++ b/soundtouch/.hg/hgrc @@ -0,0 +1,14 @@ +# example repository config (see "hg help config" for more info) +[paths] +default = https://code.google.com/p/soundtouch/ + +# path aliases to other clones of this repo in URLs or filesystem paths +# (see "hg help config.paths" for more info) +# +# default-push = ssh://jdoe@example.net/hg/jdoes-fork +# my-fork = ssh://jdoe@example.net/hg/jdoes-fork +# my-clone = /home/jdoe/jdoes-clone + +[ui] +# name and email (local to this repository, optional), e.g. +# username = Jane Doe diff --git a/soundtouch/.hg/requires b/soundtouch/.hg/requires new file mode 100644 index 0000000..f634f66 --- /dev/null +++ b/soundtouch/.hg/requires @@ -0,0 +1,4 @@ +dotencode +fncache +revlogv1 +store diff --git a/soundtouch/.hg/store/00changelog.i b/soundtouch/.hg/store/00changelog.i new file mode 100644 index 0000000..d4f50bd Binary files /dev/null and b/soundtouch/.hg/store/00changelog.i differ diff --git a/soundtouch/.hg/store/00manifest.i b/soundtouch/.hg/store/00manifest.i new file mode 100644 index 0000000..470a580 Binary files /dev/null and b/soundtouch/.hg/store/00manifest.i differ diff --git a/soundtouch/.hg/store/data/trunk/_sound_touch.dll.i b/soundtouch/.hg/store/data/trunk/_sound_touch.dll.i new file mode 100644 index 0000000..1bab67d Binary files /dev/null and b/soundtouch/.hg/store/data/trunk/_sound_touch.dll.i differ diff --git a/soundtouch/.hg/store/data/trunk/soundtouch.py.i b/soundtouch/.hg/store/data/trunk/soundtouch.py.i new file mode 100644 index 0000000..0ef47c9 Binary files /dev/null and b/soundtouch/.hg/store/data/trunk/soundtouch.py.i differ diff --git a/soundtouch/.hg/store/fncache b/soundtouch/.hg/store/fncache new file mode 100644 index 0000000..d850bc7 --- /dev/null +++ b/soundtouch/.hg/store/fncache @@ -0,0 +1,2 @@ +data/trunk/soundtouch.py.i +data/trunk/SoundTouch.dll.i diff --git a/soundtouch/.hg/store/phaseroots b/soundtouch/.hg/store/phaseroots new file mode 100644 index 0000000..e69de29 diff --git a/soundtouch/.hg/store/undo b/soundtouch/.hg/store/undo new file mode 100644 index 0000000..69b13e5 Binary files /dev/null and b/soundtouch/.hg/store/undo differ diff --git a/soundtouch/.hg/store/undo.backupfiles b/soundtouch/.hg/store/undo.backupfiles new file mode 100644 index 0000000..ce173ce Binary files /dev/null and b/soundtouch/.hg/store/undo.backupfiles differ diff --git a/soundtouch/.hg/store/undo.phaseroots b/soundtouch/.hg/store/undo.phaseroots new file mode 100644 index 0000000..e69de29 diff --git a/soundtouch/.hg/undo.bookmarks b/soundtouch/.hg/undo.bookmarks new file mode 100644 index 0000000..e69de29 diff --git a/soundtouch/.hg/undo.branch b/soundtouch/.hg/undo.branch new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/soundtouch/.hg/undo.branch @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/soundtouch/.hg/undo.desc b/soundtouch/.hg/undo.desc new file mode 100644 index 0000000..d01e1d4 --- /dev/null +++ b/soundtouch/.hg/undo.desc @@ -0,0 +1,3 @@ +0 +pull +https://code.google.com/p/soundtouch/ diff --git a/soundtouch/.hg/undo.dirstate b/soundtouch/.hg/undo.dirstate new file mode 100644 index 0000000..e69de29 diff --git a/soundtouch/trunk/SoundTouch.dll b/soundtouch/trunk/SoundTouch.dll new file mode 100644 index 0000000..649b390 Binary files /dev/null and b/soundtouch/trunk/SoundTouch.dll differ diff --git a/soundtouch/trunk/SoundTouch.so b/soundtouch/trunk/SoundTouch.so new file mode 120000 index 0000000..dc153c3 --- /dev/null +++ b/soundtouch/trunk/SoundTouch.so @@ -0,0 +1 @@ +/usr/lib/libSoundTouch.so \ No newline at end of file diff --git a/soundtouch/trunk/libSoundTouch.so b/soundtouch/trunk/libSoundTouch.so new file mode 120000 index 0000000..dc153c3 --- /dev/null +++ b/soundtouch/trunk/libSoundTouch.so @@ -0,0 +1 @@ +/usr/lib/libSoundTouch.so \ No newline at end of file diff --git a/soundtouch/trunk/soundtouch.py b/soundtouch/trunk/soundtouch.py new file mode 100644 index 0000000..422ae1a --- /dev/null +++ b/soundtouch/trunk/soundtouch.py @@ -0,0 +1,176 @@ +import ctypes as _ctypes, os as _os + +def _setFuncType(func, res, *args): + func.restype = res + func.argtypes = args + +if _os.name == 'nt': + _lib = _ctypes.windll.LoadLibrary('SoundTouch') +elif _os.name == 'posix': + _lib = _ctypes.cdll.LoadLibrary('SoundTouch') + +_setFuncType(_lib.soundtouch_getVersionId, _ctypes.c_uint) +_setFuncType(_lib.soundtouch_getVersionString, _ctypes.c_char_p) + +_setFuncType(_lib.soundtouch_createInstance, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_destroyInstance, None, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_setRate, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setTempo, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setRateChange, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setTempoChange, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setPitch, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setPitchOctaves, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setPitchSemiTones, None, _ctypes.c_void_p, _ctypes.c_float) +_setFuncType(_lib.soundtouch_setChannels, None, _ctypes.c_void_p, _ctypes.c_uint) +_setFuncType(_lib.soundtouch_setSampleRate, None, _ctypes.c_void_p, _ctypes.c_uint) + +_setFuncType(_lib.soundtouch_flush, None, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_clear, None, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_numUnprocessedSamples, _ctypes.c_uint, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_numSamples, _ctypes.c_uint, _ctypes.c_void_p) +_setFuncType(_lib.soundtouch_isEmpty, _ctypes.c_int, _ctypes.c_void_p) + +_setFuncType(_lib.soundtouch_setSetting, _ctypes.c_int, _ctypes.c_void_p, _ctypes.c_int, _ctypes.c_int) +_setFuncType(_lib.soundtouch_getSetting, _ctypes.c_int, _ctypes.c_void_p, _ctypes.c_int) + +_setFuncType(_lib.soundtouch_putSamples, None, _ctypes.c_void_p, _ctypes.POINTER(_ctypes.c_float), _ctypes.c_uint) +_setFuncType(_lib.soundtouch_receiveSamples, _ctypes.c_uint, _ctypes.c_void_p, _ctypes.POINTER(_ctypes.c_float), _ctypes.c_uint) + + +#################################### + +def getVersionId(): + '''Get SoundTouch library version Id.''' + return _lib.soundtouch_getVersionId() + +def getVersionString(): + '''Get SoundTouch library version string.''' + return _lib.soundtouch_getVersionString() + +#################################### + +class SoundTouchInstance(object): + def __init__(self, numChannels, srate): + self.handle = _lib.soundtouch_createInstance() + self.setChannels(numChannels) + self.setSampleRate(srate) + + def __del__(self): + if _lib != None: + _lib.soundtouch_destroyInstance(self.handle) + + def setRate(self, newRate): + '''Sets new rate control value. Normal rate = 1.0, smaller values + represent slower rate, larger faster rates.''' + _lib.soundtouch_setRate(self.handle, newRate) + + def setTempo(self, newTempo): + '''Sets new tempo control value. Normal tempo = 1.0, smaller values + represent slower tempo, larger faster tempo.''' + _lib.soundtouch_setTempo(self.handle, newTempo) + + def setRateChange(self, newRate): + '''Sets new rate control value as a difference in percents compared + to the original rate (-50 .. +100 %).''' + _lib.soundtouch_setRateChange(self.handle, newRate) + + def setTempoChange(self, newTempo): + '''Sets new tempo control value as a difference in percents compared + to the original tempo (-50 .. +100 %).''' + _lib.soundtouch_setTempoChange(self.handle, newTempo) + + def setPitch(self, newPitch): + '''Sets new pitch control value. Original pitch = 1.0, smaller values + represent lower pitches, larger values higher pitch.''' + _lib.soundtouch_setPitch(self.handle, newPitch) + + def setPitchOctaves(self, newPitch): + '''Sets pitch change in octaves compared to the original pitch + (-1.00 .. +1.00).''' + _lib.soundtouch_setPitchOctaves(self.handle, newPitch) + + def setPitchSemiTones(self, newPitch): + '''Sets pitch change in semi-tones compared to the original pitch + (-12 .. +12).''' + _lib.soundtouch_setPitchSemiTones(self.handle, newPitch) + + def setChannels(self, numChannels): + '''Sets the number of channels, 1 = mono, 2 = stereo.''' + assert numChannels in (1, 2) + _lib.soundtouch_setChannels(self.handle, numChannels) + self.channels = numChannels + + def setSampleRate(self, srate): + '''Sets sample rate.''' + _lib.soundtouch_setSampleRate(self.handle, srate) + + def flush(self): + '''Flushes the last samples from the processing pipeline to the output. + Clears also the internal processing buffers. + + Note: This function is meant for extracting the last samples of a sound + stream. This function may introduce additional blank samples in the end + of the sound stream, and thus it's not recommended to call this function + in the middle of a sound stream.''' + _lib.soundtouch_flush(self.handle) + + def clear(self): + '''Clears all the samples in the object's output and internal processing + buffers.''' + _lib.soundtouch_clear(self.handle) + + def numUnprocessedSamples(self): + '''Returns number of samples currently unprocessed.''' + return _lib.soundtouch_numUnprocessedSamples(self.handle) + + def numSamples(self): + '''Returns number of samples currently available.''' + return _lib.soundtouch_numSamples(self.handle) + + def isEmpty(self): + '''Returns True if there aren't any samples available for outputting.''' + return _lib.soundtouch_isEmpty(self.handle) != 0 + + def setSetting(self, settingId, value): + '''Changes a setting controlling the processing system behaviour. See the + 'SETTING_...' defines for available setting ID's. + + Returns True if the setting was succesfully changed.''' + return _lib.soundtouch_setSetting(self.handle, settingId, value) != 0 + + def getSetting(self, settingId): + '''Reads a setting controlling the processing system behaviour. See the + 'SETTING_...' defines for available setting ID's. + + Returns the setting value.''' + return _lib.soundtouch_getSetting(self.handle, settingId) + + def putSamples(self, samples): + '''Adds samples (an iterable object of floats, in case of stereo-sound, + two floats for a complete sample) into the input of the object.''' + size = len(samples) + data = (_ctypes.c_float * size)(*samples) + _lib.soundtouch_putSamples(self.handle, data, size / self.channels) + + def receiveSamples(self, maxSamples): + '''Receive at max 'maxSamples' samples (an iterable object of floats, + in case of stereo-sound, two floats for a complete sample) from the + output of the object.''' + data = (_ctypes.c_float * (maxSamples * self.channels))() + size = _lib.soundtouch_receiveSamples(self.handle, data, maxSamples) + return data[: size * self.channels] + + +def createInstance(numChannels = 2, srate = 44100): + '''Create a new instance of SoundTouch processor.''' + return SoundTouchInstance(numChannels, srate) + +#################################### + +SETTING_USE_AA_FILTER = 0 +SETTING_AA_FILTER_LENGTH = 1 +SETTING_USE_QUICKSEEK = 2 +SETTING_SEQUENCE_MS = 3 +SETTING_SEEKWINDOW_MS = 4 +SETTING_OVERLAP_MS = 5 + -- cgit v1.2.3-70-g09d2