Version 4.4.3

This commit is contained in:
Gary Scavone
2013-09-29 23:21:29 +02:00
committed by Stephen Sinclair
parent baca57040b
commit 0aec39260a
223 changed files with 26190 additions and 11130 deletions

View File

@@ -1,8 +1,8 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
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 simmply 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.
To configure and compile (on Unix systems and MinGW):
@@ -25,7 +25,7 @@ Several options can be passed to configure, including:
--with-asio = choose ASIO API support (windows only)
--with-ds = choose DirectSound API support (windows only)
It is now possible to specify more than one audio API where supported. 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 audio API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux, 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/me/rawwaves and /home/me/include):
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
./configure INCLUDE_PATH='$(HOME)/include/'
@@ -36,8 +36,6 @@ If you wish to use a different compiler than that selected by configure, specify
./configure CXX=CC
In addition, a linux RPM is available from the Planet CCRMA WWW site (http://ccrma.stanford.edu/planetccrma/software/).
For Windows Users:

View File

@@ -1,5 +1,7 @@
### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in
RM = /bin/rm
all :
cd src && $(MAKE)
cd projects/demo && $(MAKE) libdemo
@@ -8,7 +10,7 @@ all :
cd projects/examples && $(MAKE) -f libMakefile
clean :
-rm -f *~
$(RM) -f *~
cd src && $(MAKE) clean
cd projects/demo && $(MAKE) clean
cd projects/effects && $(MAKE) clean
@@ -16,7 +18,7 @@ clean :
cd projects/examples && $(MAKE) clean
distclean: clean
-rm -rf config.log config.status autom4te.cache Makefile
$(RM) -rf config.log config.status autom4te.cache Makefile
cd src && $(MAKE) distclean
cd projects/demo && $(MAKE) distclean
cd projects/effects && $(MAKE) distclean

36
README
View File

@@ -1,6 +1,6 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
@@ -23,21 +23,20 @@ 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
portable (most classes are platform-independent 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 15 years
now. STK currently runs with "realtime" support (audio and MIDI) on
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.
chances that our programs will still work in another 5-10 years. STK
currently runs with "realtime" support (audio and MIDI) on 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 Synthesis ToolKit is free for non-commercial use. The only parts
of the Synthesis ToolKit that are platform-dependent concern real-time
audio and MIDI input and output, and that is taken care of with a few
special classes. The interface for MIDI input and the simple Tcl/Tk
graphical user interfaces (GUIs) provided is the same, so it's easy to
The Synthesis ToolKit is free for non-commercial use. The only
classes of the Synthesis ToolKit that are platform-dependent concern
sockets, threads, mutexes, and real-time audio and MIDI input and
output. The interface for MIDI input and the simple Tcl/Tk graphical
user interfaces (GUIs) provided is the same, so it's easy to
experiment in real time using either the GUIs or MIDI. The Synthesis
ToolKit can generate simultaneous SND (AU), WAV, AIFF, and MAT-file
output soundfile formats (as well as realtime sound output), so you
@@ -81,7 +80,8 @@ 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.
"Release Notes" in the /doc directory 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
@@ -99,8 +99,7 @@ though the behavior of such is very hardware dependent. Under Linux,
Macintosh OS-X, and Irix, audio input and output are possible with
very low latency. Using the Windoze DirectSound API, minimum
dependable output sound latency seems to be around 20 milliseconds or
so, while input sound latency is on the order of a hundred
milliseconds or more!
so, while input sound latency is generally higher.
As mentioned above, it is possible to record the audio ouput of an STK
program to .snd, .wav, .raw, .aif, and .mat (Matlab MAT-file) output
@@ -146,7 +145,7 @@ LICENSE:
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995-2010 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -216,6 +215,3 @@ The answers lie below.
6) More rationalizations to follow . . .

View File

@@ -40,7 +40,14 @@ AC_MSG_RESULT($INCLUDE_PATH)
# Check for realtime support disable
AC_MSG_CHECKING(whether to compile realtime support)
AC_ARG_ENABLE(realtime, [ --disable-realtime = only compile generic non-realtime classes], [AC_SUBST( realtime, [no] ) AC_SUBST( sound_api, [] )], [AC_SUBST( realtime, [yes] ) ] )
AC_ARG_ENABLE(realtime,
[ --disable-realtime = only compile generic non-realtime classes],
realtime=$enableval)
if test "$realtime" = "no"; then
AC_SUBST( sound_api, [] )
else
AC_SUBST( realtime, [yes] )
fi
AC_MSG_RESULT($realtime)
# Check for math library
@@ -49,9 +56,19 @@ AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!))
# Check for debug
AC_MSG_CHECKING(whether to compile debug version)
AC_ARG_ENABLE(debug,
[ --enable-debug = enable various debug output],
[AC_SUBST( cppflag, ["-D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__"] ) AC_SUBST( cxxflag, ["-g"] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
[AC_SUBST( cppflag, [] ) AC_SUBST( cxxflag, [-O3] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
[ --enable-debug = enable various debug output],
debug=$enableval)
if test "$debug" = "yes"; then
AC_SUBST( cppflag, ["-D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__"] )
AC_SUBST( cxxflag, ["-g"] )
AC_SUBST( object_path, [Debug] )
else
AC_SUBST( debug, [no] )
AC_SUBST( cppflag, [] )
AC_SUBST( cxxflag, [-O3] )
AC_SUBST( object_path, [Release] )
fi
AC_MSG_RESULT($debug)
# Checks for functions
if test $realtime = yes; then
@@ -63,6 +80,7 @@ fi
CPPFLAGS="$CPPFLAGS $cppflag"
# For debugging and optimization ... overwrite default because it has both -g and -O2
echo "$CXXFLAGS"
CXXFLAGS="$cxxflag"
# Check compiler and use -Wall if gnu.
@@ -72,9 +90,20 @@ fi
CXXFLAGS="$CXXFLAGS $cxxflag"
AC_CANONICAL_HOST
AC_SUBST( sharedlib, ["libstk.so"] )
AC_SUBST( sharedname, ["libstk.so.\$(RELEASE)"] )
AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHAREDLIB).\$(MAJOR) -o \$(SHAREDLIB).\$(RELEASE)"] )
case $host in
*-apple*)
AC_SUBST( sharedlib, ["libstk.dylib"] )
AC_SUBST( sharedname, ["libstk.\$(RELEASE).dylib"] )
AC_SUBST( libflags, ["-dynamiclib -o libstk.\$(RELEASE).dylib"] )
esac
if test $realtime = yes; then
# Checks for package options and external software
AC_CANONICAL_HOST
AC_MSG_CHECKING(for audio API)
case $host in
*-*-linux*)

View File

@@ -1,19 +1,13 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
Please read the file README and INSTALL for more general STK information.
Realtime audio support for Linux currently includes the Advanced Linux Sound Architecture (ALSA), the JACK low-latency audio server, and/or Open Sound System (OSS version 4.0 and higher only) APIs. One or more APIs are selected during compilation using the __LINUX_ALSA__, __UNIX_JACK__, and/or __LINUX_OSS__ definitions. Because the ALSA library is now integrated into the standard Linux kernel, it is the default audio/MIDI API with STK versions 4.2 and higher. The __LINUX_ALSASEQ__ definition is required to compile RtMidi with ALSA sequencer support. Native OSS MIDI support no longer exists in RtMidi. If the __LINUX_OSS__ preprocessor definition is specified, only OSS audio support will be compiled and RtMidi will still be compiled using the ALSA API. For this reason, STK now requires the asound library for realtime support. Realtime programs must also link with the pthread library. The OSS audio API can be selected by passing the "--with-oss" option to configure.
Realtime audio support for Linux currently includes the Advanced Linux Sound Architecture (ALSA), the JACK low-latency audio server, and/or Open Sound System (OSS version 4.0 and higher only) APIs. That said, the OSS API support has not been tested in several years and is not considered a high priority. One or more APIs are selected during compilation using the __LINUX_ALSA__, __UNIX_JACK__, and/or __LINUX_OSS__ definitions. Because the ALSA library is now integrated into the standard Linux kernel, it is the default audio/MIDI API with STK versions 4.2 and higher.
STK should compile without much trouble under Linux. Since all Linux distributions typically include the GNU makefile utilities, you should be able to use the default Makefile. Typing "make" will initiate the compilation process.
The __LINUX_ALSASEQ__ definition is required to compile RtMidi with ALSA sequencer support. Native OSS MIDI support no longer exists in RtMidi. If the __LINUX_OSS__ preprocessor definition is specified, only OSS audio support will be compiled and RtMidi will still be compiled using the ALSA API. For this reason, STK now requires the asound library for realtime support. Realtime programs must also link with the pthread library.
MIDIATOR SERIAL PORT MIDI SUPPORT:
MIDIator support has been removed from RtMidi with STK versions 4.2 and higher. If you really need it, you can contact us to get an old distribution.
NOTE REGARDING PTHREADS:
There haven't been any problems with threads since the old days of RedHat Linux 5.0. STK uses the MIT pthreads API.
STK should compile without much trouble under Linux. Since all Linux distributions typically include the GNU makefile utilities, you should be able to use the default Makefiles. Typing "make" in a project directory will initiate the compilation process (after initially running the configure script in the top-level directory).

View File

@@ -1,12 +1,12 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
Please read the file README and INSTALL for more general STK information.
The default realtime support for Macintosh OS X uses the CoreAudio HAL API and is specified during compilation using the __MACOSX_CORE__ preprocessor definition. There is also support for the JACK audio server using the __UNIX_JACK__ 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.6.
It is necessary to install the OS X developer kit in order to compile STK. STK was successfully tested on the latest version of OS X.
Tcl/Tk on OS X:

View File

@@ -1,7 +0,0 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
Please read the file README and INSTALL for more general STK information.
STK has always worked under NeXTStep without realtime audio or MIDI support. In general, STK should compile in this way using any generic C++ compiler. C++ exception handling was added to STK with release 3.2. We managed to get a version of gcc compiled for NeXTStep that can deal with C++ exceptions.

View File

@@ -1,15 +1,7 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
Please read the file README and INSTALL for more general STK information.
The project Makefiles are created by configure. If you have trouble running "make", try invoking "gmake" (for GNU make). If that doesn't work, try to download the GNU Makefile utilities from the Internet.
With STK version 4.3, realtime support for IRIX has been discontinued due to the inability to test it. If you need realtime support on an SGI, go back to version 4.2.1. Release 4.0 of STK is confirmed to compile (with various warnings) using CC version 7.30.
The __IRIX_AL__ and __IRIX_MD__ preprocessor definitions are required for realtime audio and MIDI support.
NOTE REGARDING PTHREADS:
Since release 3.1, STK has used the pthread API under Irix. It appears that pthread functionality is standard on SGI, so this change shouldn't cause any problems. If I'm wrong, let me know!
Since STK version 4.3, realtime support for IRIX has been discontinued due to an inability to test it. If you need realtime support on an SGI, go back to version 4.2.1. Release 4.0 of STK is confirmed to compile (with various warnings) using CC version 7.30.

View File

@@ -1,19 +1,18 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
Please read the file README for more general STK information.
DirectX and WindowsNT Issues:
-----------------------------
The configure script supports MinGW. As well, STK is distributed with Visual C++ .NET project and workspace files. It no longer compiles with Visual C++ 6.0.
STK is currently distributed with Visual C++ .NET project and workspace files. It no longer compiles with Visual C++ 6.0. I gave up attempting to fix all the problems created by such a bad compiler. This version of STK has been tested using Visual C++ .NET. As well, the configure script now supports MinGW.
With Windows XP/7, piping works as under unix. Simply fire up the script files (ex. StkDemo.bat) by either double-clicking on them or from within a shell.
IMPORTANT VC++ NOTE: When compiling "release" versions of STK programs, link to the release multithreaded library. When compiling "debug" versions, link to the debug multithreaded library. Compiler errors will result otherwise.
Both the DirectSound and Steinberg ASIO audio APIs are supported for realtime audio input/output. The Visual C++ project files included with this distribution are configured to use the DirectSound API. In order to use the ASIO API, it is necessary to change the preprocessor definition from __WINDOWS_DS__ to __WINDOWS_ASIO__, as well as include all the files in the /src/include/ directory (i.e. asio.h, asio.cpp, ...). If you have a good quality soundcard and a native ASIO driver (not emulated), you are likely to get much better input/output response using that.
When using the DirectSound API for audio input, latency is typically pretty horrendous (should we be surprised?). Also, there is a slight chance you don't have DirectSoundCapture support on your computer. If not, you should download the DirectX 6.0 (or higher) runtime libraries from Microsoft's WWW site (http://www.microsoft.com/directx/download.asp) in order to run the pre-compiled STK executables for Windoze. The last time I checked, there was no DirectSoundCapture support for WindowsNT ... you'll have to switch to Windows 2000 or XP or use an ASIO driver. I stopped supporting the WinMM audio output code with release 3.2.
When using the DirectSound API for audio input, latency can be high. If you experience realtime audio "stuttering", you should experiment with different "buffer size" and "number of buffers" values.
Realtime MIDI input/output is supported by RtMidi using the winmm.lib API and requires the __WINDOWS_MM__ preprocessor definition.
@@ -33,22 +32,4 @@ Visual C++ workspaces have been created for the various STK projects. Everythin
Remember that items 1-5 above need to be done for each project and for each configuration. There might be an easy way to make global changes, but I couldn't figure it out.
To use the Tcl/Tk GUIs, you will have to install Tcl/Tk. I got version 8.0 and it works very well (and installed easily). The distribution is available on the WWW and is free.
In order for socketing to work, it is necessary to have the TCP protocol installed on your computer. This can be done from the "Network" control panel.
Finally, to use it all -
WINDOWS XP/2000:
There is a big advantage in using Windows XP/2000 over 95/98 with STK in that piping works, just as under unix. Also, the scheduler in 2000/XP seems to be much better, so socketed messages don't get clumped together like they do in Windows 95/98. Simply fire up a script file (ex. StkDemo.bat) by either double-clicking on it or typing it within a shell.
USE REALTIME MIDI INPUT FOR CONTROL:
1. Open a DOS console window and start syntmono with MIDI input (eg. demo Clarinet -or -im).
This assumes you already have MIDI setup correctly for your computer.
To use the Tcl/Tk GUIs, you will have to install Tcl/Tk.

View File

@@ -1,6 +1,17 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
v4.4.3: (30 August 2011)
- changed SINT24 to be lower 3 bytes of 32-bit word
- bug fixes to vectorized tick functions in Effects classes
- updated versions of RtAudio and RtMidi
- fix to ADSR bugs
- updates to the internal argument checking and reporting scheme
- updates to Bowed class (thanks to Esteban Maestre!)
- fixes for 24-bit support in FileRead and FileWrite
- added WAVE_FORMAT_EXTENSIBLE support in FileWrite
- added sample rate variable reading and writing for MAT-files in FileRead and FileWrite
v4.4.2: (4 February 2010)
- added various header file includes for newer compilers

View File

@@ -1,4 +1,4 @@
# Doxyfile 1.5.8
# Doxyfile 1.6.2
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@@ -31,7 +31,7 @@ PROJECT_NAME = STK
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 4.4.2
PROJECT_NUMBER = 4.4.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -54,11 +54,11 @@ CREATE_SUBDIRS = NO
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
# Spanish, Swedish, and Ukrainian.
# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
@@ -214,7 +214,8 @@ OPTIMIZE_OUTPUT_VHDL = NO
# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C
# use: inc=Fortran f=C. Note that for custom extensions you also need to set
# FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING =
@@ -225,7 +226,7 @@ EXTENSION_MAPPING =
# func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
@@ -386,6 +387,12 @@ HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
# will list include files with double quotes in the documentation
# rather than with sharp brackets.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
@@ -405,6 +412,16 @@ SORT_MEMBER_DOCS = NO
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that
# constructors and destructors are listed first. If set to NO (the default)
# the constructors will appear in the respective orders defined by
# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
@@ -684,7 +701,7 @@ SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
INLINE_SOURCES = YES
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
@@ -790,6 +807,12 @@ HTML_FOOTER = footer.html
HTML_STYLESHEET =
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting
# this to NO can help when comparing the output of multiple runs.
HTML_TIMESTAMP = NO
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
@@ -891,7 +914,7 @@ QCH_FILE =
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE =
QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
@@ -923,6 +946,23 @@ QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
# will be generated, which together with the HTML files, form an Eclipse help
# plugin. To install this plugin and make it available under the help contents
# menu in Eclipse, the contents of the directory containing the HTML and XML
# files needs to be copied into the plugins directory of eclipse. The name of
# the directory within the plugins directory should be the same as
# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
# the help appears.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have
# this name.
ECLIPSE_DOC_ID = org.doxygen.Project
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
@@ -936,21 +976,19 @@ ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to FRAME, a side panel will be generated
# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature. Other possible values
# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list;
# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
# disables this behavior completely. For backwards compatibility with previous
# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
# respectively.
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list.
USE_INLINE_TREES = NO
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
@@ -965,6 +1003,26 @@ TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
# for the HTML output. The underlying search engine uses javascript
# and DHTML and should work on any modern browser. Note that when using
# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
# (GENERATE_DOCSET) there is already a search function so this one should
# typically be disabled. For large projects the javascript based search engine
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a PHP enabled web server instead of at the web client
# using Javascript. Doxygen will generate the search PHP script and index
# file to put on the web server. The advantage of the server
# based approach is that it scales better to large projects and allows
# full text search. The disadvances is that it is more difficult to setup
# and does not have live searching capabilities.
SERVER_BASED_SEARCH = NO
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
@@ -981,7 +1039,10 @@ GENERATE_LATEX = NO
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
# invoked. If left blank `latex' will be used as the default command name.
# Note that when enabling USE_PDFLATEX this option is only used for
# generating bitmaps for formulas in the HTML output, but not in the
# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
@@ -1041,6 +1102,13 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
# If LATEX_SOURCE_CODE is set to YES then doxygen will include
# source code with syntax highlighting in the LaTeX output.
# Note that which sources are shown also depends on other settings
# such as SOURCE_BROWSER.
LATEX_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1192,7 +1260,7 @@ PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
@@ -1258,7 +1326,7 @@ EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles.
@@ -1301,7 +1369,7 @@ EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
@@ -1493,12 +1561,3 @@ GENERATE_LEGEND = YES
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Options related to the search engine
#---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO

View File

@@ -1,14 +1,28 @@
/*! \page download Download, Release Notes, and Bug Fixes
\section down Download Version 4.4.2 (4 February 2010):
\section down Download Version 4.4.3 (30 August 2011):
<UL>
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.2.tar.gz">Source distribution</A></LI>
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.3.tar.gz">Source distribution</A></LI>
</UL>
\section notes Release Notes:
\subsection v4dot4dot3 Version 4.4.3
<ul>
<li>Changed SINT24 to be lower 3 bytes of 32-bit word.</li>
<li>Bug fixes to vectorized tick functions in Effects classes.</li>
<li>Updated versions of RtAudio and RtMidi.</li>
<li>Bug fixes in ADSR and Envelope classes.</li>
<li>Updates to the internal argument checking and reporting scheme.</li>
<li>Updates to Bowed class (thanks to Esteban Maestre!).</li>
<li>Fixes for 24-bit support in FileRead and FileWrite.</li>
<li>Added WAVE_FORMAT_EXTENSIBLE support in FileWrite.</li>
<li>Added sample rate variable reading and writing for MAT-files in FileRead and FileWrite.</li>
</ul>
\subsection v4dot4dot2 Version 4.4.2
<ul>

View File

@@ -24,7 +24,7 @@ work with any standard C++ compiler.
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995-2010 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995-2011 Perry R. Cook and Gary P. Scavone
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -2,7 +2,7 @@
<table>
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>&copy;1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
<tr><td>&copy;1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>

View File

@@ -23,11 +23,11 @@ It appears that socket support in Tcl/Tk uses the Nagle algorithm, which produce
</UL>
<B>Windows95/98/2000/XP (specific):</B>
<B>Windows95/98/2000/XP/7 (specific):</B>
<UL>
<LI>A soundcard to use realtime audio input/output capabilities. In order to use the <I><B>effects</B></I> project, the soundcard and drivers must support full duplex mode.</LI>
<LI><A HREF="http://www.microsoft.com/directx/">DirectX</A> 5.0 (or higher) runtime libraries to use the precompiled binaries.</LI>
<LI>Visual C++ .NET for compiling (though a precompiled distribution is available).</LI>
<LI><A HREF="http://www.microsoft.com/directx/">DirectX</A> 5.0 (or higher) runtime libraries.</LI>
<LI>Visual C++ .NET or MinGW for compiling.</LI>
<LI>For compiling the source (if not already in your system): <UL><LI><A HREF="Misc/dsound.h">dsound.h</A> header file (DirectX 6.1) - put somewhere in your header search path</LI><LI><A HREF="Misc/dsound.lib">dsound.lib</A> library file (DirectX 6.1) - put somewhere in your library search path</LI></UL></LI>
</UL>

View File

@@ -2,6 +2,7 @@
- \ref directory
- \ref compiling
- \ref debug
- \ref control
- \ref voices
- \ref nort
@@ -43,9 +44,9 @@ This release of STK comes with four separate "project" directories:
\section compiling Compiling:
<UL>
<LI><B>Windows95/98/2000/XP:</B> Realtime support is available using either DirectSound or ASIO audio drivers. For DirectSound support, use the <TT>__WINDOWS_DS__</TT> preprocessor definition and link with the <TT>dsound.lib</TT>, <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. For ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, 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. In addition, the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_MM__</TT> preprocessor definitions are necessary for all Windows systems (RtMidi uses the Windows MultiMedia MIDI API). A distribution of the release is available with precompiled binaries (using DirectSound) for all the projects. In order for these binaries to function properly, your system must have the DirectX 5.0 (or higher) runtime libraries installed (available from <A HREF="http://www.microsoft.com/directx/">Microsoft</A>). Further, the <I><B>effects</B></I> project requires that your soundcard and drivers provide full duplex mode capabilities. Visual C++ .NET project files are provided in each project directory as well should you wish to compile your own binaries. It is important to link with the non-debug libraries when compiling "release" program versions and debug libraries when compiling "debug" program versions.</LI>
<LI><B>Windows95/98/2000/XP/7:</B> Realtime support is available using either DirectSound or ASIO audio drivers. For DirectSound support, use the <TT>__WINDOWS_DS__</TT> preprocessor definition and link with the <TT>dsound.lib</TT>, <TT>winmm.lib</TT>, and <TT>Wsock32.lib</TT> libraries. For ASIO support, use the <TT>__WINDOWS_ASIO__</TT> preprocessor definition, 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. In addition, the <TT>__LITTLE_ENDIAN__</TT> and <TT>__WINDOWS_MM__</TT> preprocessor definitions are necessary for all Windows systems (RtMidi uses the Windows MultiMedia MIDI API). Visual C++ .NET project files are provided in each project directory. As well, the MinGW compiler is supported (see below). It is important to link with the non-debug libraries when compiling "release" program versions and debug libraries when compiling "debug" program versions.</LI>
<LI><B>Unix Systems:</B> A GNU <TT>configure</TT> shell script is included in the distribution for unix-based systems. From the top-level distribution directory, type <TT>'./configure'</TT> and the script will create <TT>Makefiles</TT> in each project directory specific to the characteristics of the host computer. Then from within any given project directory (example <TT>demo</TT>), type <TT>'make'</TT> to compile the project. In addition, an STK library can be compiled from within the <TT>src</TT> directory.
<LI><B>Unix (and MinGW) Systems:</B> A GNU <TT>configure</TT> shell script is included in the distribution for unix-based systems. From the top-level distribution directory, type <TT>'./configure'</TT> and the script will create <TT>Makefiles</TT> in each project directory specific to the characteristics of the host computer. Then from within any given project directory (example <TT>demo</TT>), type <TT>'make'</TT> to compile the project. In addition, an STK library can be compiled from within the <TT>src</TT> directory.
Several options can be supplied to the <TT>configure</TT> script to customize the build behavior:
<UL>
@@ -75,6 +76,9 @@ For those who wish to create their own system-specific <TT>Makefiles</TT>:
<LI><B>Generic (non-realtime):</B> Most STK classes are operating system <I>independent</I> and can be compiled using any current C++ compiler. STK assumes big-endian host byte order by default, so if your system is little-endian (i.e. Intel processor), you must provide the <TT>__LITTLE_ENDIAN__</TT> preprocessor definition to your compiler. The <I><B>demo</B></I> project will compile without realtime support, allowing the use of SKINI scorefiles for input control and output to a variety of soundfile formats. The following classes <I>cannot</I> be used without realtime support: RtAudio, RtWvIn, RtWvOut, RtDuplex, RtMidi, Socket, Thread, Mutex, TcpWvIn, TcpWvOut. Because of this, it is not possible to compile the <I><B>effects</B></I>, <I><B>ragamatic</B></I>, and most of the <I><B>examples</B></I> projects for non-realtime use.</LI>
</UL>
\section debug Debugging:
When developing applications with STK, it is recommended that you define the preprocessor definition <TT>_STK_DEBUG_</TT> when compiling (or specify the <TT>--enable-debug</TT> option to the <TT>configure</TT> script). This will enable all levels of function argument and error checking within the STK classes. Without this definition, argument checking does not occur in functions that are expected to be called frequently in an iterative manner.
\section control Control Data:

View File

@@ -1,6 +1,6 @@
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
By Perry R. Cook and Gary P. Scavone, 1995-2010.
By Perry R. Cook and Gary P. Scavone, 1995-2011.
STK Classes - See the HTML documentation in the html directory for complete information.
@@ -19,11 +19,11 @@ STK Classes - See the HTML documentation in the html directory for complete info
|
|- Filter - (OnePole, OneZero, TwoPole, TwoZero, PoleZero, Biquad, FormSwep, Delay, DelayL, DelayA, TapDelay)
|
|- RtAudio, RtMidi, RtDuplex, Socket, Thread, Mutex
| |
Stk -| UdpSocket
| TcpServer
| TcpClient
|- RtAudio, RtMidi, Socket, Thread, Mutex
| |
Stk -| UdpSocket
| TcpServer
| TcpClient
|
|- StkFrames
|
@@ -86,8 +86,6 @@ Sinks: FileWrite.cpp Audio file output class (no internal data storage
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 (blocking)
Filters: Filter.h Filter master class
Iir.h General infinite-impulse response filter
Fir.h General finite-impulse response filter

View File

@@ -11,10 +11,12 @@ namespace stk {
This class implements a traditional ADSR (Attack, Decay, Sustain,
Release) envelope. It responds to simple keyOn and keyOff
messages, keeping track of its state. The \e state = ADSR::DONE
after the envelope value reaches 0.0 in the ADSR::RELEASE state.
messages, keeping track of its state. The \e state = ADSR::IDLE
before being triggered and after the envelope value reaches 0.0 in
the ADSR::RELEASE state. All rate, target and level settings must
be non-negative. All time settings must be positive.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -28,7 +30,7 @@ class ADSR : public Generator
DECAY, /*!< Decay */
SUSTAIN, /*!< Sustain */
RELEASE, /*!< Release */
DONE /*!< End of release */
IDLE /*!< Before attack / after release */
};
//! Default constructor.
@@ -46,6 +48,9 @@ class ADSR : public Generator
//! Set the attack rate.
void setAttackRate( StkFloat rate );
//! Set the target value for the attack (default = 1.0).
void setAttackTarget( StkFloat target );
//! Set the decay rate.
void setDecayRate( StkFloat rate );
@@ -58,19 +63,19 @@ class ADSR : public Generator
//! Set the attack rate based on a time duration.
void setAttackTime( StkFloat time );
//! Set the decay rate based on a time duration.
//! Set the decay rate based on a time duration (seconds).
void setDecayTime( StkFloat time );
//! Set the release rate based on a time duration.
//! Set the release rate based on a time duration (seconds).
void setReleaseTime( StkFloat time );
//! Set sustain level and attack, decay, and release time durations.
void setAllTimes( StkFloat aTime, StkFloat dTime, StkFloat sLevel, StkFloat rTime );
//! Set the target value.
//! Set a sustain target value and attack or decay from current value to target.
void setTarget( StkFloat target );
//! Return the current envelope \e state (ATTACK, DECAY, SUSTAIN, RELEASE, DONE).
//! Return the current envelope \e state (ATTACK, DECAY, SUSTAIN, RELEASE, IDLE).
int getState( void ) const { return state_; };
//! Set to state = ADSR::SUSTAIN with current and target values of \e value.
@@ -102,6 +107,7 @@ class ADSR : public Generator
StkFloat attackRate_;
StkFloat decayRate_;
StkFloat releaseRate_;
StkFloat releaseTime_;
StkFloat sustainLevel_;
};
@@ -120,10 +126,19 @@ inline StkFloat ADSR :: tick( void )
break;
case DECAY:
value_ -= decayRate_;
if ( value_ <= sustainLevel_ ) {
value_ = sustainLevel_;
state_ = SUSTAIN;
if ( value_ > sustainLevel_ ) {
value_ -= decayRate_;
if ( value_ <= sustainLevel_ ) {
value_ = sustainLevel_;
state_ = SUSTAIN;
}
}
else {
value_ += decayRate_; // attack target < sustain level
if ( value_ >= sustainLevel_ ) {
value_ = sustainLevel_;
state_ = SUSTAIN;
}
}
lastFrame_[0] = value_;
break;
@@ -131,8 +146,8 @@ inline StkFloat ADSR :: tick( void )
case RELEASE:
value_ -= releaseRate_;
if ( value_ <= 0.0 ) {
value_ = (StkFloat) 0.0;
state_ = DONE;
value_ = 0.0;
state_ = IDLE;
}
lastFrame_[0] = value_;
@@ -145,7 +160,7 @@ inline StkFrames& ADSR :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "ADSR::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "ADSR::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -26,7 +26,7 @@ namespace stk {
to \e keyOn and \e keyOff messages by ramping to
1.0 on keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -60,6 +60,9 @@ class Asymp : public Generator
//! Set the asymptotic rate based on a time duration (must be > 0).
void setTime( StkFloat time );
//! Set the asymptotic rate such that the target value is perceptually reached (to within -60dB of the target) in \e t60 seconds.
void setT60( StkFloat t60 );
//! Set the target value.
void setTarget( StkFloat target );
@@ -125,7 +128,7 @@ inline StkFrames& Asymp :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Asymp::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Asymp::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -84,6 +84,16 @@ class BandedWG : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
bool doPluck_;
@@ -111,6 +121,33 @@ class BandedWG : public Instrmnt
};
inline StkFrames& BandedWG :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "BandedWG::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -35,7 +35,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -57,6 +57,16 @@ class BeeThree : public FM
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
};
@@ -85,6 +95,33 @@ inline StkFloat BeeThree :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& BeeThree :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "BeeThree::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
Methods are provided for creating a resonance or notch in the
frequency response while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -59,6 +59,8 @@ public:
filter frequency response has a resonance at the given \e
frequency. The closer the poles are to the unit-circle (\e radius
close to one), the narrower the resulting resonance width.
An unstable filter will result for \e radius >= 1.0. The
\e frequency value should be between zero and half the sample rate.
*/
void setResonance( StkFloat frequency, StkFloat radius, bool normalize = false );
@@ -66,8 +68,9 @@ public:
/*!
This method determines the filter coefficients corresponding to
two complex-conjugate zeros with the given \e frequency (in Hz)
and \e radius from the z-plane origin. No filter normalization
is attempted.
and \e radius from the z-plane origin. No filter normalization is
attempted. The \e frequency value should be between zero and half
the sample rate. The \e radius value should be positive.
*/
void setNotch( StkFloat frequency, StkFloat radius );
@@ -130,7 +133,7 @@ inline StkFrames& BiQuad :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "BiQuad::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BiQuad::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -155,7 +158,7 @@ inline StkFrames& BiQuad :: tick( StkFrames& iFrames, StkFrames& oFrames, unsign
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "BiQuad::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BiQuad::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -133,7 +133,7 @@ inline StkFrames& Blit :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Blit::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Blit::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -129,7 +129,7 @@ inline StkFrames& BlitSaw :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "BlitSaw::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BlitSaw::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -152,7 +152,7 @@ inline StkFrames& BlitSquare :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "BlitSquare::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BlitSquare::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -25,7 +25,7 @@ namespace stk {
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -65,6 +65,16 @@ class BlowBotl : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
JetTable jetTable_;
@@ -102,6 +112,33 @@ inline StkFloat BlowBotl :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& BlowBotl :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "BlowBotl::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -43,7 +43,7 @@ namespace stk {
- Register State = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -89,6 +89,16 @@ class BlowHole : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayL delays_[3];
@@ -98,15 +108,14 @@ class BlowHole : public Instrmnt
PoleZero vent_;
Envelope envelope_;
Noise noise_;
SineWave vibrato_;
unsigned long length_;
SineWave vibrato_;
StkFloat scatter_;
StkFloat thCoeff_;
StkFloat rhGain_;
StkFloat outputGain_;
StkFloat noiseGain_;
StkFloat vibratoGain_;
};
inline StkFloat BlowHole :: tick( unsigned int )
@@ -144,6 +153,33 @@ class BlowHole : public Instrmnt
return lastFrame_[0];
}
inline StkFrames& BlowHole :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "BlowHole::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -11,9 +11,11 @@ namespace stk {
\brief STK bowed string table class.
This class implements a simple bowed string
non-linear function, as described by Smith (1986).
non-linear function, as described by Smith
(1986). The output is an instantaneous
reflection coefficient value.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -21,7 +23,7 @@ class BowTable : public Function
{
public:
//! Default constructor.
BowTable( void ) : offset_(0.0), slope_(0.1) {};
BowTable( void ) : offset_(0.0), slope_(0.1), minOutput_(0.01), maxOutput_(0.98) {};
//! Set the table offset value.
/*!
@@ -39,6 +41,12 @@ public:
*/
void setSlope( StkFloat slope ) { slope_ = slope; };
//! Set the minimum table output value (0.0 - 1.0).
void setMinOutput( StkFloat minimum ) { minOutput_ = minimum; };
//! Set the maximum table output value (0.0 - 1.0).
void setMaxOutput( StkFloat maximum ) { maxOutput_ = maximum; };
//! Take one sample input and map to one sample of output.
StkFloat tick( StkFloat input );
@@ -68,6 +76,8 @@ protected:
StkFloat offset_;
StkFloat slope_;
StkFloat minOutput_;
StkFloat maxOutput_;
};
@@ -79,11 +89,11 @@ inline StkFloat BowTable :: tick( StkFloat input )
lastFrame_[0] = (StkFloat) fabs( (double) sample ) + (StkFloat) 0.75;
lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
// Set minimum friction to 0.0
// if ( lastFrame_[0] < 0.0 ) lastFrame_[0] = 0.0;
// Set minimum threshold
if ( lastFrame_[0] < minOutput_ ) lastFrame_[0] = minOutput_;
// Set maximum friction to 1.0.
if ( lastFrame_[0] > 1.0 ) lastFrame_[0] = (StkFloat) 1.0;
// Set maximum threshold
if ( lastFrame_[0] > maxOutput_ ) lastFrame_[0] = maxOutput_;
return lastFrame_[0];
}
@@ -92,7 +102,7 @@ inline StkFrames& BowTable :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -115,7 +125,7 @@ inline StkFrames& BowTable :: tick( StkFrames& iFrames, StkFrames& oFrames, unsi
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "BowTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -28,9 +28,12 @@ namespace stk {
- Bow Position = 4
- Vibrato Frequency = 11
- Vibrato Gain = 1
- Bow Velocity = 100
- Frequency = 101
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
Contributions by Esteban Maestre, 2011.
*/
/***************************************************/
@@ -38,7 +41,7 @@ class Bowed : public Instrmnt
{
public:
//! Class constructor, taking the lowest desired playing frequency.
Bowed( StkFloat lowestFrequency );
Bowed( StkFloat lowestFrequency = 8.0 );
//! Class destructor.
~Bowed( void );
@@ -50,7 +53,7 @@ class Bowed : public Instrmnt
void setFrequency( StkFloat frequency );
//! Set vibrato gain.
void setVibrato( StkFloat gain );
void setVibrato( StkFloat gain ) { vibratoGain_ = gain; };
//! Apply breath pressure to instrument with given amplitude and rate of increase.
void startBowing( StkFloat amplitude, StkFloat rate );
@@ -70,15 +73,27 @@ class Bowed : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayL neckDelay_;
DelayL bridgeDelay_;
BowTable bowTable_;
OnePole stringFilter_;
BiQuad bodyFilter_;
BiQuad bodyFilters_[6];
SineWave vibrato_;
ADSR adsr_;
bool bowDown_;
StkFloat maxVelocity_;
StkFloat baseDelay_;
StkFloat vibratoGain_;
@@ -89,24 +104,54 @@ class Bowed : public Instrmnt
inline StkFloat Bowed :: tick( unsigned int )
{
StkFloat bowVelocity = maxVelocity_ * adsr_.tick();
StkFloat bridgeRefl = -stringFilter_.tick( bridgeDelay_.lastOut() );
StkFloat nutRefl = -neckDelay_.lastOut();
StkFloat stringVel = bridgeRefl + nutRefl; // Sum is string velocity
StkFloat velDiff = bowVelocity - stringVel; // Differential velocity
StkFloat newVel = velDiff * bowTable_.tick( velDiff ); // Non-Linear bow function
neckDelay_.tick(bridgeRefl + newVel); // Do string propagations
bridgeDelay_.tick(nutRefl + newVel);
StkFloat bridgeReflection = -stringFilter_.tick( bridgeDelay_.lastOut() );
StkFloat nutReflection = -neckDelay_.lastOut();
StkFloat stringVelocity = bridgeReflection + nutReflection;
StkFloat deltaV = bowVelocity - stringVelocity; // Differential velocity
StkFloat newVelocity = 0.0;
if ( bowDown_ )
newVelocity = deltaV * bowTable_.tick( deltaV ); // Non-Linear bow function
neckDelay_.tick( bridgeReflection + newVelocity); // Do string propagations
bridgeDelay_.tick(nutReflection + newVelocity);
if ( vibratoGain_ > 0.0 ) {
neckDelay_.setDelay( (baseDelay_ * (1.0 - betaRatio_) ) +
(baseDelay_ * vibratoGain_ * vibrato_.tick()) );
}
lastFrame_[0] = bodyFilter_.tick( bridgeDelay_.lastOut() );
lastFrame_[0] = 0.1248 * bodyFilters_[5].tick( bodyFilters_[4].tick( bodyFilters_[3].tick( bodyFilters_[2].tick( bodyFilters_[1].tick( bodyFilters_[0].tick( bridgeDelay_.lastOut() ) ) ) ) ) );
return lastFrame_[0];
}
inline StkFrames& Bowed :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Bowed::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -28,7 +28,7 @@ namespace stk {
- Vibrato Gain = 1
- Volume = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -39,7 +39,7 @@ class Brass: public Instrmnt
/*!
An StkError will be thrown if the rawwave path is incorrectly set.
*/
Brass( StkFloat lowestFrequency );
Brass( StkFloat lowestFrequency = 8.0 );
//! Class destructor.
~Brass( );
@@ -71,6 +71,16 @@ class Brass: public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayA delayLine_;
@@ -78,7 +88,7 @@ class Brass: public Instrmnt
PoleZero dcBlock_;
ADSR adsr_;
SineWave vibrato_;
unsigned long length_;
StkFloat lipTarget_;
StkFloat slideTarget_;
StkFloat vibratoGain_;
@@ -105,6 +115,33 @@ inline StkFloat Brass :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Brass :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Brass::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -14,7 +14,7 @@ namespace stk {
This class implements a chorus effect. It takes a monophonic
input signal and produces a stereo output signal.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -30,8 +30,8 @@ class Chorus : public Effect
//! Reset and clear all internal state.
void clear( void );
//! Set modulation depth.
void setModDepth( StkFloat depth ) { modDepth_ = depth; };
//! Set modulation depth in range 0.0 - 1.0.
void setModDepth( StkFloat depth );
//! Set modulation frequency.
void setModFrequency( StkFloat frequency );
@@ -94,7 +94,7 @@ inline StkFloat Chorus :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "Chorus::lastOut(): channel argument must be less than 2!";
oStream_ << "Chorus::lastOut(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -106,7 +106,7 @@ inline StkFloat Chorus :: tick( StkFloat input, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "Chorus::tick(): channel argument must be less than 2!";
oStream_ << "Chorus::tick(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -122,7 +122,7 @@ inline StkFrames& Chorus :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() - 1 ) {
errorString_ << "Chorus::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Chorus::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -130,6 +130,8 @@ inline StkFrames& Chorus :: tick( StkFrames& frames, unsigned int channel )
StkFloat *samples = &frames[channel];
unsigned int hop = frames.channels() - 1;
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
delayLine_[0].setDelay( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].tick() ) );
delayLine_[1].setDelay( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].tick() ) );
*samples = effectMix_ * ( delayLine_[0].tick( *samples ) - *samples ) + *samples;
samples++;
*samples = effectMix_ * ( delayLine_[1].tick( *samples ) - *samples ) + *samples;
@@ -144,7 +146,7 @@ inline StkFrames& Chorus :: tick( StkFrames& iFrames, StkFrames& oFrames, unsign
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() - 1 ) {
errorString_ << "Chorus::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Chorus::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -153,8 +155,10 @@ inline StkFrames& Chorus :: tick( StkFrames& iFrames, StkFrames& oFrames, unsign
StkFloat *oSamples = &oFrames[oChannel];
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop ) {
*oSamples++ = effectMix_ * ( delayLine_[0].tick( *iSamples ) - *iSamples ) + *iSamples;
*oSamples = effectMix_ * ( delayLine_[1].tick( *iSamples ) - *iSamples ) + *iSamples;
delayLine_[0].setDelay( baseLength_ * 0.707 * ( 1.0 + modDepth_ * mods_[0].tick() ) );
delayLine_[1].setDelay( baseLength_ * 0.5 * ( 1.0 - modDepth_ * mods_[1].tick() ) );
*oSamples = effectMix_ * ( delayLine_[0].tick( *iSamples ) - *iSamples ) + *iSamples;
*(oSamples+1) = effectMix_ * ( delayLine_[1].tick( *iSamples ) - *iSamples ) + *iSamples;
}
lastFrame_[0] = *(oSamples-oHop);

View File

@@ -31,7 +31,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -42,7 +42,7 @@ class Clarinet : public Instrmnt
/*!
An StkError will be thrown if the rawwave path is incorrectly set.
*/
Clarinet( StkFloat lowestFrequency );
Clarinet( StkFloat lowestFrequency = 8.0 );
//! Class destructor.
~Clarinet( void );
@@ -71,6 +71,16 @@ class Clarinet : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayL delayLine_;
@@ -79,11 +89,10 @@ class Clarinet : public Instrmnt
Envelope envelope_;
Noise noise_;
SineWave vibrato_;
long length_;
StkFloat outputGain_;
StkFloat noiseGain_;
StkFloat vibratoGain_;
};
inline StkFloat Clarinet :: tick( unsigned int )
@@ -111,6 +120,33 @@ inline StkFloat Clarinet :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Clarinet :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Clarinet::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

138
include/Cubic.h Normal file
View File

@@ -0,0 +1,138 @@
#ifndef STK_CUBIC_H
#define STK_CUBIC_H
#include "Function.h"
#include <cmath>
namespace stk {
/***************************************************/
/*! \class Cubic
\brief STK cubic non-linearity class.
This class implements the cubic non-linearity
that was used in SynthBuilder.
The formula implemented is:
\code
output = gain * (a1 * input + a2 * input^2 + a3 * input^3)
\endcode
followed by a limiter for values outside +-threshold.
Ported to STK by Nick Porcaro, 2007. Updated for inclusion
in STK distribution by Gary Scavone, 2011.
*/
/***************************************************/
class Cubic : public Function
{
public:
//! Default constructor.
Cubic( void ) : a1_(0.5), a2_(0.5), a3_(0.5), gain_(1.0), threshold_(1.0) {};
//! Set the a1 coefficient value.
void setA1( StkFloat a1 ) { a1_ = a1; };
//! Set the a2 coefficient value.
void setA2( StkFloat a2 ) { a2_ = a2; };
//! Set the a3 coefficient value.
void setA3( StkFloat a3 ) { a3_ = a3; };
//! Set the gain value.
void setGain( StkFloat gain ) { gain_ = gain; };
//! Set the threshold value.
void setThreshold( StkFloat threshold ) { threshold_ = threshold; };
//! Input one sample to the function and return one output.
StkFloat tick( StkFloat input );
//! Take a channel of the StkFrames object as inputs to the function and replace with corresponding outputs.
/*!
The StkFrames argument reference is returned. The \c channel
argument must be less than the number of channels in the
StkFrames argument (the first channel is specified by 0).
However, range checking is only performed if _STK_DEBUG_ is
defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
//! Take a channel of the \c iFrames object as inputs to the function and write outputs to the \c oFrames object.
/*!
The \c iFrames object reference is returned. Each channel
argument must be less than the number of channels in the
corresponding StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );
protected:
StkFloat a1_;
StkFloat a2_;
StkFloat a3_;
StkFloat gain_;
StkFloat threshold_;
};
inline StkFloat Cubic :: tick( StkFloat input )
{
StkFloat inSquared = input * input;
StkFloat inCubed = inSquared * input;
lastFrame_[0] = gain_ * (a1_ * input + a2_ * inSquared + a3_ * inCubed);
// Apply threshold if we are out of range.
if ( fabs( lastFrame_[0] ) > threshold_ ) {
lastFrame_[0] = ( lastFrame_[0] < 0 ? -threshold_ : threshold_ );
}
return lastFrame_[0];
}
inline StkFrames& Cubic :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
oStream_ << "Cubic::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int hop = frames.channels();
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples = tick( *samples );
lastFrame_[0] = *(samples-hop);
return frames;
}
inline StkFrames& Cubic :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
oStream_ << "Cubic::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *iSamples = &iFrames[iChannel];
StkFloat *oSamples = &oFrames[oChannel];
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop )
*oSamples = tick( *iSamples );
lastFrame_[0] = *(oSamples-oHop);
return iFrames;
}
} // stk namespace
#endif

View File

@@ -17,7 +17,7 @@ namespace stk {
A non-interpolating delay line is typically used in fixed
delay-length applications, such as for reverberation.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -36,13 +36,16 @@ public:
//! Class destructor.
~Delay();
//! Get the maximum delay-line length.
unsigned long getMaximumDelay( void ) { return inputs_.size() - 1; };
//! Set the maximum delay-line length.
/*!
This method should generally only be used during initial setup
of the delay line. If it is used between calls to the tick()
function, without a call to clear(), a signal discontinuity will
likely occur. If the current maximum length is greater than the
new length, no change will be made.
new length, no memory allocation change is made.
*/
void setMaximumDelay( unsigned long delay );
@@ -61,15 +64,18 @@ public:
relative to the last input value (i.e., a tapDelay of zero returns
the last input value).
*/
StkFloat contentsAt( unsigned long tapDelay );
StkFloat tapOut( unsigned long tapDelay );
//! Sum the provided value into the delay line at \e tapDelay samples from the input.
//! Set the \e value at \e tapDelay samples from the delay-line input.
void tapIn( StkFloat value, unsigned long tapDelay );
//! Sum the provided \e value into the delay line at \e tapDelay samples from the input.
/*!
The new value is returned. The tap point is determined modulo
the delay-line length and is relative to the last input value
(i.e., a tapDelay of zero sums into the last input value).
*/
StkFloat addTo( unsigned long tapDelay, StkFloat value );
StkFloat addTo( StkFloat value, unsigned long tapDelay );
//! Return the last computed output value.
StkFloat lastOut( void ) const { return lastFrame_[0]; };
@@ -136,7 +142,7 @@ inline StkFrames& Delay :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -158,7 +164,7 @@ inline StkFrames& Delay :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigne
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Delay::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -21,7 +21,7 @@ namespace stk {
minimum delay possible in this implementation is limited to a
value of 0.5.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -42,6 +42,9 @@ public:
//! Clears all internal states of the delay line.
void clear( void );
//! Get the maximum delay-line length.
unsigned long getMaximumDelay( void ) { return inputs_.size() - 1; };
//! Set the maximum delay-line length.
/*!
@@ -49,7 +52,7 @@ public:
of the delay line. If it is used between calls to the tick()
function, without a call to clear(), a signal discontinuity will
likely occur. If the current maximum length is greater than the
new length, no change will be made.
new length, no memory allocation change is made.
*/
void setMaximumDelay( unsigned long delay );
@@ -68,7 +71,10 @@ public:
relative to the last input value (i.e., a tapDelay of zero returns
the last input value).
*/
StkFloat contentsAt( unsigned long tapDelay );
StkFloat tapOut( unsigned long tapDelay );
//! Set the \e value at \e tapDelay samples from the delay-line input.
void tapIn( StkFloat value, unsigned long tapDelay );
//! Return the last computed output value.
StkFloat lastOut( void ) const { return lastFrame_[0]; };
@@ -151,7 +157,7 @@ inline StkFrames& DelayA :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "DelayA::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "DelayA::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -175,7 +181,7 @@ inline StkFrames& DelayA :: tick( StkFrames& iFrames, StkFrames& oFrames, unsign
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "DelayA::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "DelayA::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -20,7 +20,7 @@ namespace stk {
delay setting. The use of higher order Lagrange interpolators can
typically improve (minimize) this attenuation characteristic.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -39,13 +39,16 @@ public:
//! Class destructor.
~DelayL();
//! Get the maximum delay-line length.
unsigned long getMaximumDelay( void ) { return inputs_.size() - 1; };
//! Set the maximum delay-line length.
/*!
This method should generally only be used during initial setup
of the delay line. If it is used between calls to the tick()
function, without a call to clear(), a signal discontinuity will
likely occur. If the current maximum length is greater than the
new length, no change will be made.
new length, no memory allocation change is made.
*/
void setMaximumDelay( unsigned long delay );
@@ -64,7 +67,10 @@ public:
relative to the last input value (i.e., a tapDelay of zero returns
the last input value).
*/
StkFloat contentsAt( unsigned long tapDelay );
StkFloat tapOut( unsigned long tapDelay );
//! Set the \e value at \e tapDelay samples from the delay-line input.
void tapIn( StkFloat value, unsigned long tapDelay );
//! Return the last computed output value.
StkFloat lastOut( void ) const { return lastFrame_[0]; };
@@ -149,7 +155,7 @@ inline StkFrames& DelayL :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "DelayL::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "DelayL::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -172,7 +178,7 @@ inline StkFrames& DelayL :: tick( StkFrames& iFrames, StkFrames& oFrames, unsign
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "DelayL::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "DelayL::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -20,7 +20,7 @@ namespace stk {
of simultaneous voices) via a #define in the
Drummer.h.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -54,6 +54,16 @@ class Drummer : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
FileWvIn waves_[DRUM_POLYPHONY];
@@ -87,6 +97,34 @@ inline StkFloat Drummer :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Drummer :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Drummer::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -12,7 +12,7 @@ namespace stk {
This class implements an echo effect.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -79,7 +79,7 @@ inline StkFrames& Echo :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Echo::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Echo::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -98,7 +98,7 @@ inline StkFrames& Echo :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Echo::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Echo::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -14,7 +14,7 @@ namespace stk {
subclasses. It is general enough to support both monophonic and
polyphonic input/output classes.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -49,12 +49,12 @@ class Effect : public Stk
inline void Effect :: setEffectMix( StkFloat mix )
{
if ( mix < 0.0 ) {
errorString_ << "Effect::setEffectMix: mix parameter is less than zero ... setting to zero!";
oStream_ << "Effect::setEffectMix: mix parameter is less than zero ... setting to zero!";
handleError( StkError::WARNING );
effectMix_ = 0.0;
}
else if ( mix > 1.0 ) {
errorString_ << "Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!";
oStream_ << "Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!";
handleError( StkError::WARNING );
effectMix_ = 1.0;
}

View File

@@ -14,7 +14,7 @@ namespace stk {
specified \e rate. It also responds to simple \e keyOn and \e
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -38,9 +38,16 @@ class Envelope : public Generator
void keyOff( void ) { this->setTarget( 0.0 ); };
//! Set the \e rate.
/*!
The \e rate must be positive (though a value of 0.0 is allowed).
*/
void setRate( StkFloat rate );
//! Set the \e rate based on a time duration.
//! Set the \e rate based on a positive time duration (seconds).
/*!
The \e rate is calculated such that the envelope will ramp from
a value of 0.0 to 1.0 in the specified time duration.
*/
void setTime( StkFloat time );
//! Set the target value.
@@ -78,45 +85,6 @@ class Envelope : public Generator
int state_;
};
inline void Envelope :: setRate( StkFloat rate )
{
#if defined(_STK_DEBUG_)
if ( rate < 0.0 ) {
errorString_ << "Envelope::setRate: negative rates not allowed ... correcting!";
handleError( StkError::WARNING );
rate_ = -rate;
}
else
#endif
rate_ = rate;
}
inline void Envelope :: setTime( StkFloat time )
{
#if defined(_STK_DEBUG_)
if ( time < 0.0 ) {
errorString_ << "Envelope::setTime: negative times not allowed ... correcting!";
handleError( StkError::WARNING );
rate_ = 1.0 / ( -time * Stk::sampleRate() );
}
else
#endif
rate_ = 1.0 / ( time * Stk::sampleRate() );
}
inline void Envelope :: setTarget( StkFloat target )
{
target_ = target;
if ( value_ != target_ ) state_ = 1;
}
inline void Envelope :: setValue( StkFloat value )
{
state_ = 0;
target_ = value;
value_ = value;
}
inline StkFloat Envelope :: tick( void )
{
if ( state_ ) {
@@ -144,7 +112,7 @@ inline StkFrames& Envelope :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Envelope::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Envelope::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -30,7 +30,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -88,6 +88,16 @@ class FM : public Instrmnt
//! Compute and return one output sample.
virtual StkFloat tick( unsigned int ) = 0;
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
protected:
std::vector<ADSR *> adsr_;

View File

@@ -33,7 +33,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -61,6 +61,16 @@ class FMVoices : public FM
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
int currentVowel_;
@@ -93,6 +103,33 @@ inline StkFloat FMVoices :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& FMVoices :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "FMVoices::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -19,7 +19,7 @@ namespace stk {
the overloaded one that takes an StkFrames object for
multi-channel and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -54,6 +54,9 @@ class FileLoop : protected FileWvIn
//! Clear outputs and reset time (file) pointer to zero.
void reset( void ) { FileWvIn::reset(); };
//! Return the number of audio channels in the data or stream.
unsigned int channelsOut( void ) const { return data_.channels(); };
//! Normalize data to a maximum of +-1.0.
/*!
This function has no effect when data is incrementally loaded

View File

@@ -20,19 +20,21 @@ namespace stk {
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
16-, 24-, 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.
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 should
be specified in a variable named "fs". If no
such variable is found, the sample rate is
assumed to be 44100 Hz.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -77,6 +79,9 @@ public:
//! Return the number of audio channels in the file.
unsigned int channels( void ) const { return channels_; };
//! Return the data format of the file.
StkFormat format( void ) const { return dataType_; };
//! Return the file sample rate in Hz.
/*!
WAV, SND, and AIF formatted files specify a sample rate in
@@ -118,6 +123,9 @@ protected:
// Get MAT-file header information.
bool getMatInfo( const char *fileName );
// Helper function for MAT-file parsing.
bool findNextMatArray( SINT32 *chunkSize, SINT32 *rows, SINT32 *columns, SINT32 *nametype );
FILE *fd_;
bool byteswap_;
bool wavFile_;

View File

@@ -17,14 +17,14 @@ namespace stk {
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
(8-, 16-, 24-, 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 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -76,28 +76,28 @@ class FileWrite : public Stk
protected:
// Write STK RAW file header.
bool setRawFile( const char *fileName );
bool setRawFile( std::string fileName );
// Write WAV file header.
bool setWavFile( const char *fileName );
bool setWavFile( std::string fileName );
// Close WAV file, updating the header.
void closeWavFile( void );
// Write SND (AU) file header.
bool setSndFile( const char *fileName );
bool setSndFile( std::string fileName );
// Close SND file, updating the header.
void closeSndFile( void );
// Write AIFF file header.
bool setAifFile( const char *fileName );
bool setAifFile( std::string fileName );
// Close AIFF file, updating the header.
void closeAifFile( void );
// Write MAT-file header.
bool setMatFile( const char *fileName );
bool setMatFile( std::string fileName );
// Close MAT-file, updating the header.
void closeMatFile( void );

View File

@@ -35,7 +35,7 @@ namespace stk {
See the FileRead class for a description of the supported audio
file formats.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -99,6 +99,9 @@ public:
*/
virtual StkFloat getFileRate( void ) const { return data_.dataRate(); };
//! Query whether a file is open.
bool isOpen( void ) { return file_.isOpen(); };
//! Query whether reading is complete.
bool isFinished( void ) const { return finished_; };
@@ -179,7 +182,7 @@ inline StkFloat FileWvIn :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= data_.channels() ) {
errorString_ << "FileWvIn::lastOut(): channel argument and soundfile data are incompatible!";
oStream_ << "FileWvIn::lastOut(): channel argument and soundfile data are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -25,7 +25,7 @@ namespace stk {
Currently, FileWvOut is non-interpolating and the output rate is
always Stk::sampleRate().
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -3,6 +3,7 @@
#include "Stk.h"
#include <vector>
#include <cmath>
namespace stk {
@@ -14,7 +15,7 @@ namespace stk {
filter subclasses. It is general enough to support both
monophonic and polyphonic input/output classes.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -43,6 +44,14 @@ public:
//! Return the current filter gain.
StkFloat getGain( void ) const { return gain_; };
//! Return the filter phase delay at the specified frequency.
/*!
Note that the phase delay calculation accounts for the filter
gain. The frequency value should be greater than 0.0 and less
than or equal to one-half the sample rate.
*/
StkFloat phaseDelay( StkFloat frequency );
//! Return an StkFrames reference to the last output sample frame.
const StkFrames& lastFrame( void ) const { return lastFrame_; };
@@ -59,10 +68,10 @@ public:
protected:
StkFloat gain_;
unsigned int channelsIn_;
StkFrames lastFrame_;
StkFloat gain_;
std::vector<StkFloat> b_;
std::vector<StkFloat> a_;
StkFrames outputs_;
@@ -81,6 +90,35 @@ inline void Filter :: clear( void )
lastFrame_[i] = 0.0;
}
inline StkFloat Filter :: phaseDelay( StkFloat frequency )
{
if ( frequency <= 0.0 || frequency > 0.5 * Stk::sampleRate() ) {
oStream_ << "Filter::phaseDelay: argument (" << frequency << ") is out of range!";
handleError( StkError::WARNING ); return 0.0;
}
StkFloat omegaT = 2 * M_PI * frequency / Stk::sampleRate();
StkFloat real = 0.0, imag = 0.0;
for ( unsigned int i=0; i<b_.size(); i++ ) {
real += b_[i] * std::cos( i * omegaT );
imag -= b_[i] * std::sin( i * omegaT );
}
real *= gain_;
imag *= gain_;
StkFloat phase = atan2( imag, real );
real = 0.0, imag = 0.0;
for ( unsigned int i=0; i<a_.size(); i++ ) {
real += a_[i] * std::cos( i * omegaT );
imag -= a_[i] * std::sin( i * omegaT );
}
phase -= std::atan2( imag, real );
phase = std::fmod( -phase, 2 * M_PI );
return phase / omegaT;
}
} // stk namespace
#endif

View File

@@ -23,7 +23,7 @@ namespace stk {
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -101,7 +101,7 @@ inline StkFrames& Fir :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Fir::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Fir::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -127,7 +127,7 @@ inline StkFrames& Fir :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Fir::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Fir::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -32,7 +32,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -55,10 +55,10 @@ class Flute : public Instrmnt
void setFrequency( StkFloat frequency );
//! Set the reflection coefficient for the jet delay (-1.0 - 1.0).
void setJetReflection( StkFloat coefficient );
void setJetReflection( StkFloat coefficient ) { jetReflection_ = coefficient; };
//! Set the reflection coefficient for the air column delay (-1.0 - 1.0).
void setEndReflection( StkFloat coefficient );
void setEndReflection( StkFloat coefficient ) { endReflection_ = coefficient; };
//! Set the length of the jet delay in terms of a ratio of jet delay to air column delay lengths.
void setJetDelay( StkFloat aRatio );
@@ -81,6 +81,16 @@ class Flute : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayL jetDelay_;
@@ -91,7 +101,7 @@ class Flute : public Instrmnt
Noise noise_;
ADSR adsr_;
SineWave vibrato_;
unsigned long length_;
StkFloat lastFrequency_;
StkFloat maxPressure_;
StkFloat jetReflection_;
@@ -112,7 +122,7 @@ inline StkFloat Flute :: tick( unsigned int )
breathPressure = maxPressure_ * adsr_.tick();
breathPressure += breathPressure * ( noiseGain_ * noise_.tick() + vibratoGain_ * vibrato_.tick() );
StkFloat temp = filter_.tick( boreDelay_.lastOut() );
StkFloat temp = -filter_.tick( boreDelay_.lastOut() );
temp = dcBlock_.tick( temp ); // Block DC on reflection.
pressureDiff = breathPressure - (jetReflection_ * temp);
@@ -124,6 +134,33 @@ inline StkFloat Flute :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Flute :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Flute::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
over time from one frequency setting to another. It provides
methods for controlling the sweep rate and target frequency.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -35,12 +35,14 @@ class FormSwep : public Filter
This method determines the filter coefficients corresponding to
two complex-conjugate poles with the given \e frequency (in Hz)
and \e radius from the z-plane origin. The filter zeros are
placed at z = 1, z = -1, and the coefficients are then normalized to
produce a constant unity gain (independent of the filter \e gain
parameter). The resulting filter frequency response has a
placed at z = 1, z = -1, and the coefficients are then normalized
to produce a constant unity gain (independent of the filter \e
gain parameter). The resulting filter frequency response has a
resonance at the given \e frequency. The closer the poles are to
the unit-circle (\e radius close to one), the narrower the
resulting resonance width.
resulting resonance width. An unstable filter will result for \e
radius >= 1.0. The \e frequency value should be between zero and
half the sample rate.
*/
void setResonance( StkFloat frequency, StkFloat radius );
@@ -152,7 +154,7 @@ inline StkFrames& FormSwep :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "FormSwep::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "FormSwep::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -169,7 +171,7 @@ inline StkFrames& FormSwep :: tick( StkFrames& iFrames, StkFrames& oFrames, unsi
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "FormSwep::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "FormSwep::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
implement tables or other types of input to output function
mappings.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -13,7 +13,7 @@ namespace stk {
generator sample-source subclasses. It is general enough to
support both monophonic and polyphonic output classes.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -175,7 +175,7 @@ inline StkFloat Granulate :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= lastFrame_.channels() ) {
errorString_ << "Granulate::lastOut(): channel argument is invalid!";
oStream_ << "Granulate::lastOut(): channel argument is invalid!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -188,7 +188,7 @@ inline StkFrames& Granulate :: tick( StkFrames& frames, unsigned int channel )
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
errorString_ << "Granulate::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Granulate::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -31,7 +31,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -53,6 +53,16 @@ class HevyMetl : public FM
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
};
@@ -84,6 +94,33 @@ inline StkFloat HevyMetl :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& HevyMetl :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "HevyMetl::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -27,7 +27,7 @@ namespace stk {
This structure results in one extra multiply per computed sample,
but allows easy control of the overall filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -136,7 +136,7 @@ inline StkFrames& Iir :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Iir::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Iir::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -168,7 +168,7 @@ inline StkFrames& Iir :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "Iir::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Iir::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -31,7 +31,7 @@ namespace stk {
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 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -141,7 +141,7 @@ inline StkFloat InetWvIn :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= data_.channels() ) {
errorString_ << "InetWvIn::lastOut(): channel argument and data stream are incompatible!";
oStream_ << "InetWvIn::lastOut(): channel argument and data stream are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -25,7 +25,7 @@ namespace stk {
data type is signed 16-bit integers but any of the defined
StkFormats are permissible.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -12,7 +12,7 @@ namespace stk {
This class provides a common interface for
all STK instruments.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -65,7 +65,7 @@ class Instrmnt : public Stk
performed if _STK_DEBUG_ is defined during compilation, in which
case an out-of-range value will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
protected:
@@ -73,9 +73,9 @@ class Instrmnt : public Stk
};
inline void Instrmnt :: setFrequency(StkFloat frequency)
inline void Instrmnt :: setFrequency( StkFloat frequency )
{
errorString_ << "Instrmnt::setFrequency: virtual setFrequency function call!";
oStream_ << "Instrmnt::setFrequency: virtual setFrequency function call!";
handleError( StkError::WARNING );
}
@@ -83,7 +83,7 @@ inline StkFloat Instrmnt :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= lastFrame_.channels() ) {
errorString_ << "Instrmnt::lastOut(): channel argument is invalid!";
oStream_ << "Instrmnt::lastOut(): channel argument is invalid!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -91,36 +91,9 @@ inline StkFloat Instrmnt :: lastOut( unsigned int channel )
return lastFrame_[channel];
}
inline StkFrames& Instrmnt :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
errorString_ << "Instrmnt::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
inline void Instrmnt :: controlChange( int number, StkFloat value )
{
errorString_ << "Instrmnt::controlChange: virtual function call!";
oStream_ << "Instrmnt::controlChange: virtual function call!";
handleError( StkError::WARNING );
}

View File

@@ -3,6 +3,7 @@
#include "Effect.h"
#include "Delay.h"
#include "OnePole.h"
namespace stk {
@@ -10,14 +11,20 @@ namespace stk {
/*! \class JCRev
\brief John Chowning's reverberator class.
This class takes a monophonic input signal and produces a stereo
output signal. It is derived from the CLM JCRev function, which
is based on the use of networks of simple allpass and comb delay
filters. This class implements three series allpass units,
followed by four parallel comb filters, and two decorrelation
delay lines in parallel at the output.
This class takes a monophonic input signal and
produces a stereo output signal. It is derived
from the CLM JCRev function, which is based on
the use of networks of simple allpass and comb
delay filters. This class implements three
series allpass units, followed by four parallel
comb filters, and two decorrelation delay lines
in parallel at the output.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
Although not in the original JC reverberator,
one-pole lowpass filters have been added inside
the feedback comb filters.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -82,6 +89,7 @@ class JCRev : public Effect
Delay allpassDelays_[3];
Delay combDelays_[4];
OnePole combFilters_[4];
Delay outLeftDelay_;
Delay outRightDelay_;
StkFloat allpassCoefficient_;
@@ -93,7 +101,7 @@ inline StkFloat JCRev :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "JCRev::lastOut(): channel argument must be less than 2!";
oStream_ << "JCRev::lastOut(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -105,7 +113,7 @@ inline StkFloat JCRev :: tick( StkFloat input, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "JCRev::tick(): channel argument must be less than 2!";
oStream_ << "JCRev::tick(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -131,10 +139,10 @@ inline StkFloat JCRev :: tick( StkFloat input, unsigned int channel )
allpassDelays_[2].tick(temp2);
temp2 = -(allpassCoefficient_ * temp2) + temp;
temp3 = temp2 + (combCoefficient_[0] * combDelays_[0].lastOut());
temp4 = temp2 + (combCoefficient_[1] * combDelays_[1].lastOut());
temp5 = temp2 + (combCoefficient_[2] * combDelays_[2].lastOut());
temp6 = temp2 + (combCoefficient_[3] * combDelays_[3].lastOut());
temp3 = temp2 + ( combFilters_[0].tick( combCoefficient_[0] * combDelays_[0].lastOut() ) );
temp4 = temp2 + ( combFilters_[1].tick( combCoefficient_[1] * combDelays_[1].lastOut() ) );
temp5 = temp2 + ( combFilters_[2].tick( combCoefficient_[2] * combDelays_[2].lastOut() ) );
temp6 = temp2 + ( combFilters_[3].tick( combCoefficient_[3] * combDelays_[3].lastOut() ) );
combDelays_[0].tick(temp3);
combDelays_[1].tick(temp4);
@@ -149,7 +157,7 @@ inline StkFloat JCRev :: tick( StkFloat input, unsigned int channel )
lastFrame_[0] += temp;
lastFrame_[1] += temp;
return lastFrame_[channel];
return 0.7 * lastFrame_[channel];
}
} // stk namespace

View File

@@ -16,7 +16,7 @@ namespace stk {
Consult Fletcher and Rossing, Karjalainen,
Cook, and others for more information.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -68,7 +68,7 @@ inline StkFrames& JetTable :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -89,7 +89,7 @@ inline StkFrames& JetTable :: tick( StkFrames& iFrames, StkFrames& oFrames, unsi
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -134,7 +134,7 @@ inline void LentPitShift::process()
for ( n=0; n<inputFrames.size(); n++ ) {
x_t = inputLine_.tick( inputFrames[ n ] );
for ( delay_=1; delay_<= tMax_; delay_++ ) {
x_t_T = inputLine_.contentsAt( delay_ );
x_t_T = inputLine_.tapOut( delay_ );
coeff = x_t - x_t_T;
dt[delay_] += coeff * coeff;
}
@@ -193,7 +193,7 @@ inline void LentPitShift::process()
M = tMax_ - inputPtr + lastPeriod_ - 1; // New reading pointer
N = 2*tMax_ - (unsigned long)floor(outputPtr + tMax_) + lastPeriod_ - 1; // New writing pointer
for ( unsigned int j=0; j<2*lastPeriod_; j++,M--,N-- ) {
sample = inputLine_.contentsAt(M) * window[j] / 2.;
sample = inputLine_.tapOut(M) * window[j] / 2.;
// Linear interpolation
outputLine_.addTo(N, env[0] * sample);
outputLine_.addTo(N-1, env[1] * sample);
@@ -228,7 +228,7 @@ inline StkFrames& LentPitShift :: tick( StkFrames& frames, unsigned int channel
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "LentPitShift::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "LentPitShift::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -246,7 +246,7 @@ inline StkFrames& LentPitShift :: tick( StkFrames& iFrames, StkFrames& oFrames,
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "LentPitShift::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "LentPitShift::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -1,7 +1,8 @@
#ifndef STK_MANDOLIN_H
#define STK_MANDOLIN_H
#include "PluckTwo.h"
#include "Instrmnt.h"
#include "Twang.h"
#include "FileWvIn.h"
namespace stk {
@@ -10,19 +11,18 @@ namespace stk {
/*! \class Mandolin
\brief STK mandolin instrument model class.
This class inherits from PluckTwo and uses
"commuted synthesis" techniques to model a
mandolin instrument.
This class uses two "twang" models and "commuted
synthesis" techniques to model a mandolin
instrument.
This is a digital waveguide model, making its
use possibly subject to patents held by
Stanford University, Yamaha, and others.
Commuted Synthesis, in particular, is covered
by patents, granted, pending, and/or
applied-for. All are assigned to the Board of
Trustees, Stanford University. For
information, contact the Office of Technology
Licensing, Stanford University.
use possibly subject to patents held by Stanford
University, Yamaha, and others. Commuted
Synthesis, in particular, is covered by patents,
granted, pending, and/or applied-for. All are
assigned to the Board of Trustees, Stanford
University. For information, contact the Office
of Technology Licensing, Stanford University.
Control Change Numbers:
- Body Size = 2
@@ -31,11 +31,11 @@ namespace stk {
- String Detuning = 1
- Microphone Position = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
class Mandolin : public PluckTwo
class Mandolin : public Instrmnt
{
public:
//! Class constructor, taking the lowest desired playing frequency.
@@ -44,6 +44,21 @@ class Mandolin : public PluckTwo
//! Class destructor.
~Mandolin( void );
//! Reset and clear all internal state.
void clear( void );
//! Detune the two strings by the given factor. A value of 1.0 produces unison strings.
void setDetune( StkFloat detune );
//! Set the body size (a value of 1.0 produces the "default" size).
void setBodySize( StkFloat size );
//! Set the pluck or "excitation" position along the string (0.0 - 1.0).
void setPluckPosition( StkFloat position );
//! Set instrument parameters for a particular frequency.
void setFrequency( StkFloat frequency );
//! Pluck the strings with the given amplitude (0.0 - 1.0) using the current frequency.
void pluck( StkFloat amplitude );
@@ -53,8 +68,8 @@ class Mandolin : public PluckTwo
//! Start a note with the given frequency and amplitude (0.0 - 1.0).
void noteOn( StkFloat frequency, StkFloat amplitude );
//! Set the body size (a value of 1.0 produces the "default" size).
void setBodySize( StkFloat size );
//! Stop a note with the given amplitude (speed of decay).
void noteOff( StkFloat amplitude );
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
void controlChange( int number, StkFloat value );
@@ -62,44 +77,67 @@ class Mandolin : public PluckTwo
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
FileWvIn *soundfile_[12];
Twang strings_[2];
FileWvIn soundfile_[12];
int mic_;
long dampTime_;
bool waveDone_;
StkFloat detuning_;
StkFloat frequency_;
StkFloat pluckAmplitude_;
};
inline StkFloat Mandolin :: tick( unsigned int )
{
StkFloat temp = 0.0;
if ( !waveDone_ ) {
// Scale the pluck excitation with comb
// filtering for the duration of the file.
temp = soundfile_[mic_]->tick() * pluckAmplitude_;
temp = temp - combDelay_.tick(temp);
waveDone_ = soundfile_[mic_]->isFinished();
}
if ( !soundfile_[mic_].isFinished() )
temp = soundfile_[mic_].tick() * pluckAmplitude_;
// Damping hack to help avoid overflow on re-plucking.
if ( dampTime_ >=0 ) {
dampTime_ -= 1;
// Calculate 1st delay filtered reflection plus pluck excitation.
lastFrame_[0] = delayLine_.tick( filter_.tick( temp + (delayLine_.lastOut() * 0.7) ) );
// Calculate 2nd delay just like the 1st.
lastFrame_[0] += delayLine2_.tick( filter2_.tick( temp + (delayLine2_.lastOut() * 0.7) ) );
}
else { // No damping hack after 1 period.
// Calculate 1st delay filtered reflection plus pluck excitation.
lastFrame_[0] = delayLine_.tick( filter_.tick( temp + (delayLine_.lastOut() * loopGain_) ) );
// Calculate 2nd delay just like the 1st.
lastFrame_[0] += delayLine2_.tick( filter2_.tick( temp + (delayLine2_.lastOut() * loopGain_) ) );
}
lastFrame_[0] = strings_[0].tick( temp );
lastFrame_[0] += strings_[1].tick( temp );
lastFrame_[0] *= 0.2;
lastFrame_[0] *= 0.3;
return lastFrame_[0];
}
inline StkFrames& Mandolin :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Mandolin::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -32,14 +32,14 @@ namespace stk {
*/
/***************************************************/
const short NXMAX = 12;
const short NYMAX = 12;
const unsigned short NXMAX = 12;
const unsigned short NYMAX = 12;
class Mesh2D : public Instrmnt
{
public:
//! Class constructor, taking the x and y dimensions in samples.
Mesh2D( short nX, short nY );
Mesh2D( unsigned short nX, unsigned short nY );
//! Class destructor.
~Mesh2D( void );
@@ -48,10 +48,10 @@ class Mesh2D : public Instrmnt
void clear( void );
//! Set the x dimension size in samples.
void setNX( short lenX );
void setNX( unsigned short lenX );
//! Set the y dimension size in samples.
void setNY( short lenY );
void setNY( unsigned short lenY );
//! Set the x, y input position on a 0.0 - 1.0 scale.
void setInputPosition( StkFloat xFactor, StkFloat yFactor );
@@ -77,14 +77,24 @@ class Mesh2D : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
StkFloat tick0();
StkFloat tick1();
void clearMesh();
short NX_, NY_;
short xInput_, yInput_;
unsigned short NX_, NY_;
unsigned short xInput_, yInput_;
OnePole filterX_[NXMAX];
OnePole filterY_[NYMAX];
StkFloat v_[NXMAX-1][NYMAX-1]; // junction velocities
@@ -102,6 +112,33 @@ class Mesh2D : public Instrmnt
int counter_; // time in samples
};
inline StkFrames& Mesh2D :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Mesh2D::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -46,7 +46,7 @@ namespace stk {
This class is primarily for use in STK example programs but it is
generic enough to work in many other contexts.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -40,10 +40,10 @@ class MidiFileIn : public Stk
~MidiFileIn();
//! Return the MIDI file format (0, 1, or 2).
int getFileFormat() const;
int getFileFormat() const { return format_; };
//! Return the number of tracks in the MIDI file.
unsigned int getNumberOfTracks() const;
unsigned int getNumberOfTracks() const { return nTracks_; };
//! Return the MIDI file division value from the file header.
/*!
@@ -51,7 +51,7 @@ class MidiFileIn : public Stk
MIDI File Specification. In particular, if the MSB is set, the
file uses time-code representations for delta-time values.
*/
int getDivision() const;
int getDivision() const { return division_; };
//! Move the specified track event reader to the beginning of its track.
/*!

View File

@@ -19,7 +19,7 @@ namespace stk {
(non-sweeping BiQuad filters), where N is set
during instantiation.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -71,6 +71,16 @@ public:
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
Envelope envelope_;
@@ -112,6 +122,33 @@ inline StkFloat Modal :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Modal :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Modal::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -31,7 +31,7 @@ namespace stk {
- Two Fixed = 7
- Clump = 8
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -16,7 +16,7 @@ namespace stk {
modulations to give a nice, natural human
modulation function.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -90,7 +90,7 @@ inline StkFrames& Modulate :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Modulate::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Modulate::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -22,7 +22,7 @@ namespace stk {
- Vibrato Gain = 1
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -56,6 +56,16 @@ class Moog : public Sampler
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
FormSwep filters_[2];
@@ -83,6 +93,33 @@ inline StkFloat Moog :: tick( unsigned int )
return lastFrame_[0] * 6.0;
}
inline StkFrames& Moog :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Moog::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -29,7 +29,7 @@ namespace stk {
systems, the pthread library is used. Under
Windows, critical sections are used.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -18,7 +18,7 @@ namespace stk {
another allpass in series, followed by two allpass filters in
parallel with corresponding right and left outputs.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -93,7 +93,7 @@ inline StkFloat NRev :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "NRev::lastOut(): channel argument must be less than 2!";
oStream_ << "NRev::lastOut(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -105,7 +105,7 @@ inline StkFloat NRev :: tick( StkFloat input, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "NRev::tick(): channel argument must be less than 2!";
oStream_ << "NRev::tick(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
C rand() function. The quality of the rand()
function varies from one OS to another.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -64,7 +64,7 @@ inline StkFrames& Noise :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "Noise::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "Noise::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
provided for setting the pole position along the real axis of the
z-plane while maintaining a constant peak filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -42,7 +42,8 @@ public:
z-plane and normalizes the coefficients for a maximum gain of one.
A positive pole value produces a low-pass filter, while a negative
pole value produces a high-pass filter. This method does not
affect the filter \e gain value.
affect the filter \e gain value. The argument magnitude should be
less than one to maintain filter stability.
*/
void setPole( StkFloat thePole );
@@ -89,7 +90,7 @@ inline StkFrames& OnePole :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "OnePole::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "OnePole::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -110,7 +111,7 @@ inline StkFrames& OnePole :: tick( StkFrames& iFrames, StkFrames& oFrames, unsig
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "OnePole::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "OnePole::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
provided for setting the zero position along the real axis of the
z-plane while maintaining a constant filter gain.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -89,7 +89,7 @@ inline StkFrames& OneZero :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "OneZero::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "OneZero::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -110,7 +110,7 @@ inline StkFrames& OneZero :: tick( StkFrames& iFrames, StkFrames& oFrames, unsig
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "OneZero::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "OneZero::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -17,7 +17,7 @@ namespace stk {
allpass and comb delay filters. This class implements two series
allpass units and two parallel comb filters.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -80,8 +80,8 @@ public:
protected:
Delay allpassDelays_[2];
Delay combDelays_[2];
Delay allpassDelays_[2];
Delay combDelays_[2];
StkFloat allpassCoefficient_;
StkFloat combCoefficient_[2];
@@ -91,7 +91,7 @@ inline StkFloat PRCRev :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "PRCRev::lastOut(): channel argument must be less than 2!";
oStream_ << "PRCRev::lastOut(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -103,7 +103,7 @@ inline StkFloat PRCRev :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
errorString_ << "PRCRev::tick(): channel argument must be less than 2!";
oStream_ << "PRCRev::tick(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -122,8 +122,8 @@ inline StkFloat PRCRev :: lastOut( unsigned int channel )
allpassDelays_[1].tick(temp1);
temp1 = -(allpassCoefficient_ * temp1) + temp;
temp2 = temp1 + (combCoefficient_[0] * combDelays_[0].lastOut());
temp3 = temp1 + (combCoefficient_[1] * combDelays_[1].lastOut());
temp2 = temp1 + ( combCoefficient_[0] * combDelays_[0].lastOut() );
temp3 = temp1 + ( combCoefficient_[1] * combDelays_[1].lastOut() );
lastFrame_[0] = effectMix_ * (combDelays_[0].tick(temp2));
lastFrame_[1] = effectMix_ * (combDelays_[1].tick(temp3));

View File

@@ -29,7 +29,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -54,6 +54,16 @@ class PercFlut : public FM
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
};
@@ -85,6 +95,33 @@ inline StkFloat PercFlut :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& PercFlut :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "PercFlut::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -13,7 +13,7 @@ namespace stk {
set of 32 static phoneme formant parameters
and provide access to those values.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -21,8 +21,9 @@ class Phonemes : public Stk
{
public:
Phonemes(void);
~Phonemes(void);
Phonemes( void );
~Phonemes( void );
//! Returns the phoneme name for the given index (0-31).
static const char *name( unsigned int index );

View File

@@ -13,7 +13,7 @@ namespace stk {
This class implements a simple pitch shifter
using delay lines.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -1,89 +0,0 @@
#ifndef STK_PLUCKTWO_H
#define STK_PLUCKTWO_H
#include "Instrmnt.h"
#include "DelayL.h"
#include "DelayA.h"
#include "OneZero.h"
namespace stk {
/***************************************************/
/*! \class PluckTwo
\brief STK enhanced plucked string model class.
This class implements an enhanced two-string,
plucked physical model, a la Jaffe-Smith,
Smith, and others.
PluckTwo is an abstract class, with no excitation
specified. Therefore, it can't be directly
instantiated.
This is a digital waveguide model, making its
use possibly subject to patents held by
Stanford University, Yamaha, and others.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
*/
/***************************************************/
class PluckTwo : public Instrmnt
{
public:
//! Class constructor, taking the lowest desired playing frequency.
PluckTwo( StkFloat lowestFrequency );
//! Class destructor.
virtual ~PluckTwo( void );
//! Reset and clear all internal state.
void clear( void );
//! Set instrument parameters for a particular frequency.
virtual void setFrequency( StkFloat frequency );
//! Detune the two strings by the given factor. A value of 1.0 produces unison strings.
void setDetune( StkFloat detune );
//! Efficient combined setting of frequency and detuning.
void setFreqAndDetune( StkFloat frequency, StkFloat detune );
//! Set the pluck or "excitation" position along the string (0.0 - 1.0).
void setPluckPosition( StkFloat position );
//! Set the base loop gain.
/*!
The actual loop gain is set according to the frequency.
Because of high-frequency loop filter roll-off, higher
frequency settings have greater loop gains.
*/
void setBaseLoopGain( StkFloat aGain );
//! Stop a note with the given amplitude (speed of decay).
virtual void noteOff( StkFloat amplitude );
virtual StkFloat tick( unsigned int channel = 0 ) = 0;
protected:
DelayA delayLine_;
DelayA delayLine2_;
DelayL combDelay_;
OneZero filter_;
OneZero filter2_;
unsigned long length_;
StkFloat loopGain_;
StkFloat baseLoopGain_;
StkFloat lastFrequency_;
StkFloat lastLength_;
StkFloat detuning_;
StkFloat pluckAmplitude_;
StkFloat pluckPosition_;
};
} // stk namespace
#endif

View File

@@ -11,12 +11,15 @@ namespace stk {
/***************************************************/
/*! \class Plucked
\brief STK plucked string model class.
\brief STK basic plucked string class.
This class implements a simple plucked string
physical model based on the Karplus-Strong
algorithm.
For a more advanced plucked string implementation,
see the stk::Twang class.
This is a digital waveguide model, making its
use possibly subject to patents held by
Stanford University, Yamaha, and others.
@@ -24,7 +27,7 @@ namespace stk {
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -32,7 +35,7 @@ class Plucked : public Instrmnt
{
public:
//! Class constructor, taking the lowest desired playing frequency.
Plucked( StkFloat lowestFrequency );
Plucked( StkFloat lowestFrequency = 10.0 );
//! Class destructor.
~Plucked( void );
@@ -55,15 +58,24 @@ class Plucked : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayA delayLine_;
OneZero loopFilter_;
OnePole pickFilter_;
Noise noise_;
StkFloat loopGain_;
unsigned long length_;
StkFloat loopGain_;
};
inline StkFloat Plucked :: tick( unsigned int )
@@ -72,6 +84,33 @@ inline StkFloat Plucked :: tick( unsigned int )
return lastFrame_[0] = 3.0 * delayLine_.tick( loopFilter_.tick( delayLine_.lastOut() * loopGain_ ) );
}
inline StkFrames& Plucked :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Plucked::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -14,7 +14,7 @@ namespace stk {
coefficient. Another method is provided to create a DC blocking
filter.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -43,17 +43,18 @@ class PoleZero : public Filter
//! Set the filter for allpass behavior using \e coefficient.
/*!
This method uses \e coefficient to create an allpass filter,
which has unity gain at all frequencies. Note that the \e
coefficient magnitude must be less than one to maintain stability.
which has unity gain at all frequencies. Note that the
\e coefficient magnitude must be less than one to maintain
filter stability.
*/
void setAllpass( StkFloat coefficient );
//! Create a DC blocking filter with the given pole position in the z-plane.
/*!
This method sets the given pole position, together with a zero
at z=1, to create a DC blocking filter. \e thePole should be
close to one to minimize low-frequency attenuation.
at z=1, to create a DC blocking filter. The argument magnitude
should be close to (but less than) one to minimize low-frequency
attenuation.
*/
void setBlockZero( StkFloat thePole = 0.99 );
@@ -89,7 +90,7 @@ inline StkFrames& PoleZero :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "PoleZero::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "PoleZero::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -20,7 +20,7 @@ namespace stk {
Smith (1986), Hirschman, Cook, Scavone, and
others for more information.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -99,7 +99,7 @@ inline StkFrames& ReedTable :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "ReedTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "ReedTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
@@ -120,7 +120,7 @@ inline StkFrames& ReedTable :: tick( StkFrames& iFrames, StkFrames& oFrames, uns
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
errorString_ << "ReedTable::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "ReedTable::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -23,7 +23,7 @@ namespace stk {
- Zero Radii = 1
- Envelope Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -66,6 +66,16 @@ class Resonate : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
ADSR adsr_;
@@ -85,6 +95,33 @@ inline StkFloat Resonate :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Resonate :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Resonate::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -33,7 +33,7 @@ namespace stk {
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -58,6 +58,16 @@ class Rhodey : public FM
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
};
@@ -86,6 +96,33 @@ inline StkFloat Rhodey :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Rhodey :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Rhodey::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -10,7 +10,7 @@
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/
RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2010 Gary P. Scavone
Copyright (c) 2001-2011 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -42,7 +42,7 @@
\file RtAudio.h
*/
// RtAudio: Version 4.0.7
// RtAudio: Version 4.0.10
#ifndef __RTAUDIO_H
#define __RTAUDIO_H
@@ -59,10 +59,12 @@
internal routines will automatically take care of any necessary
byte-swapping between the host format and the soundcard. Thus,
endian-ness is not a concern in the following format definitions.
Note that 24-bit data is expected to be encapsulated in a 32-bit
format.
- \e RTAUDIO_SINT8: 8-bit signed integer.
- \e RTAUDIO_SINT16: 16-bit signed integer.
- \e RTAUDIO_SINT24: Upper 3 bytes of 32-bit signed integer.
- \e RTAUDIO_SINT24: Lower 3 bytes of 32-bit signed integer.
- \e RTAUDIO_SINT32: 32-bit signed integer.
- \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0.
- \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0.
@@ -84,6 +86,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
- \e RTAUDIO_NONINTERLEAVED: Use non-interleaved buffers (default = interleaved).
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
- \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only).
By default, RtAudio streams pass and receive audio data from the
client in an interleaved format. By passing the
@@ -111,12 +114,17 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi
If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt
to select realtime scheduling (round-robin) for the callback thread.
If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
open the "default" PCM device when using the ALSA API. Note that this
will override any specified input or output device id.
*/
typedef unsigned int RtAudioStreamFlags;
static const RtAudioStreamFlags RTAUDIO_NONINTERLEAVED = 0x1; // Use non-interleaved buffers (default = interleaved).
static const RtAudioStreamFlags RTAUDIO_MINIMIZE_LATENCY = 0x2; // Attempt to set stream parameters for lowest possible latency.
static const RtAudioStreamFlags RTAUDIO_HOG_DEVICE = 0x4; // Attempt grab device and prevent use by others.
static const RtAudioStreamFlags RTAUDIO_SCHEDULE_REALTIME = 0x8; // Try to select realtime scheduling for callback thread.
static const RtAudioStreamFlags RTAUDIO_ALSA_USE_DEFAULT = 0x10; // Use the "default" PCM device (ALSA only).
/*! \typedef typedef unsigned long RtAudioStreamStatus;
\brief RtAudio stream status (over- or underflow) flags.
@@ -248,6 +256,7 @@ class RtAudio
- \e RTAUDIO_MINIMIZE_LATENCY: Attempt to set stream parameters for lowest possible latency.
- \e RTAUDIO_HOG_DEVICE: Attempt grab device for exclusive use.
- \e RTAUDIO_SCHEDULE_REALTIME: Attempt to select realtime scheduling for callback thread.
- \e RTAUDIO_ALSA_USE_DEFAULT: Use the "default" PCM device (ALSA only).
By default, RtAudio streams pass and receive audio data from the
client in an interleaved format. By passing the
@@ -276,7 +285,11 @@ class RtAudio
If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt
to select realtime scheduling (round-robin) for the callback thread.
The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME
flag is set. It defines the thread's realtime priority.
flag is set. It defines the thread's realtime priority.
If the RTAUDIO_ALSA_USE_DEFAULT flag is set, RtAudio will attempt to
open the "default" PCM device when using the ALSA API. Note that this
will override any specified input or output device id.
The \c numberOfBuffers parameter can be used to control stream
latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs
@@ -292,7 +305,7 @@ class RtAudio
RtAudio with Jack, each instance must have a unique client name.
*/
struct StreamOptions {
RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE). */
RtAudioStreamFlags flags; /*!< A bit-mask of stream flags (RTAUDIO_NONINTERLEAVED, RTAUDIO_MINIMIZE_LATENCY, RTAUDIO_HOG_DEVICE, RTAUDIO_ALSA_USE_DEFAULT). */
unsigned int numberOfBuffers; /*!< Number of stream buffers. */
std::string streamName; /*!< A stream name (currently used only in Jack). */
int priority; /*!< Scheduling priority of callback thread (only used with flag RTAUDIO_SCHEDULE_REALTIME). */

View File

@@ -41,13 +41,13 @@ class RtError : public std::exception
virtual ~RtError( void ) throw() {}
//! Prints thrown error message to stderr.
virtual void printMessage( void ) throw() { std::cerr << '\n' << message_ << "\n\n"; }
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
//! Returns the thrown error message type.
virtual const Type& getType(void) throw() { return type_; }
virtual const Type& getType(void) const throw() { return type_; }
//! Returns the thrown error message string.
virtual const std::string& getMessage(void) throw() { return message_; }
virtual const std::string& getMessage(void) const throw() { return message_; }
//! Returns the thrown error message as a c-style string.
virtual const char* what( void ) const throw() { return message_.c_str(); }

View File

@@ -8,7 +8,7 @@
RtMidi WWW site: http://music.mcgill.ca/~gary/rtmidi/
RtMidi: realtime MIDI i/o C++ classes
Copyright (c) 2003-2010 Gary P. Scavone
Copyright (c) 2003-2011 Gary P. Scavone
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
@@ -35,7 +35,7 @@
*/
/**********************************************************************/
// RtMidi: Version 1.0.11
// RtMidi: Version 1.0.15
#ifndef RTMIDI_H
#define RTMIDI_H
@@ -96,7 +96,6 @@ class RtMidi
/**********************************************************************/
#include <vector>
#include <queue>
class RtMidiIn : public RtMidi
{
@@ -105,11 +104,15 @@ class RtMidiIn : public RtMidi
//! User callback function type definition.
typedef void (*RtMidiCallback)( double timeStamp, std::vector<unsigned char> *message, void *userData);
//! Default constructor that allows an optional client name.
//! Default constructor that allows an optional client name and queue size.
/*!
An exception will be thrown if a MIDI system initialization error occurs.
An exception will be thrown if a MIDI system initialization
error occurs. The queue size defines the maximum number of
messages that can be held in the MIDI queue (when not using a
callback function). If the queue size limit is reached,
incoming messages will be ignored.
*/
RtMidiIn( const std::string clientName = std::string( "RtMidi Input Client") );
RtMidiIn( const std::string clientName = std::string( "RtMidi Input Client"), unsigned int queueSizeLimit = 100 );
//! If a MIDI connection is still open, it will be closed by the destructor.
~RtMidiIn();
@@ -154,20 +157,13 @@ class RtMidiIn : public RtMidi
//! Return a string identifier for the specified MIDI input port number.
/*!
An exception is thrown if an invalid port specifier is provided.
An empty string is returned if an invalid port specifier is provided.
*/
std::string getPortName( unsigned int portNumber = 0 );
//! Set the maximum number of MIDI messages to be saved in the queue.
/*!
If the queue size limit is reached, incoming messages will be
ignored. The default limit is 1024.
*/
void setQueueSizeLimit( unsigned int queueSize );
//! Specify whether certain MIDI message types should be queued or ignored during input.
/*!
By default, MIDI timing and active sensing messages are ignored
o By default, MIDI timing and active sensing messages are ignored
during message input because of their relative high data rates.
MIDI sysex messages are ignored by default as well. Variable
values of "true" imply that the respective message type will be
@@ -193,15 +189,26 @@ class RtMidiIn : public RtMidi
// Default constructor.
MidiMessage()
:bytes(3), timeStamp(0.0) {}
:bytes(0), timeStamp(0.0) {}
};
struct MidiQueue {
unsigned int front;
unsigned int back;
unsigned int size;
unsigned int ringSize;
MidiMessage *ring;
// Default constructor.
MidiQueue()
:front(0), back(0), size(0), ringSize(0) {}
};
// The RtMidiInData structure is used to pass private class data to
// the MIDI input handling function or thread.
struct RtMidiInData {
std::queue<MidiMessage> queue;
MidiQueue queue;
MidiMessage message;
unsigned int queueLimit;
unsigned char ignoreFlags;
bool doInput;
bool firstMessage;
@@ -213,7 +220,7 @@ class RtMidiIn : public RtMidi
// Default constructor.
RtMidiInData()
: queueLimit(1024), ignoreFlags(7), doInput(false), firstMessage(true),
: ignoreFlags(7), doInput(false), firstMessage(true),
apiData(0), usingCallback(false), userCallback(0), userData(0),
continueSysex(false) {}
};
@@ -280,7 +287,7 @@ class RtMidiOut : public RtMidi
//! Return a string identifier for the specified MIDI port type and number.
/*!
An exception is thrown if an invalid port specifier is provided.
An empty string is returned if an invalid port specifier is provided.
*/
std::string getPortName( unsigned int portNumber = 0 );

View File

@@ -24,7 +24,7 @@ namespace stk {
that takes an StkFrames object for multi-channel and/or
multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -112,7 +112,7 @@ inline StkFloat RtWvIn :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= data_.channels() ) {
errorString_ << "RtWvIn::lastOut(): channel argument and audio stream are incompatible!";
oStream_ << "RtWvIn::lastOut(): channel argument and audio stream are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -23,7 +23,7 @@ namespace stk {
that takes a reference to an StkFrames object for multi-channel
and/or multi-frame data.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

View File

@@ -9,7 +9,7 @@
where <name> is the string used in the SKINI stream.
by Perry R. Cook, 1995 - 2010.
by Perry R. Cook, 1995-2011.
*/
/*********************************************************/

View File

@@ -15,7 +15,7 @@ namespace stk {
This instrument provides an ADSR envelope, a one-pole filter, and
structures for an arbitrary number of attack and looped files.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -49,6 +49,16 @@ class Sampler : public Instrmnt
//! Compute and return one output sample.
virtual StkFloat tick( unsigned int channel = 0 ) = 0;
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
protected:
ADSR adsr_;

View File

@@ -44,7 +44,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -87,6 +87,16 @@ class Saxofony : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayL delays_[2];
@@ -95,7 +105,7 @@ class Saxofony : public Instrmnt
Envelope envelope_;
Noise noise_;
SineWave vibrato_;
unsigned long length_;
StkFloat outputGain_;
StkFloat noiseGain_;
StkFloat vibratoGain_;
@@ -124,6 +134,33 @@ inline StkFloat Saxofony :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Saxofony :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Saxofony::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -55,7 +55,7 @@ namespace stk {
- Little Rocks = 21
- Tuned Bamboo Chimes = 22
by Perry R. Cook, 1996 - 2010.
by Perry R. Cook, 1995-2011.
*/
/***************************************************/
@@ -87,6 +87,16 @@ class Shakers : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
int setupName( char* instr );
@@ -126,6 +136,33 @@ class Shakers : public Instrmnt
};
inline StkFrames& Shakers :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Shakers::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -25,7 +25,7 @@ namespace stk {
- Envelope Rate = 11
- Gain = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -65,6 +65,16 @@ class Simple : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
ADSR adsr_;
@@ -87,6 +97,33 @@ inline StkFloat Simple :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Simple :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Simple::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -18,7 +18,7 @@ namespace stk {
The "table" length, set in SineWave.h, is 2048 samples by default.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -121,7 +121,7 @@ inline StkFrames& SineWave :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "SineWave::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "SineWave::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -18,7 +18,7 @@ namespace stk {
Within STK, it is used as an excitation source for other
instruments.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -118,7 +118,7 @@ inline StkFrames& SingWave :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
errorString_ << "SingWave::tick(): channel and StkFrames arguments are incompatible!";
oStream_ << "SingWave::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif

View File

@@ -25,7 +25,7 @@ namespace stk {
Stanford, bearing the names of Karplus and/or
Strong.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -33,7 +33,7 @@ class Sitar : public Instrmnt
{
public:
//! Class constructor, taking the lowest desired playing frequency.
Sitar( StkFloat lowestFrequency = 20 );
Sitar( StkFloat lowestFrequency = 8.0 );
//! Class destructor.
~Sitar( void );
@@ -56,6 +56,16 @@ class Sitar : public Instrmnt
//! Compute and return one output sample.
StkFloat tick( unsigned int channel = 0 );
//! Fill a channel of the StkFrames object with computed outputs.
/*!
The \c channel argument must be less than the number of
channels in the StkFrames argument (the first channel is specified
by 0). However, range checking is only performed if _STK_DEBUG_
is defined during compilation, in which case an out-of-range value
will trigger an StkError exception.
*/
StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
protected:
DelayA delayLine_;
@@ -86,6 +96,33 @@ inline StkFloat Sitar :: tick( unsigned int )
return lastFrame_[0];
}
inline StkFrames& Sitar :: tick( StkFrames& frames, unsigned int channel )
{
unsigned int nChannels = lastFrame_.channels();
#if defined(_STK_DEBUG_)
if ( channel > frames.channels() - nChannels ) {
oStream_ << "Sitar::tick(): channel and StkFrames arguments are incompatible!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
StkFloat *samples = &frames[channel];
unsigned int j, hop = frames.channels() - nChannels;
if ( nChannels == 1 ) {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop )
*samples++ = tick();
}
else {
for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) {
*samples++ = tick();
for ( j=1; j<nChannels; j++ )
*samples++ = lastFrame_[j];
}
}
return frames;
}
} // stk namespace
#endif

View File

@@ -31,7 +31,7 @@ namespace stk {
\sa \ref skini
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -95,24 +95,25 @@ class Skini : public Stk
std::ifstream file_;
};
//! A static table of equal-tempered MIDI to frequency (Hz) values.
static const double Midi2Pitch[129] = {
8.18,8.66,9.18,9.72,10.30,10.91,11.56,12.25,
12.98,13.75,14.57,15.43,16.35,17.32,18.35,19.45,
20.60,21.83,23.12,24.50,25.96,27.50,29.14,30.87,
32.70,34.65,36.71,38.89,41.20,43.65,46.25,49.00,
51.91,55.00,58.27,61.74,65.41,69.30,73.42,77.78,
82.41,87.31,92.50,98.00,103.83,110.00,116.54,123.47,
130.81,138.59,146.83,155.56,164.81,174.61,185.00,196.00,
207.65,220.00,233.08,246.94,261.63,277.18,293.66,311.13,
329.63,349.23,369.99,392.00,415.30,440.00,466.16,493.88,
523.25,554.37,587.33,622.25,659.26,698.46,739.99,783.99,
830.61,880.00,932.33,987.77,1046.50,1108.73,1174.66,1244.51,
1318.51,1396.91,1479.98,1567.98,1661.22,1760.00,1864.66,1975.53,
2093.00,2217.46,2349.32,2489.02,2637.02,2793.83,2959.96,3135.96,
3322.44,3520.00,3729.31,3951.07,4186.01,4434.92,4698.64,4978.03,
5274.04,5587.65,5919.91,6271.93,6644.88,7040.00,7458.62,7902.13,
8372.02,8869.84,9397.27,9956.06,10548.08,11175.30,11839.82,12543.85,
13289.75};
8.176, 8.662, 9.177, 9.723, 10.301, 10.913, 11.562, 12.25,
12.978, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445,
20.602, 21.827, 23.125, 24.50, 25.957, 27.50, 29.135, 30.868,
32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 49.0,
51.913, 55.0, 58.271, 61.735, 65.406, 69.296, 73.416, 77.782,
82.407, 87.307, 92.499, 97.999, 103.826, 110.0, 116.541, 123.471,
130.813, 138.591, 146.832, 155.563, 164.814, 174.614, 184.997, 195.998,
207.652, 220.0, 233.082, 246.942, 261.626, 277.183, 293.665, 311.127,
329.628, 349.228, 369.994, 391.995, 415.305, 440.0, 466.164, 493.883,
523.251, 554.365, 587.33, 622.254, 659.255, 698.456, 739.989, 783.991,
830.609, 880.0, 932.328, 987.767, 1046.502, 1108.731, 1174.659, 1244.508,
1318.51, 1396.913, 1479.978, 1567.982, 1661.219, 1760.0, 1864.655, 1975.533,
2093.005, 2217.461, 2349.318, 2489.016, 2637.02, 2793.826, 2959.955, 3135.963,
3322.438, 3520.0, 3729.31, 3951.066, 4186.009, 4434.922, 4698.636, 4978.032,
5274.041, 5587.652, 5919.911, 6271.927, 6644.875, 7040.0, 7458.62, 7902.133,
8372.018, 8869.844, 9397.273, 9956.063, 10548.082, 11175.303, 11839.822, 12543.854,
13289.75};
} // stk namespace

View File

@@ -31,7 +31,7 @@ namespace stk {
number of static functions for use with external socket
descriptors.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/

Some files were not shown because too many files have changed in this diff Show More