mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
Version 4.2.1
This commit is contained in:
committed by
Stephen Sinclair
parent
a6381b9d38
commit
2cbce2d8bd
6
INSTALL
6
INSTALL
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people just choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.
|
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people just choose the classes they need for a particular project and copy those to their project directory. Others like to compile and link to a library of object files. STK was not designed with one particular style of use in mind.
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ Several options can be passed to configure, including:
|
|||||||
|
|
||||||
It is now possible to specify more than one Linux audio API. Note however that the ALSA library is required in order to compile the RtMidi class, even if the "--with-oss" option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/gary/rawwaves and /home/gary/include):
|
It is now possible to specify more than one Linux audio API. Note however that the ALSA library is required in order to compile the RtMidi class, even if the "--with-oss" option is provided (only the OSS audio API will be used, not the OSS MIDI API). Typing "./configure --help" will display all the available options. In addition, it is possible to specify the RAWWAVES and INCLUDE paths to configure as (ex. to set to /home/gary/rawwaves and /home/gary/include):
|
||||||
|
|
||||||
./configure RAWWAVE_PATH="/home/gary/rawwaves/"
|
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
|
||||||
./configure INCLUDE_PATH="/home/gary/include/"
|
./configure INCLUDE_PATH='$(HOME)/include/'
|
||||||
|
|
||||||
The ending "/" is required for the RAWWAVES path. The default behavior will set a relative path that works for the project files included with the distribution (assuming they are not moved). You can also change the RAWWAVE_PATH dynamically via the static Stk::setRawwavePath() function.
|
The ending "/" is required for the RAWWAVES path. The default behavior will set a relative path that works for the project files included with the distribution (assuming they are not moved). You can also change the RAWWAVE_PATH dynamically via the static Stk::setRawwavePath() function.
|
||||||
|
|
||||||
|
|||||||
4
README
4
README
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
|
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ WHAT'S NEW (AND NOT SO NEW):
|
|||||||
|
|
||||||
Despite being available in one form or another since 1996, we still consider STK to be alpha software. We attempt to maintain backward compatability but changes are sometimes made in an effort to improve the overall design or performance of the software. Please read the Release Notes to see what has changed since the last release.
|
Despite being available in one form or another since 1996, we still consider STK to be alpha software. We attempt to maintain backward compatability but changes are sometimes made in an effort to improve the overall design or performance of the software. Please read the Release Notes to see what has changed since the last release.
|
||||||
|
|
||||||
A new StkFrames class has been created to facilitate the handling and passing of multichannel, vectorized audio data. All STK classes have been updated to include tick() functions which accept StkFrames arguments.
|
A new StkFrames class has been created to facilitate the handling and passing of multichannel, vectorized audio data. All STK classes have been updated to include tick() functions that accept StkFrames arguments.
|
||||||
|
|
||||||
The control message handling scheme has been simplified greatly through the use of the Messager class. It is now possible to have access to simultaneous piped, socketed, and/or MIDI input control messages. In most cases, this should eliminate the use of the Md2Skini program.
|
The control message handling scheme has been simplified greatly through the use of the Messager class. It is now possible to have access to simultaneous piped, socketed, and/or MIDI input control messages. In most cases, this should eliminate the use of the Md2Skini program.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(STK, 4.2.0, gary@music.mcgill.ca, stk)
|
AC_INIT(STK, 4.2.1, gary@music.mcgill.ca, stk)
|
||||||
AC_CONFIG_SRCDIR(src/Stk.cpp)
|
AC_CONFIG_SRCDIR(src/Stk.cpp)
|
||||||
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile)
|
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile)
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
@@ -53,7 +53,7 @@ AC_ARG_ENABLE(debug,
|
|||||||
|
|
||||||
# Check compiler and use -Wall if gnu.
|
# Check compiler and use -Wall if gnu.
|
||||||
if test $GXX = "yes" ; then
|
if test $GXX = "yes" ; then
|
||||||
AC_SUBST( warn, ["-Wall -g -Woverloaded-virtual -D__GXX__"] )
|
AC_SUBST( warn, ["-Wall -g -D__GXX__"] )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $realtime = yes; then
|
if test $realtime = yes; then
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
Please read the file README and INSTALL for more general STK information.
|
Please read the file README and INSTALL for more general STK information.
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
Please read the file README and INSTALL for more general STK information.
|
Please read the file README and INSTALL for more general STK information.
|
||||||
|
|
||||||
Realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition.
|
Realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition.
|
||||||
|
|
||||||
It is necessary to install the OS X developer kit in order to compile STK. STK was successfully tested on OS X versions 10.2 and 10.3.
|
It is necessary to install the OS X developer kit in order to compile STK. STK was successfully tested on OS X versions 10.4.
|
||||||
|
|
||||||
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. The default STK sample rate is now 44100 Hz and all current example programs use this rate. However, it is possible to manually override this value in some programs from the command-line. The default sample rate is set in Stk.h. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
|
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. The default STK sample rate is now 44100 Hz and all current example programs use this rate. However, it is possible to manually override this value in some programs from the command-line. The default sample rate is set in Stk.h. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
Please read the file README and INSTALL for more general STK information.
|
Please read the file README and INSTALL for more general STK information.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
Please read the file README and INSTALL for more general STK information.
|
Please read the file README and INSTALL for more general STK information.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
Please read the file README for more general STK information.
|
Please read the file README for more general STK information.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,38 @@
|
|||||||
The Synthesis ToolKit in C++ (STK)
|
The Synthesis ToolKit in C++ (STK)
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
|
Future To Do:
|
||||||
|
- OSC server/client classes
|
||||||
|
- move various error checks, especially in tick() functions, into __DEBUG__ blocks?
|
||||||
|
- add WAVEFORMATEXTENSIBLE support to RtAudio
|
||||||
|
- add WAVEFORMATEXTENSIBLE support to WvIn/WvOut?
|
||||||
|
- better documentation
|
||||||
|
|
||||||
|
v4.2.1: (14 October 2005)
|
||||||
|
- greatly expanded StkFrames functionality (including interpolation and indexing by channel/frame)
|
||||||
|
- new Granulate granular synthesis class
|
||||||
|
- new Blit, BlitSaw, and BlitSquare bandlimited waveform classes (thanks to Robin Davies!)
|
||||||
|
- removed Table class ... all functionality (including interpolation) now in StkFrames and FileRead classes
|
||||||
|
- revised Socket class (now abstract) and added TcpServer, TcpClient, and UdpSocket subclasses
|
||||||
|
- added Stk::showWarnings() and Stk::printErrors() functions to dis/enable warning and error printouts
|
||||||
|
- extracted file I/O functionality to new FileRead and FileWrite classes
|
||||||
|
- revised WvIn / WvOut class structure (WvIn / WvOut now abstract and file I/O functionality in new FileWvIn / FileWvOut subclasses)
|
||||||
|
- new SineWave class which calculates its own static table of variable length (no rawwave dependency)
|
||||||
|
- new sinewave.raw file of length 1024 samples (used to be 256)
|
||||||
|
- TcpWvIn and TcpWvOut renamed InetWvIn and InetWvOut, with added support for UDP sockets
|
||||||
|
- fixed bug in WvOut tickFrame( const StkFrames &frames ) function
|
||||||
|
- fixed bug in demo.cpp when writing output soundfiles without realtime output
|
||||||
|
- added "binary" open flag to MidiFileIn class for Windows
|
||||||
|
- fixed oversized MAT-file header in WvOut.cpp
|
||||||
|
- fixed case statement bug in MidiFileIn.cpp for sysex
|
||||||
|
- added missing getDelay() function to DelayA.cpp
|
||||||
|
- fixed modDepth omission in Chorus.cpp
|
||||||
|
- fixed DC blocker initialization bug in Flute.cpp
|
||||||
|
- changed Filter class behavior so no default clearing of state when changing coefficients
|
||||||
|
- bug fixes to RtAudio, especially for Windows DirectSound and ASIO (thanks to Robin Davies)
|
||||||
|
- bug fixes to RtMidi, especially for Linux (thanks to Pedro Pedro Lopez-Cabanillas)
|
||||||
|
|
||||||
|
|
||||||
v4.2.0: (4 October 2004)
|
v4.2.0: (4 October 2004)
|
||||||
- simultaneous multiple audio APIs supported at compile time
|
- simultaneous multiple audio APIs supported at compile time
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# Doxyfile 1.3.6
|
# Doxyfile 1.4.4
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Project related configuration options
|
# Project related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
PROJECT_NAME = STK
|
PROJECT_NAME = STK
|
||||||
PROJECT_NUMBER = 4.2.0
|
PROJECT_NUMBER = 4.2.1
|
||||||
OUTPUT_DIRECTORY = .
|
OUTPUT_DIRECTORY = .
|
||||||
|
CREATE_SUBDIRS = NO
|
||||||
OUTPUT_LANGUAGE = English
|
OUTPUT_LANGUAGE = English
|
||||||
USE_WINDOWS_ENCODING = NO
|
USE_WINDOWS_ENCODING = NO
|
||||||
BRIEF_MEMBER_DESC = YES
|
BRIEF_MEMBER_DESC = YES
|
||||||
@@ -15,12 +16,14 @@ ALWAYS_DETAILED_SEC = NO
|
|||||||
INLINE_INHERITED_MEMB = NO
|
INLINE_INHERITED_MEMB = NO
|
||||||
FULL_PATH_NAMES = NO
|
FULL_PATH_NAMES = NO
|
||||||
STRIP_FROM_PATH =
|
STRIP_FROM_PATH =
|
||||||
|
STRIP_FROM_INC_PATH =
|
||||||
SHORT_NAMES = NO
|
SHORT_NAMES = NO
|
||||||
JAVADOC_AUTOBRIEF = NO
|
JAVADOC_AUTOBRIEF = NO
|
||||||
MULTILINE_CPP_IS_BRIEF = NO
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
DETAILS_AT_TOP = YES
|
DETAILS_AT_TOP = YES
|
||||||
INHERIT_DOCS = YES
|
INHERIT_DOCS = NO
|
||||||
DISTRIBUTE_GROUP_DOC = NO
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
TAB_SIZE = 9
|
TAB_SIZE = 9
|
||||||
ALIASES =
|
ALIASES =
|
||||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||||
@@ -31,12 +34,13 @@ SUBGROUPING = YES
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
EXTRACT_ALL = NO
|
EXTRACT_ALL = NO
|
||||||
EXTRACT_PRIVATE = NO
|
EXTRACT_PRIVATE = NO
|
||||||
EXTRACT_STATIC = YES
|
EXTRACT_STATIC = NO
|
||||||
EXTRACT_LOCAL_CLASSES = YES
|
EXTRACT_LOCAL_CLASSES = NO
|
||||||
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
HIDE_UNDOC_MEMBERS = YES
|
HIDE_UNDOC_MEMBERS = YES
|
||||||
HIDE_UNDOC_CLASSES = YES
|
HIDE_UNDOC_CLASSES = YES
|
||||||
HIDE_FRIEND_COMPOUNDS = NO
|
HIDE_FRIEND_COMPOUNDS = YES
|
||||||
HIDE_IN_BODY_DOCS = NO
|
HIDE_IN_BODY_DOCS = YES
|
||||||
INTERNAL_DOCS = NO
|
INTERNAL_DOCS = NO
|
||||||
CASE_SENSE_NAMES = YES
|
CASE_SENSE_NAMES = YES
|
||||||
HIDE_SCOPE_NAMES = NO
|
HIDE_SCOPE_NAMES = NO
|
||||||
@@ -52,6 +56,8 @@ GENERATE_DEPRECATEDLIST= YES
|
|||||||
ENABLED_SECTIONS =
|
ENABLED_SECTIONS =
|
||||||
MAX_INITIALIZER_LINES = 30
|
MAX_INITIALIZER_LINES = 30
|
||||||
SHOW_USED_FILES = YES
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = YES
|
||||||
|
FILE_VERSION_FILTER =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to warning and progress messages
|
# configuration options related to warning and progress messages
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -59,6 +65,7 @@ QUIET = NO
|
|||||||
WARNINGS = YES
|
WARNINGS = YES
|
||||||
WARN_IF_UNDOCUMENTED = YES
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
WARN_IF_DOC_ERROR = YES
|
WARN_IF_DOC_ERROR = YES
|
||||||
|
WARN_NO_PARAMDOC = NO
|
||||||
WARN_FORMAT = "$file:$line: $text"
|
WARN_FORMAT = "$file:$line: $text"
|
||||||
WARN_LOGFILE =
|
WARN_LOGFILE =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -69,7 +76,7 @@ INPUT = . \
|
|||||||
FILE_PATTERNS = *.txt \
|
FILE_PATTERNS = *.txt \
|
||||||
*.msg \
|
*.msg \
|
||||||
*.h
|
*.h
|
||||||
RECURSIVE = YES
|
RECURSIVE = NO
|
||||||
EXCLUDE = ../../src/asio
|
EXCLUDE = ../../src/asio
|
||||||
EXCLUDE_SYMLINKS = NO
|
EXCLUDE_SYMLINKS = NO
|
||||||
EXCLUDE_PATTERNS =
|
EXCLUDE_PATTERNS =
|
||||||
@@ -78,20 +85,22 @@ EXAMPLE_PATTERNS =
|
|||||||
EXAMPLE_RECURSIVE = NO
|
EXAMPLE_RECURSIVE = NO
|
||||||
IMAGE_PATH =
|
IMAGE_PATH =
|
||||||
INPUT_FILTER =
|
INPUT_FILTER =
|
||||||
|
FILTER_PATTERNS =
|
||||||
FILTER_SOURCE_FILES = NO
|
FILTER_SOURCE_FILES = NO
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to source browsing
|
# configuration options related to source browsing
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
SOURCE_BROWSER = YES
|
SOURCE_BROWSER = NO
|
||||||
INLINE_SOURCES = YES
|
INLINE_SOURCES = NO
|
||||||
STRIP_CODE_COMMENTS = YES
|
STRIP_CODE_COMMENTS = YES
|
||||||
REFERENCED_BY_RELATION = YES
|
REFERENCED_BY_RELATION = NO
|
||||||
REFERENCES_RELATION = YES
|
REFERENCES_RELATION = NO
|
||||||
|
USE_HTAGS = NO
|
||||||
VERBATIM_HEADERS = YES
|
VERBATIM_HEADERS = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the alphabetical class index
|
# configuration options related to the alphabetical class index
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ALPHABETICAL_INDEX = NO
|
ALPHABETICAL_INDEX = YES
|
||||||
COLS_IN_ALPHA_INDEX = 5
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
IGNORE_PREFIX =
|
IGNORE_PREFIX =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
@@ -167,7 +176,7 @@ PERLMOD_MAKEVAR_PREFIX =
|
|||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the preprocessor
|
# Configuration options related to the preprocessor
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
ENABLE_PREPROCESSING = YES
|
ENABLE_PREPROCESSING = NO
|
||||||
MACRO_EXPANSION = NO
|
MACRO_EXPANSION = NO
|
||||||
EXPAND_ONLY_PREDEF = NO
|
EXPAND_ONLY_PREDEF = NO
|
||||||
SEARCH_INCLUDES = YES
|
SEARCH_INCLUDES = YES
|
||||||
@@ -192,18 +201,22 @@ HIDE_UNDOC_RELATIONS = YES
|
|||||||
HAVE_DOT = NO
|
HAVE_DOT = NO
|
||||||
CLASS_GRAPH = YES
|
CLASS_GRAPH = YES
|
||||||
COLLABORATION_GRAPH = YES
|
COLLABORATION_GRAPH = YES
|
||||||
|
GROUP_GRAPHS = YES
|
||||||
UML_LOOK = NO
|
UML_LOOK = NO
|
||||||
TEMPLATE_RELATIONS = NO
|
TEMPLATE_RELATIONS = NO
|
||||||
INCLUDE_GRAPH = YES
|
INCLUDE_GRAPH = YES
|
||||||
INCLUDED_BY_GRAPH = YES
|
INCLUDED_BY_GRAPH = YES
|
||||||
CALL_GRAPH = NO
|
CALL_GRAPH = NO
|
||||||
GRAPHICAL_HIERARCHY = YES
|
GRAPHICAL_HIERARCHY = YES
|
||||||
|
DIRECTORY_GRAPH = YES
|
||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
DOT_PATH =
|
DOT_PATH = /sw/bin
|
||||||
DOTFILE_DIRS =
|
DOTFILE_DIRS =
|
||||||
MAX_DOT_GRAPH_WIDTH = 1024
|
MAX_DOT_GRAPH_WIDTH = 1024
|
||||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||||
MAX_DOT_GRAPH_DEPTH = 0
|
MAX_DOT_GRAPH_DEPTH = 0
|
||||||
|
DOT_TRANSPARENT = NO
|
||||||
|
DOT_MULTI_TARGETS = NO
|
||||||
GENERATE_LEGEND = YES
|
GENERATE_LEGEND = YES
|
||||||
DOT_CLEANUP = YES
|
DOT_CLEANUP = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -5,9 +5,21 @@ The Synthesis ToolKit can be used in a variety of ways, depending on your partic
|
|||||||
|
|
||||||
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
\section rtvsnonrt "Realtime" vs. "Non-Realtime"
|
||||||
|
|
||||||
Most of the Synthesis ToolKit classes are platform independent. That means that they should compile on any reasonably current C++ compiler. The functionality needed for realtime audio and MIDI input/output, as well as realtime control message acquistion, is inherently platform and operating-system (OS) <I>dependent</I>. STK classes which require specific platform/OS support include RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, Thread, and Mutex. These classes currently can only be compiled on Linux, Irix, Macintosh OS X, and Windows systems.
|
Most of the Synthesis ToolKit classes are platform independent. That
|
||||||
|
means that they should compile on any reasonably current C++ compiler.
|
||||||
|
The functionality needed for realtime audio and MIDI input/output, as
|
||||||
|
well as realtime control message acquistion, is inherently platform
|
||||||
|
and operating-system (OS) <I>dependent</I>. STK classes which require
|
||||||
|
specific platform/OS support include RtAudio, RtWvOut, RtWvIn,
|
||||||
|
RtDuplex, RtMidi, InetWvIn, InetWvOut, Socket, UdpSocket, TcpServer,
|
||||||
|
TcpClient, Thread, and Mutex. These classes currently can only be
|
||||||
|
compiled on Linux, Irix, Macintosh OS X, and Windows systems.
|
||||||
|
|
||||||
Without the "realtime" classes, it is still possible to read SKINI scorefiles for control input and to read and write to/from a variety of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If compiling for a "little-endian" host processor, the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
Without the "realtime" classes, it is still possible to read SKINI
|
||||||
|
scorefiles for control input and to read and write to/from a variety
|
||||||
|
of audio file formats (WAV, SND, AIFF, MAT-file, and RAW). If
|
||||||
|
compiling for a "little-endian" host processor, the
|
||||||
|
<TT>__LITTLE_ENDIAN__</TT> preprocessor definition should be provided.
|
||||||
|
|
||||||
|
|
||||||
\section unix Unix Systems:
|
\section unix Unix Systems:
|
||||||
@@ -28,6 +40,12 @@ STK compiles with realtime support on the following flavors of the Unix operatin
|
|||||||
<TD>__LINUX_ALSA__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
<TD>__LINUX_ALSA__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||||
<TD><TT>asound, pthread</TT></TD>
|
<TD><TT>asound, pthread</TT></TD>
|
||||||
</TR>
|
</TR>
|
||||||
|
<TR>
|
||||||
|
<TD>Linux</TD>
|
||||||
|
<TD>Jack (audio only, use ALSA for MIDI support)</TD>
|
||||||
|
<TD>__LINUX_JACK__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
|
||||||
|
<TD><TT>asound, pthread</TT></TD>
|
||||||
|
</TR>
|
||||||
<TR>
|
<TR>
|
||||||
<TD>Linux</TD>
|
<TD>Linux</TD>
|
||||||
<TD>OSS (audio only, use ALSA for MIDI support)</TD>
|
<TD>OSS (audio only, use ALSA for MIDI support)</TD>
|
||||||
@@ -51,9 +69,18 @@ STK compiles with realtime support on the following flavors of the Unix operatin
|
|||||||
|
|
||||||
The available C++ compilers on any of these systems can vary.
|
The available C++ compilers on any of these systems can vary.
|
||||||
|
|
||||||
One approach in using STK is to simply copy the class files needed for a particular program into a project directory. Taking the <TT>sineosc.cpp</TT> example from the previous tutorial chapter, it would be necessary to set up a directory that includes the files <TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a subdirectory called <TT>rawwaves</TT>, and the header and source files for the classes Stk, WvIn, WaveLoop, and WvOut. The program could then be compiled on a little-endian system, such as a PC running Linux, using the GNU g++ compiler as follows:
|
One approach in using STK is to simply copy the class files needed for
|
||||||
|
a particular program into a project directory. Taking the
|
||||||
|
<TT>sineosc.cpp</TT> example from the previous tutorial chapter, it
|
||||||
|
would be necessary to set up a directory that includes the files
|
||||||
|
<TT>sineosc.cpp</TT>, the rawwave file <TT>sinewave.raw</TT> in a
|
||||||
|
subdirectory called <TT>rawwaves</TT>, and the header and source files
|
||||||
|
for the classes Stk, FileRead, FileWrite, WvIn, FileWvIn, WaveLoop,
|
||||||
|
WvOut, and FileWvOut. The program could then be compiled on a
|
||||||
|
little-endian system, such as a PC running Linux, using the GNU g++
|
||||||
|
compiler as follows:
|
||||||
\code
|
\code
|
||||||
g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp sineosc.cpp
|
g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc Stk.cpp FileRead.cpp FileWrite.cpp WvIn.cpp FileWvIn.cpp WaveLoop.cpp WvOut.cpp FileWvOut.cpp sineosc.cpp
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
Note that the <TT>sineosc.cpp</TT> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
|
Note that the <TT>sineosc.cpp</TT> example does not make use of realtime audio or MIDI input/output classes. For programs using any of the STK realtime classes mentioned above, it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks.
|
||||||
@@ -75,7 +102,7 @@ With the header files in a standard search path, it is possible to modify the <T
|
|||||||
|
|
||||||
\code
|
\code
|
||||||
#include "stk/WaveLoop.h"
|
#include "stk/WaveLoop.h"
|
||||||
#include "stk/WvOut.h"
|
#include "stk/FileWvOut.h"
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
and then compile without an explicit include path argument to the compiler:
|
and then compile without an explicit include path argument to the compiler:
|
||||||
@@ -87,13 +114,22 @@ g++ -Wall -D__LITTLE_ENDIAN__ -o sineosc sineosc.cpp -lstk
|
|||||||
|
|
||||||
\section compileWin Windows:
|
\section compileWin Windows:
|
||||||
|
|
||||||
STK has been tested on Windows platforms using the Visual C++ compiler only. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies.
|
STK has been tested on Windows platforms using the Visual C++ compiler
|
||||||
|
only. It is assumed here that you're familiar with Visual C++ and its
|
||||||
|
particular idiosyncrasies.
|
||||||
|
|
||||||
The approach when using Visual C++ is to build a project which includes the necessary ToolKit files from the distribution <TT>src</TT> and <TT>include</TT> directories. For the example program from the previous tutorial chapter, create a VC++ console application project, add the Stk, WvIn, WaveLoop, and WvOut class files, as well as <TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is in the subdirectory <TT>rawwaves</TT>.
|
The approach when using Visual C++ is to build a project which
|
||||||
|
includes the necessary ToolKit files from the distribution
|
||||||
|
<TT>src</TT> and <TT>include</TT> directories. For the example
|
||||||
|
program from the previous tutorial chapter, create a VC++ console
|
||||||
|
application project, add the Stk, FileRead, FileWrite, WvIn, FileWvIn,
|
||||||
|
WaveLoop, WvOut, and FileWvOut class files, as well as
|
||||||
|
<TT>sineosc.cpp</TT>, and make sure the <TT>sinewave.raw</TT> file is
|
||||||
|
in the subdirectory <TT>rawwaves</TT>.
|
||||||
|
|
||||||
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT>, <TT>__WINDOWS_DS__</TT>, and <TT>__WINDOWS_MM__</TT> preprocessor definitions.
|
For programs using any of the STK realtime classes mentioned above, it is necessary to link with the DirectSound (<TT>dsound.lib</TT>), <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries, select the multithreaded library, and provide the <TT>__LITTLE_ENDIAN__</TT>, <TT>__WINDOWS_DS__</TT>, and <TT>__WINDOWS_MM__</TT> preprocessor definitions.
|
||||||
|
|
||||||
For Steinberg ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition (and the <TT>__WINDOWS_MM__</TT> definition for RtMidi support), include all the files in the <TT>src/asio/</TT> directory (i.e., <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries.
|
For Steinberg ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition (and the <TT>__WINDOWS_MM__</TT> definition for RtMidi support), include all the files in the <TT>src/asio/</TT> directory (i.e., <TT>asio.h,cpp</TT>, <TT>asiodrivers.h,cpp</TT>, ...), and link with the <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries.
|
||||||
|
|
||||||
[<A HREF="filtering.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="filtering.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,5 +39,5 @@ Only a few basic SKINI message type case statements are included in this example
|
|||||||
|
|
||||||
This example could also be easily extended to accept "realtime" control input messages via pipe, socket or MIDI connections. The Messager class provides Messager::startStdInput(), Messager::startSocketInput(), and Messager::startMidiInput() functions for this purpose.
|
This example could also be easily extended to accept "realtime" control input messages via pipe, socket or MIDI connections. The Messager class provides Messager::startStdInput(), Messager::startSocketInput(), and Messager::startMidiInput() functions for this purpose.
|
||||||
|
|
||||||
[<A HREF="multichannel.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="multichannel.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ The \c main() function blocks at the std::cin.get() call until the user hits the
|
|||||||
|
|
||||||
\section callback Blocking vs. Callbacks
|
\section callback Blocking vs. Callbacks
|
||||||
|
|
||||||
Prior to version 4.2.0, all STK example projects and programs used blocking audio input/output functionality (typically with the RtWvIn, RtWvOut, or RtDuplex classes). In many instances, a blocking scheme results in a clearer and more straight forward program structure. Within a graphical user interface (GUI) programming context, however, callback routines are often more natural.
|
Prior to version 4.2.0, all STK example projects and programs used blocking audio input/output functionality (typically with the RtWvIn, RtWvOut, or RtDuplex classes). In many instances, a blocking scheme results in a clearer and more straight-forward program structure. Within a graphical user interface (GUI) programming context, however, callback routines are often more natural.
|
||||||
|
|
||||||
The RtAudio class provides both blocking and callback routines for all supported audio APIs. It should be noted that it is easy to embed blocking calls within a thread to create "callback-like" functionality. In fact, this is what RtAudio does for those audio APIs which are naturally based on blocking routines (Linux ALSA and OSS, SGI Irix, and Windows DirectSound). It is much more difficult to make an inherently callback-based system work like a blocking scheme. RtAudio attempts to do this with the Linux JACK, Macintosh OS-X CoreAudio, and Windows ASIO APIs, but the result is not fully robust (audio over/underruns are more likely to occur).
|
The RtAudio class provides both blocking and callback routines for all supported audio APIs. It should be noted that it is easy to embed blocking calls within a thread to create "callback-like" functionality. In fact, this is what RtAudio does for those audio APIs which are naturally based on blocking routines (Linux ALSA and OSS, SGI Irix, and Windows DirectSound). It is much more difficult to make an inherently callback-based system work like a blocking scheme. RtAudio attempts to do this with the Linux JACK, Macintosh OS-X CoreAudio, and Windows ASIO APIs, but the result is not fully robust (audio over/underruns are more likely to occur).
|
||||||
|
|
||||||
In order to allow all STK programs to function with equal proficiency on all supported computer platforms, a decision was made to modify the example projects to use audio callback routines. The result is a more complicated code structure, which is unfortunate given that we generally strive to make STK code as clear as possible for educational purposes. This was especially an issue with the demo program because it is designed to function in both realtime and non-realtime contexts. The use of global variables has been avoided by defining data structures to hold all variables which must be accessible to the callback routine and other functions. Alternative schemes for making control updates could be designed depending on particular program needs and constraints.
|
In order to allow all STK programs to function with equal proficiency on all supported computer platforms, a decision was made to modify the example projects to use audio callback routines. The result is a more complicated code structure, which is unfortunate given that we generally strive to make STK code as clear as possible for educational purposes. This was especially an issue with the demo program because it is designed to function in both realtime and non-realtime contexts. The use of global variables has been avoided by defining data structures to hold all variables which must be accessible to the callback routine and other functions. Alternative schemes for making control updates could be designed depending on particular program needs and constraints.
|
||||||
|
|
||||||
[<A HREF="instruments.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="instruments.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,15 +1,42 @@
|
|||||||
/*! \page download Download and Release Notes
|
/*! \page download Download, Release Notes, and Bug Fixes
|
||||||
|
|
||||||
|
\section down Download Version 4.2.1 (14 October 2005):
|
||||||
|
|
||||||
<B>Version 4.2.0, 4 October 2004</B><P>
|
|
||||||
<UL>
|
<UL>
|
||||||
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.2.0.tar.gz">Source distribution</A></LI>
|
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.2.1.tar.gz">Source distribution</A></LI>
|
||||||
<LI><A HREF="http://www-ccrma.stanford.edu/software/stk/release/stk-4.2.0.binaries.tar.gz">Source with precompiled Windows binaries</A></LI>
|
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.2.1.binaries.tar.gz">Source with precompiled Windows binaries</A></LI>
|
||||||
<LI><A HREF="http://www-ccrma.stanford.edu/planetccrma/software/">Linux RPMs from Planet CCRMA</A></LI>
|
<LI><A HREF="http://ccrma.stanford.edu/planetccrma/software/">Linux RPMs from Planet CCRMA</A></LI>
|
||||||
</UL>
|
</UL>
|
||||||
|
|
||||||
|
|
||||||
\section notes Release Notes:
|
\section notes Release Notes:
|
||||||
|
|
||||||
|
\subsection v4dot2dot1 Version 4.2.1
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Greatly expanded StkFrames functionality (including interpolation and indexing by channel/frame).</li>
|
||||||
|
<li>New Blit, BlitSaw, and BlitSquare bandlimited waveform classes (thanks to Robin Davies!).</li>
|
||||||
|
<li>New Granulate granular synthesis class.</li>
|
||||||
|
<li>Removed Table class ... all functionality (including interpolation) now in StkFrames and FileRead classes.</li>
|
||||||
|
<li>Revised Socket class (now abstract) and added TcpServer, TcpClient, and UdpSocket subclasses.</li>
|
||||||
|
<li>Added Stk::showWarnings() and Stk::printErrors() functions to dis/enable warning and error printouts.</li>
|
||||||
|
<li>Extracted file I/O functionality to FileRead and FileWrite classes.</li>
|
||||||
|
<li>Revised WvIn / WvOut class structure (WvIn / WvOut now abstract and file I/O functionality in new FileWvIn / FileWvOut subclasses).</li>
|
||||||
|
<li>New SineWave class which calculates its own static table of variable length (no rawwave dependency).</li>
|
||||||
|
<li>New sinewave.raw file of length 1024 samples (used to be 256).</li>
|
||||||
|
<li>TcpWvIn and TcpWvOut renamed InetWvIn and InetWvOut, with added support for UDP sockets.</li>
|
||||||
|
<li>Fixed bug in WvOut tickFrame( const StkFrames &frames ) function.</li>
|
||||||
|
<li>Fixed bug in demo.cpp when writing output soundfiles without realtime output.</li>
|
||||||
|
<li>Added "binary" open flag to MidiFileIn class for Windows.</li>
|
||||||
|
<li>Fixed oversized MAT-file header in WvOut.cpp</li>
|
||||||
|
<li>Fixed case statement bug in MidiFileIn.cpp for sysex.</li>
|
||||||
|
<li>Added missing getDelay() function to DelayA.cpp.</li>
|
||||||
|
<li>Fixed modDepth omission in Chorus.cpp.</li>
|
||||||
|
<li>Fixed DC blocker initialization bug in Flute.cpp.</li>
|
||||||
|
<li>Changed Filter class behavior so no default clearing of state when changing coefficients.</li>
|
||||||
|
<li>Fixes to RtAudio, especially for Windows DirectSound and ASIO (thanks to Robin Davies).</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
\subsection v4dot2dot0 Version 4.2.0
|
\subsection v4dot2dot0 Version 4.2.0
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ In this section, we demonstrate the use of a few of the STK filter classes. The
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
StkFrames output( 20 ); // initialize StkFrames to 20 elements (defaults: 1 channel, interleaved)
|
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||||
output[0] = 1.0;
|
output[0] = 1.0;
|
||||||
|
|
||||||
std::vector<StkFloat> numerator( 5, 0.1 ); // create and initialize numerator coefficients
|
std::vector<StkFloat> numerator( 5, 0.1 ); // create and initialize numerator coefficients
|
||||||
@@ -46,7 +46,7 @@ The STK BiQuad and TwoPole classes provide functionality for creating resonance
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
StkFrames output( 20 ); // initialize StkFrames to 20 elements (defaults: 1 channel, interleaved)
|
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||||
Noise noise;
|
Noise noise;
|
||||||
|
|
||||||
BiQuad biquad;
|
BiQuad biquad;
|
||||||
@@ -69,7 +69,7 @@ By passing a boolian value of \c true as the third argument to the BiQuad::setRe
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
StkFrames output( 20 ); // initialize StkFrames to 20 elements (defaults: 1 channel, interleaved)
|
StkFrames output( 20, 1 ); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||||
Noise noise;
|
Noise noise;
|
||||||
|
|
||||||
BiQuad biquad;
|
BiQuad biquad;
|
||||||
@@ -84,5 +84,5 @@ int main()
|
|||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
[<A HREF="realtime.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="realtime.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
||||||
<tr><td>©1995-2004 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
<tr><td>©1995-2005 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</BODY>
|
</BODY>
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ int main()
|
|||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
Nearly all STK classes implement <TT>tick()</TT> functions which take and/or return sample values. Within the <TT>tick()</TT> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <TT>tick()</TT> method takes/returns each sample "by value". In addition, every class implementing a <TT>tick()</TT> function also provides one or more overloaded <TT>tick()</TT> functions which can be used for vectorized computations, as shown in the next example.
|
Nearly all STK classes implement <TT>tick()</TT> functions that take and/or return sample values. Within the <TT>tick()</TT> function, the fundamental sample calculations are performed for a given class. Most STK classes consume/generate a single sample per operation and their <TT>tick()</TT> method takes/returns each sample "by value". In addition, every class implementing a <TT>tick()</TT> function also provides one or more overloaded <TT>tick()</TT> functions which can be used for vectorized computations, as shown in the next example.
|
||||||
|
|
||||||
\code
|
\code
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
StkFrames output(20); // initialize StkFrames to 20 elements (defaults: 1 channel, interleaved)
|
StkFrames output(20, 1); // initialize StkFrames to 20 frames and 1 channel (default: interleaved)
|
||||||
Noise noise;
|
Noise noise;
|
||||||
|
|
||||||
noise.tick( output );
|
noise.tick( output );
|
||||||
@@ -44,20 +44,20 @@ int main()
|
|||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
In this way, it might be possible to achieve improved processing efficiency using vectorized computations. The StkFrames class is a new addition to the ToolKit to provide a general "mechanism" for handling and passing vectorized, multi-channel audio data. The StkFrames "type" provides functions to set and/or determine the number of audio channels and sample frames it holds, as well as the format (interleaved or non-interleaved) of its data.
|
In this way, it might be possible to achieve improved processing efficiency using vectorized computations. The StkFrames class is a relatively new addition to the ToolKit to provide a general "mechanism" for handling and passing vectorized, multi-channel audio data. The StkFrames "type" provides functions to set and/or determine the number of audio channels and sample frames it holds, as well as the format (interleaved or non-interleaved) of its data. Further, the StkFrames class provides data interpolation and subscripting functionality by frame/channel values.
|
||||||
|
|
||||||
\section STK Inheritance:
|
\section STK Inheritance:
|
||||||
|
|
||||||
Nearly all STK classes inherit from the Stk abstract base class, which provides common functionality related to error reporting, sample rate control, and byte swapping. Several other base classes exist which roughly group many of the classes according to function as follows:
|
Nearly all STK classes inherit from the Stk abstract base class, which provides common functionality related to error reporting, sample rate control, and byte swapping. Several other base classes exist which roughly group many of the classes according to function as follows:
|
||||||
|
|
||||||
- Generator: source signal unit generator classes [Envelope, ADSR, Asymp, Noise, SubNoise, Modulate, SingWave]
|
- Generator: source signal unit generator classes [Envelope, ADSR, Asymp, Noise, SubNoise, Modulate, SingWave, SineWave Blit, BlitSaw, BlitSquare, Granulate]
|
||||||
- Filter: digital filtering classes [OneZero, OnePole, PoleZero, TwoZero, TwoPole, BiQuad, FormSwep, Delay, DelayL, DelayA]
|
- Filter: digital filtering classes [OneZero, OnePole, PoleZero, TwoZero, TwoPole, BiQuad, FormSwep, Delay, DelayL, DelayA]
|
||||||
- Function: input to output function mappings [Table, BowTable, JetTable, ReedTable]
|
- Function: input to output function mappings [BowTable, JetTable, ReedTable]
|
||||||
- Instrmnt: sound synthesis algorithms, including physical, FM, modal, and particle models
|
- Instrmnt: sound synthesis algorithms, including physical, FM, modal, and particle models
|
||||||
- Effect: sound processing effect classes [Echo, Chorus, PitShift, PRCRev, JCRev, NRev]
|
- Effect: sound processing effect classes [Echo, Chorus, PitShift, PRCRev, JCRev, NRev]
|
||||||
- WvOut: audio file and streaming output classes [RtWvOut, TcpWvOut]
|
- WvOut: audio data output classes [FileWvOut, RtWvOut, InetWvOut]
|
||||||
- WvIn: audio file and streaming input classes [WaveLoop, RtWvIn, TcpWvIn]
|
- WvIn: audio data input classes [FileWvIn, WaveLoop, RtWvIn, InetWvIn]
|
||||||
|
|
||||||
|
|
||||||
[<A HREF="hello.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="hello.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,55 +1,81 @@
|
|||||||
/*! \page hello Hello Sine!
|
/*! \page hello Hello Sine!
|
||||||
|
|
||||||
We'll continue our introduction to the Synthesis ToolKit with a simple sine-wave oscillator program. STK does not provide a specific oscillator for sine waves. Instead, it provides a generic waveform oscillator class, WaveLoop, which can load a variety of common file types. In this example, we load a sine "table" from an STK RAW file (defined as monophonic, 16-bit, big-endian data). We use the class WvOut to write the result to a 16-bit, WAV formatted audio file.
|
We'll continue our introduction to the Synthesis ToolKit with a simple
|
||||||
|
sine-wave oscillator program. STK provides two different classes for
|
||||||
|
sine-wave generation. We will first look at a generic waveform
|
||||||
|
oscillator class, WaveLoop, that can load a variety of common file
|
||||||
|
types. In this example, we load a sine "table" from an STK RAW file
|
||||||
|
(defined as monophonic, 16-bit, big-endian data). We use the class
|
||||||
|
FileWvOut to write the result to a 16-bit, WAV formatted audio file.
|
||||||
|
|
||||||
\code
|
\code
|
||||||
|
|
||||||
// sineosc.cpp
|
// sineosc.cpp
|
||||||
|
|
||||||
#include "WaveLoop.h"
|
#include "WaveLoop.h"
|
||||||
#include "WvOut.h"
|
#include "FileWvOut.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Set the global sample rate before creating class instances.
|
// Set the global sample rate before creating class instances.
|
||||||
Stk::setSampleRate( 44100.0 );
|
Stk::setSampleRate( 44100.0 );
|
||||||
|
|
||||||
// Define and load the sine wave file
|
WaveLoop input;
|
||||||
WaveLoop* input = new WaveLoop( "rawwaves/sinewave.raw", true );
|
FileWvOut output;
|
||||||
input->setFrequency( 440.0 );
|
|
||||||
|
|
||||||
// Define and open a 16-bit, one-channel WAV formatted output file
|
// Load the sine wave file.
|
||||||
WvOut* output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
input.openFile( "rawwaves/sinewave.raw", true );
|
||||||
|
|
||||||
|
// Open a 16-bit, one-channel WAV formatted output file
|
||||||
|
output.openFile( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 );
|
||||||
|
|
||||||
|
input.setFrequency( 440.0 );
|
||||||
|
|
||||||
// Run the oscillator for 40000 samples, writing to the output file
|
// Run the oscillator for 40000 samples, writing to the output file
|
||||||
int i;
|
for ( int i=0; i<40000; i++ )
|
||||||
for ( i=0; i<40000; i++ ) {
|
output.tick( input.tick() );
|
||||||
output->tick( input->tick() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up
|
|
||||||
delete input;
|
|
||||||
delete output;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
WaveLoop is a subclass of WvIn, which supports WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. WvIn provides interpolating, read once ("oneshot") functionality, as well as methods for setting the read rate and read position.
|
WaveLoop is a subclass of FileWvIn, which supports WAV, SND (AU),
|
||||||
|
AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit
|
||||||
|
integer and 32- and 64-bit floating-point data types. FileWvIn
|
||||||
|
provides interpolating, read-once ("oneshot") functionality, as well
|
||||||
|
as methods for setting the read rate and read position.
|
||||||
|
|
||||||
The WvIn and WvOut classes are complementary, both supporting WAV, SND (AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-, and 32-bit integer and 32- and 64-bit floating-point data types. However, WvOut does not perform data interpolation.
|
FileWvIn provides a "tick level" and interpolating interface to the
|
||||||
|
FileRead class. Likewise, FileWvOut provides a "tick level" interface
|
||||||
|
to the FileWrite class. FileRead and FileWrite both support WAV,
|
||||||
|
SND(AU), AIFF, MAT-file (Matlab), and RAW file formats with 8-, 16-,
|
||||||
|
and 32-bit integer and 32- and 64-bit floating-point data types.
|
||||||
|
FileWvOut does not currently offer data interpolation functionality.
|
||||||
|
|
||||||
The WvIn and WvOut classes support multi-channel sample frames. To distinguish single-sample frame operations from multi-channel frame operations, these classes also implement <TT>tickFrame()</TT> functions. When a <TT>tick()</TT> method is called for multi-channel data, frame averages are returned or the input sample is distributed across all channels of a sample frame.
|
The WvIn and WvOut parent classes and all subclasses support
|
||||||
|
multi-channel sample frames. To distinguish single-sample frame
|
||||||
|
operations from multi-channel frame operations, these classes also
|
||||||
|
implement <TT>tickFrame()</TT> functions. When a <TT>tick()</TT>
|
||||||
|
method is called for multi-channel data, frame averages are returned
|
||||||
|
or the input sample is distributed across all channels of a sample
|
||||||
|
frame.
|
||||||
|
|
||||||
Nearly all STK classes inherit from the Stk base class. Stk provides a static sample rate which is queried by subclasses as needed. Because many classes use the current sample rate value during instantiation, it is important that the desired value be set at the beginning of a program. The default STK sample rate is 44100 Hz.
|
Nearly all STK classes inherit from the Stk base class. Stk provides
|
||||||
|
a static sample rate which is queried by subclasses as needed.
|
||||||
|
Because many classes use the current sample rate value during
|
||||||
|
instantiation, it is important that the desired value be set at the
|
||||||
|
beginning of a program. The default STK sample rate is 44100 Hz.
|
||||||
|
|
||||||
\section error Error Handling
|
\section error Error Handling
|
||||||
|
|
||||||
The ToolKit has some basic C++ error handling functionality built in. Classes which access files and/or hardware are most prone to runtime errors. To properly "catch" such errors, the above example should be rewritten as shown below.
|
The ToolKit has some basic C++ error handling functionality built in.
|
||||||
|
Classes that access files and/or hardware are most prone to runtime
|
||||||
|
errors. To properly "catch" such errors, the above example should be
|
||||||
|
rewritten as shown below.
|
||||||
|
|
||||||
\include sineosc.cpp
|
\include sineosc.cpp
|
||||||
|
|
||||||
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing. See the \ref classes to determine which constructors and functions can throw an error.
|
In this particular case, we simply exit the program if an error occurs (an error message is automatically printed to stderr). A more refined program might attempt to recover from or fix a particular problem and, if successful, continue processing. See the \ref classes to determine which constructors and functions can throw an error.
|
||||||
|
|
||||||
[<A HREF="compile.html">Next tutorial</A>] [<A HREF="fundamentals.html">Main tutorial page</A>]
|
[<A HREF="fundamentals.html">Main tutorial page</A>] [<A HREF="compile.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,25 @@
|
|||||||
/*! \mainpage <I>The Synthesis ToolKit in C++ (STK)</I>
|
/*! \mainpage <I>The Synthesis ToolKit in C++ (STK)</I>
|
||||||
|
|
||||||
<BODY BGCOLOR="white">
|
|
||||||
|
|
||||||
\htmlonly
|
\htmlonly
|
||||||
|
<BODY BGCOLOR="white">
|
||||||
<h3><center><a href="http://www.cs.princeton.edu/~prc/">Perry R. Cook</a> & <a href="http://music.mcgill.ca/~gary/">Gary P. Scavone</a></center></h3>
|
<h3><center><a href="http://www.cs.princeton.edu/~prc/">Perry R. Cook</a> & <a href="http://music.mcgill.ca/~gary/">Gary P. Scavone</a></center></h3>
|
||||||
\endhtmlonly
|
\endhtmlonly
|
||||||
|
|
||||||
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 10 years now. STK currently runs with "realtime" support (audio and MIDI) on SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms. Generic, non-realtime support has been tested under NeXTStep, Sun, and other platforms and should work with any standard C++ compiler.
|
The <B>Synthesis ToolKit in C++ (STK)</B> is a set of open source
|
||||||
|
audio signal processing and algorithmic synthesis classes written in
|
||||||
|
the C++ programming language. STK was designed to facilitate rapid
|
||||||
|
development of music synthesis and audio processing software, with an
|
||||||
|
emphasis on cross-platform functionality, realtime control, ease of
|
||||||
|
use, and educational example code. The Synthesis ToolKit is extremely
|
||||||
|
portable (it's mostly platform-independent C and C++ code), and it's
|
||||||
|
completely user-extensible (all source included, no unusual libraries,
|
||||||
|
and no hidden drivers). We like to think that this increases the
|
||||||
|
chances that our programs will still work in another 5-10 years. In
|
||||||
|
fact, the ToolKit has been working continuously for about 10 years
|
||||||
|
now. STK currently runs with "realtime" support (audio and MIDI) on
|
||||||
|
SGI (Irix), Linux, Macintosh OS X, and Windows computer platforms.
|
||||||
|
Generic, non-realtime support has been tested under NeXTStep, Sun, and
|
||||||
|
other platforms and should work with any standard C++ compiler.
|
||||||
|
|
||||||
- \ref information
|
- \ref information
|
||||||
- \ref classes
|
- \ref classes
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
<H3>References</H3>
|
<H3>References</H3>
|
||||||
<UL>
|
<UL>
|
||||||
<LI><A HREF="Papers/stkicmc99.pdf">ICMC99 Paper</A></LI>
|
<LI><A HREF="papers/stkupdate.pdf">ICMC2005 Paper</A></LI>
|
||||||
|
<BR>
|
||||||
|
A paper by Gary and Perry detailing recent updates to the Synthesis ToolKit in C++.
|
||||||
|
<P>
|
||||||
|
<LI><A HREF="papers/stkicmc99.pdf">ICMC99 Paper</A></LI>
|
||||||
<BR>
|
<BR>
|
||||||
A not-so-recent paper by Perry and Gary about the Synthesis ToolKit in C++.
|
A not-so-recent paper by Perry and Gary about the Synthesis ToolKit in C++.
|
||||||
<P>
|
<P>
|
||||||
<LI><A HREF="Papers/STKsiggraph96.pdf">SIGGRAPH96 Paper</A></LI>
|
<LI>Book Chapter: <A HREF="http://www.akpeters.com/product.asp?ProdCode=1047">Audio Anecdotes</A></LI>
|
||||||
<BR>
|
<BR>
|
||||||
A very-not-so-recent paper by Perry about the Synthesis ToolKit in C++.
|
Here's a link to a book that includes an chapter on STK.
|
||||||
<P>
|
|
||||||
<LI><A HREF="http://www.cs.princeton.edu/~prc/NewWork.html#STK">Perry's STK Web Page</A></LI>
|
|
||||||
<BR>
|
|
||||||
This is a link to Perry Cook's STK Web page. He has information about the \ref skini, the protocol used to control STK instruments, as well as a lot of other cool stuff.
|
|
||||||
</UL>
|
</UL>
|
||||||
|
|
||||||
|
|
||||||
@@ -31,9 +31,30 @@ For those instances where a simple GUI with sliders and buttons is helpful, we u
|
|||||||
|
|
||||||
<H4>A brief history of the <I>Synthesis ToolKit in C++.</I></H4>
|
<H4>A brief history of the <I>Synthesis ToolKit in C++.</I></H4>
|
||||||
|
|
||||||
Perry Cook began developing a pre-cursor to the Synthesis ToolKit (also called STK) under NeXTStep at the Center for Computer Research in Music and Acoustics (CCRMA) at Stanford University in the early-1990s. With his move to Princeton University in 1996, he ported everything to C++ on SGI hardware, added real-time capabilities, and greatly expanded the synthesis techniques available. With the help of Bill Putnam, Perry also made a port of STK to Windows95. Gary Scavone began using STK extensively in the summer of 1997 and completed a full port of STK to Linux early in 1998. He finished the fully compatable Windows port (using Direct Sound API) in June 1998. Numerous improvements and extensions have been made since then.
|
Perry Cook began developing a pre-cursor to the Synthesis ToolKit
|
||||||
|
(also called STK) under NeXTStep at the Center for Computer Research
|
||||||
|
in Music and Acoustics (CCRMA) at Stanford University in the
|
||||||
|
early-1990s. With his move to Princeton University in 1996, he ported
|
||||||
|
everything to C++ on SGI hardware, added real-time capabilities, and
|
||||||
|
greatly expanded the synthesis techniques available. With the help of
|
||||||
|
Bill Putnam, Perry also made a port of STK to Windows95. Gary Scavone
|
||||||
|
began using STK extensively in the summer of 1997 and completed a full
|
||||||
|
port of STK to Linux early in 1998. He finished the fully compatable
|
||||||
|
Windows port (using Direct Sound API) in June 1998. Numerous
|
||||||
|
improvements and extensions have been made since then.
|
||||||
|
|
||||||
The Toolkit has been distributed continuously since 1996 via the <A HREF="http://www.music.princeton.edu/psk">Princeton Sound Kitchen</A>, <A HREF="http://www.cs.princeton.edu/~prc">Perry Cook's home page</A> at Princeton, <A HREF="http://www-ccrma.stanford.edu/~gary/">Gary Scavone's home page</A> at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), and the <A HREF="http://www-ccrma.stanford.edu/software/stk">Synthesis ToolKit home page</A>. The ToolKit has been included in various collections of software. Much of it has also been ported to Max/MSP on Macintosh computers by Dan trueman and Luke Dubois of Columbia University, and is distributed as <A HREF="http://music.columbia.edu/PeRColate">PeRColate</A>. Help on real-time sound and MIDI has been provided over the years by Tim Stilson, Bill Putnam, and Gabriel Maldonado.
|
The Toolkit has been distributed continuously since 1996 via the <A
|
||||||
|
HREF="http://www.music.princeton.edu/psk">Princeton Sound Kitchen</A>,
|
||||||
|
<A HREF="http://www.cs.princeton.edu/~prc">Perry Cook's home page</A>
|
||||||
|
at Princeton, <A HREF="http://www.music.mcgill.ca/~gary/">Gary
|
||||||
|
Scavone's home page</A> at McGill University, and the <A HREF="http://ccrma.stanford.edu/software/stk">Synthesis ToolKit
|
||||||
|
home page</A>. The ToolKit has been included in various collections
|
||||||
|
of software. Much of it has also been ported to Max/MSP on Macintosh
|
||||||
|
computers by Dan Trueman and Luke Dubois of Columbia University, and
|
||||||
|
is distributed as <A
|
||||||
|
HREF="http://music.columbia.edu/PeRColate">PeRColate</A>. Help on
|
||||||
|
real-time sound and MIDI has been provided over the years by Tim
|
||||||
|
Stilson, Bill Putnam, and Gabriel Maldonado.
|
||||||
|
|
||||||
<H4>Legal and Ethical Notes</H4>
|
<H4>Legal and Ethical Notes</H4>
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ The ToolKit comes with a wide variety of synthesis algorithms, all of which inhe
|
|||||||
|
|
||||||
\include bethree.cpp
|
\include bethree.cpp
|
||||||
|
|
||||||
We have used an Instrmnt pointer when referencing the BeeThree instance above, so it would be simple to replace the BeeThree class with any other STK instrument class. It should be noted, however, that a few classes do not respond to the setFrequency() function (e.g., Shakers, Drummer).
|
We have used an Instrmnt pointer when referencing the BeeThree
|
||||||
|
instance above, so it would be simple to replace the BeeThree class
|
||||||
|
with any other STK instrument class. It should be noted, however,
|
||||||
|
that a few classes do not respond to the setFrequency() function
|
||||||
|
(e.g., Shakers, Drummer).
|
||||||
|
|
||||||
The noteOn() function initiates an instrument attack. Instruments which are continuously excited (e.g., Clarinet, BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., Plucked, Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
|
The noteOn() function initiates an instrument attack. Instruments that are continuously excited (e.g., Clarinet, BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., Plucked, Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack.
|
||||||
|
|
||||||
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.
|
Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter.
|
||||||
|
|
||||||
[<A HREF="controlin.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="controlin.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,26 @@
|
|||||||
|
|
||||||
The ToolKit WvIn and WvOut classes (and their subclasses) support multi-channel audio data input and output. A set of interleaved audio samples representing a single time "slice" is referred to as a <I>sample frame</I>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
|
The ToolKit WvIn and WvOut classes (and their subclasses) support multi-channel audio data input and output. A set of interleaved audio samples representing a single time "slice" is referred to as a <I>sample frame</I>. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second.
|
||||||
|
|
||||||
Most STK classes process single-sample data streams via their <TT>tick()</TT> function. In order to distinguish single-sample and sample frame calculations, the WvIn and WvOut classes implement both <TT>tick()</TT> and <TT>tickFrame()</TT> functions. The <TT>tickFrame()</TT> functions take or return a pointer to an array of audio data representing one or more sample frames. For single-channel streams, the <TT>tick()</TT> and <TT>tickFrame()</TT> functions produce equivalent results. When <TT>tick()</TT> is called for a multi-channel stream, however, the function either returns a sample frame average (WvIn) or writes a single sample argument to all channels (WvOut).
|
Most STK classes process single-sample data streams via their
|
||||||
|
<TT>tick()</TT> function. In order to distinguish single-sample and
|
||||||
|
sample frame calculations, the WvIn and WvOut classes implement both
|
||||||
|
<TT>tick()</TT> and <TT>tickFrame()</TT> functions. The
|
||||||
|
<TT>tickFrame()</TT> functions take or return a reference to an StkFrames object
|
||||||
|
representing one or more sample frames. For single-channel
|
||||||
|
streams, the <TT>tick()</TT> and <TT>tickFrame()</TT> functions
|
||||||
|
produce equivalent results. When <TT>tick()</TT> is called for a
|
||||||
|
multi-channel stream, however, the function either returns a sample
|
||||||
|
frame average (WvIn) or writes a single sample argument to all
|
||||||
|
channels (WvOut).
|
||||||
|
|
||||||
Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system.
|
Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system.
|
||||||
|
|
||||||
The following example demonstrates the use of the WvOut class for creating a four channel, 16-bit AIFF formatted audio file. We will use four sinewaves of different frequencies for the first two seconds and then a single sinewave for the last two seconds.
|
The following example demonstrates the use of the FileWvOut class for
|
||||||
|
creating a four channel, 16-bit AIFF formatted audio file. We will
|
||||||
|
use four sinewaves of different frequencies for the first two seconds
|
||||||
|
and then a single sinewave for the last two seconds.
|
||||||
|
|
||||||
\include foursine.cpp
|
\include foursine.cpp
|
||||||
|
|
||||||
[<A HREF="polyvoices.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="polyvoices.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,28 +1,43 @@
|
|||||||
/*! \page realtime Realtime Audio (blocking)
|
/*! \page realtime Realtime Audio (blocking)
|
||||||
|
|
||||||
In this section, we modify the <TT>sineosc.cpp</TT> program in order to send the output to the default audio playback device on your computer system.
|
In this section, we modify the <TT>sineosc.cpp</TT> program in order
|
||||||
|
to send the output to the default audio playback device on your
|
||||||
|
computer system. We also make use of the SineWave class as a
|
||||||
|
sine-wave oscillator. SineWave computes an internal, static sine-wave
|
||||||
|
table when its first instance is created. Subsequent instances make
|
||||||
|
use of the same table. The default table length, specified in
|
||||||
|
SineWave.h, is 2048 samples.
|
||||||
|
|
||||||
\include rtsine.cpp
|
\include rtsine.cpp
|
||||||
|
|
||||||
The class RtWvOut is a protected subclass of WvOut. A number of optional constructor arguments can be used to fine tune its performance for a given system. RtWvOut provides a "single-sample" interface to the RtAudio class. Note that RtWvOut (as well as the RtWvIn and RtDuplex classes described below) make use of RtAudio's blocking input/output functionality. On systems which implement an inherently callback-based audio API, this blocking functionality will be less robust. An example of audio output using a callback scheme will be discussed in a subsequent tutorial section.
|
The class RtWvOut is a protected subclass of WvOut. A number of
|
||||||
|
optional constructor arguments can be used to fine tune its
|
||||||
|
performance for a given system. RtWvOut provides a "single-sample"
|
||||||
|
interface to the RtAudio class. Note that RtWvOut (as well as the
|
||||||
|
RtWvIn and RtDuplex classes described below) make use of RtAudio's
|
||||||
|
blocking input/output functionality. On systems that implement an
|
||||||
|
inherently callback-based audio API (Linux Jack, Windows ASIO, OS-X
|
||||||
|
CoreAudio), this blocking functionality will be less robust. An
|
||||||
|
example of audio output using a callback scheme will be discussed in a
|
||||||
|
subsequent tutorial section.
|
||||||
|
|
||||||
Though not used here, an RtWvIn class exists as well which can be used to read realtime audio data from an input device. See the <TT>record.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
Though not used here, an RtWvIn class exists as well that can be used to read realtime audio data from an input device. See the <TT>record.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||||
|
|
||||||
It may be possible to use an instance of RtWvOut and an instance of RtWvIn to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of RtDuplex to achieve this behavior, in that it guarantees better synchronization between the input and output data. See the <TT>effects</TT> project or the <TT>io.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
It may be possible to use an instance of RtWvOut and an instance of RtWvIn to simultaneously read and write realtime audio to and from a hardware device or devices. However, it is recommended to instead use a single instance of RtDuplex to achieve this behavior, in that it guarantees better synchronization between the input and output data. See the <TT>effects</TT> project or the <TT>io.cpp</TT> example program in the <TT>examples</TT> project for more information.
|
||||||
|
|
||||||
When using any realtime STK class (RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, TcpWvIn, TcpWvOut, Socket, and Thread), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio API as follows (assuming all necessary files exist in the project directory):
|
When using any realtime STK class (RtAudio, RtWvOut, RtWvIn, RtDuplex, RtMidi, InetWvIn, InetWvOut, Socket, UdpSocket, TcpServer, TcpClient, and Thread), it is necessary to specify an audio/MIDI API preprocessor definition and link with the appropriate libraries or frameworks. For example, the above program could be compiled on a Linux system using the GNU g++ compiler and the ALSA audio API as follows (assuming all necessary files exist in the project directory):
|
||||||
|
|
||||||
\code
|
\code
|
||||||
g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp \
|
g++ -Wall -D__LINUX_ALSA__ -D__LITTLE_ENDIAN__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp \
|
||||||
RtWvOut.cpp RtAudio.cpp rtsine.cpp -lpthread -lasound
|
RtWvOut.cpp RtAudio.cpp rtsine.cpp -lpthread -lasound
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
On a Macintosh OS X system, the syntax would be:
|
On a Macintosh OS X system, the syntax would be:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
g++ -Wall -D__MACOSX_CORE__ -o rtsine Stk.cpp WvIn.cpp WaveLoop.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp \
|
g++ -Wall -D__MACOSX_CORE__ -o rtsine Stk.cpp Generator.cpp SineWave.cpp WvOut.cpp RtWvOut.cpp RtAudio.cpp \
|
||||||
rtsine.cpp -lpthread -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
rtsine.cpp -lpthread -framework CoreAudio -framework CoreMIDI -framework CoreFoundation
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
[<A HREF="crealtime.html">Next tutorial</A>] [<A HREF="tutorial.html">Main tutorial page</A>]
|
[<A HREF="tutorial.html">Main tutorial page</A>] [<A HREF="crealtime.html">Next tutorial</A>]
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,23 +28,25 @@ I am basically a bottom-up designer with an awareness of top-down design ideas,
|
|||||||
|
|
||||||
\section messages SKINI Messages
|
\section messages SKINI Messages
|
||||||
|
|
||||||
A basic SKINI message is a line of text. There are only three required fields, the message type (an ASCII name), the time (either delta or absolute), and the channel number. Don't freak out and think that this is MIDI channel 0-15 (which is supported), because the channel number is scanned as a long int. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. Other fields might be used, as specified in the SKINI.tbl file. This is described in more detail later.
|
A basic SKINI message is a line of text. There are only three required fields, the message type (an ASCII name), the time (either delta or absolute), and the channel number. Don't freak out and think that this is MIDI channel 0-15 (which is supported), because the channel number is scanned as a long int. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. Other fields might be used, as specified in the \c SKINI.tbl file. This is described in more detail later.
|
||||||
|
|
||||||
Fields in a SKINI line are delimited by spaces, commas, or tabs. The SKINI parser only operates on a line at a time, so a newline means the message is over. Multiple messages are NOT allowed directly on a single line (by use of the ; for example in C). This could be supported, but it isn't in version 1.1.
|
Fields in a SKINI line are delimited by spaces, commas, or tabs. The SKINI parser only operates on a line at a time, so a newline means the message is over. Multiple messages are NOT allowed directly on a single line (by use of the ; for example in C). This could be supported, but it isn't in version 1.1.
|
||||||
|
|
||||||
Message types include standard MIDI types like NoteOn, NoteOff, ControlChange, etc. MIDI extension message types (messages which look better than MIDI but actually get turned into MIDI-like messages) include LipTension, StringDamping, etc. Non-MIDI message types include SetPath (sets a path for file use later), and OpenReadFile (for streaming, mixing, and applying effects to soundfiles along with synthesis, for example). Other non-MIDI message types include Trilling, HammerOn, etc. (these translate to gestures, behaviors, and contexts for use by intellegent players and instruments using SKINI). Where possible I will still use these as MIDI extension messages, so foot switches, etc. can be used to control them in real time.
|
Message types include standard MIDI types like NoteOn, NoteOff, ControlChange, etc. MIDI extension message types (messages which look better than MIDI but actually get turned into MIDI-like messages) include LipTension, StringDamping, etc. Non-MIDI message types include SetPath (sets a path for file use later), and OpenReadFile (for streaming, mixing, and applying effects to soundfiles along with synthesis, for example). Other non-MIDI message types include Trilling, HammerOn, etc. (these translate to gestures, behaviors, and contexts for use by intelligent players and instruments using SKINI). Where possible I will still use these as MIDI extension messages, so foot switches, etc. can be used to control them in real time.
|
||||||
|
|
||||||
All fields other than type, time, and channel are optional, and the types and useage of the additional fields is defined in the file SKINI.tbl.
|
All fields other than type, time, and channel are optional, and the
|
||||||
|
types and useage of the additional fields is defined in the file \c
|
||||||
|
SKINI.tbl.
|
||||||
|
|
||||||
The other important file used by SKINI is SKINI.msg, which is a set of #defines to make C code more readable, and to allow reasonably quick re-mapping of control numbers, etc.. All of these defined symbols are assigned integer values. For Java, the #defines could be replaced by declaration and assignment statements, preserving the look and behavior of the rest of the code.
|
The other important file used by SKINI is \c SKINI.msg, which is a set of #defines to make C code more readable, and to allow reasonably quick re-mapping of control numbers, etc.. All of these defined symbols are assigned integer values. For Java, the #defines could be replaced by declaration and assignment statements, preserving the look and behavior of the rest of the code.
|
||||||
|
|
||||||
\section cfiles Files Used To Implement SKINI
|
\section cfiles Files Used To Implement SKINI
|
||||||
|
|
||||||
Skini.cpp is a C++ object which can either open a SKINI file and successively read and parse lines of text as SKINI strings, or accept strings from another object and parse them. The latter functionality would be used by a socket, pipe, or other connection receiving SKINI messages a line at a time, usually in real time, but not restricted to real time.
|
Skini is a C++ class which can either open a SKINI file and successively read and parse lines of text as SKINI strings, or accept strings from another object and parse them. The latter functionality would be used by a socket, pipe, or other connection receiving SKINI messages a line at a time, usually in real time, but not restricted to real time.
|
||||||
|
|
||||||
SKINI.msg should be included by anything wanting to use the Skini.cpp object. This is not mandatory, but use of the __SK_blah_ symbols which are defined in the .msg file will help to ensure clarity and consistency when messages are added and changed.
|
\c SKINI.msg should be included by anything wanting to use the Skini object. This is not mandatory, but use of the __SK_blah_ symbols which are defined in the .msg file will help to ensure clarity and consistency when messages are added and changed.
|
||||||
|
|
||||||
SKINI.tbl is used only by the SKINI parser object (Skini.cpp). In the file SKINI.tbl, an array of structures is declared and assigned values which instruct the parser as to what the message types are, and what the fields mean for those message types. This table is compiled and linked into applications using SKINI, but could be dynamically loaded and changed in a future version of SKINI.
|
\c SKINI.tbl is used only by the Skini parser object (Skini.cpp). In the file \c SKINI.tbl, an array of structures is declared and assigned values which instruct the parser as to what the message types are, and what the fields mean for those message types. This table is compiled and linked into applications using SKINI, but could be dynamically loaded and changed in a future version of SKINI.
|
||||||
|
|
||||||
\section parser SKINI Messages and the SKINI Parser:
|
\section parser SKINI Messages and the SKINI Parser:
|
||||||
|
|
||||||
@@ -52,8 +54,6 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
|||||||
|
|
||||||
- If the first (non-delimiter ... see below) character in a SKINI string is '/' that line is treated as a comment and echoed to stdout.
|
- If the first (non-delimiter ... see below) character in a SKINI string is '/' that line is treated as a comment and echoed to stdout.
|
||||||
|
|
||||||
- If there are no characters on a line, that line is treated as blank and echoed to stdout. Tabs and spaces are treated as non-characters.
|
|
||||||
|
|
||||||
- Spaces, commas, and tabs delimit the fields in a SKINI message line. (We might allow for multiple messages per line later using the semicolon, but probably not. A series of lines with deltaTimes of 0.0 denotes simultaneous events. For read-ability, multiple messages per line doesn't help much, so it's unlikely to be supported later).
|
- Spaces, commas, and tabs delimit the fields in a SKINI message line. (We might allow for multiple messages per line later using the semicolon, but probably not. A series of lines with deltaTimes of 0.0 denotes simultaneous events. For read-ability, multiple messages per line doesn't help much, so it's unlikely to be supported later).
|
||||||
|
|
||||||
- The first field must be a SKINI message name (like NoteOn). These might become case-insensitive in future versions, so don't plan on exciting clever overloading of names (like noTeOn being different from NoTeON). There can be a number of leading spaces or tabs, but don't exceed 32 or so.
|
- The first field must be a SKINI message name (like NoteOn). These might become case-insensitive in future versions, so don't plan on exciting clever overloading of names (like noTeOn being different from NoTeON). There can be a number of leading spaces or tabs, but don't exceed 32 or so.
|
||||||
@@ -62,7 +62,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
|||||||
|
|
||||||
- The third field must be an integer channel number. Don't go crazy and think that this is just MIDI channel 0-15 (which is supported). The channel number is scanned as a long int. Channels 0-15 are in general to be treated as MIDI channels. After that it's wide open. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. A -1 channel can be used as don't care, omni, or other functions depending on your needs and taste.
|
- The third field must be an integer channel number. Don't go crazy and think that this is just MIDI channel 0-15 (which is supported). The channel number is scanned as a long int. Channels 0-15 are in general to be treated as MIDI channels. After that it's wide open. Channels could be socket numbers, machine IDs, serial numbers, or even unique tags for each event in a synthesis. A -1 channel can be used as don't care, omni, or other functions depending on your needs and taste.
|
||||||
|
|
||||||
- All remaining fields are specified in the SKINI.tbl file. In general, there are maximum two more fields, which are either SK_INT (long), SK_DBL (double float), or SK_STR (string). The latter is the mechanism by which more arguments can be specified on the line, but the object using SKINI must take that string apart (retrived by using getRemainderString()) and scan it. Any excess fields are stashed in remainderString.
|
- All remaining fields are specified in the \c SKINI.tbl file. In general, there are maximum two more fields, which are either SK_INT (long), SK_DBL (double float), or SK_STR (string). The latter is the mechanism by which more arguments can be specified on the line, but the object using SKINI must take that string apart (retrived by using getRemainderString()) and scan it. Any excess fields are stashed in remainderString.
|
||||||
|
|
||||||
\section file A Short SKINI File:
|
\section file A Short SKINI File:
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ The parser isn't all that smart, but neither am I. Here are the basic rules gov
|
|||||||
|
|
||||||
\section table The SKINI.tbl File and Message Parsing:
|
\section table The SKINI.tbl File and Message Parsing:
|
||||||
|
|
||||||
The SKINI.tbl file contains an array of structures which are accessed by the parser object Skini.cpp. The struct is:
|
The \c SKINI.tbl file contains an array of structures which are accessed by the parser object Skini.cpp. The struct is:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
struct SKINISpec {
|
struct SKINISpec {
|
||||||
@@ -129,9 +129,21 @@ so an assignment of one of these structs looks like:
|
|||||||
|
|
||||||
- SK_DBL : double precision floating point. SKINI uses these in the MIDI context for note numbers with micro tuning, velocities, controller values, etc.
|
- SK_DBL : double precision floating point. SKINI uses these in the MIDI context for note numbers with micro tuning, velocities, controller values, etc.
|
||||||
|
|
||||||
- SK_STR : only valid in final field. This allows (nearly) arbitrary message types to be supported by simply scanning the string to EndOfLine and then passing it to a more intellegent handler. For example, MIDI SYSEX (system exclusive) messages of up to 256 bytes can be read as space-delimited integers into the 1K SK_STR buffer. Longer bulk dumps, soundfiles, etc. should be handled as a new message type pointing to a FileName, Socket, or something else stored in the SK_STR field, or as a new type of multi-line message.
|
- SK_STR : only valid in final field. This allows (nearly) arbitrary message types to be supported by simply scanning the string to EOL (End Of Line) and then passing it to a more intelligent handler. For example, MIDI SYSEX (system exclusive) messages can be read as space-delimited integers into the SK_STR buffer. Longer bulk dumps, soundfiles, etc. should be handled as a new message type pointing to a FileName, Socket, or something else stored in the SK_STR field, or as a new type of multi-line message.
|
||||||
|
|
||||||
Here's a couple of lines from the SKINI.tbl file
|
Each individual SKINI message is parsed and saved to a Skini::Message structure of the form:
|
||||||
|
\code
|
||||||
|
struct Message {
|
||||||
|
long type; /*!< The message type, as defined in SKINI.msg. */
|
||||||
|
long channel; /*!< The message channel (not limited to 16!). */
|
||||||
|
StkFloat time; /*!< The message time stamp in seconds (delta or absolute). */
|
||||||
|
std::vector<StkFloat> floatValues; /*!< The message values read as floats (values are type-specific). */
|
||||||
|
std::vector<long> intValues; /*!< The message values read as ints (number and values are type-specific). */
|
||||||
|
std::string remainder; /*!< Any remaining message data, read as ascii text. */
|
||||||
|
};
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
Here's a couple of lines from the \c SKINI.tbl file
|
||||||
|
|
||||||
\code
|
\code
|
||||||
{"NoteOff" , __SK_NoteOff_, SK_DBL, SK_DBL},
|
{"NoteOff" , __SK_NoteOff_, SK_DBL, SK_DBL},
|
||||||
@@ -144,7 +156,7 @@ Here's a couple of lines from the SKINI.tbl file
|
|||||||
{"StringDetune" , __SK_ControlChange_, __SK_StringDetune_, SK_DBL},
|
{"StringDetune" , __SK_ControlChange_, __SK_StringDetune_, SK_DBL},
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
The first three are basic MIDI messages. The first two would cause the parser, after recognizing a match of the string "NoteOff" or "NoteOn", to set the message type to 128 or 144 (__SK_NoteOff_ and __SK_NoteOn_ are #defined in the file SKINI.msg to be the MIDI byte value, without channel, of the actual MIDI messages for NoteOn and NoteOff). The parser would then set the time or delta time (this is always done and is therefore not described in the SKINI Message Struct). The next two fields would be scanned as double-precision floats and assigned to the byteTwo and byteThree variables of the SKINI parser. The remainder of the line is stashed in the remainderString variable.
|
The first three are basic MIDI messages. The first two would cause the parser, after recognizing a match of the string "NoteOff" or "NoteOn", to set the message type to 128 or 144 (__SK_NoteOff_ and __SK_NoteOn_ are #defined in the file \c SKINI.msg to be the MIDI byte value, without channel, of the actual MIDI messages for NoteOn and NoteOff). The parser would then set the time or delta time (this is always done and is therefore not described in the SKINI Message Struct). The next two fields would be scanned either as double-precision \c floats or as <tt>long ints</tt>, depending on the format specified in \c SKINI.tbl, and saved to the corresponding C++ vector variables in the Skini::Message structure (either \c floatValues or \c intValues). Floating-point values are also cast to <tt>ints</tt> (and vice-versa) and stored to their respective variables. For example, an expected integer value of 64 will also be saved as 64.0 in the corresponding \c floatValues variable of the Skini::Message structure. The remainder of the line is stashed in the remainderString variable.
|
||||||
|
|
||||||
The ControlChange spec is basically the same as NoteOn and NoteOff, but the second data byte is set to an integer (for checking later as to what MIDI control is being changed).
|
The ControlChange spec is basically the same as NoteOn and NoteOff, but the second data byte is set to an integer (for checking later as to what MIDI control is being changed).
|
||||||
|
|
||||||
@@ -155,13 +167,13 @@ The Volume spec is a MIDI Extension message, which behaves like a ControlChange
|
|||||||
Volume 0.000000 2 64.1
|
Volume 0.000000 2 64.1
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
I like the 2nd line better, thus my motivation for SKINI in the first place.
|
I like the second line better, thus my motivation for SKINI in the first place.
|
||||||
|
|
||||||
The StringDamping and StringDetune messages behave the same as the Volume message, but use Control Numbers which aren't specifically nailed-down in MIDI. Note that these Control Numbers are carried around as long ints, so we're not limited to 0-127. If, however, you want to use a MIDI controller to play an instrument, using controller numbers in the 0-127 range might make sense.
|
The StringDamping and StringDetune messages behave the same as the Volume message, but use Control Numbers which aren't specifically nailed-down in MIDI. Note that these Control Numbers are carried around as long ints, so we're not limited to 0-127. If, however, you want to use a MIDI controller to play an instrument, using controller numbers in the 0-127 range might make sense.
|
||||||
|
|
||||||
\section using Using SKINI:
|
\section using Using SKINI:
|
||||||
|
|
||||||
Here's a simple example of code which uses the SKINI object to read a SKINI file and control a single instrument.
|
Here's a simple example of code which uses the Skini object to read a SKINI file and control a single instrument.
|
||||||
|
|
||||||
\code
|
\code
|
||||||
Skini score;
|
Skini score;
|
||||||
@@ -207,8 +219,6 @@ Here's a simple example of code which uses the SKINI object to read a SKINI file
|
|||||||
|
|
||||||
When a SKINI score is passed to a Skini object using the Skini::setFile() function, valid messages are read from the file and returned using the Skini::nextMessage() function.
|
When a SKINI score is passed to a Skini object using the Skini::setFile() function, valid messages are read from the file and returned using the Skini::nextMessage() function.
|
||||||
|
|
||||||
A Skini::Message structure contains all the information parsed from a single SKINI message. A returned message type of zero indicates either an invalid message or the end of a scorefile.
|
|
||||||
|
|
||||||
The "time" member of a Skini::Message is the deltaTime until the current message should occur. If this is greater than 0, synthesis occurs until the deltaTime has elapsed. If deltaTime is less than zero, the time is interpreted as absolute time and the output device is queried as to what time it is now. That is used to form a deltaTime, and if it's positive we synthesize. If it's negative, we print an error, pretend this never happened and we hang around hoping to eventually catch up.
|
The "time" member of a Skini::Message is the deltaTime until the current message should occur. If this is greater than 0, synthesis occurs until the deltaTime has elapsed. If deltaTime is less than zero, the time is interpreted as absolute time and the output device is queried as to what time it is now. That is used to form a deltaTime, and if it's positive we synthesize. If it's negative, we print an error, pretend this never happened and we hang around hoping to eventually catch up.
|
||||||
|
|
||||||
The rest of the code sorts out message types NoteOn, NoteOff (including NoteOn with velocity 0), and ControlChange. The code implicitly takes into account the integer type of the control number, but all other data is treated as double float.
|
The rest of the code sorts out message types NoteOn, NoteOff (including NoteOn with velocity 0), and ControlChange. The code implicitly takes into account the integer type of the control number, but all other data is treated as double float.
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
|
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
|
||||||
|
|
||||||
By Perry R. Cook and Gary P. Scavone, 1995-2004.
|
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||||
|
|
||||||
STK Classes - See the HTML documentation in the html directory for complete information.
|
STK Classes - See the HTML documentation in the html directory for complete information.
|
||||||
|
|
||||||
|
|
||||||
.- Generator - (Modulate, Noise, SingWave, Envelope)
|
.- Generator - (Modulate, Noise, SingWave, Envelope, SineWave, Blit, BlitSaw, BlitSquare, Granulate)
|
||||||
| | |
|
| | |
|
||||||
| SubNoise ADSR
|
| SubNoise ADSR
|
||||||
| Asymp
|
| Asymp
|
||||||
|
|
|
|
||||||
|- Function - (Table, BowTable, JetTable, ReedTable)
|
|- Function - (BowTable, JetTable, ReedTable)
|
||||||
|
|
|
|
||||||
|- WvIn - (WaveLoop, RtWvIn, TcpWvIn)
|
|- FileRead, FileWrite
|
||||||
|
|
|
|
||||||
|- WvOut - (RtWvOut, TcpWvOut)
|
|- WvIn - (FileWvIn, RtWvIn, InetWvIn)
|
||||||
|
| |
|
||||||
|
| WaveLoop
|
||||||
|
|
|
||||||
|
|- WvOut - (FileWvOut, RtWvOut, TcpWvOut)
|
||||||
|
|
|
|
||||||
|- Filter - (OnePole, OneZero, Delay, TwoPole, TwoZero, PoleZero, Biquad)
|
|- Filter - (OnePole, OneZero, Delay, TwoPole, TwoZero, PoleZero, Biquad)
|
||||||
| | |
|
| | |
|
||||||
@@ -22,7 +26,13 @@ STK Classes - See the HTML documentation in the html directory for complete info
|
|||||||
| DelayA
|
| DelayA
|
||||||
|
|
|
|
||||||
|- RtAudio, RtMidi, RtDuplex, Socket, Thread, Mutex
|
|- RtAudio, RtMidi, RtDuplex, Socket, Thread, Mutex
|
||||||
Stk -|
|
| |
|
||||||
|
Stk -| UdpSocket
|
||||||
|
| TcpServer
|
||||||
|
| TcpClient
|
||||||
|
|
|
||||||
|
|- StkFrames
|
||||||
|
|
|
||||||
|- Effect - (Echo, Chorus, PitShift, PRCRev, JCRev, NRev)
|
|- Effect - (Echo, Chorus, PitShift, PRCRev, JCRev, NRev)
|
||||||
|
|
|
|
||||||
|- Voicer, Message, Skini, MidiFileIn, Phonemes, Sphere, Vector3D
|
|- Voicer, Message, Skini, MidiFileIn, Phonemes, Sphere, Vector3D
|
||||||
@@ -58,42 +68,50 @@ Stk -|
|
|||||||
|
|
||||||
Master Class: Stk.cpp Sample rate, byte-swapping, error handling functionality
|
Master Class: Stk.cpp Sample rate, byte-swapping, error handling functionality
|
||||||
|
|
||||||
Sources: Generator.cpp Abstract Base Class for Various Source Signal Classes
|
Sources: Generator.cpp Abstract base class for various source signal classes
|
||||||
Function.cpp Abstract Base Class for Various Input/Output Mapping Classes
|
Function.cpp Abstract base class for various input/output mapping classes
|
||||||
Envelope.cpp Linearly Goes to Target by Rate
|
Envelope.cpp Linearly goes to target by rate
|
||||||
ADSR.cpp ADSR Flavor of Envelope
|
ADSR.cpp ADSR flavor of Envelope
|
||||||
Asymp.cpp Exponentially Approaches Target
|
Asymp.cpp Exponentially approaches target
|
||||||
Noise.cpp Random Number Generator
|
Noise.cpp Random number generator
|
||||||
SubNoise.cpp Random Numbers each N samples
|
SubNoise.cpp Random numbers each N samples
|
||||||
Table.cpp Lookup Table (assumes given data in big-endian format)
|
SineWave.cpp Sinusoidal oscillator with internally computed static table
|
||||||
WvIn.cpp Data Input Class (interpolating) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
Blit.cpp Bandlimited impulse train
|
||||||
WaveLoop.cpp Wavetable looping (subclass of WvIn)
|
BlitSaw.cpp Bandlimited sawtooth generator
|
||||||
RtWvIn.cpp Realtime Audio Input Class (subclass of WvIn)
|
BlitSquare.cpp Bandlimited square wave generator
|
||||||
TcpWvIn.cpp Audio Streaming (socket server) Input Class (subclass of WvIn)
|
Granulate.cpp Granular synthesis class that processes a monophonic audio file
|
||||||
|
FileRead.cpp Audio file input class (no internal data storage) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||||
|
WvIn.cpp Abstract base class for audio data input classes
|
||||||
|
FileWvIn.cpp Audio file input interface class with interpolation
|
||||||
|
WaveLoop.cpp Wavetable looping (subclass of FileWvIn)
|
||||||
|
RtWvIn.cpp Realtime audio input class (subclass of WvIn)
|
||||||
|
InetWvIn.cpp Audio streaming (socket server) input class (subclass of WvIn)
|
||||||
|
|
||||||
Sinks: WvOut.cpp Output Master Class for RAW, WAV, SND (AU), AIFF, MAT-file files
|
Sinks: FileWrite.cpp Audio file output class (no internal data storage) for RAW, WAV, SND (AU), AIFF, MAT-file files
|
||||||
RtWvOut.cpp Realtime Audio Output Class (subclass of WvOut)
|
WvOut.cpp Abstract base class for audio data output classes
|
||||||
TcpWvOut.cpp Audio Streaming (socket client) Output Class (subclass of WvOut)
|
FileWvOut.cpp Audio file output interface class to FileWrite
|
||||||
|
RtWvOut.cpp Realtime audio output class (subclass of WvOut)
|
||||||
|
InetWvOut.cpp Audio streaming (socket client) output class (subclass of WvOut)
|
||||||
|
|
||||||
Duplex: RtDuplex.cpp Synchronous Realtime Audio Input/Output Class
|
Duplex: RtDuplex.cpp Synchronous realtime audio input/output class (blocking)
|
||||||
|
|
||||||
Filters: Filter.cpp Filter Master Class
|
Filters: Filter.cpp Filter master class
|
||||||
OneZero.cpp One Zero Filter
|
OneZero.cpp One zero filter
|
||||||
OnePole.cpp One Pole Filter
|
OnePole.cpp One pole filter
|
||||||
PoleZero.cpp One Pole/One Zero Filter
|
PoleZero.cpp One pole/one zero filter
|
||||||
TwoZero.cpp Two Zero Filter
|
TwoZero.cpp Two zero filter
|
||||||
TwoPole.cpp Two Pole Filter
|
TwoPole.cpp Two pole filter
|
||||||
BiQuad.cpp Two Pole/Two Zero Filter
|
BiQuad.cpp Two pole/two zero filter
|
||||||
FormSwep.cpp Sweepable BiQuad Filter (goes to target by rate)
|
FormSwep.cpp Sweepable biquad filter (goes to target by rate)
|
||||||
Delay.cpp Non-Interpolating Delay Line Class
|
Delay.cpp Non-interpolating delay line class
|
||||||
DelayL.cpp Linearly Interpolating Delay Line (subclass of Delay)
|
DelayL.cpp Linearly interpolating delay line (subclass of Delay)
|
||||||
DelayA.cpp Allpass Interpolating Delay Line (subclass of Delay)
|
DelayA.cpp Allpass interpolating delay line (subclass of Delay)
|
||||||
|
|
||||||
Non-Linear: JetTabl.cpp Cubic Jet Non-Linearity
|
Non-Linear: JetTabl.cpp Cubic jet non-linearity
|
||||||
BowTabl.cpp x^(-3) Bow Non-Linearity
|
BowTabl.cpp x^(-3) Bow non-linearity
|
||||||
ReedTabl.cpp One Breakpoint Saturating Reed Non-Linearity
|
ReedTabl.cpp One breakpoint saturating reed non-linearity
|
||||||
|
|
||||||
Derived: Modulate.cpp Periodic and Random Vibrato: WvIn, SubNoise, OnePole
|
Derived: Modulate.cpp Periodic and random vibrato: WvIn, SubNoise, OnePole
|
||||||
SingWave.cpp Looping wave table with randomness: Modulate, WaveLoop, Envelope
|
SingWave.cpp Looping wave table with randomness: Modulate, WaveLoop, Envelope
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
envelope value reaches 0.0 in the
|
envelope value reaches 0.0 in the
|
||||||
ADSR::RELEASE state.
|
ADSR::RELEASE state.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class ADSR : public Envelope
|
|||||||
//! Set the release rate based on a time duration.
|
//! Set the release rate based on a time duration.
|
||||||
void setReleaseTime(StkFloat time);
|
void setReleaseTime(StkFloat time);
|
||||||
|
|
||||||
//! Set sustain level and attach, decay, and release time durations.
|
//! Set sustain level and attack, decay, and release time durations.
|
||||||
void setAllTimes(StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime);
|
void setAllTimes(StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime);
|
||||||
|
|
||||||
//! Set the target value.
|
//! Set the target value.
|
||||||
@@ -72,22 +72,10 @@ class ADSR : public Envelope
|
|||||||
//! Set to state = ADSR::SUSTAIN with current and target values of \e aValue.
|
//! Set to state = ADSR::SUSTAIN with current and target values of \e aValue.
|
||||||
void setValue(StkFloat value);
|
void setValue(StkFloat value);
|
||||||
|
|
||||||
//! Return one envelope output value.
|
|
||||||
StkFloat tick(void);
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
StkFloat attackRate_;
|
StkFloat attackRate_;
|
||||||
StkFloat decayRate_;
|
StkFloat decayRate_;
|
||||||
StkFloat sustainLevel_;
|
StkFloat sustainLevel_;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
to \e keyOn and \e keyOff messages by ramping to
|
to \e keyOn and \e keyOff messages by ramping to
|
||||||
1.0 on keyOn and to 0.0 on keyOff.
|
1.0 on keyOn and to 0.0 on keyOff.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -61,22 +61,10 @@ class Asymp : public Envelope
|
|||||||
//! Set the target value.
|
//! Set the target value.
|
||||||
void setTarget(StkFloat target);
|
void setTarget(StkFloat target);
|
||||||
|
|
||||||
//! Return one envelope output value.
|
|
||||||
StkFloat tick(void);
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
StkFloat factor_;
|
StkFloat factor_;
|
||||||
StkFloat constant_;
|
StkFloat constant_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,26 +76,13 @@ class BandedWG : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
bool doPluck_;
|
bool doPluck_;
|
||||||
bool trackVelocity_;
|
bool trackVelocity_;
|
||||||
int nModes_;
|
int nModes_;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -52,20 +52,9 @@ class BeeThree : public FM
|
|||||||
//! Start a note with the given frequency and amplitude.
|
//! Start a note with the given frequency and amplitude.
|
||||||
void noteOn(StkFloat frequency, StkFloat amplitude);
|
void noteOn(StkFloat frequency, StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
protected:
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
StkFloat computeSample( void );
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
frequency response while maintaining a constant
|
frequency response while maintaining a constant
|
||||||
filter gain.
|
filter gain.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -93,17 +93,20 @@ public:
|
|||||||
//! Input one sample to the filter and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
virtual StkFloat tick(StkFloat sample);
|
virtual StkFloat tick(StkFloat sample);
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// This function must be implemented in all subclasses. It is used
|
||||||
|
// to get around a C++ problem with overloaded virtual functions.
|
||||||
|
virtual StkFloat computeSample( StkFloat input );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
84
include/Blit.h
Normal file
84
include/Blit.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class Blit
|
||||||
|
\brief STK band-limited impulse train class.
|
||||||
|
|
||||||
|
This class generates a band-limited impulse train using a
|
||||||
|
closed-form algorithm reported by Stilson and Smith in "Alias-Free
|
||||||
|
Digital Synthesis of Classic Analog Waveforms", 1996. The user
|
||||||
|
can specify both the fundamental frequency of the impulse train
|
||||||
|
and the number of harmonics contained in the resulting signal.
|
||||||
|
|
||||||
|
The signal is normalized so that the peak value is +/-1.0.
|
||||||
|
|
||||||
|
If nHarmonics is 0, then the signal will contain all harmonics up
|
||||||
|
to half the sample rate. Note, however, that this setting may
|
||||||
|
produce aliasing in the signal when the frequency is changing (no
|
||||||
|
automatic modification of the number of harmonics is performed by
|
||||||
|
the setFrequency() function).
|
||||||
|
|
||||||
|
Original code by Robin Davies, 2005.
|
||||||
|
Revisions by Gary Scavone for STK, 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_BLIT_H
|
||||||
|
#define STK_BLIT_H
|
||||||
|
|
||||||
|
#include "Generator.h"
|
||||||
|
|
||||||
|
class Blit: public Generator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor that initializes BLIT frequency to 220 Hz.
|
||||||
|
Blit( StkFloat frequency = 220.0 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~Blit();
|
||||||
|
|
||||||
|
//! Resets the oscillator state and phase to 0.
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
//! Set the phase of the signal.
|
||||||
|
/*!
|
||||||
|
Set the phase of the signal, in the range 0 to 1.
|
||||||
|
*/
|
||||||
|
void setPhase( StkFloat phase ) { phase_ = PI * phase; };
|
||||||
|
|
||||||
|
//! Get the current phase of the signal.
|
||||||
|
/*!
|
||||||
|
Get the phase of the signal, in the range [0 to 1.0).
|
||||||
|
*/
|
||||||
|
StkFloat getPhase() const { return phase_ / PI; };
|
||||||
|
|
||||||
|
//! Set the impulse train rate in terms of a frequency in Hz.
|
||||||
|
void setFrequency( StkFloat frequency );
|
||||||
|
|
||||||
|
//! Set the number of harmonics generated in the signal.
|
||||||
|
/*!
|
||||||
|
This function sets the number of harmonics contained in the
|
||||||
|
resulting signal. It is equivalent to (2 * M) + 1 in the BLIT
|
||||||
|
algorithm. The default value of 0 sets the algorithm for maximum
|
||||||
|
harmonic content (harmonics up to half the sample rate). This
|
||||||
|
parameter is not checked against the current sample rate and
|
||||||
|
fundamental frequency. Thus, aliasing can result if one or more
|
||||||
|
harmonics for a given fundamental frequency exceeds fs / 2. This
|
||||||
|
behavior was chosen over the potentially more problematic solution
|
||||||
|
of automatically modifying the M parameter, which can produce
|
||||||
|
audible clicks in the signal.
|
||||||
|
*/
|
||||||
|
void setHarmonics( unsigned int nHarmonics = 0 );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void updateHarmonics( void );
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
unsigned int nHarmonics_;
|
||||||
|
unsigned int m_;
|
||||||
|
StkFloat rate_;
|
||||||
|
StkFloat phase_;
|
||||||
|
StkFloat p_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
73
include/BlitSaw.h
Normal file
73
include/BlitSaw.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class BlitSaw
|
||||||
|
\brief STK band-limited sawtooth wave class.
|
||||||
|
|
||||||
|
This class generates a band-limited sawtooth waveform using a
|
||||||
|
closed-form algorithm reported by Stilson and Smith in "Alias-Free
|
||||||
|
Digital Synthesis of Classic Analog Waveforms", 1996. The user
|
||||||
|
can specify both the fundamental frequency of the sawtooth and the
|
||||||
|
number of harmonics contained in the resulting signal.
|
||||||
|
|
||||||
|
If nHarmonics is 0, then the signal will contain all harmonics up
|
||||||
|
to half the sample rate. Note, however, that this setting may
|
||||||
|
produce aliasing in the signal when the frequency is changing (no
|
||||||
|
automatic modification of the number of harmonics is performed by
|
||||||
|
the setFrequency() function).
|
||||||
|
|
||||||
|
Based on initial code of Robin Davies, 2005.
|
||||||
|
Modified algorithm code by Gary Scavone, 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_BLITSAW_H
|
||||||
|
#define STK_BLITSAW_H
|
||||||
|
|
||||||
|
#include "Generator.h"
|
||||||
|
|
||||||
|
class BlitSaw: public Generator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Class constructor.
|
||||||
|
BlitSaw( StkFloat frequency = 220.0 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~BlitSaw();
|
||||||
|
|
||||||
|
//! Resets the oscillator state and phase to 0.
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
//! Set the sawtooth oscillator rate in terms of a frequency in Hz.
|
||||||
|
void setFrequency( StkFloat frequency );
|
||||||
|
|
||||||
|
//! Set the number of harmonics generated in the signal.
|
||||||
|
/*!
|
||||||
|
This function sets the number of harmonics contained in the
|
||||||
|
resulting signal. It is equivalent to (2 * M) + 1 in the BLIT
|
||||||
|
algorithm. The default value of 0 sets the algorithm for maximum
|
||||||
|
harmonic content (harmonics up to half the sample rate). This
|
||||||
|
parameter is not checked against the current sample rate and
|
||||||
|
fundamental frequency. Thus, aliasing can result if one or more
|
||||||
|
harmonics for a given fundamental frequency exceeds fs / 2. This
|
||||||
|
behavior was chosen over the potentially more problematic solution
|
||||||
|
of automatically modifying the M parameter, which can produce
|
||||||
|
audible clicks in the signal.
|
||||||
|
*/
|
||||||
|
void setHarmonics( unsigned int nHarmonics = 0 );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void updateHarmonics( void );
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
unsigned int nHarmonics_;
|
||||||
|
unsigned int m_;
|
||||||
|
StkFloat rate_;
|
||||||
|
StkFloat phase_;
|
||||||
|
StkFloat p_;
|
||||||
|
StkFloat C2_;
|
||||||
|
StkFloat a_;
|
||||||
|
StkFloat state_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
89
include/BlitSquare.h
Normal file
89
include/BlitSquare.h
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class BlitSquare
|
||||||
|
\brief STK band-limited square wave class.
|
||||||
|
|
||||||
|
This class generates a band-limited square wave signal. It is
|
||||||
|
derived in part from the approach reported by Stilson and Smith in
|
||||||
|
"Alias-Free Digital Synthesis of Classic Analog Waveforms", 1996.
|
||||||
|
The algorithm implemented in this class uses a SincM function with
|
||||||
|
an even M value to achieve a bipolar bandlimited impulse train.
|
||||||
|
This signal is then integrated to achieve a square waveform. The
|
||||||
|
integration process has an associated DC offset but that is
|
||||||
|
subtracted off the output signal.
|
||||||
|
|
||||||
|
The user can specify both the fundamental frequency of the
|
||||||
|
waveform and the number of harmonics contained in the resulting
|
||||||
|
signal.
|
||||||
|
|
||||||
|
If nHarmonics is 0, then the signal will contain all harmonics up
|
||||||
|
to half the sample rate. Note, however, that this setting may
|
||||||
|
produce aliasing in the signal when the frequency is changing (no
|
||||||
|
automatic modification of the number of harmonics is performed by
|
||||||
|
the setFrequency() function).
|
||||||
|
|
||||||
|
Based on initial code of Robin Davies, 2005.
|
||||||
|
Modified algorithm code by Gary Scavone, 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_BLITSQUARE_H
|
||||||
|
#define STK_BLITSQUARE_H
|
||||||
|
|
||||||
|
#include "Generator.h"
|
||||||
|
|
||||||
|
class BlitSquare: public Generator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor that initializes BLIT frequency to 220 Hz.
|
||||||
|
BlitSquare( StkFloat frequency = 220.0 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~BlitSquare();
|
||||||
|
|
||||||
|
//! Resets the oscillator state and phase to 0.
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
//! Set the phase of the signal.
|
||||||
|
/*!
|
||||||
|
Set the phase of the signal, in the range 0 to 1.
|
||||||
|
*/
|
||||||
|
void setPhase( StkFloat phase ) { phase_ = PI * phase; };
|
||||||
|
|
||||||
|
//! Get the current phase of the signal.
|
||||||
|
/*!
|
||||||
|
Get the phase of the signal, in the range [0 to 1.0).
|
||||||
|
*/
|
||||||
|
StkFloat getPhase() const { return phase_ / PI; };
|
||||||
|
|
||||||
|
//! Set the impulse train rate in terms of a frequency in Hz.
|
||||||
|
void setFrequency( StkFloat frequency );
|
||||||
|
|
||||||
|
//! Set the number of harmonics generated in the signal.
|
||||||
|
/*!
|
||||||
|
This function sets the number of harmonics contained in the
|
||||||
|
resulting signal. It is equivalent to (2 * M) + 1 in the BLIT
|
||||||
|
algorithm. The default value of 0 sets the algorithm for maximum
|
||||||
|
harmonic content (harmonics up to half the sample rate). This
|
||||||
|
parameter is not checked against the current sample rate and
|
||||||
|
fundamental frequency. Thus, aliasing can result if one or more
|
||||||
|
harmonics for a given fundamental frequency exceeds fs / 2. This
|
||||||
|
behavior was chosen over the potentially more problematic solution
|
||||||
|
of automatically modifying the M parameter, which can produce
|
||||||
|
audible clicks in the signal.
|
||||||
|
*/
|
||||||
|
void setHarmonics( unsigned int nHarmonics = 0 );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void updateHarmonics( void );
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
unsigned int nHarmonics_;
|
||||||
|
unsigned int m_;
|
||||||
|
StkFloat rate_;
|
||||||
|
StkFloat phase_;
|
||||||
|
StkFloat p_;
|
||||||
|
StkFloat offset_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Volume = 128
|
- Volume = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "PoleZero.h"
|
#include "PoleZero.h"
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class BlowBotl : public Instrmnt
|
class BlowBotl : public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -57,31 +57,19 @@ class BlowBotl : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
JetTable jetTable_;
|
JetTable jetTable_;
|
||||||
BiQuad resonator_;
|
BiQuad resonator_;
|
||||||
PoleZero dcBlock_;
|
PoleZero dcBlock_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
StkFloat maxPressure_;
|
StkFloat maxPressure_;
|
||||||
StkFloat noiseGain_;
|
StkFloat noiseGain_;
|
||||||
StkFloat vibratoGain_;
|
StkFloat vibratoGain_;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
- Register State = 1
|
- Register State = 1
|
||||||
- Breath Pressure = 128
|
- Breath Pressure = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
#include "PoleZero.h"
|
#include "PoleZero.h"
|
||||||
#include "Envelope.h"
|
#include "Envelope.h"
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class BlowHole : public Instrmnt
|
class BlowHole : public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -81,25 +81,13 @@ class BlowHole : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayL delays_[3];
|
DelayL delays_[3];
|
||||||
ReedTable reedTable_;
|
ReedTable reedTable_;
|
||||||
OneZero filter_;
|
OneZero filter_;
|
||||||
@@ -107,7 +95,7 @@ class BlowHole : public Instrmnt
|
|||||||
PoleZero vent_;
|
PoleZero vent_;
|
||||||
Envelope envelope_;
|
Envelope envelope_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
unsigned long length_;
|
unsigned long length_;
|
||||||
StkFloat scatter_;
|
StkFloat scatter_;
|
||||||
StkFloat thCoeff_;
|
StkFloat thCoeff_;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
This class implements a simple bowed string
|
This class implements a simple bowed string
|
||||||
non-linear function, as described by Smith (1986).
|
non-linear function, as described by Smith (1986).
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -39,26 +39,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSlope(StkFloat slope);
|
void setSlope(StkFloat slope);
|
||||||
|
|
||||||
//! Return the function value for \e input.
|
|
||||||
/*!
|
|
||||||
The function input represents differential
|
|
||||||
string-to-bow velocity.
|
|
||||||
*/
|
|
||||||
StkFloat tick( StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs from \e vector and replace them with corresponding outputs.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
StkFloat offset_;
|
StkFloat offset_;
|
||||||
StkFloat slope_;
|
StkFloat slope_;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Volume = 128
|
- Volume = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "BowTable.h"
|
#include "BowTable.h"
|
||||||
#include "OnePole.h"
|
#include "OnePole.h"
|
||||||
#include "BiQuad.h"
|
#include "BiQuad.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
|
|
||||||
class Bowed : public Instrmnt
|
class Bowed : public Instrmnt
|
||||||
@@ -62,31 +62,19 @@ class Bowed : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayL neckDelay_;
|
DelayL neckDelay_;
|
||||||
DelayL bridgeDelay_;
|
DelayL bridgeDelay_;
|
||||||
BowTable bowTable_;
|
BowTable bowTable_;
|
||||||
OnePole stringFilter_;
|
OnePole stringFilter_;
|
||||||
BiQuad bodyFilter_;
|
BiQuad bodyFilter_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
StkFloat maxVelocity_;
|
StkFloat maxVelocity_;
|
||||||
StkFloat baseDelay_;
|
StkFloat baseDelay_;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Volume = 128
|
- Volume = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "BiQuad.h"
|
#include "BiQuad.h"
|
||||||
#include "PoleZero.h"
|
#include "PoleZero.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class Brass: public Instrmnt
|
class Brass: public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -63,30 +63,18 @@ class Brass: public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayA delayLine_;
|
DelayA delayLine_;
|
||||||
BiQuad lipFilter_;
|
BiQuad lipFilter_;
|
||||||
PoleZero dcBlock_;
|
PoleZero dcBlock_;
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
unsigned long length_;
|
unsigned long length_;
|
||||||
StkFloat lipTarget_;
|
StkFloat lipTarget_;
|
||||||
StkFloat slideTarget_;
|
StkFloat slideTarget_;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This class implements a chorus effect.
|
This class implements a chorus effect.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include "DelayL.h"
|
#include "DelayL.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class Chorus : public Effect
|
class Chorus : public Effect
|
||||||
{
|
{
|
||||||
@@ -36,24 +36,12 @@ class Chorus : public Effect
|
|||||||
//! Set modulation frequency.
|
//! Set modulation frequency.
|
||||||
void setModFrequency(StkFloat frequency);
|
void setModFrequency(StkFloat frequency);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
DelayL delayLine_[2];
|
DelayL delayLine_[2];
|
||||||
WaveLoop *mods_[2];
|
SineWave mods_[2];
|
||||||
StkFloat baseLength_;
|
StkFloat baseLength_;
|
||||||
StkFloat modDepth_;
|
StkFloat modDepth_;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Breath Pressure = 128
|
- Breath Pressure = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#include "OneZero.h"
|
#include "OneZero.h"
|
||||||
#include "Envelope.h"
|
#include "Envelope.h"
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class Clarinet : public Instrmnt
|
class Clarinet : public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -63,31 +63,19 @@ class Clarinet : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayL delayLine_;
|
DelayL delayLine_;
|
||||||
ReedTable reedTable_;
|
ReedTable reedTable_;
|
||||||
OneZero filter_;
|
OneZero filter_;
|
||||||
Envelope envelope_;
|
Envelope envelope_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
long length_;
|
long length_;
|
||||||
StkFloat outputGain_;
|
StkFloat outputGain_;
|
||||||
StkFloat noiseGain_;
|
StkFloat noiseGain_;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
used in fixed delay-length applications, such
|
used in fixed delay-length applications, such
|
||||||
as for reverberation.
|
as for reverberation.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -83,22 +83,24 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual StkFloat nextOut(void);
|
virtual StkFloat nextOut(void);
|
||||||
|
|
||||||
//! Input one sample to the delayline and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
virtual StkFloat tick(StkFloat sample);
|
virtual StkFloat tick(StkFloat sample);
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the delayline and return an equal number of outputs in \e vector.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the delayline and replace with corresponding outputs.
|
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// This function must be implemented in all subclasses. It is used
|
||||||
|
// to get around a C++ problem with overloaded virtual functions.
|
||||||
|
virtual StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
unsigned long inPoint_;
|
unsigned long inPoint_;
|
||||||
unsigned long outPoint_;
|
unsigned long outPoint_;
|
||||||
StkFloat delay_;
|
StkFloat delay_;
|
||||||
|
|||||||
@@ -2,23 +2,20 @@
|
|||||||
/*! \class DelayA
|
/*! \class DelayA
|
||||||
\brief STK allpass interpolating delay line class.
|
\brief STK allpass interpolating delay line class.
|
||||||
|
|
||||||
This Delay subclass implements a fractional-
|
This Delay subclass implements a fractional-length digital
|
||||||
length digital delay-line using a first-order
|
delay-line using a first-order allpass filter. A fixed maximum
|
||||||
allpass filter. A fixed maximum length
|
length of 4095 and a delay of 0.5 is set using the default
|
||||||
of 4095 and a delay of 0.5 is set using the
|
constructor. Alternatively, the delay and maximum length can be
|
||||||
default constructor. Alternatively, the
|
set during instantiation with an overloaded constructor.
|
||||||
delay and maximum length can be set during
|
|
||||||
instantiation with an overloaded constructor.
|
|
||||||
|
|
||||||
An allpass filter has unity magnitude gain but
|
An allpass filter has unity magnitude gain but variable phase
|
||||||
variable phase delay properties, making it useful
|
delay properties, making it useful in achieving fractional delays
|
||||||
in achieving fractional delays without affecting
|
without affecting a signal's frequency magnitude response. In
|
||||||
a signal's frequency magnitude response. In
|
order to achieve a maximally flat phase delay response, the
|
||||||
order to achieve a maximally flat phase delay
|
minimum delay possible in this implementation is limited to a
|
||||||
response, the minimum delay possible in this
|
value of 0.5.
|
||||||
implementation is limited to a value of 0.5.
|
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -55,7 +52,7 @@ public:
|
|||||||
void setDelay(StkFloat delay);
|
void setDelay(StkFloat delay);
|
||||||
|
|
||||||
//! Return the current delay-line length.
|
//! Return the current delay-line length.
|
||||||
StkFloat getDelay(void);
|
StkFloat getDelay(void) const;
|
||||||
|
|
||||||
//! Return the value which will be output by the next call to tick().
|
//! Return the value which will be output by the next call to tick().
|
||||||
/*!
|
/*!
|
||||||
@@ -63,22 +60,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
StkFloat nextOut(void);
|
StkFloat nextOut(void);
|
||||||
|
|
||||||
//! Input one sample to the delayline and return one output.
|
|
||||||
StkFloat tick(StkFloat sample);
|
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the delayline and return an equal number of outputs in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the delayline and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
StkFloat alpha_;
|
StkFloat alpha_;
|
||||||
StkFloat coeff_;
|
StkFloat coeff_;
|
||||||
StkFloat apInput_;
|
StkFloat apInput_;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
order Lagrange interpolators can typically
|
order Lagrange interpolators can typically
|
||||||
improve (minimize) this attenuation characteristic.
|
improve (minimize) this attenuation characteristic.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -60,22 +60,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
StkFloat nextOut(void);
|
StkFloat nextOut(void);
|
||||||
|
|
||||||
//! Input one sample to the delay-line and return one output.
|
|
||||||
StkFloat tick(StkFloat sample);
|
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the delay-line and return an equal number of outputs in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the delayline and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
StkFloat alpha_;
|
StkFloat alpha_;
|
||||||
StkFloat omAlpha_;
|
StkFloat omAlpha_;
|
||||||
StkFloat nextOutput_;
|
StkFloat nextOutput_;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
of simultaneous voices) via a #define in the
|
of simultaneous voices) via a #define in the
|
||||||
Drummer.h.
|
Drummer.h.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#define STK_DRUMMER_H
|
#define STK_DRUMMER_H
|
||||||
|
|
||||||
#include "Instrmnt.h"
|
#include "Instrmnt.h"
|
||||||
#include "WvIn.h"
|
#include "FileWvIn.h"
|
||||||
#include "OnePole.h"
|
#include "OnePole.h"
|
||||||
|
|
||||||
const int DRUM_NUMWAVES = 11;
|
const int DRUM_NUMWAVES = 11;
|
||||||
@@ -49,25 +49,14 @@ class Drummer : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WvIn *waves_[DRUM_POLYPHONY];
|
|
||||||
OnePole *filters_[DRUM_POLYPHONY];
|
StkFloat computeSample( void );
|
||||||
int sounding_[DRUM_POLYPHONY];
|
|
||||||
|
FileWvIn waves_[DRUM_POLYPHONY];
|
||||||
|
OnePole filters_[DRUM_POLYPHONY];
|
||||||
|
std::vector<int> soundOrder_;
|
||||||
|
std::vector<int> soundNumber_;
|
||||||
int nSounding_;
|
int nSounding_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
This class implements an echo effect.
|
This class implements an echo effect.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -35,22 +35,10 @@ class Echo : public Effect
|
|||||||
//! Set the delay line length in samples.
|
//! Set the delay line length in samples.
|
||||||
void setDelay( unsigned long delay );
|
void setDelay( unsigned long delay );
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
Delay delayLine_;
|
Delay delayLine_;
|
||||||
unsigned long length_;
|
unsigned long length_;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
This class provides common functionality for
|
This class provides common functionality for
|
||||||
STK effects subclasses.
|
STK effects subclasses.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -38,23 +38,25 @@ class Effect : public Stk
|
|||||||
//! Return the last right output value.
|
//! Return the last right output value.
|
||||||
StkFloat lastOutRight() const;
|
StkFloat lastOutRight() const;
|
||||||
|
|
||||||
//! Abstract tick function ... must be implemented in subclasses.
|
//! Take one sample input and compute one sample of output.
|
||||||
virtual StkFloat tick( StkFloat input ) = 0;
|
StkFloat tick( StkFloat input );
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// This abstract function must be implemented in all subclasses.
|
||||||
|
// It is used to get around a C++ problem with overloaded virtual
|
||||||
|
// functions.
|
||||||
|
virtual StkFloat computeSample( StkFloat input ) = 0;
|
||||||
|
|
||||||
// Returns true if argument value is prime.
|
// Returns true if argument value is prime.
|
||||||
bool isPrime( int number );
|
bool isPrime( int number );
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
\e keyOff messages, ramping to 1.0 on
|
\e keyOff messages, ramping to 1.0 on
|
||||||
keyOn and to 0.0 on keyOff.
|
keyOn and to 0.0 on keyOff.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -25,9 +25,15 @@ class Envelope : public Generator
|
|||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
Envelope(void);
|
Envelope(void);
|
||||||
|
|
||||||
|
//! Copy constructor.
|
||||||
|
Envelope( const Envelope& e );
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
virtual ~Envelope(void);
|
virtual ~Envelope(void);
|
||||||
|
|
||||||
|
//! Assignment operator.
|
||||||
|
Envelope& operator= ( const Envelope& e );
|
||||||
|
|
||||||
//! Set target = 1.
|
//! Set target = 1.
|
||||||
virtual void keyOn(void);
|
virtual void keyOn(void);
|
||||||
|
|
||||||
@@ -49,22 +55,10 @@ class Envelope : public Generator
|
|||||||
//! Return the current envelope \e state (0 = at target, 1 otherwise).
|
//! Return the current envelope \e state (0 = at target, 1 otherwise).
|
||||||
virtual int getState(void) const;
|
virtual int getState(void) const;
|
||||||
|
|
||||||
//! Return one envelope output value.
|
|
||||||
virtual StkFloat tick(void);
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual StkFloat computeSample( void );
|
||||||
|
|
||||||
StkFloat value_;
|
StkFloat value_;
|
||||||
StkFloat target_;
|
StkFloat target_;
|
||||||
StkFloat rate_;
|
StkFloat rate_;
|
||||||
|
|||||||
23
include/FM.h
23
include/FM.h
@@ -19,7 +19,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "Instrmnt.h"
|
#include "Instrmnt.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
#include "WaveLoop.h"
|
#include "WaveLoop.h"
|
||||||
|
#include "SineWave.h"
|
||||||
#include "TwoZero.h"
|
#include "TwoZero.h"
|
||||||
|
|
||||||
class FM : public Instrmnt
|
class FM : public Instrmnt
|
||||||
@@ -79,28 +80,16 @@ class FM : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Pure virtual function ... must be defined in subclasses.
|
|
||||||
virtual StkFloat tick() = 0;
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize) = 0;
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 ) = 0;
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
virtual void controlChange(int number, StkFloat value);
|
virtual void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual StkFloat computeSample( void ) = 0;
|
||||||
|
|
||||||
std::vector<ADSR *> adsr_;
|
std::vector<ADSR *> adsr_;
|
||||||
std::vector<WaveLoop *> waves_;
|
std::vector<WaveLoop *> waves_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
TwoZero twozero_;
|
TwoZero twozero_;
|
||||||
unsigned int nOperators_;
|
unsigned int nOperators_;
|
||||||
StkFloat baseFrequency_;
|
StkFloat baseFrequency_;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -53,25 +53,13 @@ class FMVoices : public FM
|
|||||||
//! Start a note with the given frequency and amplitude.
|
//! Start a note with the given frequency and amplitude.
|
||||||
void noteOn(StkFloat frequency, StkFloat amplitude);
|
void noteOn(StkFloat frequency, StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
virtual void controlChange(int number, StkFloat value);
|
virtual void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
int currentVowel_;
|
int currentVowel_;
|
||||||
StkFloat tilt_[3];
|
StkFloat tilt_[3];
|
||||||
StkFloat mods_[3];
|
StkFloat mods_[3];
|
||||||
|
|||||||
124
include/FileRead.h
Normal file
124
include/FileRead.h
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class FileRead
|
||||||
|
\brief STK audio file input class.
|
||||||
|
|
||||||
|
This class provides input support for various
|
||||||
|
audio file formats. Multi-channel (>2)
|
||||||
|
soundfiles are supported. The file data is
|
||||||
|
returned via an external StkFrames object
|
||||||
|
passed to the read() function. This class
|
||||||
|
does not store its own copy of the file data,
|
||||||
|
rather the data is read directly from disk.
|
||||||
|
|
||||||
|
FileRead currently supports uncompressed WAV,
|
||||||
|
AIFF/AIFC, SND (AU), MAT-file (Matlab), and
|
||||||
|
STK RAW file formats. Signed integer (8-,
|
||||||
|
16-, and 32-bit) and floating-point (32- and
|
||||||
|
64-bit) data types are supported. Compressed
|
||||||
|
data types are not supported.
|
||||||
|
|
||||||
|
STK RAW files have no header and are assumed
|
||||||
|
to contain a monophonic stream of 16-bit
|
||||||
|
signed integers in big-endian byte order at a
|
||||||
|
sample rate of 22050 Hz. MAT-file data should
|
||||||
|
be saved in an array with each data channel
|
||||||
|
filling a matrix row. The sample rate for
|
||||||
|
MAT-files is assumed to be 44100 Hz.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_FILEREAD_H
|
||||||
|
#define STK_FILEREAD_H
|
||||||
|
|
||||||
|
#include "Stk.h"
|
||||||
|
|
||||||
|
class FileRead : public Stk
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
FileRead();
|
||||||
|
|
||||||
|
//! Overloaded constructor that opens a file during instantiation.
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if the file is not found or its
|
||||||
|
format is unknown or unsupported.
|
||||||
|
*/
|
||||||
|
FileRead( std::string fileName, bool typeRaw = false );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~FileRead();
|
||||||
|
|
||||||
|
//! Open the specified file and determine its formatting.
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if the file is not found or its
|
||||||
|
format is unknown or unsupported. An optional parameter is
|
||||||
|
provided to specify whether the input file is of type STK RAW
|
||||||
|
(default = false).
|
||||||
|
*/
|
||||||
|
void open( std::string fileName, bool typeRaw = false );
|
||||||
|
|
||||||
|
//! If a file is open, close it.
|
||||||
|
void close( void );
|
||||||
|
|
||||||
|
//! Returns \e true if a file is currently open.
|
||||||
|
bool isOpen( void );
|
||||||
|
|
||||||
|
//! Return the file size in sample frames.
|
||||||
|
unsigned long fileSize( void ) const { return fileSize_; };
|
||||||
|
|
||||||
|
//! Return the number of audio channels in the file.
|
||||||
|
unsigned int channels( void ) const { return channels_; };
|
||||||
|
|
||||||
|
//! Return the file sample rate in Hz.
|
||||||
|
/*!
|
||||||
|
WAV, SND, and AIF formatted files specify a sample rate in
|
||||||
|
their headers. By definition, STK RAW files have a sample rate of
|
||||||
|
22050 Hz. MAT-files are assumed to have a rate of 44100 Hz.
|
||||||
|
*/
|
||||||
|
StkFloat fileRate( void ) const { return fileRate_; };
|
||||||
|
|
||||||
|
//! Read sample frames from the file into an StkFrames object.
|
||||||
|
/*!
|
||||||
|
The number of sample frames to read will be determined from the
|
||||||
|
number of frames of the StkFrames argument. If this size is
|
||||||
|
larger than the available data in the file (given the file size
|
||||||
|
and starting frame index), the extra frames will be unaffected
|
||||||
|
(the StkFrames object will not be resized). Optional parameters
|
||||||
|
are provided to specify the starting sample frame within the file
|
||||||
|
(default = 0) and whether to normalize the data with respect to
|
||||||
|
fixed-point limits (default = true). An StkError will be thrown
|
||||||
|
if a file error occurs or if the number of channels in the
|
||||||
|
StkFrames argument is not equal to that in the file.
|
||||||
|
*/
|
||||||
|
void read( StkFrames& buffer, unsigned long startFrame = 0, bool doNormalize = true );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Get STK RAW file information.
|
||||||
|
bool getRawInfo( const char *fileName );
|
||||||
|
|
||||||
|
// Get WAV file header information.
|
||||||
|
bool getWavInfo( const char *fileName );
|
||||||
|
|
||||||
|
// Get SND (AU) file header information.
|
||||||
|
bool getSndInfo( const char *fileName );
|
||||||
|
|
||||||
|
// Get AIFF file header information.
|
||||||
|
bool getAifInfo( const char *fileName );
|
||||||
|
|
||||||
|
// Get MAT-file header information.
|
||||||
|
bool getMatInfo( const char *fileName );
|
||||||
|
|
||||||
|
FILE *fd_;
|
||||||
|
bool byteswap_;
|
||||||
|
bool wavFile_;
|
||||||
|
unsigned long fileSize_;
|
||||||
|
unsigned long dataOffset_;
|
||||||
|
unsigned int channels_;
|
||||||
|
StkFormat dataType_;
|
||||||
|
StkFloat fileRate_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
112
include/FileWrite.h
Normal file
112
include/FileWrite.h
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class FileWrite
|
||||||
|
\brief STK audio file output class.
|
||||||
|
|
||||||
|
This class provides output support for various
|
||||||
|
audio file formats.
|
||||||
|
|
||||||
|
FileWrite writes samples to an audio file. It supports
|
||||||
|
multi-channel data.
|
||||||
|
|
||||||
|
FileWrite currently supports uncompressed WAV, AIFF, AIFC, SND
|
||||||
|
(AU), MAT-file (Matlab), and STK RAW file formats. Signed integer
|
||||||
|
(8-, 16-, and 32-bit) and floating- point (32- and 64-bit) data
|
||||||
|
types are supported. STK RAW files use 16-bit integers by
|
||||||
|
definition. MAT-files will always be written as 64-bit floats.
|
||||||
|
If a data type specification does not match the specified file
|
||||||
|
type, the data type will automatically be modified. Compressed
|
||||||
|
data types are not supported.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_FILEWRITE_H
|
||||||
|
#define STK_FILEWRITE_H
|
||||||
|
|
||||||
|
#include "Stk.h"
|
||||||
|
|
||||||
|
class FileWrite : public Stk
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef unsigned long FILE_TYPE;
|
||||||
|
|
||||||
|
static const FILE_TYPE FILE_RAW; /*!< STK RAW file type. */
|
||||||
|
static const FILE_TYPE FILE_WAV; /*!< WAV file type. */
|
||||||
|
static const FILE_TYPE FILE_SND; /*!< SND (AU) file type. */
|
||||||
|
static const FILE_TYPE FILE_AIF; /*!< AIFF file type. */
|
||||||
|
static const FILE_TYPE FILE_MAT; /*!< Matlab MAT-file type. */
|
||||||
|
|
||||||
|
//! Default constructor.
|
||||||
|
FileWrite();
|
||||||
|
|
||||||
|
//! Overloaded constructor used to specify a file name, type, and data format with this object.
|
||||||
|
/*!
|
||||||
|
An StkError is thrown for invalid argument values or if an error occurs when initializing the output file.
|
||||||
|
*/
|
||||||
|
FileWrite( std::string fileName, unsigned int nChannels = 1, FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
virtual ~FileWrite();
|
||||||
|
|
||||||
|
//! Create a file of the specified type and name and output samples to it in the given data format.
|
||||||
|
/*!
|
||||||
|
An StkError is thrown for invalid argument values or if an error occurs when initializing the output file.
|
||||||
|
*/
|
||||||
|
void open( std::string fileName, unsigned int nChannels = 1,
|
||||||
|
FileWrite::FILE_TYPE type = FILE_WAV, Stk::StkFormat format = STK_SINT16 );
|
||||||
|
|
||||||
|
//! If a file is open, write out samples in the queue and then close it.
|
||||||
|
void close( void );
|
||||||
|
|
||||||
|
//! Returns \e true if a file is currently open.
|
||||||
|
bool isOpen( void );
|
||||||
|
|
||||||
|
//! Write sample frames from the StkFrames object to the file.
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if the number of channels in the
|
||||||
|
StkFrames argument does not agree with the number of channels
|
||||||
|
specified when opening the file.
|
||||||
|
*/
|
||||||
|
void write( StkFrames& buffer );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Write STK RAW file header.
|
||||||
|
bool setRawFile( const char *fileName );
|
||||||
|
|
||||||
|
// Write WAV file header.
|
||||||
|
bool setWavFile( const char *fileName );
|
||||||
|
|
||||||
|
// Close WAV file, updating the header.
|
||||||
|
void closeWavFile( void );
|
||||||
|
|
||||||
|
// Write SND (AU) file header.
|
||||||
|
bool setSndFile( const char *fileName );
|
||||||
|
|
||||||
|
// Close SND file, updating the header.
|
||||||
|
void closeSndFile( void );
|
||||||
|
|
||||||
|
// Write AIFF file header.
|
||||||
|
bool setAifFile( const char *fileName );
|
||||||
|
|
||||||
|
// Close AIFF file, updating the header.
|
||||||
|
void closeAifFile( void );
|
||||||
|
|
||||||
|
// Write MAT-file header.
|
||||||
|
bool setMatFile( const char *fileName );
|
||||||
|
|
||||||
|
// Close MAT-file, updating the header.
|
||||||
|
void closeMatFile( void );
|
||||||
|
|
||||||
|
FILE *fd_;
|
||||||
|
FILE_TYPE fileType_;
|
||||||
|
StkFormat dataType_;
|
||||||
|
unsigned int channels_;
|
||||||
|
unsigned long frameCounter_;
|
||||||
|
bool byteswap_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
143
include/FileWvIn.h
Normal file
143
include/FileWvIn.h
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class FileWvIn
|
||||||
|
\brief STK audio file input class.
|
||||||
|
|
||||||
|
This class inherits from WvIn. It provides a "tick-level"
|
||||||
|
interface to the FileRead class. It also provides variable-rate
|
||||||
|
"playback" functionality. Audio file support is provided by the
|
||||||
|
FileRead class. Linear interpolation is used for fractional "read
|
||||||
|
rates".
|
||||||
|
|
||||||
|
FileWvIn supports multi-channel data. It is important to distinguish
|
||||||
|
the tick() methods, which return samples produced by averaging
|
||||||
|
across sample frames, from the tickFrame() methods, which return
|
||||||
|
references to multi-channel sample frames.
|
||||||
|
|
||||||
|
FileWvIn will either load the entire content of an audio file into
|
||||||
|
local memory or incrementally read file data from disk in chunks.
|
||||||
|
This behavior is controlled by the optional constructor arguments
|
||||||
|
\e chunkThreshold and \e chunkSize. File sizes greater than \e
|
||||||
|
chunkThreshold (in sample frames) will be read incrementally in
|
||||||
|
chunks of \e chunkSize each (also in sample frames).
|
||||||
|
|
||||||
|
When the file end is reached, subsequent calls to the tick()
|
||||||
|
functions return zero-valued data and isFinished() returns \e
|
||||||
|
true.
|
||||||
|
|
||||||
|
See the FileRead class for a description of the supported audio
|
||||||
|
file formats.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_FILEWVIN_H
|
||||||
|
#define STK_FILEWVIN_H
|
||||||
|
|
||||||
|
#include "WvIn.h"
|
||||||
|
#include "FileRead.h"
|
||||||
|
|
||||||
|
class FileWvIn : public WvIn
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
FileWvIn( unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024 );
|
||||||
|
|
||||||
|
//! Overloaded constructor for file input.
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if the file is not found, its format is
|
||||||
|
unknown, or a read error occurs.
|
||||||
|
*/
|
||||||
|
FileWvIn( std::string fileName, bool raw = false, bool doNormalize = true,
|
||||||
|
unsigned long chunkThreshold = 1000000, unsigned long chunkSize = 1024 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
virtual ~FileWvIn();
|
||||||
|
|
||||||
|
//! Open the specified file and load its data.
|
||||||
|
/*!
|
||||||
|
Data from a previously opened file will be overwritten by this
|
||||||
|
function. An StkError will be thrown if the file is not found,
|
||||||
|
its format is unknown, or a read error occurs. If the file data
|
||||||
|
is to be loaded incrementally from disk and normalization is
|
||||||
|
specified, a scaling will be applied with respect to fixed-point
|
||||||
|
limits. If the data format is floating-point, no scaling is
|
||||||
|
performed.
|
||||||
|
*/
|
||||||
|
void openFile( std::string fileName, bool raw = false, bool doNormalize = true );
|
||||||
|
|
||||||
|
//! Close a file if one is open.
|
||||||
|
void closeFile( void );
|
||||||
|
|
||||||
|
//! Clear outputs and reset time (file) pointer to zero.
|
||||||
|
void reset( void );
|
||||||
|
|
||||||
|
//! Normalize data to a maximum of +-1.0.
|
||||||
|
/*!
|
||||||
|
This function has no effect when data is incrementally loaded
|
||||||
|
from disk.
|
||||||
|
*/
|
||||||
|
void normalize( void );
|
||||||
|
|
||||||
|
//! Normalize data to a maximum of \e +-peak.
|
||||||
|
/*!
|
||||||
|
This function has no effect when data is incrementally loaded
|
||||||
|
from disk.
|
||||||
|
*/
|
||||||
|
void normalize( StkFloat peak );
|
||||||
|
|
||||||
|
//! Return the file size in sample frames.
|
||||||
|
unsigned long getSize( void ) const { return data_.frames(); };
|
||||||
|
|
||||||
|
//! Return the input file sample rate in Hz (not the data read rate).
|
||||||
|
/*!
|
||||||
|
WAV, SND, and AIF formatted files specify a sample rate in
|
||||||
|
their headers. STK RAW files have a sample rate of 22050 Hz
|
||||||
|
by definition. MAT-files are assumed to have a rate of 44100 Hz.
|
||||||
|
*/
|
||||||
|
StkFloat getFileRate( void ) const { return data_.dataRate(); };
|
||||||
|
|
||||||
|
//! Query whether reading is complete.
|
||||||
|
bool isFinished( void ) const { return finished_; };
|
||||||
|
|
||||||
|
//! Set the data read rate in samples. The rate can be negative.
|
||||||
|
/*!
|
||||||
|
If the rate value is negative, the data is read in reverse order.
|
||||||
|
*/
|
||||||
|
void setRate( StkFloat rate );
|
||||||
|
|
||||||
|
//! Increment the read pointer by \e time samples.
|
||||||
|
/*!
|
||||||
|
Note that this function will not modify the interpolation flag status.
|
||||||
|
*/
|
||||||
|
virtual void addTime( StkFloat time );
|
||||||
|
|
||||||
|
//! Turn linear interpolation on/off.
|
||||||
|
/*!
|
||||||
|
Interpolation is automatically off when the read rate is
|
||||||
|
an integer value. If interpolation is turned off for a
|
||||||
|
fractional rate, the time index is truncated to an integer
|
||||||
|
value.
|
||||||
|
*/
|
||||||
|
void setInterpolate( bool doInterpolate ) { interpolate_ = doInterpolate; };
|
||||||
|
|
||||||
|
StkFloat lastOut( void ) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void computeFrame( void );
|
||||||
|
|
||||||
|
FileRead file_;
|
||||||
|
bool finished_;
|
||||||
|
bool interpolate_;
|
||||||
|
bool normalizing_;
|
||||||
|
bool chunking_;
|
||||||
|
StkFloat time_;
|
||||||
|
StkFloat rate_;
|
||||||
|
unsigned long chunkThreshold_;
|
||||||
|
unsigned long chunkSize_;
|
||||||
|
long chunkPointer_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
87
include/FileWvOut.h
Normal file
87
include/FileWvOut.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class FileWvOut
|
||||||
|
\brief STK audio file output class.
|
||||||
|
|
||||||
|
This class inherits from WvOut. It provides a "tick-level"
|
||||||
|
interface to the FileWrite class.
|
||||||
|
|
||||||
|
FileWvOut writes samples to an audio file and supports
|
||||||
|
multi-channel data. It is important to distinguish the tick()
|
||||||
|
methods, which output single samples to all channels in a sample
|
||||||
|
frame, from the tickFrame() methods, which take a pointer or
|
||||||
|
reference to multi-channel sample frame data.
|
||||||
|
|
||||||
|
See the FileWrite class for a description of the supported audio
|
||||||
|
file formats.
|
||||||
|
|
||||||
|
Currently, FileWvOut is non-interpolating and the output rate is
|
||||||
|
always Stk::sampleRate().
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_FILEWVOUT_H
|
||||||
|
#define STK_FILEWVOUT_H
|
||||||
|
|
||||||
|
#include "WvOut.h"
|
||||||
|
#include "FileWrite.h"
|
||||||
|
|
||||||
|
class FileWvOut : public WvOut
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Default constructor with optional output buffer size argument.
|
||||||
|
/*!
|
||||||
|
The output buffer size defines the number of frames that are
|
||||||
|
accumulated between writes to disk.
|
||||||
|
*/
|
||||||
|
FileWvOut( unsigned int bufferFrames = 1024 );
|
||||||
|
|
||||||
|
//! Overloaded constructor used to specify a file name, type, and data format with this object.
|
||||||
|
/*!
|
||||||
|
An StkError is thrown for invalid argument values or if an error occurs when initializing the output file.
|
||||||
|
*/
|
||||||
|
FileWvOut( std::string fileName,
|
||||||
|
unsigned int nChannels = 1,
|
||||||
|
FileWrite::FILE_TYPE type = FileWrite::FILE_WAV,
|
||||||
|
Stk::StkFormat format = STK_SINT16,
|
||||||
|
unsigned int bufferFrames = 1024 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
virtual ~FileWvOut();
|
||||||
|
|
||||||
|
//! Open a new file with the specified parameters.
|
||||||
|
/*!
|
||||||
|
If a file was previously open, it will be closed. An StkError
|
||||||
|
will be thrown if any of the specified arguments are invalid or a
|
||||||
|
file error occurs during opening.
|
||||||
|
*/
|
||||||
|
void openFile( std::string fileName,
|
||||||
|
unsigned int nChannels,
|
||||||
|
FileWrite::FILE_TYPE type,
|
||||||
|
Stk::StkFormat format );
|
||||||
|
|
||||||
|
//! Close a file if one is open.
|
||||||
|
/*!
|
||||||
|
Any data remaining in the internal buffer will be written to
|
||||||
|
the file before closing.
|
||||||
|
*/
|
||||||
|
void closeFile( void );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void computeSample( const StkFloat sample );
|
||||||
|
|
||||||
|
void computeFrames( const StkFrames& frames );
|
||||||
|
|
||||||
|
void incrementFrame( void );
|
||||||
|
|
||||||
|
FileWrite file_;
|
||||||
|
unsigned int bufferFrames_;
|
||||||
|
unsigned int bufferIndex_;
|
||||||
|
unsigned int iData_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
/*! \class Filter
|
/*! \class Filter
|
||||||
\brief STK filter class.
|
\brief STK filter class.
|
||||||
|
|
||||||
This class implements a generic structure which
|
This class implements a generic structure that
|
||||||
can be used to create a wide range of filters.
|
can be used to create a wide range of filters.
|
||||||
It can function independently or be subclassed
|
It can function independently or be subclassed
|
||||||
to provide more specific controls based on a
|
to provide more specific controls based on a
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
results in one extra multiply per computed sample,
|
results in one extra multiply per computed sample,
|
||||||
but allows easy control of the overall filter gain.
|
but allows easy control of the overall filter gain.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include "Stk.h"
|
#include "Stk.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <valarray>
|
|
||||||
|
|
||||||
class Filter : public Stk
|
class Filter : public Stk
|
||||||
{
|
{
|
||||||
@@ -58,19 +57,20 @@ public:
|
|||||||
An StkError can be thrown if either of the coefficient vector
|
An StkError can be thrown if either of the coefficient vector
|
||||||
sizes is zero, or if the a[0] coefficient is equal to zero. If
|
sizes is zero, or if the a[0] coefficient is equal to zero. If
|
||||||
a[0] is not equal to 1, the filter coeffcients are normalized by
|
a[0] is not equal to 1, the filter coeffcients are normalized by
|
||||||
a[0]. The internal state of the filter is cleared.
|
a[0]. The internal state of the filter is not cleared unless the
|
||||||
|
\e clearState flag is \c true.
|
||||||
*/
|
*/
|
||||||
void setCoefficients( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients );
|
void setCoefficients( std::vector<StkFloat> &bCoefficients, std::vector<StkFloat> &aCoefficients, bool clearState = false );
|
||||||
|
|
||||||
//! Set numerator coefficients.
|
//! Set numerator coefficients.
|
||||||
/*!
|
/*!
|
||||||
An StkError can be thrown if coefficient vector is empty. Any
|
An StkError can be thrown if coefficient vector is empty. Any
|
||||||
previously set denominator coefficients are left unaffected. Note
|
previously set denominator coefficients are left unaffected. Note
|
||||||
that the default constructor sets the single denominator
|
that the default constructor sets the single denominator
|
||||||
coefficient a[0] to 1.0. The internal state of the filter is
|
coefficient a[0] to 1.0. The internal state of the filter is not
|
||||||
cleared.
|
cleared unless the \e clearState flag is \c true.
|
||||||
*/
|
*/
|
||||||
void setNumerator( std::vector<StkFloat> &bCoefficients );
|
void setNumerator( std::vector<StkFloat> &bCoefficients, bool clearState = false );
|
||||||
|
|
||||||
//! Set denominator coefficients.
|
//! Set denominator coefficients.
|
||||||
/*!
|
/*!
|
||||||
@@ -79,9 +79,10 @@ public:
|
|||||||
numerator coefficients are unaffected unless a[0] is not equal to
|
numerator coefficients are unaffected unless a[0] is not equal to
|
||||||
1, in which case all coeffcients are normalized by a[0]. Note
|
1, in which case all coeffcients are normalized by a[0]. Note
|
||||||
that the default constructor sets the single numerator coefficient
|
that the default constructor sets the single numerator coefficient
|
||||||
b[0] to 1.0. The internal state of the filter is cleared.
|
b[0] to 1.0. The internal state of the filter is not cleared
|
||||||
|
unless the \e clearState flag is \c true.
|
||||||
*/
|
*/
|
||||||
void setDenominator( std::vector<StkFloat> &aCoefficients );
|
void setDenominator( std::vector<StkFloat> &aCoefficients, bool clearState = false );
|
||||||
|
|
||||||
//! Set the filter gain.
|
//! Set the filter gain.
|
||||||
/*!
|
/*!
|
||||||
@@ -97,21 +98,19 @@ public:
|
|||||||
virtual StkFloat lastOut(void) const;
|
virtual StkFloat lastOut(void) const;
|
||||||
|
|
||||||
//! Input one sample to the filter and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
virtual StkFloat tick(StkFloat sample);
|
virtual StkFloat tick( StkFloat input );
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
StkFloat gain_;
|
StkFloat gain_;
|
||||||
std::vector<StkFloat> b_;
|
std::vector<StkFloat> b_;
|
||||||
std::vector<StkFloat> a_;
|
std::vector<StkFloat> a_;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Breath Pressure = 128
|
- Breath Pressure = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "PoleZero.h"
|
#include "PoleZero.h"
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class Flute : public Instrmnt
|
class Flute : public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -73,25 +73,13 @@ class Flute : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayL jetDelay_;
|
DelayL jetDelay_;
|
||||||
DelayL boreDelay_;
|
DelayL boreDelay_;
|
||||||
JetTable jetTable_;
|
JetTable jetTable_;
|
||||||
@@ -99,7 +87,7 @@ class Flute : public Instrmnt
|
|||||||
PoleZero dcBlock_;
|
PoleZero dcBlock_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
unsigned long length_;
|
unsigned long length_;
|
||||||
StkFloat lastFrequency_;
|
StkFloat lastFrequency_;
|
||||||
StkFloat maxPressure_;
|
StkFloat maxPressure_;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
It provides methods for controlling the sweep
|
It provides methods for controlling the sweep
|
||||||
rate and target frequency.
|
rate and target frequency.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -66,22 +66,10 @@ class FormSwep : public BiQuad
|
|||||||
*/
|
*/
|
||||||
void setSweepTime(StkFloat time);
|
void setSweepTime(StkFloat time);
|
||||||
|
|
||||||
//! Input one sample to the filter and return one output.
|
|
||||||
StkFloat tick(StkFloat sample);
|
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
bool dirty_;
|
bool dirty_;
|
||||||
StkFloat frequency_;
|
StkFloat frequency_;
|
||||||
StkFloat radius_;
|
StkFloat radius_;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
implement tables or other types of input to output function
|
implement tables or other types of input to output function
|
||||||
mappings.
|
mappings.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -27,23 +27,25 @@ class Function : public Stk
|
|||||||
//! Return the last output value.
|
//! Return the last output value.
|
||||||
virtual StkFloat lastOut() const { return lastOutput_; };
|
virtual StkFloat lastOut() const { return lastOutput_; };
|
||||||
|
|
||||||
//! Abstract tick function ... must be implemented in subclasses.
|
//! Take one sample input and compute one sample of output.
|
||||||
virtual StkFloat tick( StkFloat input ) = 0;
|
StkFloat tick( StkFloat input );
|
||||||
|
|
||||||
//! Take \e vectorSize inputs from \e vector and replace them with corresponding outputs.
|
|
||||||
virtual StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// This abstract function must be implemented in all subclasses.
|
||||||
|
// It is used to get around a C++ problem with overloaded virtual
|
||||||
|
// functions.
|
||||||
|
virtual StkFloat computeSample( StkFloat input ) = 0;
|
||||||
|
|
||||||
StkFloat lastOutput_;
|
StkFloat lastOutput_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
\brief STK abstract unit generator parent class.
|
\brief STK abstract unit generator parent class.
|
||||||
|
|
||||||
This class provides common functionality for
|
This class provides common functionality for
|
||||||
STK unit generator source subclasses.
|
STK unit generator sample-source subclasses.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -18,31 +18,33 @@ class Generator : public Stk
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Class constructor.
|
//! Class constructor.
|
||||||
Generator();
|
Generator( void );
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
virtual ~Generator();
|
virtual ~Generator( void );
|
||||||
|
|
||||||
//! Return the last output value.
|
//! Return the last output value.
|
||||||
virtual StkFloat lastOut() const { return lastOutput_; };
|
virtual StkFloat lastOut( void ) const { return lastOutput_; };
|
||||||
|
|
||||||
//! Abstract tick function ... must be implemented in subclasses.
|
//! Compute one sample and output.
|
||||||
virtual StkFloat tick( void ) = 0;
|
StkFloat tick( void );
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
//! Fill a channel of the StkFrames object with computed outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// This abstract function must be implemented in all subclasses.
|
||||||
|
// It is used to get around a C++ problem with overloaded virtual
|
||||||
|
// functions.
|
||||||
|
virtual StkFloat computeSample( void ) = 0;
|
||||||
|
|
||||||
StkFloat lastOutput_;
|
StkFloat lastOutput_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
145
include/Granulate.h
Normal file
145
include/Granulate.h
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class Granulate
|
||||||
|
\brief STK granular synthesis class.
|
||||||
|
|
||||||
|
This class implements a real-time granular synthesis algorithm
|
||||||
|
that operates on an input soundfile. Currently, only monophonic
|
||||||
|
files are supported. Various functions are provided to allow
|
||||||
|
control over voice and grain parameters.
|
||||||
|
|
||||||
|
The functionality of this class is based on the program MacPod by
|
||||||
|
Chris Rolfe and Damian Keller, though there are likely to be a
|
||||||
|
number of differences in the actual implementation.
|
||||||
|
|
||||||
|
by Gary Scavone, 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_GRANULATE_H
|
||||||
|
#define STK_GRANULATE_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include "Generator.h"
|
||||||
|
#include "Envelope.h"
|
||||||
|
#include "Noise.h"
|
||||||
|
|
||||||
|
class Granulate: public Generator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
Granulate( void );
|
||||||
|
|
||||||
|
//! Constructor taking input audio file and number of voices arguments.
|
||||||
|
Granulate( unsigned int nVoices, std::string fileName, bool typeRaw = false );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~Granulate();
|
||||||
|
|
||||||
|
//! Load a monophonic soundfile to be "granulated".
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if the file is not found, its format
|
||||||
|
is unknown or unsupported, or the file has more than one channel.
|
||||||
|
*/
|
||||||
|
void openFile( std::string fileName, bool typeRaw = false );
|
||||||
|
|
||||||
|
//! Reset the file pointer and all existing grains to the file start.
|
||||||
|
/*!
|
||||||
|
Multiple grains are offset from one another in time by grain
|
||||||
|
duration / nVoices.
|
||||||
|
*/
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
//! Set the number of simultaneous grain "voices" to use.
|
||||||
|
/*!
|
||||||
|
Multiple grains are offset from one another in time by grain
|
||||||
|
duration / nVoices. For this reason, it is best to set the grain
|
||||||
|
parameters before calling this function (during initialization).
|
||||||
|
*/
|
||||||
|
void setVoices( unsigned int nVoices = 1 );
|
||||||
|
|
||||||
|
//! Set the stretch factor used for grain playback (1 - 1000).
|
||||||
|
/*!
|
||||||
|
Granular synthesis allows for time-stetching without affecting
|
||||||
|
the original pitch of a sound. A stretch factor of 4 will produce
|
||||||
|
a resulting sound of length 4 times the orignal sound. The
|
||||||
|
default parameter of 1 produces no stretching.
|
||||||
|
*/
|
||||||
|
void setStretch( unsigned int stretchFactor = 1 );
|
||||||
|
|
||||||
|
//! Set global grain parameters used to determine individual grain settings.
|
||||||
|
/*!
|
||||||
|
Each grain is defined as having a length of \e duration
|
||||||
|
milliseconds which must be greater than zero. For values of \e
|
||||||
|
rampPercent (0 - 100) greater than zero, a linear envelope will be
|
||||||
|
applied to each grain. If \e rampPercent = 100, the resultant
|
||||||
|
grain "window" is triangular while \e rampPercent = 50 produces a
|
||||||
|
trapezoidal window. In addition, each grain can have a time delay
|
||||||
|
of length \e delay and a grain pointer increment of length \e
|
||||||
|
offset, which can be negative, before the next ramp onset (in
|
||||||
|
milliseconds). The actual values calculated for each grain will
|
||||||
|
be randomized by a factor set using the setRandomFactor()
|
||||||
|
function.
|
||||||
|
*/
|
||||||
|
void setGrainParameters( unsigned int duration = 30, unsigned int rampPercent = 50,
|
||||||
|
int offset = 0, unsigned int delay = 0 );
|
||||||
|
|
||||||
|
//! This factor is used when setting individual grain parameters (0.0 - 1.0).
|
||||||
|
/*!
|
||||||
|
This random factor is applied when all grain state durations
|
||||||
|
are calculated. If set to 0.0, no randomness occurs. When
|
||||||
|
randomness = 1.0, a grain segment of length \e duration will be
|
||||||
|
randomly augmented by up to +- \e duration seconds (i.e., a 30
|
||||||
|
millisecond length will be augmented by an extra length of up to
|
||||||
|
+30 or -30 milliseconds).
|
||||||
|
*/
|
||||||
|
void setRandomFactor( StkFloat randomness = 0.1 );
|
||||||
|
|
||||||
|
enum GrainState {
|
||||||
|
GRAIN_STOPPED,
|
||||||
|
GRAIN_FADEIN,
|
||||||
|
GRAIN_SUSTAIN,
|
||||||
|
GRAIN_FADEOUT
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
struct Grain {
|
||||||
|
StkFloat eScaler;
|
||||||
|
StkFloat eRate;
|
||||||
|
unsigned long attackCount;
|
||||||
|
unsigned long sustainCount;
|
||||||
|
unsigned long decayCount;
|
||||||
|
unsigned long delayCount;
|
||||||
|
unsigned long counter;
|
||||||
|
unsigned long pointer;
|
||||||
|
unsigned long startPointer;
|
||||||
|
unsigned int repeats;
|
||||||
|
GrainState state;
|
||||||
|
|
||||||
|
// Default constructor.
|
||||||
|
Grain()
|
||||||
|
:eScaler(0.0), eRate(0.0), attackCount(0), sustainCount(0), decayCount(0),
|
||||||
|
delayCount(0), counter(0), pointer(0), startPointer(0), repeats(0), state(GRAIN_STOPPED) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
void calculateGrain( Granulate::Grain& grain );
|
||||||
|
|
||||||
|
StkFrames data_;
|
||||||
|
std::vector<Grain> grains_;
|
||||||
|
Noise noise;
|
||||||
|
long gPointer_;
|
||||||
|
|
||||||
|
// Global grain parameters.
|
||||||
|
unsigned int gDuration_;
|
||||||
|
unsigned int gRampPercent_;
|
||||||
|
unsigned int gDelay_;
|
||||||
|
unsigned int gStretch_;
|
||||||
|
unsigned int stretchCounter_;
|
||||||
|
int gOffset_;
|
||||||
|
StkFloat gRandomFactor_;
|
||||||
|
StkFloat gain_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -48,20 +48,9 @@ class HevyMetl : public FM
|
|||||||
//! Start a note with the given frequency and amplitude.
|
//! Start a note with the given frequency and amplitude.
|
||||||
void noteOn(StkFloat frequency, StkFloat amplitude);
|
void noteOn(StkFloat frequency, StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
protected:
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
StkFloat computeSample( void );
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
103
include/InetWvIn.h
Normal file
103
include/InetWvIn.h
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class InetWvIn
|
||||||
|
\brief STK internet streaming input class.
|
||||||
|
|
||||||
|
This Wvin subclass reads streamed audio data over a network via a
|
||||||
|
TCP or UDP socket connection. The data is assumed in big-endian,
|
||||||
|
or network, byte order. Only a single socket connection is
|
||||||
|
supported.
|
||||||
|
|
||||||
|
InetWvIn supports multi-channel data. It is important to
|
||||||
|
distinguish the tick() methods, which return samples produced by
|
||||||
|
averaging across sample frames, from the tickFrame() methods,
|
||||||
|
which return references or pointers to multi-channel sample
|
||||||
|
frames.
|
||||||
|
|
||||||
|
This class implements a socket server. When using the TCP
|
||||||
|
protocol, the server "listens" for a single remote connection
|
||||||
|
within the InetWvIn::start() function. For the UDP protocol, no
|
||||||
|
attempt is made to verify packet delivery or order. The default
|
||||||
|
data type for the incoming stream is signed 16-bit integers,
|
||||||
|
though any of the defined StkFormats are permissible.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_INETWVIN_H
|
||||||
|
#define STK_INETWVIN_H
|
||||||
|
|
||||||
|
#include "WvIn.h"
|
||||||
|
#include "TcpServer.h"
|
||||||
|
#include "UdpSocket.h"
|
||||||
|
#include "Thread.h"
|
||||||
|
#include "Mutex.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool finished;
|
||||||
|
void *object;
|
||||||
|
} ThreadInfo;
|
||||||
|
|
||||||
|
class InetWvIn : public WvIn
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
/*!
|
||||||
|
An StkError will be thrown if an error occurs while initializing the input thread.
|
||||||
|
*/
|
||||||
|
InetWvIn( unsigned long bufferFrames = 1024, unsigned int nBuffers = 8 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~InetWvIn();
|
||||||
|
|
||||||
|
//! Wait for a (new) socket connection with specified protocol, port, data channels and format.
|
||||||
|
/*!
|
||||||
|
For the UDP protocol, this function will create a socket
|
||||||
|
instance and return. For the TCP protocol, this function will
|
||||||
|
block until a connection is established. An StkError will be
|
||||||
|
thrown if a socket error occurs or an invalid function argument is
|
||||||
|
provided.
|
||||||
|
*/
|
||||||
|
void listen( int port = 2006, unsigned int nChannels = 1,
|
||||||
|
Stk::StkFormat format = STK_SINT16,
|
||||||
|
Socket::ProtocolType protocol = Socket::PROTO_TCP );
|
||||||
|
|
||||||
|
//! Returns true is an input connection exists or input data remains in the queue.
|
||||||
|
/*!
|
||||||
|
This method will not return false after an input connection has been closed until
|
||||||
|
all buffered input data has been read out.
|
||||||
|
*/
|
||||||
|
bool isConnected( void );
|
||||||
|
|
||||||
|
// Called by the thread routine to receive data via the socket connection
|
||||||
|
// and fill the socket buffer. This is not intended for general use but
|
||||||
|
// had to be made public for access from the thread.
|
||||||
|
void receive( void );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Read buffered socket data into the data buffer ... will block if none available.
|
||||||
|
int readData( void );
|
||||||
|
|
||||||
|
void computeFrame( void );
|
||||||
|
|
||||||
|
Socket *soket_;
|
||||||
|
Thread thread_;
|
||||||
|
Mutex mutex_;
|
||||||
|
char *buffer_;
|
||||||
|
unsigned long bufferFrames_;
|
||||||
|
unsigned long bufferBytes_;
|
||||||
|
unsigned long bytesFilled_;
|
||||||
|
unsigned int nBuffers_;
|
||||||
|
unsigned long writePoint_;
|
||||||
|
unsigned long readPoint_;
|
||||||
|
long bufferCounter_;
|
||||||
|
int dataBytes_;
|
||||||
|
bool connected_;
|
||||||
|
int fd_;
|
||||||
|
ThreadInfo threadInfo_;
|
||||||
|
Stk::StkFormat dataType_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
77
include/InetWvOut.h
Normal file
77
include/InetWvOut.h
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class InetWvOut
|
||||||
|
\brief STK internet streaming output class.
|
||||||
|
|
||||||
|
This WvOut subclass can stream data over a network via a TCP or
|
||||||
|
UDP socket connection. The data is converted to big-endian byte
|
||||||
|
order, if necessary, before being transmitted.
|
||||||
|
|
||||||
|
InetWvOut supports multi-channel data. It is important to
|
||||||
|
distinguish the tick() methods, which output single samples to all
|
||||||
|
channels in a sample frame, from the tickFrame() method, which
|
||||||
|
takes a reference to multi-channel sample frame data.
|
||||||
|
|
||||||
|
This class connects to a socket server, the port and IP address of
|
||||||
|
which must be specified as constructor arguments. The default
|
||||||
|
data type is signed 16-bit integers but any of the defined
|
||||||
|
StkFormats are permissible.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_INETWVOUT_H
|
||||||
|
#define STK_INETWVOUT_H
|
||||||
|
|
||||||
|
#include "WvOut.h"
|
||||||
|
#include "Socket.h"
|
||||||
|
|
||||||
|
class InetWvOut : public WvOut
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor ... the socket is not instantiated.
|
||||||
|
InetWvOut( unsigned long packetFrames = 1024 );
|
||||||
|
|
||||||
|
//! Overloaded constructor which opens a network connection during instantiation.
|
||||||
|
/*!
|
||||||
|
An StkError is thrown if a socket error occurs or an invalid argument is specified.
|
||||||
|
*/
|
||||||
|
InetWvOut( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||||
|
std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16,
|
||||||
|
unsigned long packetFrames = 1024 );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
~InetWvOut();
|
||||||
|
|
||||||
|
//! Connect to the specified host and port and prepare to stream \e nChannels of data in the given data format.
|
||||||
|
/*!
|
||||||
|
An StkError is thrown if a socket error occurs or an invalid argument is specified.
|
||||||
|
*/
|
||||||
|
void connect( int port, Socket::ProtocolType protocol = Socket::PROTO_TCP,
|
||||||
|
std::string hostname = "localhost", unsigned int nChannels = 1, Stk::StkFormat format = STK_SINT16 );
|
||||||
|
|
||||||
|
//! If a connection is open, write out remaining samples in the queue and then disconnect.
|
||||||
|
void disconnect(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void computeSample( const StkFloat sample );
|
||||||
|
|
||||||
|
void computeFrames( const StkFrames& frames );
|
||||||
|
|
||||||
|
void incrementFrame( void );
|
||||||
|
|
||||||
|
// Write a buffer of length frames via the socket connection.
|
||||||
|
void writeData( unsigned long frames );
|
||||||
|
|
||||||
|
char *buffer_;
|
||||||
|
Socket *soket_;
|
||||||
|
unsigned long bufferFrames_;
|
||||||
|
unsigned long bufferBytes_;
|
||||||
|
unsigned long bufferIndex_;
|
||||||
|
unsigned long iData_;
|
||||||
|
unsigned int dataBytes_;
|
||||||
|
Stk::StkFormat dataType_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
This class provides a common interface for
|
This class provides a common interface for
|
||||||
all STK instruments.
|
all STK instruments.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -41,25 +41,28 @@ class Instrmnt : public Stk
|
|||||||
//! Return the last right output value.
|
//! Return the last right output value.
|
||||||
StkFloat lastOutRight() const;
|
StkFloat lastOutRight() const;
|
||||||
|
|
||||||
//! Compute one output sample.
|
//! Compute one sample and output.
|
||||||
virtual StkFloat tick() = 0;
|
StkFloat tick( void );
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
//! Fill a channel of the StkFrames object with computed outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
virtual void controlChange(int number, StkFloat value);
|
virtual void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// This abstract function must be implemented in all subclasses.
|
||||||
|
// It is used to get around a C++ problem with overloaded virtual
|
||||||
|
// functions.
|
||||||
|
virtual StkFloat computeSample( void ) = 0;
|
||||||
|
|
||||||
StkFloat lastOutput_;
|
StkFloat lastOutput_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
filters, and two decorrelation delay lines in
|
filters, and two decorrelation delay lines in
|
||||||
parallel at the output.
|
parallel at the output.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -35,22 +35,10 @@ class JCRev : public Effect
|
|||||||
//! Set the reverberation T60 decay time.
|
//! Set the reverberation T60 decay time.
|
||||||
void setT60( StkFloat T60 );
|
void setT60( StkFloat T60 );
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
Delay allpassDelays_[3];
|
Delay allpassDelays_[3];
|
||||||
Delay combDelays_[4];
|
Delay combDelays_[4];
|
||||||
Delay outLeftDelay_;
|
Delay outLeftDelay_;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
Consult Fletcher and Rossing, Karjalainen,
|
Consult Fletcher and Rossing, Karjalainen,
|
||||||
Cook, and others for more information.
|
Cook, and others for more information.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -27,23 +27,10 @@ public:
|
|||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
~JetTable();
|
~JetTable();
|
||||||
|
|
||||||
//! Return the function value for \e input.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs from \e vector and replace them with corresponding outputs.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
- String Detuning = 1
|
- String Detuning = 1
|
||||||
- Microphone Position = 128
|
- Microphone Position = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#define STK_MANDOLIN_H
|
#define STK_MANDOLIN_H
|
||||||
|
|
||||||
#include "PluckTwo.h"
|
#include "PluckTwo.h"
|
||||||
#include "WvIn.h"
|
#include "FileWvIn.h"
|
||||||
|
|
||||||
class Mandolin : public PluckTwo
|
class Mandolin : public PluckTwo
|
||||||
{
|
{
|
||||||
@@ -54,26 +54,14 @@ class Mandolin : public PluckTwo
|
|||||||
//! Set the body size (a value of 1.0 produces the "default" size).
|
//! Set the body size (a value of 1.0 produces the "default" size).
|
||||||
void setBodySize(StkFloat size);
|
void setBodySize(StkFloat size);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WvIn *soundfile_[12];
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
FileWvIn *soundfile_[12];
|
||||||
int mic_;
|
int mic_;
|
||||||
long dampTime_;
|
long dampTime_;
|
||||||
bool waveDone_;
|
bool waveDone_;
|
||||||
|
|||||||
@@ -66,29 +66,16 @@ class Mesh2D : public Instrmnt
|
|||||||
//! Calculate and return the signal energy stored in the mesh.
|
//! Calculate and return the signal energy stored in the mesh.
|
||||||
StkFloat energy();
|
StkFloat energy();
|
||||||
|
|
||||||
//! Compute one output sample, without adding energy to the mesh.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Input a sample to the mesh and compute one output sample.
|
//! Input a sample to the mesh and compute one output sample.
|
||||||
StkFloat tick(StkFloat input);
|
StkFloat inputTick( StkFloat input );
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
StkFloat tick0();
|
StkFloat tick0();
|
||||||
StkFloat tick1();
|
StkFloat tick1();
|
||||||
void clearMesh();
|
void clearMesh();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
This class is primarily for use in STK example programs but it is
|
This class is primarily for use in STK example programs but it is
|
||||||
generic enough to work in many other contexts.
|
generic enough to work in many other contexts.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ const int DEFAULT_QUEUE_LIMIT = 200;
|
|||||||
|
|
||||||
#include "Mutex.h"
|
#include "Mutex.h"
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "Socket.h"
|
#include "TcpServer.h"
|
||||||
#include "RtMidi.h"
|
#include "RtMidi.h"
|
||||||
|
|
||||||
extern "C" THREAD_RETURN THREAD_TYPE stdinHandler(void * ptr);
|
extern "C" THREAD_RETURN THREAD_TYPE stdinHandler(void * ptr);
|
||||||
@@ -69,7 +69,7 @@ class Messager : public Stk
|
|||||||
#if defined(__STK_REALTIME__)
|
#if defined(__STK_REALTIME__)
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
RtMidiIn *midi;
|
RtMidiIn *midi;
|
||||||
Socket *socket;
|
TcpServer *socket;
|
||||||
std::vector<int> fd;
|
std::vector<int> fd;
|
||||||
fd_set mask;
|
fd_set mask;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
(non-sweeping BiQuad filters), where N is set
|
(non-sweeping BiQuad filters), where N is set
|
||||||
during instantiation.
|
during instantiation.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "Instrmnt.h"
|
#include "Instrmnt.h"
|
||||||
#include "Envelope.h"
|
#include "Envelope.h"
|
||||||
#include "WaveLoop.h"
|
#include "WaveLoop.h"
|
||||||
|
#include "SineWave.h"
|
||||||
#include "BiQuad.h"
|
#include "BiQuad.h"
|
||||||
#include "OnePole.h"
|
#include "OnePole.h"
|
||||||
|
|
||||||
@@ -62,30 +63,18 @@ public:
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
virtual StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
virtual void controlChange(int number, StkFloat value) = 0;
|
virtual void controlChange(int number, StkFloat value) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
Envelope envelope_;
|
Envelope envelope_;
|
||||||
WvIn *wave_;
|
FileWvIn *wave_;
|
||||||
BiQuad **filters_;
|
BiQuad **filters_;
|
||||||
OnePole onepole_;
|
OnePole onepole_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
|
|
||||||
unsigned int nModes_;
|
unsigned int nModes_;
|
||||||
std::vector<StkFloat> ratios_;
|
std::vector<StkFloat> ratios_;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
- Two Fixed = 7
|
- Two Fixed = 7
|
||||||
- Clump = 8
|
- Clump = 8
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
modulations to give a nice, natural human
|
modulations to give a nice, natural human
|
||||||
modulation function.
|
modulation function.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#define STK_MODULATE_H
|
#define STK_MODULATE_H
|
||||||
|
|
||||||
#include "Generator.h"
|
#include "Generator.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
#include "SubNoise.h"
|
#include "SubNoise.h"
|
||||||
#include "OnePole.h"
|
#include "OnePole.h"
|
||||||
|
|
||||||
@@ -42,23 +42,11 @@ class Modulate : public Generator
|
|||||||
//! Set the random modulation gain.
|
//! Set the random modulation gain.
|
||||||
void setRandomGain(StkFloat gain);
|
void setRandomGain(StkFloat gain);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WaveLoop *vibrato_;
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
SineWave vibrato_;
|
||||||
SubNoise noise_;
|
SubNoise noise_;
|
||||||
OnePole filter_;
|
OnePole filter_;
|
||||||
StkFloat vibratoGain_;
|
StkFloat vibratoGain_;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Gain = 128
|
- Gain = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -48,25 +48,13 @@ class Moog : public Sampler
|
|||||||
//! Set the modulation (vibrato) depth.
|
//! Set the modulation (vibrato) depth.
|
||||||
void setModulationDepth(StkFloat mDepth);
|
void setModulationDepth(StkFloat mDepth);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
FormSwep filters_[2];
|
FormSwep filters_[2];
|
||||||
StkFloat modDepth_;
|
StkFloat modDepth_;
|
||||||
StkFloat filterQ_;
|
StkFloat filterQ_;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
systems, the pthread library is used. Under
|
systems, the pthread library is used. Under
|
||||||
Windows, critical sections are used.
|
Windows, critical sections are used.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
filters in parallel with corresponding right
|
filters in parallel with corresponding right
|
||||||
and left outputs.
|
and left outputs.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -37,22 +37,10 @@ class NRev : public Effect
|
|||||||
//! Set the reverberation T60 decay time.
|
//! Set the reverberation T60 decay time.
|
||||||
void setT60( StkFloat T60 );
|
void setT60( StkFloat T60 );
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
Delay allpassDelays_[8];
|
Delay allpassDelays_[8];
|
||||||
Delay combDelays_[6];
|
Delay combDelays_[6];
|
||||||
StkFloat allpassCoefficient_;
|
StkFloat allpassCoefficient_;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
C rand() function. The quality of the rand()
|
C rand() function. The quality of the rand()
|
||||||
function varies from one OS to another.
|
function varies from one OS to another.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -39,23 +39,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSeed( unsigned int seed = 0 );
|
void setSeed( unsigned int seed = 0 );
|
||||||
|
|
||||||
//! Return a random number between -1.0 and 1.0 using rand().
|
|
||||||
virtual StkFloat tick();
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual StkFloat computeSample( void );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
the real axis of the z-plane while maintaining
|
the real axis of the z-plane while maintaining
|
||||||
a constant peak filter gain.
|
a constant peak filter gain.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
OnePole();
|
OnePole();
|
||||||
|
|
||||||
//! Overloaded constructor which sets the pole position during instantiation.
|
//! Overloaded constructor which sets the pole position during instantiation.
|
||||||
OnePole(StkFloat thePole);
|
OnePole( StkFloat thePole );
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
~OnePole();
|
~OnePole();
|
||||||
@@ -65,17 +65,14 @@ public:
|
|||||||
//! Input one sample to the filter and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
StkFloat tick(StkFloat sample);
|
StkFloat tick(StkFloat sample);
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
along the real axis of the z-plane while
|
along the real axis of the z-plane while
|
||||||
maintaining a constant filter gain.
|
maintaining a constant filter gain.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -65,17 +65,14 @@ class OneZero : protected Filter
|
|||||||
//! Input one sample to the filter and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
StkFloat tick(StkFloat sample);
|
StkFloat tick(StkFloat sample);
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
two series allpass units and two parallel comb
|
two series allpass units and two parallel comb
|
||||||
filters.
|
filters.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -35,22 +35,10 @@ public:
|
|||||||
//! Set the reverberation T60 decay time.
|
//! Set the reverberation T60 decay time.
|
||||||
void setT60( StkFloat T60 );
|
void setT60( StkFloat T60 );
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
Delay allpassDelays_[2];
|
Delay allpassDelays_[2];
|
||||||
Delay combDelays_[2];
|
Delay combDelays_[2];
|
||||||
StkFloat allpassCoefficient_;
|
StkFloat allpassCoefficient_;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -49,20 +49,9 @@ class PercFlut : public FM
|
|||||||
//! Start a note with the given frequency and amplitude.
|
//! Start a note with the given frequency and amplitude.
|
||||||
void noteOn(StkFloat frequency, StkFloat amplitude);
|
void noteOn(StkFloat frequency, StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
protected:
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
StkFloat computeSample( void );
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
set of 32 static phoneme formant parameters
|
set of 32 static phoneme formant parameters
|
||||||
and provide access to those values.
|
and provide access to those values.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
This class implements a simple pitch shifter
|
This class implements a simple pitch shifter
|
||||||
using delay lines.
|
using delay lines.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -30,22 +30,10 @@ class PitShift : public Effect
|
|||||||
//! Set the pitch shift factor (1.0 produces no shift).
|
//! Set the pitch shift factor (1.0 produces no shift).
|
||||||
void setShift(StkFloat shift);
|
void setShift(StkFloat shift);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs, compute the same number of outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
DelayL delayLine_[2];
|
DelayL delayLine_[2];
|
||||||
StkFloat delay_[2];
|
StkFloat delay_[2];
|
||||||
StkFloat env_[2];
|
StkFloat env_[2];
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
use possibly subject to patents held by
|
use possibly subject to patents held by
|
||||||
Stanford University, Yamaha, and others.
|
Stanford University, Yamaha, and others.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -61,22 +61,10 @@ class PluckTwo : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
virtual void noteOff(StkFloat amplitude);
|
virtual void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Virtual (abstract) tick function is implemented by subclasses.
|
|
||||||
virtual StkFloat tick() = 0;
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize) = 0;
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 ) = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual StkFloat computeSample( void ) = 0;
|
||||||
|
|
||||||
DelayA delayLine_;
|
DelayA delayLine_;
|
||||||
DelayA delayLine2_;
|
DelayA delayLine2_;
|
||||||
DelayL combDelay_;
|
DelayL combDelay_;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
Stanford, bearing the names of Karplus and/or
|
Stanford, bearing the names of Karplus and/or
|
||||||
Strong.
|
Strong.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -50,22 +50,10 @@ class Plucked : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
virtual void noteOff(StkFloat amplitude);
|
virtual void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
virtual StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayA delayLine_;
|
DelayA delayLine_;
|
||||||
OneZero loopFilter_;
|
OneZero loopFilter_;
|
||||||
OnePole pickFilter_;
|
OnePole pickFilter_;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
filter with a given coefficient. Another
|
filter with a given coefficient. Another
|
||||||
method is provided to create a DC blocking filter.
|
method is provided to create a DC blocking filter.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -61,28 +61,25 @@ class PoleZero : protected Filter
|
|||||||
The gain is applied at the filter input and does not affect the
|
The gain is applied at the filter input and does not affect the
|
||||||
coefficient values. The default gain value is 1.0.
|
coefficient values. The default gain value is 1.0.
|
||||||
*/
|
*/
|
||||||
void setGain(StkFloat gain);
|
void setGain( StkFloat gain );
|
||||||
|
|
||||||
//! Return the current filter gain.
|
//! Return the current filter gain.
|
||||||
StkFloat getGain(void) const;
|
StkFloat getGain( void ) const;
|
||||||
|
|
||||||
//! Return the last computed output value.
|
//! Return the last computed output value.
|
||||||
StkFloat lastOut(void) const;
|
StkFloat lastOut( void ) const;
|
||||||
|
|
||||||
//! Input one sample to the filter and return one output.
|
//! Input one sample to the filter and return one output.
|
||||||
StkFloat tick(StkFloat sample);
|
StkFloat tick( StkFloat sample );
|
||||||
|
|
||||||
//! Input \e vectorSize samples to the filter and return an equal number of outputs in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
//! Take a channel of the StkFrames object as inputs to the filter and replace with corresponding outputs.
|
||||||
/*!
|
/*!
|
||||||
The \c channel argument should be one or greater (the first
|
The \c channel argument should be zero or greater (the first
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
channel is specified by 0). An StkError will be thrown if the \c
|
||||||
channel argument is zero or it is greater than the number of
|
channel argument is equal to or greater than the number of
|
||||||
channels in the StkFrames object.
|
channels in the StkFrames object.
|
||||||
*/
|
*/
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
Smith (1986), Hirschman, Cook, Scavone, and
|
Smith (1986), Hirschman, Cook, Scavone, and
|
||||||
others for more information.
|
others for more information.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -47,26 +47,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSlope(StkFloat slope);
|
void setSlope(StkFloat slope);
|
||||||
|
|
||||||
//! Return the function value for \e input.
|
|
||||||
/*!
|
|
||||||
The function input represents the differential
|
|
||||||
pressure across the reeds.
|
|
||||||
*/
|
|
||||||
StkFloat tick(StkFloat input);
|
|
||||||
|
|
||||||
//! Take \e vectorSize inputs from \e vector and replace them with corresponding outputs.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( StkFloat input );
|
||||||
|
|
||||||
StkFloat offset_;
|
StkFloat offset_;
|
||||||
StkFloat slope_;
|
StkFloat slope_;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
- Zero Radii = 1
|
- Zero Radii = 1
|
||||||
- Envelope Gain = 128
|
- Envelope Gain = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -58,25 +58,13 @@ class Resonate : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
BiQuad filter_;
|
BiQuad filter_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
type who should worry about this (making
|
type who should worry about this (making
|
||||||
money) worry away.
|
money) worry away.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -53,20 +53,9 @@ class Rhodey : public FM
|
|||||||
//! Start a note with the given frequency and amplitude.
|
//! Start a note with the given frequency and amplitude.
|
||||||
void noteOn(StkFloat frequency, StkFloat amplitude);
|
void noteOn(StkFloat frequency, StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
protected:
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
StkFloat computeSample( void );
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
RtAudio WWW site: http://music.mcgill.ca/~gary/rtaudio/
|
RtAudio WWW site: http://music.mcgill.ca/~gary/rtaudio/
|
||||||
|
|
||||||
RtAudio: realtime audio i/o C++ classes
|
RtAudio: realtime audio i/o C++ classes
|
||||||
Copyright (c) 2001-2004 Gary P. Scavone
|
Copyright (c) 2001-2005 Gary P. Scavone
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation files
|
obtaining a copy of this software and associated documentation files
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
// RtAudio: Version 3.0.2, pre-release for STK 4.2.0
|
// RtAudio: Version 3.0.2 (14 October 2005)
|
||||||
|
|
||||||
#ifndef __RTAUDIO_H
|
#ifndef __RTAUDIO_H
|
||||||
#define __RTAUDIO_H
|
#define __RTAUDIO_H
|
||||||
@@ -676,6 +676,53 @@ public:
|
|||||||
void setStreamCallback( RtAudioCallback callback, void *userData );
|
void setStreamCallback( RtAudioCallback callback, void *userData );
|
||||||
void cancelStreamCallback();
|
void cancelStreamCallback();
|
||||||
|
|
||||||
|
public:
|
||||||
|
// \brief Internal structure that provide debug information on the state of a running DSound device.
|
||||||
|
struct RtDsStatistics {
|
||||||
|
// \brief Sample Rate.
|
||||||
|
long sampleRate;
|
||||||
|
// \brief The size of one sample * number of channels on the input device.
|
||||||
|
int inputFrameSize;
|
||||||
|
// \brief The size of one sample * number of channels on the output device.
|
||||||
|
int outputFrameSize;
|
||||||
|
/* \brief The number of times the read pointer had to be adjusted to avoid reading from an unsafe buffer position.
|
||||||
|
*
|
||||||
|
* This field is only used when running in DUPLEX mode. INPUT mode devices just wait until the data is
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
int numberOfReadOverruns;
|
||||||
|
// \brief The number of times the write pointer had to be adjusted to avoid writing in an unsafe buffer position.
|
||||||
|
int numberOfWriteUnderruns;
|
||||||
|
// \brief Number of bytes by attribute to buffer configuration by which writing must lead the current write pointer.
|
||||||
|
int writeDeviceBufferLeadBytes;
|
||||||
|
// \brief Number of bytes by attributable to the device driver by which writing must lead the current write pointer on this output device.
|
||||||
|
unsigned long writeDeviceSafeLeadBytes;
|
||||||
|
// \brief Number of bytes by which reading must trail the current read pointer on this input device.
|
||||||
|
unsigned long readDeviceSafeLeadBytes;
|
||||||
|
/* \brief Estimated latency in seconds.
|
||||||
|
*
|
||||||
|
* For INPUT mode devices, based the latency of the device's safe read pointer, plus one buffer's
|
||||||
|
* worth of additional latency.
|
||||||
|
*
|
||||||
|
* For OUTPUT mode devices, the latency of the device's safe write pointer, plus N buffers of
|
||||||
|
* additional buffer latency.
|
||||||
|
*
|
||||||
|
* For DUPLEX devices, the sum of latencies for both input and output devices. DUPLEX devices
|
||||||
|
* also back off the read pointers an additional amount in order to maintain synchronization
|
||||||
|
* between out-of-phase read and write pointers. This time is also included.
|
||||||
|
*
|
||||||
|
* Note that most software packages report latency between the safe write pointer
|
||||||
|
* and the software lead pointer, excluding the hardware device's safe write pointer
|
||||||
|
* latency. Figures of 1 or 2ms of latency on Windows audio devices are invariably of this type.
|
||||||
|
* The reality is that hardware devices often have latencies of 30ms or more (often much
|
||||||
|
* higher for duplex operation).
|
||||||
|
*/
|
||||||
|
|
||||||
|
double latency;
|
||||||
|
};
|
||||||
|
// \brief Report on the current state of a running DSound device.
|
||||||
|
static RtDsStatistics getDsStatistics();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void initialize(void);
|
void initialize(void);
|
||||||
@@ -683,6 +730,12 @@ public:
|
|||||||
bool probeDeviceOpen( int device, StreamMode mode, int channels,
|
bool probeDeviceOpen( int device, StreamMode mode, int channels,
|
||||||
int sampleRate, RtAudioFormat format,
|
int sampleRate, RtAudioFormat format,
|
||||||
int *bufferSize, int numberOfBuffers );
|
int *bufferSize, int numberOfBuffers );
|
||||||
|
|
||||||
|
bool coInitialized;
|
||||||
|
bool buffersRolling;
|
||||||
|
long duplexPrerollBytes;
|
||||||
|
static RtDsStatistics statistics;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -716,6 +769,9 @@ public:
|
|||||||
bool probeDeviceOpen( int device, StreamMode mode, int channels,
|
bool probeDeviceOpen( int device, StreamMode mode, int channels,
|
||||||
int sampleRate, RtAudioFormat format,
|
int sampleRate, RtAudioFormat format,
|
||||||
int *bufferSize, int numberOfBuffers );
|
int *bufferSize, int numberOfBuffers );
|
||||||
|
|
||||||
|
bool coInitialized;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
methods, which take/return pointers to
|
methods, which take/return pointers to
|
||||||
multi-channel sample frames.
|
multi-channel sample frames.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
|
||||||
|
|
||||||
RtMidi: realtime MIDI i/o C++ classes
|
RtMidi: realtime MIDI i/o C++ classes
|
||||||
Copyright (c) 2003-2004 Gary P. Scavone
|
Copyright (c) 2003-2005 Gary P. Scavone
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
obtaining a copy of this software and associated documentation files
|
obtaining a copy of this software and associated documentation files
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
||||||
// RtMidi: Version 1.0.2, 21 September 2004
|
// RtMidi: Version 1.0.4, 14 October 2005
|
||||||
|
|
||||||
#ifndef RTMIDI_H
|
#ifndef RTMIDI_H
|
||||||
#define RTMIDI_H
|
#define RTMIDI_H
|
||||||
@@ -45,10 +45,26 @@
|
|||||||
|
|
||||||
class RtMidi
|
class RtMidi
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//! Pure virtual openPort() function.
|
||||||
|
virtual void openPort( unsigned int portNumber = 0 ) = 0;
|
||||||
|
|
||||||
|
//! Pure virtual openVirtualPort() function.
|
||||||
|
virtual void openVirtualPort() = 0;
|
||||||
|
|
||||||
|
//! Pure virtual getPortCount() function.
|
||||||
|
virtual unsigned int getPortCount() = 0;
|
||||||
|
|
||||||
|
//! Pure virtual getPortName() function.
|
||||||
|
virtual std::string getPortName( unsigned int portNumber = 0 ) = 0;
|
||||||
|
|
||||||
|
//! Pure virtual closePort() function.
|
||||||
|
virtual void closePort( void ) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RtMidi();
|
RtMidi();
|
||||||
|
|
||||||
virtual ~RtMidi() {};
|
virtual ~RtMidi() {};
|
||||||
|
|
||||||
// A basic error reporting function for internal use in the RtMidi
|
// A basic error reporting function for internal use in the RtMidi
|
||||||
@@ -56,8 +72,6 @@ class RtMidi
|
|||||||
// suit specific needs.
|
// suit specific needs.
|
||||||
void error( RtError::Type type );
|
void error( RtError::Type type );
|
||||||
|
|
||||||
virtual void openPort( unsigned int portNumber = 0 ) = 0;
|
|
||||||
|
|
||||||
void *apiData_;
|
void *apiData_;
|
||||||
bool connected_;
|
bool connected_;
|
||||||
std::string errorString_;
|
std::string errorString_;
|
||||||
|
|||||||
@@ -2,24 +2,19 @@
|
|||||||
/*! \class RtWvIn
|
/*! \class RtWvIn
|
||||||
\brief STK realtime audio (blocking) input class.
|
\brief STK realtime audio (blocking) input class.
|
||||||
|
|
||||||
This class provides a simplified interface to
|
This class provides a simplified interface to RtAudio for realtime
|
||||||
RtAudio for realtime audio input. It is a
|
audio input. It is a subclass of WvIn. Because this class makes
|
||||||
protected subclass of WvIn. Because this
|
use of RtAudio's blocking output routines, its performance is less
|
||||||
class makes use of RtAudio's blocking output
|
robust on systems where the audio API is callback-based (Macintosh
|
||||||
routines, its performance is less robust on
|
CoreAudio and Windows ASIO).
|
||||||
systems where the audio API is callback-based
|
|
||||||
(Macintosh CoreAudio and Windows ASIO).
|
|
||||||
|
|
||||||
RtWvIn supports multi-channel data in
|
RtWvIn supports multi-channel data in interleaved format. It is
|
||||||
interleaved format. It is important to
|
important to distinguish the tick() methods, which return samples
|
||||||
distinguish the tick() methods, which return
|
produced by averaging across sample frames, from the tickFrame()
|
||||||
samples produced by averaging across sample
|
methods, which return references or pointers to multi-channel
|
||||||
frames, from the tickFrame() methods, which
|
sample frames.
|
||||||
return pointers to multi-channel sample frames.
|
|
||||||
For single-channel data, these methods return
|
|
||||||
equivalent values.
|
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -29,7 +24,7 @@
|
|||||||
#include "WvIn.h"
|
#include "WvIn.h"
|
||||||
#include "RtAudio.h"
|
#include "RtAudio.h"
|
||||||
|
|
||||||
class RtWvIn : protected WvIn
|
class RtWvIn : public WvIn
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Default constructor.
|
//! Default constructor.
|
||||||
@@ -44,75 +39,35 @@ public:
|
|||||||
is defined in Stk.h. An StkError will be thrown if an error
|
is defined in Stk.h. An StkError will be thrown if an error
|
||||||
occurs duing instantiation.
|
occurs duing instantiation.
|
||||||
*/
|
*/
|
||||||
RtWvIn(int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(), int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 2);
|
RtWvIn( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
|
||||||
|
int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 4 );
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
~RtWvIn();
|
~RtWvIn();
|
||||||
|
|
||||||
//! Start the audio input stream.
|
//! Start the audio input stream.
|
||||||
/*!
|
/*!
|
||||||
The stream is started automatically, if necessary, when a tick() or tickFrame method is called.
|
The stream is started automatically, if necessary, when a
|
||||||
|
tick() or tickFrame() method is called.
|
||||||
*/
|
*/
|
||||||
void start(void);
|
void start( void );
|
||||||
|
|
||||||
//! Stop the audio input stream.
|
//! Stop the audio input stream.
|
||||||
/*!
|
/*!
|
||||||
It may be necessary to use this method to avoid audio underflow problems if you wish to temporarily stop audio input.
|
It may be necessary to use this method to avoid audio underflow
|
||||||
|
problems if you wish to temporarily stop audio input.
|
||||||
*/
|
*/
|
||||||
void stop(void);
|
void stop( void );
|
||||||
|
|
||||||
//! Return the average across the last output sample frame.
|
|
||||||
StkFloat lastOut(void) const;
|
|
||||||
|
|
||||||
//! Read out the average across one sample frame of data.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during input.
|
|
||||||
*/
|
|
||||||
StkFloat tick(void);
|
|
||||||
|
|
||||||
//! Read out vectorSize averaged sample frames of data in \e vector.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during input.
|
|
||||||
*/
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with averaged sample frames.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if an
|
|
||||||
error occurs during input or the \c channel argument is zero or it
|
|
||||||
is greater than the number of channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Return a pointer to the last output sample frame.
|
|
||||||
const StkFloat *lastFrame(void) const;
|
|
||||||
|
|
||||||
//! Return a pointer to the next sample frame of data.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during input.
|
|
||||||
*/
|
|
||||||
const StkFloat *tickFrame(void);
|
|
||||||
|
|
||||||
//! Read out sample \e frames of data to \e frameVector.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during input.
|
|
||||||
*/
|
|
||||||
StkFloat *tickFrame(StkFloat *frameVector, unsigned int frames);
|
|
||||||
|
|
||||||
//! Fill the StkFrames object with sample frames of data and return the same reference.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during input or
|
|
||||||
there is an incompatability between the number of channels in the
|
|
||||||
RtWvIn object and that in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tickFrame( StkFrames& frames );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RtAudio *audio_;
|
void computeFrame( void );
|
||||||
|
|
||||||
|
RtAudio *adc_;
|
||||||
|
StkFloat *buffer_;
|
||||||
bool stopped_;
|
bool stopped_;
|
||||||
long counter_;
|
unsigned int bufferFrames_;
|
||||||
|
unsigned int bufferIndex_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,23 +2,19 @@
|
|||||||
/*! \class RtWvOut
|
/*! \class RtWvOut
|
||||||
\brief STK realtime audio (blocking) output class.
|
\brief STK realtime audio (blocking) output class.
|
||||||
|
|
||||||
This class provides a simplified interface to
|
This class provides a simplified interface to RtAudio for realtime
|
||||||
RtAudio for realtime audio output. It is a
|
audio output. It is a subclass of WvOut. Because this class
|
||||||
protected subclass of WvOut. Because this
|
makes use of RtAudio's blocking output routines, its performance
|
||||||
class makes use of RtAudio's blocking output
|
is less robust on systems where the audio API is callback-based
|
||||||
routines, its performance is less robust on
|
|
||||||
systems where the audio API is callback-based
|
|
||||||
(Macintosh CoreAudio and Windows ASIO).
|
(Macintosh CoreAudio and Windows ASIO).
|
||||||
|
|
||||||
RtWvOut supports multi-channel data in
|
RtWvOut supports multi-channel data in interleaved format. It is
|
||||||
interleaved format. It is important to
|
important to distinguish the tick() methods, which output single
|
||||||
distinguish the tick() methods, which output
|
samples to all channels in a sample frame, from the tickFrame()
|
||||||
single samples to all channels in a sample
|
method, which take a pointer or reference to multi-channel sample
|
||||||
frame, from the tickFrame() method, which
|
|
||||||
takes a pointer to multi-channel sample
|
|
||||||
frame data.
|
frame data.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -28,7 +24,7 @@
|
|||||||
#include "WvOut.h"
|
#include "WvOut.h"
|
||||||
#include "RtAudio.h"
|
#include "RtAudio.h"
|
||||||
|
|
||||||
class RtWvOut : protected WvOut
|
class RtWvOut : public WvOut
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -44,70 +40,41 @@ class RtWvOut : protected WvOut
|
|||||||
is defined in Stk.h. An StkError will be thrown if an error
|
is defined in Stk.h. An StkError will be thrown if an error
|
||||||
occurs duing instantiation.
|
occurs duing instantiation.
|
||||||
*/
|
*/
|
||||||
RtWvOut(unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(), int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 4 );
|
RtWvOut( unsigned int nChannels = 1, StkFloat sampleRate = Stk::sampleRate(),
|
||||||
|
int device = 0, int bufferFrames = RT_BUFFER_SIZE, int nBuffers = 4 );
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
~RtWvOut();
|
~RtWvOut();
|
||||||
|
|
||||||
//! Start the audio output stream.
|
//! Start the audio output stream.
|
||||||
/*!
|
/*!
|
||||||
The stream is started automatically, if necessary, when a tick() or tickFrame method is called.
|
The stream is started automatically, if necessary, when a
|
||||||
|
tick() or tickFrame method is called.
|
||||||
*/
|
*/
|
||||||
void start(void);
|
void start(void);
|
||||||
|
|
||||||
//! Stop the audio output stream.
|
//! Stop the audio output stream.
|
||||||
/*!
|
/*!
|
||||||
It may be necessary to use this method to avoid undesireable audio buffer cycling if you wish to temporarily stop audio output.
|
It may be necessary to use this method to avoid undesireable
|
||||||
|
audio buffer cycling if you wish to temporarily stop audio output.
|
||||||
*/
|
*/
|
||||||
void stop(void);
|
void stop(void);
|
||||||
|
|
||||||
//! Return the number of sample frames output.
|
|
||||||
unsigned long getFrames( void ) const;
|
|
||||||
|
|
||||||
//! Return the number of seconds of data output.
|
|
||||||
StkFloat getTime( void ) const;
|
|
||||||
|
|
||||||
//! Output a single sample to all channels in a sample frame.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during output.
|
|
||||||
*/
|
|
||||||
void tick( const StkFloat sample );
|
|
||||||
|
|
||||||
//! Output each sample in \e vector to all channels in \e vectorSize sample frames.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during output.
|
|
||||||
*/
|
|
||||||
void tick( const StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Output a channel of the StkFrames object to all channels of the RtWvOut object.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if an
|
|
||||||
error occurs during output or the \c channel argument is zero or
|
|
||||||
it is greater than the number of channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
void tick( const StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Output the \e frameVector of sample frames of the given length.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during output.
|
|
||||||
*/
|
|
||||||
void tickFrame( const StkFloat *frameVector, unsigned int frames = 1 );
|
|
||||||
|
|
||||||
//! Output the StkFrames data to the RtWvOut object.
|
|
||||||
/*!
|
|
||||||
An StkError will be thrown if an error occurs during output or
|
|
||||||
if there is an incompatability between the number of channels in
|
|
||||||
the WvOut object and that in the StkFrames object.
|
|
||||||
*/
|
|
||||||
void tickFrame( const StkFrames& frames );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
RtAudio *audio_;
|
void computeSample( const StkFloat sample );
|
||||||
StkFloat *dataPtr_;
|
|
||||||
|
void computeFrames( const StkFrames& frames );
|
||||||
|
|
||||||
|
void incrementFrame( void );
|
||||||
|
|
||||||
|
RtAudio *dac_;
|
||||||
|
StkFloat *buffer_;
|
||||||
bool stopped_;
|
bool stopped_;
|
||||||
int bufferSize_;
|
unsigned int nChannels_;
|
||||||
|
unsigned int bufferIndex_;
|
||||||
|
unsigned int iBuffer_;
|
||||||
|
unsigned int bufferFrames_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
This instrument provides an ADSR envelope, a one-pole filter, and
|
This instrument provides an ADSR envelope, a one-pole filter, and
|
||||||
structures for an arbitrary number of attack and loop waves.
|
structures for an arbitrary number of attack and loop waves.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "Instrmnt.h"
|
#include "Instrmnt.h"
|
||||||
#include "ADSR.h"
|
#include "ADSR.h"
|
||||||
#include "WvIn.h"
|
|
||||||
#include "WaveLoop.h"
|
#include "WaveLoop.h"
|
||||||
#include "OnePole.h"
|
#include "OnePole.h"
|
||||||
|
|
||||||
@@ -42,27 +41,15 @@ class Sampler : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
virtual void noteOff(StkFloat amplitude);
|
virtual void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
virtual StkFloat tick() = 0;
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize) = 0;
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 ) = 0;
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
virtual void controlChange(int number, StkFloat value) = 0;
|
virtual void controlChange(int number, StkFloat value) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual StkFloat computeSample( void ) = 0;
|
||||||
|
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
std::vector<WvIn *> attacks_;
|
std::vector<FileWvIn *> attacks_;
|
||||||
std::vector<WaveLoop *> loops_;
|
std::vector<WaveLoop *> loops_;
|
||||||
OnePole filter_;
|
OnePole filter_;
|
||||||
StkFloat baseFrequency_;
|
StkFloat baseFrequency_;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
- Vibrato Gain = 1
|
- Vibrato Gain = 1
|
||||||
- Breath Pressure = 128
|
- Breath Pressure = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
#include "OneZero.h"
|
#include "OneZero.h"
|
||||||
#include "Envelope.h"
|
#include "Envelope.h"
|
||||||
#include "Noise.h"
|
#include "Noise.h"
|
||||||
#include "WaveLoop.h"
|
#include "SineWave.h"
|
||||||
|
|
||||||
class Saxofony : public Instrmnt
|
class Saxofony : public Instrmnt
|
||||||
{
|
{
|
||||||
@@ -79,31 +79,19 @@ class Saxofony : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayL delays_[2];
|
DelayL delays_[2];
|
||||||
ReedTable reedTable_;
|
ReedTable reedTable_;
|
||||||
OneZero filter_;
|
OneZero filter_;
|
||||||
Envelope envelope_;
|
Envelope envelope_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
WaveLoop *vibrato_;
|
SineWave vibrato_;
|
||||||
unsigned long length_;
|
unsigned long length_;
|
||||||
StkFloat outputGain_;
|
StkFloat outputGain_;
|
||||||
StkFloat noiseGain_;
|
StkFloat noiseGain_;
|
||||||
|
|||||||
@@ -79,26 +79,12 @@ class Shakers : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
int setupName(char* instr);
|
int setupName(char* instr);
|
||||||
int setupNum(int inst);
|
int setupNum(int inst);
|
||||||
int setFreqAndReson(int which, StkFloat freq, StkFloat reson);
|
int setFreqAndReson(int which, StkFloat freq, StkFloat reson);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
- Envelope Rate = 11
|
- Envelope Rate = 11
|
||||||
- Gain = 128
|
- Gain = 128
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -57,25 +57,13 @@ class Simple : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
|
||||||
void controlChange(int number, StkFloat value);
|
void controlChange(int number, StkFloat value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
ADSR adsr_;
|
ADSR adsr_;
|
||||||
WaveLoop *loop_;
|
WaveLoop *loop_;
|
||||||
OnePole filter_;
|
OnePole filter_;
|
||||||
|
|||||||
80
include/SineWave.h
Normal file
80
include/SineWave.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/***************************************************/
|
||||||
|
/*! \class SineWave
|
||||||
|
\brief STK sinusoid oscillator class.
|
||||||
|
|
||||||
|
This class computes and saves a static sine "table" that can be
|
||||||
|
shared by multiple instances. It has an interface similar to the
|
||||||
|
WaveLoop class but inherits from the Generator class. Output
|
||||||
|
values are computed using linear interpolation.
|
||||||
|
|
||||||
|
The "table" length, set in SineWave.h, is 2048 samples by default.
|
||||||
|
|
||||||
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
|
*/
|
||||||
|
/***************************************************/
|
||||||
|
|
||||||
|
#ifndef STK_SINEWAVE_H
|
||||||
|
#define STK_SINEWAVE_H
|
||||||
|
|
||||||
|
const unsigned long TABLE_SIZE = 2048;
|
||||||
|
|
||||||
|
#include "Generator.h"
|
||||||
|
|
||||||
|
class SineWave : public Generator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Default constructor.
|
||||||
|
SineWave( void );
|
||||||
|
|
||||||
|
//! Class destructor.
|
||||||
|
virtual ~SineWave( void );
|
||||||
|
|
||||||
|
//! Clear output and reset time pointer to zero.
|
||||||
|
void reset( void );
|
||||||
|
|
||||||
|
//! Set the data read rate in samples. The rate can be negative.
|
||||||
|
/*!
|
||||||
|
If the rate value is negative, the data is read in reverse order.
|
||||||
|
*/
|
||||||
|
void setRate( StkFloat rate ) { rate_ = rate; };
|
||||||
|
|
||||||
|
//! Set the data interpolation rate based on a looping frequency.
|
||||||
|
/*!
|
||||||
|
This function determines the interpolation rate based on the file
|
||||||
|
size and the current Stk::sampleRate. The \e frequency value
|
||||||
|
corresponds to file cycles per second. The frequency can be
|
||||||
|
negative, in which case the loop is read in reverse order.
|
||||||
|
*/
|
||||||
|
void setFrequency( StkFloat frequency );
|
||||||
|
|
||||||
|
//! Increment the read pointer by \e time samples, modulo file size.
|
||||||
|
void addTime( StkFloat time );
|
||||||
|
|
||||||
|
//! Increment current read pointer by \e angle, relative to a looping frequency.
|
||||||
|
/*!
|
||||||
|
This function increments the read pointer based on the file
|
||||||
|
size and the current Stk::sampleRate. The \e anAngle value
|
||||||
|
is a multiple of file size.
|
||||||
|
*/
|
||||||
|
void addPhase( StkFloat angle );
|
||||||
|
|
||||||
|
//! Add a phase offset to the current read pointer.
|
||||||
|
/*!
|
||||||
|
This function determines a time offset based on the file
|
||||||
|
size and the current Stk::sampleRate. The \e angle value
|
||||||
|
is a multiple of file size.
|
||||||
|
*/
|
||||||
|
void addPhaseOffset( StkFloat angle );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
|
static StkFrames table_;
|
||||||
|
StkFloat time_;
|
||||||
|
StkFloat rate_;
|
||||||
|
StkFloat phaseOffset_;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
from pitch shifting. It will be used as an
|
from pitch shifting. It will be used as an
|
||||||
excitation source for other instruments.
|
excitation source for other instruments.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ class SingWave : public Generator
|
|||||||
An StkError will be thrown if the file is not found, its format is
|
An StkError will be thrown if the file is not found, its format is
|
||||||
unknown, a read error occurs, or the rawwave path is incorrectly set.
|
unknown, a read error occurs, or the rawwave path is incorrectly set.
|
||||||
*/
|
*/
|
||||||
SingWave( std::string fileName, bool raw=false);
|
SingWave( std::string fileName, bool raw = false);
|
||||||
|
|
||||||
//! Class destructor.
|
//! Class destructor.
|
||||||
~SingWave();
|
~SingWave();
|
||||||
@@ -69,25 +69,12 @@ class SingWave : public Generator
|
|||||||
//! Stop a note.
|
//! Stop a note.
|
||||||
void noteOff();
|
void noteOff();
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Compute \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick( StkFloat *vector, unsigned int vectorSize );
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
WaveLoop *wave_;
|
WaveLoop *wave_;
|
||||||
Modulate *modulator_;
|
Modulate modulator_;
|
||||||
Envelope envelope_;
|
Envelope envelope_;
|
||||||
Envelope pitchEnvelope_;
|
Envelope pitchEnvelope_;
|
||||||
StkFloat rate_;
|
StkFloat rate_;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
Stanford, bearing the names of Karplus and/or
|
Stanford, bearing the names of Karplus and/or
|
||||||
Strong.
|
Strong.
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
@@ -50,22 +50,10 @@ class Sitar : public Instrmnt
|
|||||||
//! Stop a note with the given amplitude (speed of decay).
|
//! Stop a note with the given amplitude (speed of decay).
|
||||||
void noteOff(StkFloat amplitude);
|
void noteOff(StkFloat amplitude);
|
||||||
|
|
||||||
//! Compute one output sample.
|
|
||||||
StkFloat tick();
|
|
||||||
|
|
||||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
|
||||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
|
||||||
|
|
||||||
//! Fill a channel of the StkFrames object with computed outputs.
|
|
||||||
/*!
|
|
||||||
The \c channel argument should be one or greater (the first
|
|
||||||
channel is specified by 1). An StkError will be thrown if the \c
|
|
||||||
channel argument is zero or it is greater than the number of
|
|
||||||
channels in the StkFrames object.
|
|
||||||
*/
|
|
||||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
StkFloat computeSample( void );
|
||||||
|
|
||||||
DelayA delayLine_;
|
DelayA delayLine_;
|
||||||
OneZero loopFilter_;
|
OneZero loopFilter_;
|
||||||
Noise noise_;
|
Noise noise_;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
\sa \ref skini
|
\sa \ref skini
|
||||||
|
|
||||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user