audiofilters
– Support for audio filter effects
The audiofilters
module contains classes to provide access to audio filter effects.
The method of distortion used by the audiofilters.Distortion
effect.
Digital distortion effect which cuts off peaks at the top and bottom of the waveform.
Low-resolution digital distortion effect (bit depth reduction). You can use it to emulate the sound of early digital audio devices.
Emulates the warm distortion produced by a field effect transistor, which is commonly used in solid-state musical instrument amplifiers. The audiofilters.Distortion.drive
property has no effect in this mode.
Waveshaper distortions are used mainly by electronic musicians to achieve an extra-abrasive sound.
A Distortion effect
sound according to the DistortionMode.
The mix parameter allows you to change how much of the unchanged sample passes through to the output to how much of the effect audio you hear as the output.
drive (synthio.BlockInput) – Distortion power. Value can range from 0.0 to 1.0.
pre_gain (synthio.BlockInput) – Increases or decreases the volume before the effect, in decibels. Value can range from -60 to 60.
post_gain (synthio.BlockInput) – Increases or decreases the volume after the effect, in decibels. Value can range from -80 to 24.
mode (DistortionMode) – Distortion type.
soft_clip (bool) – Whether or not to soft clip (True) or hard clip (False) the output.
mix (synthio.BlockInput) – The mix as a ratio of the sample (0.0) to the effect (1.0).
buffer_size (int) – The total size in bytes of each of the two playback buffers to use
sample_rate (int) – The sample rate to be used
channel_count (int) – The number of channels the source samples contain. 1 = mono; 2 = stereo.
bits_per_sample (int) – The bits per sample of the effect
samples_signed (bool) – Effect is signed (True) or unsigned (False)
Playing adding a distortion to a synth:
import time import board import audiobusio import synthio import audiofilters audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22) synth = synthio.Synthesizer(channel_count=1, sample_rate=44100) effect = audiofilters.Distortion(drive=0.5, mix=1.0, buffer_size=1024, channel_count=1, sample_rate=44100) effect.play(synth) audio.play(effect) note = synthio.Note(261) while True: synth.press(note) time.sleep(0.25) synth.release(note) time.sleep(5)
Deinitialises the Distortion.
No-op used by Context Managers.
Automatically deinitializes when exiting a context. See Lifetime and ContextManagers for more info.
Distortion power. Value can range from 0.0 to 1.0.
Increases or decreases the volume before the effect, in decibels. Value can range from -60 to 60.
Increases or decreases the volume after the effect, in decibels. Value can range from -80 to 24.
Distortion type.
Whether or not to soft clip (True) or hard clip (False) the output.
The rate the filtered signal mix between 0 and 1 where 0 is only sample and 1 is all effect.
True when the effect is playing a sample. (read-only)
Plays the sample once when loop=False and continuously when loop=True. Does not block. Use playing
to block.
The sample must match the encoding settings given in the constructor.
Stops playback of the sample.
A Filter effect
created by a synthio.Synthesizer object. This can be used to generate a low-pass, high-pass, or band-pass filter.
The mix parameter allows you to change how much of the unchanged sample passes through to the output to how much of the effect audio you hear as the output.
filter (Optional[synthio.Biquad|Tuple[synthio.Biquad]]) – A normalized biquad filter object or tuple of normalized biquad filter objects. The sample is processed sequentially by each filter to produce the output samples.
mix (synthio.BlockInput) – The mix as a ratio of the sample (0.0) to the effect (1.0).
buffer_size (int) – The total size in bytes of each of the two playback buffers to use
sample_rate (int) – The sample rate to be used
channel_count (int) – The number of channels the source samples contain. 1 = mono; 2 = stereo.
bits_per_sample (int) – The bits per sample of the effect
samples_signed (bool) – Effect is signed (True) or unsigned (False)
Playing adding a filter to a synth:
import time import board import audiobusio import synthio import audiofilters audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22) synth = synthio.Synthesizer(channel_count=1, sample_rate=44100) effect = audiofilters.Filter(buffer_size=1024, channel_count=1, sample_rate=44100, mix=1.0) effect.filter = synth.low_pass_filter(frequency=2000, Q=1.25) effect.play(synth) audio.play(effect) note = synthio.Note(261) while True: synth.press(note) time.sleep(0.25) synth.release(note) time.sleep(5)
Deinitialises the Filter.
No-op used by Context Managers.
Automatically deinitializes when exiting a context. See Lifetime and ContextManagers for more info.
A normalized biquad filter object or tuple of normalized biquad filter objects. The sample is processed sequentially by each filter to produce the output samples.
The rate the filtered signal mix between 0 and 1 where 0 is only sample and 1 is all effect.
True when the effect is playing a sample. (read-only)
Plays the sample once when loop=False and continuously when loop=True. Does not block. Use playing
to block.
The sample must match the encoding settings given in the constructor.
Stops playback of the sample.
A Phaser effect
number of all-pass filter stages. This slightly delays the signal so that it is out of phase with the original signal. When the amount of phase is modulated and mixed back into the original signal with the mix parameter, it creates a distinctive phasing sound.
frequency (synthio.BlockInput) – The target frequency which is affected by the effect in hz.
stages (int) – The number of all-pass filters which will be applied to the signal.
feedback (synthio.BlockInput) – The amount that the previous output of the filters is mixed back into their input along with the unprocessed signal.
mix (synthio.BlockInput) – The mix as a ratio of the sample (0.0) to the effect (1.0).
buffer_size (int) – The total size in bytes of each of the two playback buffers to use
sample_rate (int) – The sample rate to be used
channel_count (int) – The number of channels the source samples contain. 1 = mono; 2 = stereo.
bits_per_sample (int) – The bits per sample of the effect
samples_signed (bool) – Effect is signed (True) or unsigned (False)
Playing adding a phaser to a synth:
import time import board import audiobusio import audiofilters import synthio audio = audiobusio.I2SOut(bit_clock=board.GP20, word_select=board.GP21, data=board.GP22) synth = synthio.Synthesizer(channel_count=1, sample_rate=44100) effect = audiofilters.Phaser(channel_count=1, sample_rate=44100) effect.frequency = synthio.LFO(offset=1000.0, scale=600.0, rate=0.5) effect.play(synth) audio.play(effect) synth.press(48)
Deinitialises the Phaser.
No-op used by Context Managers.
Automatically deinitializes when exiting a context. See Lifetime and ContextManagers for more info.
The target frequency in hertz at which the phaser is delaying the signal.
The amount of which the incoming signal is fed back into the phasing filters from 0.1 to 0.9.
The amount that the effect signal is mixed into the output between 0 and 1 where 0 is only the original sample and 1 is all effect.
The number of allpass filters to pass the signal through. More stages requires more processing but produces a more pronounced effect. Requires a minimum value of 1.
True when the effect is playing a sample. (read-only)
Plays the sample once when loop=False and continuously when loop=True. Does not block. Use playing
to block.
The sample must match the encoding settings given in the constructor.
Stops playback of the sample.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4