rswt API
The rswt module exports only a single class : WavTrigger
WavTrigger objects
class rswt.WavTrigger(device, timeout=5.0, baud=57600)- Create a new WavTrigger object. All parameter should be passed as keyword arguments.
device- name of serial porttimeout- timeout for reading from the serial portbaud- baudrate for the serial port
Raises : OSError
if opening the serial port failed, or reading from the WavTrigger times out
WavTrigger properties
WavTrigger.version- The version string returned from the device
WavTrigger.voices- The number of polyphonic voices the
WavTriggersupports WavTrigger.tracks- The number of tracks found on the SD-Card
Playing tracks
play(track)- Play a track from the SD-Card using one of the polyphonic voices of a
WavTrigger
track- the number of the track
solo(track)- Play a solo track from the SD-Card. Stops all polyphonic voices and plays the track in solo mode.
track- the number of the track
pause(track)- Pause a playing track.
track- the number of the track
resume(track)- Resume a paused track.
track- the number of the track
stop(track)- Stop a playing track
track- the number of the track
load(track)- load a track into memory and pause it. Tracks loaded with this method can be
played in sync when started with
resumeAll()
track- the number of the track
resumeAll()- start playing tracks that where loaded into memory with the
load(track)method. stopAll()- stop all playing tracks
loop(track)- loop the track when playing. The track will play in a loop even if it is
restarted after a
stop(track)orstopAll()command.
track- the number of the track
unLoop(track)- stop playing a track in a loop. If the track is playing when
unLoop(track)is called the track will play to the end and then stop.
track- the number of the track
playing()- returns a list of the currently playing tracks from the
WavTrigger. If no tracks are playing the empty list is returned.
Raises :OSErrorif theWavTriggerdoes not return valid data in the timespan set by the timeout.
Gain/Volume
trackVolume(track,volume)- set the volume for a track.
track- the number of the trackvolume- the new volume setting. The range of valid volume arguments is 0..100, resulting in a gain setting from -70dB to 0dB.
trackGain(track,gain)- set gain for a track.
track- the number of the trackgain- the new gain setting. The range of valid gain arguments is -70..+10. Gain values >0 might cause distortion in the output signal.
masterVolume(volume)- set volume for the WavTrigger output signal stage.
volume- the new volume setting. The range of valid volume arguments is 1..100, resulting in a gain setting from -70dB to 0dB.
masterGain(gain)- set the gain for the WavTrigger output signal stage.
gain- the new gain setting. The range of valid gain arguments is -70..+10. Gain values >0 might cause distortion in the output signal.
Effects
fade(track,volume,duration)- fade the volume for a track to a new level in the timespan given by
duration
track- the number of the trackvolume- the new volume level for the track. The range of valid volume arguments is 1..100, resulting in a gain setting from -70dB to 0dB.duration- the timespan in milliseconds for the fading effect
fadeOut(track,duration)- fade the volume for a track from its current level to zero, than stop the track.
track- the number of the trackduration- the timespan in milliseconds for the fade out
pitch(offset)- change the samplerate for the
WavTrigger.
offset- the offset of the samplerate. Vaildoffsetvalues are -32767..32767. Values below 0 cause the output signal to be pitched down. Value greater 0 raise the pitch.
Amplifier
amplifierOn()- Switch the onboard amplifier on
amplifierOff()- Switch the onboard amplifier off
rswt Project on Github
e.fahle@wayoda.org