Yet Another Synthesizer Engine
 
Loading...
Searching...
No Matches
yase::AntiAlias Class Reference

#include <anti_alias.hh>

+ Inheritance diagram for yase::AntiAlias:
+ Collaboration diagram for yase::AntiAlias:

Detailed Description

An anti-aliasing filter.

This module wraps around other modules duplicating their inputs and providing a single output named "signal". The module works by running at twice the normal sample rate and using a biquad filter to filter out frequencies lower than half the sample rate. For example, to use it with a raw sawtooth oscillator, which is notorious for producing aliased frequencies, you would do

Saw raw_saw("raw");
AntiAlias saw(raw_saw);
Container container;
Audio audio;
container.connect(saw, "signal", audio, "left");
An anti-aliasing filter.
Definition anti_alias.hh:51
A module wrapper for a stereo PortAudio interface (http://www.portaudio.com/).
Definition audio.hh:46
A module and event manager that can contain other modules.
Definition container.hh:63
Container & connect(Module &source, string output, Module &dest, string input)
Definition container.cc:111
A sawtooth wave oscillator.
Definition saw.hh:40

Note that you should add the AntiAlias Module to whatever container you you building and not the underlying module. If you add both, you're underlying module will be updated twice per timestep.

Parameters
[in]*all parameters of underlying module
[out]signalthe anti-aliased output of the underlying module

Public Member Functions

 AntiAlias (Module &m)
 
void init ()
 
void update ()
 
void set (double frequency, double resonance)
 
- Public Member Functions inherited from yase::Module
virtual void init ()=0
 
virtual void update ()=0
 
int add_input (string name)
 
int add_output (string name)
 
int get_input_index (string name) const
 
string get_input_name (int index) const
 
string get_output_name (int index) const
 
int get_output_index (string name) const
 
void set_input (string name, double value)
 
void set_input (int index, double value)
 
double get_input (int index) const
 
double get_input (string name) const
 
double get_output (string name) const
 
double get_output (int index) const
 
void set_output (int index, double value)
 
void copy_inputs (const Module &source)
 
void copy_outputs (Module &destination) const
 
void configure (std::vector< std::tuple< string, double > > assignments)
 
int num_inputs () const
 
int num_outputs () const
 
void emit (Event e)
 
void set_ts (double s)
 
double get_ts ()
 

Constructor & Destructor Documentation

◆ AntiAlias()

yase::AntiAlias::AntiAlias ( Module m)

Construct an anti-aliased version the Module m. All inputs of m will be available to the resulting Module. The Module m must provide an output named "signal" which will be availabled to the resulting anti-aliased Module.

Parameters
mA Module to be anti-aliased

Member Function Documentation

◆ init()

void yase::AntiAlias::init ( )
virtual

This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.

Implements yase::Module.

◆ update()

void yase::AntiAlias::update ( )
virtual

This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.

Implements yase::Module.


The documentation for this class was generated from the following files: