| |
- exceptions.Exception
-
- SoundError
- SoundError
- __builtin__.object
-
- Input
- Mixer
- Output
- Resampler
- SpectrAnalyzer
class Mixer(__builtin__.object) |
|
Mixer( [ device_id ] ) -> mixer
Opens mixer device for access. |
|
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- getControls(...)
- get controls in a list.
Returned list contains dictionary with the following items:
.'destination' - destination name( playback or recording )
'connection' - name of connection for the control
'name' - name of the control( Line-In, Volume, etc )
'control'- control object
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x00848568>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Output(__builtin__.object) |
|
Output( frequency, channels, format[ ,deviceId ] )-> OutputSound
accepts raw strings of data and allows to control the playback through the following methods:
play()
pause()
unpause()
stop()
getPosition()
getChannels()
getRate()
getLeft()
getSpace()
getVolume() -> ( 0..0xffff )
Current volume level for sound channel
()
setVolume( volume ) -> None
Set volume level of sound channel
()
isPlaying() |
|
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- getChannels(...)
- getChannels() -> {1..n}
Returns number of channels that have been passed during the initialization
- getLeft(...)
- getLeft() -> secs
Number of seconds left in a buffer to play
- getPosition(...)
- getPosition() -> int
Returns position for the currently playing fragment.
Position is calculated from the last full stop. Pause does not considered as a stop
- getRate(...)
- getRate() -> rate
Current frequency rate
- getSpace(...)
- getSpace() -> secs
Number of seconds left in a buffer to enqueue without blocking
- getVolume(...)
- getVolume() -> ( 0..0xffff )
Current volume level for sound channel
- isPlaying(...)
- isPlaying() -> {0|1}
Whether sound is playing
- pause(...)
- pause() -> None
Pauses currently playing fragment
If fragment is not playing, it has effect
- play(...)
- play( fragment ) -> None
Play raw frangment using settings specified during output creation
- setVolume(...)
- setVolume( volume ) -> None
Set volume level of sound channel
- stop(...)
- stop() -> None
Stops currently played fragment
- unpause(...)
- unpause() -> None
Unpauses currently paused fragment
If fragment is not paused, it has no effect
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x008482D8>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Resampler(__builtin__.object) |
|
Resampler( (sample_rate_from, channels_from), (sample_rate_to, channels_to) ) -> Resampler
allows to convert audio streams between different sample rates and channels
The following considerations are made for the mutltichannel audio streams:
2 channels -> (left,right)
3 channels -> (left,right,sub)
4 channels -> (left_front,center,right_front,sub)
5 channels -> (left_front,center,right_front,left_back,right_back)
6 channels -> (left_front,center,right_front,left_back,right_back,sub)
The following methods available once you create Resampler instance:
resample() |
|
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- resample(...)
- resample( data ) -> data
string with resampled audio samples
Resamples audio stream from->to certain format.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x00848648>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class SpectrAnalyzer(__builtin__.object) |
|
SpectrAnalyzer( channels, samples_in, frequencies ) -> SpectAnalyzer
Allow to analyze audio stream for frequencies. It will convert audio samples with specified
number of channels into list of integers where every item represnts each frequency
in 0..sample_rate/4 interval.
For instance if you want 10 frequencies for 44100 KHz, the frequencies will be:
~1KHz ~2KHz ~3KHz ~4KHz ~5KHz ~6KHz ~7KHz ~8KHz ~9KHz ~10Khz
Also note that bass takes frequencies: 200-800 Hz, treble: 1400-10Khz
The following methods available for SpectrAnalyzer:
asFrequencies()
asBands() |
|
Methods defined here:
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- asBands(...)
- asBands( bandsNum, data ) -> [ (( lowFreq, value )*) ]
List of bands groupped by frequency.
All m frequencies will be splitted into bandNum bands accodring to number of octaves per band.
The result will be given as lists of tuples in which first two elements are frequency limits
to which value is computed.
It will be at least len( data ) / n elements in a list for every n samples in the input data.
If there is no enough data to fullfill the n samples, it will be right padded with zeroes.
IMPORTANT: Please note that only mono signals are supported at this time.
- asFrequencies(...)
- asFrequencies( data ) -> [ ( freqs* ) ]
List of frequency lists.
For every n( given as number of samples ) it returns
m frequencies. The result will contain list of lists of frequencies.
Number of lists will be len( data )/ n.
If there is no enough data to fullfill the n samples, it will be right padded with zeroes.
IMPORTANT: Please note that only mono signals are supported at this time.
Data and other attributes defined here:
- __new__ = <built-in method __new__ of type object at 0x00848738>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
|