113 Commits
4.4.1 ... 4.5.0

Author SHA1 Message Date
Gary Scavone
cbb2fea120 Updated docs for release date. 2014-04-26 16:33:24 -04:00
Gary Scavone
4e4e8053a5 Updated to RtAudio 4.1.1; Fixed typo in ElectricGuitar script. 2014-04-26 15:04:32 -04:00
Gary Scavone
dc2bfe01d0 Added FunctionDiscoveryKeys_devpkey.h file necessary for WASAPI compile in MinGW. 2014-04-23 12:42:10 -04:00
Gary Scavone
ea52f1f1a8 Removed undefined clear() functions in FM, Resonate, Simple, and Sampler classes; a few documentation updates in preparation for 4.5.0 release. 2014-04-23 12:12:35 -04:00
Gary Scavone
1c5d42e64c Updated to latest version of RtAudio with support for WASAPI using MinGW. 2014-04-23 11:39:32 -04:00
Gary Scavone
f1c929a6c4 Merge branch 'master' of https://github.com/thestk/stk 2014-04-18 10:27:55 -04:00
Gary Scavone
d6dba8859f Another update to FileRead for Aiff sowt uncompressed format. 2014-04-18 10:27:17 -04:00
Gary Scavone
069cc1c339 Update to FileRead for Aiff sowt uncompressed format. 2014-04-18 09:43:08 -04:00
garyscavone
32574e97d6 Merge pull request #24 from gperciva/master
add clear() to abstract Instrumnt.h
2014-04-16 10:05:03 -04:00
Graham Percival
a0638ad024 add clear() to abstract Instrumnt.h
This simplies code which uses different instruments.
2014-04-15 09:55:42 +08:00
garyscavone
3ad1a59585 Merge pull request #23 from arielelkin/update_ios_readme
iOS: updated readme
2014-04-13 14:19:54 -04:00
garyscavone
90c33cae06 Merge pull request #22 from arielelkin/iOS_static_lib_reorg
iOS Lib: move static lib target and rawwaves bundle to Products folder
2014-04-13 14:18:43 -04:00
garyscavone
1ce9b33ca3 Merge pull request #19 from arielelkin/Whistle-new-typedefs
Whistle: Replace const declarations with typedefs
2014-04-13 14:18:13 -04:00
garyscavone
3caee97842 Merge pull request #18 from arielelkin/fix-variable-types-in-Iir
fix variable types in Iir
2014-04-13 14:17:42 -04:00
garyscavone
887baf05f8 Merge pull request #17 from arielelkin/fix-variable-types-in-Granulate
Fix variable types in Granulate
2014-04-13 14:16:33 -04:00
Ariel Elkin
aec65bcb76 iOS: updated readme 2014-04-12 00:15:15 +02:00
Ariel Elkin
db6fc1f0df iOS Lib: move static lib target and rawwaves bundle to Products folder 2014-04-12 00:10:39 +02:00
Ariel Elkin
1a2509ead9 Iir: change variable types from std::vector<StkFloat>::size_type to size_t 2014-04-11 23:50:52 +02:00
Ariel Elkin
7388163b7c Granulate.cpp: change variable types from std::vector<Grain>::size_type to size_t 2014-04-11 23:47:51 +02:00
Ariel Elkin
3d9bb4051b Whistle.cpp: Comment out unused variables 2014-04-11 23:44:46 +02:00
Gary Scavone
92ca28918f Bug fix in FreeVerb; Added <cstring> header in Stk.h (which seemed necessary for MinGW). 2014-04-11 16:03:52 -04:00
Gary Scavone
32a3b551d8 Documentation updates in preparation for 4.5.0 release. 2014-04-11 10:18:38 -04:00
Gary Scavone
a9a654862f A few more RtError updates in documentation and .dsp files. 2014-04-11 09:52:02 -04:00
Gary Scavone
a239b58651 More RtError updates in various project files. 2014-04-11 09:44:49 -04:00
Gary Scavone
caf7d2f2eb Updated to new releases of RtAudio and RtMidi. 2014-04-11 09:29:42 -04:00
Gary Scavone
3ee62e42d0 Date changes in preparation for new release. 2014-04-11 09:10:58 -04:00
garyscavone
afa3069dea Merge pull request #21 from arielelkin/readme_improvements
updated readmes
2014-04-11 08:50:41 -04:00
garyscavone
2c136e82ef Merge pull request #20 from arielelkin/Messager-new-typedef
Messager: add MessagerSourceType typedef
2014-04-07 20:50:53 -04:00
garyscavone
17b45a1dad Merge pull request #16 from arielelkin/explicit-casts-in-FileWrite.cpp
FileWrite.cpp: make explicit casts.
2014-04-07 20:24:15 -04:00
Ariel Elkin
dbecf1f7f0 FileWrite::setMatFile : type of iterator should be size_t 2014-04-07 15:20:37 +01:00
garyscavone
4c8e0dec43 Merge pull request #15 from arielelkin/fix-variable-types-in-TapDelay
Fix variable types in tap delay
2014-04-07 10:07:22 -04:00
garyscavone
914a76cae0 Merge pull request #14 from arielelkin/fix-variable-types-in-LentPitShift
fix variable types in LentPitShift
2014-04-07 10:04:21 -04:00
garyscavone
979c6877c9 Merge pull request #13 from arielelkin/remove-register-keyword
remove register keyword
2014-04-07 10:01:19 -04:00
Ariel Elkin
fff3e0b887 update iOS Readme 2014-04-07 13:49:30 +01:00
Ariel Elkin
a027a515af updated readmes 2014-04-07 13:45:13 +01:00
Ariel Elkin
1f0cad64dd Messager: add MessagerSourceType typedef 2014-04-06 08:55:26 +01:00
Ariel Elkin
3d3ab8b86a Whistle: Replace const declarations with typedefs 2014-04-06 08:50:31 +01:00
Ariel Elkin
e4146d6dae Update TapDelay.cpp 2014-04-06 08:39:31 +01:00
Ariel Elkin
79cdf449b5 fix variable types in Iir 2014-04-06 08:37:04 +01:00
Ariel Elkin
ce076784a4 Fix variable types in Granulate 2014-04-06 08:33:25 +01:00
Ariel Elkin
0f6f1c4194 fix variable types in LentPitShift 2014-04-06 08:26:33 +01:00
Ariel Elkin
b2cefb3b53 TapDelay: fix variable types 2014-04-06 08:24:32 +01:00
Ariel Elkin
1468ad7e12 FileWrite.cpp: make explicit casts. 2014-04-06 08:11:52 +01:00
Ariel Elkin
eade52ff5c remove register keyword 2014-04-05 21:39:57 +01:00
garyscavone
4e90d3ffd2 Merge pull request #11 from arielelkin/ios_lib
iOS-friendly static library
2014-03-30 20:23:20 -04:00
Ariel Elkin
b2c4aa87bb full rename from tempiOSDir to iOS/demo 2014-03-30 23:43:32 +01:00
Ariel Elkin
85ca274a33 Temporary rename of iOS Demo direcotry to tempiOSDir 2014-03-30 23:39:20 +01:00
Ariel Elkin
eccc38a093 removed xccheckout file 2014-03-22 01:50:01 +00:00
Ariel Elkin
3ebdbe6977 update xccheckout file for Xcode 5.1 2014-03-14 18:36:01 +00:00
Ariel Elkin
742cf6a202 remove woebegone changes to base STK class 2014-03-14 18:34:43 +00:00
Ariel Elkin
b7cbce0ced move iOS demo project to iOS folder 2014-03-14 18:07:53 +00:00
Ariel Elkin
b5e24dec52 ensure bundle url is there before making a C string from it 2014-03-14 17:51:41 +00:00
Gary Scavone
8658acabee Merge branch 'master' of https://github.com/thestk/stk 2014-03-12 13:30:49 -04:00
Gary Scavone
0e7077c0f3 ADSR fix for decay/release time calculations; FileRead variable size fixes and argument check. 2014-03-12 13:27:05 -04:00
garyscavone
e2f4193e1a Merge pull request #9 from arielelkin/fix_warnings_in_MidiFileIn.cpp
make casts in MidiFileIn.cpp explicit
2014-03-12 12:50:36 -04:00
garyscavone
f38bcceed7 Merge pull request #10 from fsateler/configure-static-shared
Add configure options to build static or shared libraries
2014-03-12 12:48:13 -04:00
Felipe Sateler
9e2cad425a Add configure options to build static or shared libraries 2014-03-12 11:21:39 -03:00
Ariel Elkin
3e43d5e297 Merge branch 'ios_lib' of github.com:arielelkin/stk into ios_lib 2014-03-12 04:49:25 +01:00
Ariel Elkin
8055f1d040 set raw wave path dynamically if needed 2014-03-12 04:49:11 +01:00
Ariel Elkin
5e145ff682 Update README.md 2014-03-08 18:57:24 +01:00
Ariel Elkin
042dea6ff7 Update README.md 2014-03-08 18:56:08 +01:00
Ariel Elkin
04ba9c694e update readme.md for iOS lib 2014-03-08 18:42:52 +01:00
Ariel Elkin
40fe7dae1d Update README.md 2014-03-08 17:37:37 +01:00
Ariel Elkin
cafad844ad make casts in MidiFileIn.cpp explicit 2014-03-08 17:18:45 +01:00
Ariel Elkin
5749dc1c55 Merge branch 'ios_lib' of github.com:arielelkin/stk into ios_lib
Conflicts:
	STK for iOS/README.md
2014-03-08 17:06:13 +01:00
Ariel Elkin
8284487d4b added all files to iOS static library 2014-03-08 17:05:05 +01:00
Ariel Elkin
193a8ebb2e Update README.md 2014-03-04 02:51:23 +00:00
Ariel Elkin
84cf7c5344 add readme for iOS xcode project 2014-03-04 02:50:15 +00:00
Ariel Elkin
11ff75339d update UI in demo ViewController.mm 2014-03-04 02:33:39 +00:00
Ariel Elkin
96543e1b84 added iOS Demo to demo projects 2014-03-04 02:25:34 +00:00
Ariel Elkin
416c02c83c rename xcode projet to STK.xcodeproj 2014-03-03 20:37:43 +00:00
Ariel Elkin
08af1a08b4 Create rawwwaves bundle 2014-03-03 19:45:05 +00:00
garyscavone
4c6e8aee76 Merge pull request #6 from arielelkin/explicit-casts-in-Fir
make casts in Fir.h explicit
2014-02-28 13:02:09 -05:00
garyscavone
b2fbc4f302 Merge pull request #5 from arielelkin/explicit-cast-in-Stk.h-frames
explicitly cast return value in Stk::frames() to match return type
2014-02-28 13:00:25 -05:00
Ariel Elkin
7aefe7caff make casts in Fir.h explicit 2014-02-27 01:19:34 +00:00
Ariel Elkin
00f822e00c explicitly cast return value in frames() to match return type 2014-02-27 01:08:45 +00:00
Ariel Elkin
c2ae82f200 Created libSTK.a 2014-02-25 00:29:49 +00:00
Ariel Elkin
72786d0b72 Tidied Effects, Instruments, and Filters folders 2014-02-24 23:15:18 +00:00
Ariel Elkin
32f23f9538 created Generators, Instruments, Effects, Filters, and Helpers folders 2014-02-24 22:58:05 +00:00
Ariel Elkin
b0e8953a6f made Generators, Instruments, and FM folders 2014-02-23 23:42:18 +00:00
Ariel Elkin
586eeac02e add STK for iOS project with iOS-relevant files 2014-02-23 21:17:30 +00:00
Gary Scavone
1874c0efa9 Merge branch 'master' of https://github.com/thestk/stk 2014-01-18 15:56:04 -05:00
Gary Scavone
9e6a25d046 FileRead fix for long matlab array names. 2014-01-18 15:51:30 -05:00
garyscavone
8912a5c0af Merge pull request #4 from radarsat1/master
Fix several potential compilation issues on various platforms, fix ElectricGuitar script, fix version number, add McGill logo.
2014-01-18 12:49:51 -08:00
Pino Toscano
b017472cdf Build realtime projects only when requested 2014-01-12 15:10:38 +01:00
Felipe Sateler
ed754183e3 Add install target to Makefile.in 2014-01-12 14:58:32 +01:00
Stephen Sinclair
add961c2f4 Change "-lWsock32" to "-lwsock32" for case-sensitive file names.
This is needed to be able to cross-compile for Windows using MingW32
on Linux.
2014-01-12 14:51:49 +01:00
Gary Scavone
e619de2a65 Merge branch 'master' of https://github.com/thestk/stk 2014-01-09 12:31:25 -05:00
Gary Scavone
5e68ce4eeb Commented-out unused arguments in Stk.cpp 2014-01-09 12:24:38 -05:00
garyscavone
ae9e437ae8 Merge pull request #3 from arielelkin/FileRead_fix
Fixes for FileRead.cpp
2014-01-09 09:22:48 -08:00
garyscavone
4699f8ef59 Merge pull request #2 from arielelkin/master
logic issue in TapDelay::setTapDelays()
2014-01-09 09:12:34 -08:00
Ariel Elkin
80db57e79b FileRead::getMatInfo, fixed if-else block 2014-01-05 20:19:27 +00:00
Ariel Elkin
4078d9309d prevent division by zero in FileRead::getRawInfo 2014-01-03 03:36:19 +01:00
Ariel Elkin
18e210ea94 Update TapDelay.cpp 2013-12-29 00:48:48 +01:00
garyscavone
3369940892 Merge pull request #1 from tmatth/filewrite_fix_warnings
FileWrite: fix warnings
2013-12-21 22:56:24 -08:00
Tristan Matthews
c57c52c17e FileWrite: fix warnings
Namely:
- unused but set
- will break strict aliasing
- unchecked return value (fread)
2013-12-02 21:19:31 -05:00
Stephen Sinclair
1bbd2c003a Change version number to 4.4.4. 2013-10-12 14:11:25 +02:00
Stephen Sinclair
80561731fe Add the McGill logo to the doc directory. 2013-10-12 14:11:24 +02:00
Stephen Sinclair
4f0c39e7eb Rename Eguitar.tcl so that ElectricGuitar works on case-sensitive file systems.
The shell script uses a different case for the TCL script's filename.
2013-10-12 14:11:24 +02:00
Stephen Sinclair
b089236578 Remove a spurious echo in the configure script. 2013-10-12 14:11:24 +02:00
Stephen Sinclair
deaabdd041 Missing header include in Md2Skini. 2013-10-12 14:11:24 +02:00
Stephen Sinclair
caeaa5778c handleError member function must be declared const.
Otherwise it causes a compilation failure when called from const
functions.
2013-10-12 14:11:24 +02:00
Stephen Sinclair
c298839886 Extra bracket causes compilation failure in debug mode. 2013-10-12 14:11:24 +02:00
Stephen Sinclair
57e3fe7dae Fix markdown title and pandoc-style metadata. 2013-10-11 15:52:59 +02:00
Stephen Sinclair
4c8691eb08 Rename README and INSTALL files to give them a .md extension.
So that they are recognized as markdown and displayed correctly on the web.
2013-10-11 15:52:59 +02:00
Stephen Sinclair
3d0db65b1c Convert README and INSTALL instructions to markdown. 2013-10-11 15:52:59 +02:00
Stephen Sinclair
c8b7b67680 Add automake-generated files to .gitignore 2013-10-11 15:52:59 +02:00
Ariel Elkin
72095c0a3d Added .gitignore 2013-10-11 15:52:59 +02:00
Stephen Sinclair
e449ac3583 Create Release and Debug directories if they are not present.
Otherwise, build fails if these directories do not exist.
2013-10-11 15:52:59 +02:00
Stephen Sinclair
a117cd0bb1 Add a check for -lpthread. 2013-10-11 15:52:59 +02:00
Gary Scavone
fc877b87bf Version 4.4.4 2013-09-29 23:22:28 +02:00
Gary Scavone
0aec39260a Version 4.4.3 2013-09-29 23:21:29 +02:00
Gary Scavone
baca57040b Version 4.4.2 2013-09-29 23:15:24 +02:00
320 changed files with 39384 additions and 17038 deletions

188
.gitignore vendored Normal file
View File

@@ -0,0 +1,188 @@
#####
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.DS_Store
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.Trashes
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
*.swp
# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV
*.lock
#
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
#profile
####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
*~.nib
####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
DerivedData/
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
build/
#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"
# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
*.pbxuser
# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
*.mode1v3
# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
*.mode2v3
# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
*.perspectivev3
# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
####
# Xcode 4 - semi-personal settings
#
#
# OPTION 1: ---------------------------------
# throw away ALL personal settings (including custom schemes!
# - unless they are "shared")
#
# NB: this is exclusive with OPTION 2 below
xcuserdata
# OPTION 2: ---------------------------------
# get rid of ALL personal settings, but KEEP SOME OF THEM
# - NB: you must manually uncomment the bits you want to keep
#
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
# or manually install git over the top of the OS X version
# NB: this is exclusive with OPTION 1 above
#
#xcuserdata/**/*
# (requires option 2 above): Personal Schemes
#
#!xcuserdata/**/xcschemes/*
####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# /(root)/
# /(project-name).xcodeproj/
# project.pbxproj
# /project.xcworkspace/
# contents.xcworkspacedata
# /xcuserdata/
# /(your name)/xcuserdatad/
# UserInterfaceState.xcuserstate
# /xcsshareddata/
# /xcschemes/
# (shared scheme name).xcscheme
# /xcuserdata/
# /(your name)/xcuserdatad/
# (private scheme).xcscheme
# xcschememanagement.plist
#
#
####
# Xcode 4 - Deprecated classes
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!
*.moved-aside
####
# Files generated by automake
Makefile
autom4te.cache
config.log
config.status
configure
projects/demo/Makefile
projects/demo/demo
projects/demo/Release
projects/demo/Debug
projects/effects/Makefile
projects/effects/effects
projects/effects/Release
projects/effects/Debug
projects/eguitar/Makefile
projects/eguitar/eguitar
projects/eguitar/Release
projects/eguitar/Debug
projects/examples/Makefile
projects/examples/audioprobe
projects/examples/bethree
projects/examples/controlbee
projects/examples/crtsine
projects/examples/duplex
projects/examples/foursine
projects/examples/grains
projects/examples/inetIn
projects/examples/inetOut
projects/examples/libMakefile
projects/examples/midiprobe
projects/examples/play
projects/examples/playsmf
projects/examples/record
projects/examples/rtsine
projects/examples/sine
projects/examples/sineosc
projects/examples/threebees
projects/examples/Release
projects/examples/Debug
projects/ragamatic/Makefile
projects/ragamatic/ragamat
projects/ragamatic/Release
projects/ragamatic/Debug
src/libstk.a
src/Release
src/Debug
src/Makefile

44
INSTALL
View File

@@ -1,44 +0,0 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
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.
To configure and compile (on Unix systems and MinGW):
1. Unpack the STK distribution (tar -xzf stk-4.x.x.tar.gz).
2. From within the directory containing this file, run configure:
./configure
3. From within each project directory, type "make".
4. To compile a library of objects, type "make" from within the src directory.
Several options can be passed to configure, including:
--disable-realtime = only compile generic non-realtime classes
--enable-debug = enable various debug output
--with-alsa = choose native ALSA API support (default, linux only)
--with-oss = choose native OSS API support (linux only)
--with-jack = choose native JACK server API support (linux and macintosh OS-X)
--with-core = choose OS-X Core Audio API (macintosh OS-X only)
--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):
./configure RAWWAVE_PATH='$(HOME)/rawwaves/'
./configure INCLUDE_PATH='$(HOME)/include/'
The ending "/" is required for the RAWWAVES path. The default behavior will set a relative path that works for the project files included with the distribution (assuming they are not moved). You can also change the RAWWAVE_PATH dynamically via the static Stk::setRawwavePath() function.
If you wish to use a different compiler than that selected by configure, specify that compiler in the command line (ex. to use CC):
./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:
MinGW support is provided in the configure script. In addition, Visual C++ project files are included for each of the example STK projects.

58
INSTALL.md Normal file
View File

@@ -0,0 +1,58 @@
% The Synthesis ToolKit in C++ (STK)
% Perry R. Cook and Gary P. Scavone
% 1995--2014
# The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2014.
The Synthesis ToolKit in C++ can be used in a variety of ways, depending on your particular needs. Some people simply 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.
## Unix systems and MinGW
1. If you downloaded the software from the git repository, first run autoconf,
autoconf
otherwise, if you downloaded the software from the STK source distribution, unpack the tar file,
tar -xzf stk-4.x.x.tar.gz
2. From within the directory containing this file, run configure:
./configure
3. From within each project directory, type `make`.
4. To compile a library of objects, type `make` from within the `src` directory.
Several options can be passed to configure, including:
--disable-realtime = only compile generic non-realtime classes
--enable-debug = enable various debug output
--with-alsa = choose native ALSA API support (default, linux only)
--with-oss = choose native OSS API support (linux only)
--with-jack = choose native JACK server API support (linux and macintosh OS-X)
--with-core = choose OS-X Core Audio API (macintosh OS-X only)
--with-asio = choose ASIO API support (windows only)
--with-ds = choose DirectSound API support (windows only)
--with-wasapi = choose Windows Audio Session API support (windows only)
It is now possible to specify more than one audio and MIDI API where supported. Note, however, that the ALSA library is required in order to compile the RtMidi class in Linux 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/'
The ending "/" is required for the RAWWAVES path. The default behavior will set a relative path that works for the project files included with the distribution (assuming they are not moved). You can also change the RAWWAVE_PATH dynamically via the static Stk::setRawwavePath() function.
If you wish to use a different compiler than that selected by configure, specify that compiler in the command line (ex. to use CC):
./configure CXX=CC
## Windows
MinGW support is provided in the configure script. In addition, Visual C++ 6.0 project files are included for each of the example STK projects, though these may not work with more recent versions of Visual Studio.
##iOS
You can integrate the STK in iOS projects either by using its iOS static library or Cocoapods. See the [iOS README file](iOS/README-iOS.md) for instructions.

27
LICENSE Normal file
View File

@@ -0,0 +1,27 @@
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995--2014 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
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is
asked to send the modifications to the original developer so that they
can be incorporated into the canonical version. This is, however, not
a binding provision of this license.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

41
Makefile.in Normal file
View File

@@ -0,0 +1,41 @@
### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in
RM = /bin/rm
REALTIME = @realtime@
all :
cd src && $(MAKE)
cd projects/demo && $(MAKE) libdemo
ifeq ($(REALTIME),yes)
cd projects/effects && $(MAKE) libeffects
cd projects/ragamatic && $(MAKE) libragamat
cd projects/eguitar && $(MAKE) libeguitar
endif
cd projects/examples && $(MAKE) -f libMakefile
clean :
$(RM) -f *~
cd src && $(MAKE) clean
cd projects/demo && $(MAKE) clean
ifeq ($(REALTIME),yes)
cd projects/effects && $(MAKE) clean
cd projects/ragamatic && $(MAKE) clean
cd projects/eguitar && $(MAKE) clean
endif
cd projects/examples && $(MAKE) clean
distclean: clean
$(RM) -rf config.log config.status autom4te.cache Makefile
cd src && $(MAKE) distclean
cd projects/demo && $(MAKE) distclean
ifeq ($(REALTIME),yes)
cd projects/effects && $(MAKE) distclean
cd projects/ragamatic && $(MAKE) distclean
cd projects/eguitar && $(MAKE) distclean
endif
cd projects/examples && $(MAKE) distclean
install:
$(MAKE) -C src install

View File

@@ -1,21 +1,29 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
# The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995--2014.
This distribution of the Synthesis ToolKit in C++ (STK) contains the following:
include: STK class header files
src: STK class source files
rawwaves: STK audio files (1-channel, 16-bit, big-endian)
doc: STK documentation
projects: example STK projects and programs
* [`include`](include/): STK class header files
* [`src`](src/): STK class source files
* [`rawwaves`](rawwaves): STK audio files (1-channel, 16-bit, big-endian)
* [`doc`](doc): STK documentation
* [`projects`](projects): example STK projects and programs
Please read the Legal and Ethical notes near the bottom of this document.
Please read the [Legal and Ethical notes](#legal-and-ethical) near the bottom of this document and the [License](LICENSE).
For compiling and installing STK, see the INSTALL file in this directory.
For compiling and installing STK, see the [INSTALL.md](INSTALL.md) file in this directory.
##Contents
OVERVIEW:
* [Overview](#overview)
* [System Requirements](#system-requirements)
* [What's New (and not so new)](#whats-new-and-not-so-new)
* [Disclaimer](#disclaimer)
* [Legal and Ethical](#legal-and-ethical)
* [Further Reading](#further-reading)
* [Perry's Notes From the Original Distribution](#perrys-notes-from-the-original-distribution)
# OVERVIEW
The Synthesis ToolKit in C++ (STK) is a set of open source audio
signal processing and algorithmic synthesis classes written in the C++
@@ -23,20 +31,18 @@ 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 10 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
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
@@ -65,7 +71,7 @@ and SKINI (Synthesis ToolKit Instrument Network Interface, a MIDI-like
text message synthesis control format).
SYSTEM REQUIREMENTS:
# SYSTEM REQUIREMENTS
See the individual README's (eg. README-linux) in the /doc directory
for platform specific information and system requirements. In
@@ -75,13 +81,14 @@ example programs. To use the Tcl/Tk GUIs, you will need Tcl/Tk
version 8.0 or higher.
WHAT'S NEW (AND NOT SO NEW):
# WHAT'S NEW (AND NOT SO NEW)
Despite being available in one form or another since 1996, we still
consider STK to be alpha software. We attempt to maintain backward
compatability but changes are sometimes made in an effort to improve
the overall design or performance of the software. Please read the
Release Notes to see what has changed since the last release.
"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
@@ -95,12 +102,12 @@ messages. In most cases, this should eliminate the use of the
Md2Skini program.
Realtime audio input capabilities were added to STK with release 3.0,
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!
though the behavior of such is very hardware dependent. Under Linux
and Macintosh OS-X, 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 generally higher. Performance with the ASIO audio
API on Windoze provides much better performance.
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
@@ -111,10 +118,10 @@ generic C++ compiler.
For those who wish to make a library from the core STK classes, the
configure script generates a Makefile in the src directory that will
accomplish that (Linux, SGI, and Macintosh OS X only).
accomplish that.
DISCLAIMER:
# DISCLAIMER
You probably already guessed this, but just to be sure, we don't
guarantee anything works. :-) It's free ... what do you expect? If
@@ -123,14 +130,14 @@ can also make suggestions, but again, no guarantees. Send email to
the mail list.
LEGAL AND ETHICAL:
# LEGAL AND ETHICAL
This software was designed and created to be made publicly available
for free, primarily for academic purposes, so if you use it, pass it
on with this documentation, and for free.
If you make a million dollars with it, it would be nice if you would
share. If you make compositions with it, put us in the program notes.
share. If you make compositions with it, put us in the program notes.
Some of the concepts are covered by various patents, some known to us
and likely others which are unknown. Many of the ones known to us are
@@ -141,39 +148,8 @@ public domain. To avoid subtle legal issues, we'll not state what's
freely useable here, but we'll try to note within the various classes
where certain things are likely to be protected by patents.
LICENSE:
STK WWW site: http://ccrma.stanford.edu/software/stk/
The Synthesis ToolKit in C++ (STK)
Copyright (c) 1995-2009 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
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
Any person wishing to distribute modifications to the Software is
asked to send the modifications to the original developer so that they
can be incorporated into the canonical version. This is, however, not
a binding provision of this license.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FURTHER READING:
# FURTHER READING
For complete documentation on this ToolKit, the classes, etc., see the
doc directory of the distribution or surf to
@@ -181,7 +157,7 @@ http://ccrma.stanford.edu/software/stk/. Also check the platform
specific README's for specific system requirements.
PERRY'S NOTES FROM THE ORIGINAL DISTRIBUTION:
# PERRY'S NOTES FROM THE ORIGINAL DISTRIBUTION
This whole world was created with no particular hardware in mind.
These examples are intended to be tutorial in nature, as a platform
@@ -204,11 +180,11 @@ The answers lie below.
3) The classic difficulties most people have in trying to implement physical models are:
A) They have trouble understanding the papers, and/or in turning the theory into practice.
A) They have trouble understanding the papers, and/or in turning the theory into practice.
B) The Physical Model instruments are a pain to get to oscillate, and coming up with stable and meaningful parameter values is required to get the models to work at all.
B) The Physical Model instruments are a pain to get to oscillate, and coming up with stable and meaningful parameter values is required to get the models to work at all.
This set of C++ unit generators and instruments might help to diminish the scores of emails I get asking what to do with those block diagrams I put in my papers.
This set of C++ unit generators and instruments might help to diminish the scores of emails I get asking what to do with those block diagrams I put in my papers.
4) I wanted to try some new stuff with modal synthesis, and implement some classic FM patches as well.
@@ -216,6 +192,3 @@ The answers lie below.
6) More rationalizations to follow . . .

2
config/config.guess vendored
View File

@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
timestamp='2001-04-20'
timestamp='2004-02-26'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by

2
config/config.sub vendored
View File

@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
timestamp='2001-04-20'
timestamp='2004-02-26'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software

View File

@@ -1,8 +1,8 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(STK, 4.4, gary@music.mcgill.ca, stk)
AC_INIT(STK, 4.5.0, gary@music.mcgill.ca, stk)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR(src/Stk.cpp)
AC_CONFIG_FILES(src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile)
AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile)
# Fill GXX with something before test.
AC_SUBST( GXX, ["no"] )
@@ -40,18 +40,55 @@ 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)
AC_MSG_CHECKING(whether to build the static library)
AC_ARG_ENABLE(static,
[ --disable-static = do not compile static library ],
build_static=$enableval,
build_static=yes)
AC_SUBST(build_static)
AC_MSG_RESULT($build_static)
AC_MSG_CHECKING(whether to build the shared library)
AC_ARG_ENABLE(shared,
[ --enable-shared = compile the shared library ],
build_shared=$enableval,
build_shared=no)
AC_SUBST(build_shared)
AC_MSG_RESULT($build_shared)
if test x$build_static = xno -a x$build_shared = xno ; then
AC_MSG_ERROR([ both static and shared libraries are disabled], 1)
fi
# Check for math library
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
@@ -72,9 +109,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*)
@@ -92,8 +140,9 @@ if test $realtime = yes; then
# Look for OSS flag
AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
api="$api -D__LINUX_OSS__"
AC_MSG_RESULT(using OSS)], )
api="$api -D__LINUX_OSS__ -D__LINUX_ALSA__"
AC_MSG_RESULT(using OSS)
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))], )
# If no audio api flags specified, use ALSA
if [test "$api" == "";] then
@@ -102,11 +151,7 @@ if test $realtime = yes; then
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
fi
# Look for ALSA library because we need it for RtMidi
AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(STK in Linux requires the ALSA asound library for RtMidi!))
api="$api -D__LINUX_ALSASEQ__"
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(realtime support requires the pthread library!))
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
;;
*-apple*)
@@ -145,7 +190,13 @@ if test $realtime = yes; then
AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
api="$api -D__WINDOWS_DS__"
AC_MSG_RESULT(using DirectSound)
LIBS="-ldsound -lwinmm $LIBS" ], )
LIBS="-ldsound $LIBS" ], )
# Look for WASAPI flag
AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)], [
api="$api -D__WINDOWS_WASAPI__"
AC_MSG_RESULT(using WASAPI)
LIBS="-luuid -lksuser $LIBS" ], )
# If no audio api flags specified, use DirectSound
if [test "$api" == "";] then
@@ -155,7 +206,7 @@ if test $realtime = yes; then
fi
api="$api -D__WINDOWS_MM__"
LIBS="-lole32 -lwinmm -lWsock32 $LIBS"
LIBS="-lole32 -lwinmm -lwsock32 $LIBS"
;;
*)

View File

@@ -1,19 +1,13 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
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.
Realtime MIDI support Linux currently includes the Jack and 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 (unless only using the Jack API). 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,21 +1,16 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
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.5.
The internal Macintosh audio hardware typically supports a sample rate of 44100 Hz only. The default STK sample rate is now 44100 Hz and all current example programs use this rate. However, it is possible to manually override this value in some programs from the command-line. The default sample rate is set in Stk.h. In addition, the RT_BUFFER_SIZE, specified in Stk.h, could be increased (to a higher power of two) for more robust performance.
There is a potential conflict between the STK Delay class and a Delay() function declared in OSUtils.h (which is included via <CoreServices/CoreServices.h>). In general, this conflict can be avoided via the use of a namespace (an explicit Delay::Delay declaration), though this made the Windows Visual C++ compiler barf. If you use STK classes within a project that includes the OSUtils.h file, you will likely need to make changes in STK classes that use the Delay class.
It is necessary to install the OS X developer kit (or the command line tools) in order to compile STK. STK was successfully tested on the latest version of OS X.
Tcl/Tk on OS X:
The tcl/tk interpreter does not ship by default with OS X, but must be downloaded from the internet. The latest Tcl/Tk Aqua distribution (http://www.apple.com/downloads/macosx/unix_open_source/tcltk.html) has been successfully tested on 10.2 and 10.3 systems. The default installation will place a link to the wish interpretor at /usr/bin/wish.
I think that tcl/tk interpreter is now included in the XCode package, since I haven't had to download it for several years now.
It appears that socket support in Tcl/Tk on OS X uses the Nagle algorithm, which produces poor response between changes made in the tcl/tk script and the resulting audio updates. Note that this is only a problem when using a socket connection from a Tcl/Tk script.

View File

@@ -1,7 +0,0 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
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-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
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-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
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 (though these may no longer work with current versions of Visual Studio). 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 supprots 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. Also, the Microsoft folk are up to their old habits of trying to change standards. The .NET compiler will complain about cerr for some reason.
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.
The DirectSound, WASAPI 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 all supported APIs. In order to use the ASIO API, it is necessary to use the preprocessor definition __WINDOWS_ASIO__, as well as include most of 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,42 +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.
WINDOWS 95/98:
PLAY SKINI SCOREFILES IN REALTIME:
demo Clarinet -or -if scores/streetsf.ski
USE TCL/TK GUIs FOR REALTIME CONTROL:
1. Open a DOS console window and start syntmono (eg. demo Clarinet -or -is).
2. Double click on a Tcl/Tk file in the tcl/ subdirectory of the demo directory (eg. Demo.tcl) from the Windows Explorer to start the GUI. Select the "communications" menu item and "Socket" and make the connection.
3. Start moving the sliders to control the instrument.
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.
WINDOWS NT ONLY:
Realtime piping seems to work under WindowsNT in much the same way as on Unix platforms. Thus, it is possible to pipe realtime control data to syntmono under WindowsNT as well. Note, however, that the DirectSoundCapture API does not exist for WindowsNT, so it is necessary to use an ASIO audio driver and the STK ASIO support.
To use the Tcl/Tk GUIs, you will have to install Tcl/Tk.

View File

@@ -1,14 +1,54 @@
The Synthesis ToolKit in C++ (STK)
By Perry R. Cook and Gary P. Scavone, 1995-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
v4.4.1: (3 June 2009)
v4.5.0: (26 April 2014)
- updated versions of RtAudio and RtMidi, with associated renaming of RtError class to either RtAudioError or RtMidiError and addition of WASAPI support in Windows
- added support in FileRead for little-endian AIFC file format
- new iOS project files (thanks to Ariel Elkin)
- bug fix in FreeVerb that could cause crackling for stereo input
- various bug fixes and updates to minimize compiler warnings
- ADSR fix for decay/release time calculations
- various updates to build system
v4.4.4: (24 August 2012)
- new FreeVerb class (thanks to Greg Burlet)
- new Guitar class
- new electric guitar project
- cleaned / revised Shakers class
- updated versions of RtAudio and RtMidi
- bug fix in LentPitShift
- bug fix in Echo constructor
- bug fix in FileWvIn (file size when chunking)
- bug fix in StkFrames copy constructor
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 2011)
- added various header file includes for newer compilers
- new LentPitShift class (thanks to Francois Germain)
- added "addTo" function to Delay class
- updates to RtAudio and RtMidi
- bug fixes in Voicer class (thanks Richard Dobson!)
- bug fixes in Granulate class
- added Makefile.in to compile library and all projects, as well as clean and distclean all
v4.4.1: (3 June 2010)
- added multi-channel/frame tick() virtual function to WvIn and WvOut abstract base classes (required update to RtWvOut class)
- updated configure script to select g++ compiler by default
- in demo.cpp: removed voicer grouping for messages, fixing polyphony when messages are on the same MIDI/SKINI channel
- updates to RtAudio and RtMidi
v4.4: (30 April 2009)
v4.4: (30 April 2010)
- all classes embedded in the "stk" namespace (except RtAudio, RtMidi, and RtError)
- class WaveLoop renamed FileLoop
- significant efficiency improvements via code restructuring and inlining

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.1
PROJECT_NUMBER = 4.5.0
# 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

@@ -37,19 +37,19 @@ STK compiles with realtime support on the following flavors of the Unix operatin
<TR>
<TD>Linux</TD>
<TD>ALSA</TD>
<TD>__LINUX_ALSA__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
<TD>__LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
<TD><TT>asound, pthread</TT></TD>
</TR>
<TR>
<TD>Linux</TD>
<TD>OSS (version 4.0 only, use ALSA for MIDI support)</TD>
<TD>__LINUX_OSS__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
<TD>__LINUX_OSS__, __LINUX_ALSA__, __LITTLE_ENDIAN__</TD>
<TD><TT>asound, pthread</TT></TD>
</TR>
<TR>
<TD>Linux and Macintosh OS-X</TD>
<TD>Jack (audio only, use ALSA for MIDI support)</TD>
<TD>__UNIX_JACK__, __LINUX_ALSASEQ__, __LITTLE_ENDIAN__</TD>
<TD>Jack</TD>
<TD>__UNIX_JACK__, __LITTLE_ENDIAN__</TD>
<TD><TT>asound, pthread, jack</TT></TD>
</TR>
<TR>

View File

@@ -1,14 +1,63 @@
/*! \page download Download, Release Notes, and Bug Fixes
\section down Download Version 4.4.1 (3 June 2009):
\section down Download Version 4.5.0 (26 April 2014):
<UL>
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.4.1.tar.gz">Source distribution</A></LI>
<LI><A HREF="http://ccrma.stanford.edu/software/stk/release/stk-4.5.0.tar.gz">Source distribution</A></LI>
</UL>
\section notes Release Notes:
\subsection v4dot5dot0 Version 4.5.0
<ul>
<li>Updated versions of RtAudio and RtMidi, with associated renaming of RtError class to either RtAudioError or RtMidiError</li>
<li>New iOS project files (thanks to Ariel Elkin)</li>
<li>Bug fix in FreeVerb that could cause crackling for stereo input</li>
<li>Various bug fixes and updates to minimize compiler warnings</li>
<li>ADSR fix for decay/release time calculations</li>
<li>Various updates to build system</li>
</ul>
\subsection v4dot4dot4 Version 4.4.4
<ul>
<li>New FreeVerb class (thanks to Greg Burlet)</li>
<li>New Guitar class</li>
<li>New electric guitar project</li>
<li>Updated versions of RtAudio and RtMidi</li>
<li>Cleaned / revised Shakers class</li>
<li>Bug fix in LentPitShift</li>
<li>Bug fix in Echo constructor</li>
<li>Bug fix in FileWvIn (file size when chunking)</li>
<li>Bug fix in StkFrames copy constructor</li>
</ul>
\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>
<li>Added various header file includes for newer compilers.</li>
<li>Updates to RtAudio and RtMidi.</li>
<li>New LentPitShift class (thanks to Francois Germain).</li>
<li>Bug fixes in Voicer class (thanks Richard Dobson!).</li>
<li>Added Makefile.in to compile library and all projects, as well as clean and distclean.</li>
</ul>
\subsection v4dot4dot1 Version 4.4.1
<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-2009 Perry R. Cook and Gary P. Scavone
Copyright (c) 1995--2014 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-2009 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
<tr><td>&copy;1995--2014 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>

View File

@@ -1,6 +1,6 @@
/*! \page fundamentals STK Fundamentals
The Synthesis ToolKit is implemented in the C++ programming language. STK does not attempt to provide a new programming environment or paradigm but rather provides a set of objects that can be used within a normal C++ programming framework. Therefore, it is expected that users of STK will have some familiarity with C/C++ programming concepts. That said, the STK classes do have some particular idiosyncrasies that we will mention here. Starting with STK version 4.4, all STK classes except RtAudio, RtMidi, and RtError are defined within the stk namespace.
The Synthesis ToolKit is implemented in the C++ programming language. STK does not attempt to provide a new programming environment or paradigm but rather provides a set of objects that can be used within a normal C++ programming framework. Therefore, it is expected that users of STK will have some familiarity with C/C++ programming concepts. That said, the STK classes do have some particular idiosyncrasies that we will mention here. Starting with STK version 4.4, all STK classes except RtAudio and RtMidi are defined within the stk namespace.
\section Signal Computations:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -15,7 +15,7 @@ portable (it's mostly platform-independent C and C++ code), and it's
completely user-extensible (all source included, no unusual libraries,
and no hidden drivers). We like to think that this increases the
chances that our programs will still work in another 5-10 years. In
fact, the ToolKit has been working continuously for nearly 15 years
fact, the ToolKit has been working continuously for nearly 20 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

View File

@@ -18,7 +18,7 @@ Here's a link to a book that includes an chapter on STK.
<H4>What is the <I>Synthesis ToolKit</I>?</H4>
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 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.
The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language. STK was designed to facilitate rapid development of music synthesis and audio processing software, with an emphasis on cross-platform functionality, realtime control, ease of use, and educational example code. The Synthesis ToolKit is extremely portable (it's mostly platform-independent C and C++ code), and it's completely user-extensible (all source included, no unusual libraries, and no hidden drivers). We like to think that this increases the chances that our programs will still work in another 5-10 years. In fact, the ToolKit has been working continuously for nearly 20 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.
The Synthesis ToolKit is free. 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 <A HREF="http://dev.scriptics.com">Tcl/Tk</A> 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 can view your results using one of a large variety of sound/signal analysis tools already available (e.g. <A HREF="http://www-ccrma.stanford.edu/software/snd/">Snd</A>, Cool Edit, Matlab).

View File

@@ -4,26 +4,22 @@
- <A HREF="http://www.music.mcgill.ca/~gary/rtmidi/">The %RtMidi WWW site</A>
- <A HREF="http://momu.stanford.edu/stk/">MoMu-Stk: A lightly modified version of STK that supports the iPhone platform (iPhone, iPad, iPod Touches)</A>
- <A HREF="http://ccrma.stanford.edu/~woony/software/stkx/">StkX: A Cocoa STK Framework for Mac OS X by Woon Seung Yeo</A>
- <A HREF="http://sourceforge.net/projects/mobilestk">Mobile STK: A port of STK for mobile devices by Georg Essl and Michael Rohs</A>
- <A HREF="http://chuck.cs.princeton.edu/">ChucK: Concurrent, On-the-fly Audio Programming Language</A> using STK unit generators
- <A HREF="http://www.music.princeton.edu/paul/stkugens.tar.gz">Paul Lansky's port of STK to SuperCollider</A>
- <A HREF="http://kern.humdrum.net/">Kern Scores: A Library of Electronic Musical Scores</A> (with automatic conversion to SKINI format)
- <A HREF="http://kern.ccarh.org">Kern Scores: A Library of Electronic Musical Scores</A> (with automatic conversion to SKINI format)
- <A HREF="http://stk.sapp.org/midi2skini">MIDI to SKINI file converter</A> by Craig Sapp
- <A HREF="http://stk.sapp.org/kern2skini">Kern Score to SKINI file converter</A> by Craig Sapp
- <A HREF="http://www.artassault.org/software/software.html">Calico - A Polyphonic Score File Parser for STK</A> by Greg Kellum
- <A HREF="http://extra.humdrum.org/example/kern2skini/">Kern Score to SKINI file converter</A> by Craig Sapp
- <A HREF="http://www.music.columbia.edu/PeRColate/">PeRColate: A Port of STK for Max/MSP</A>
- <A HREF="http://mathmorphs.swiki.net/32/">A Partial Port of STK to Squeak</A>
- <a href="http://airy.andre.online.fr/AU/index.html">AUStk: a demo of integration of STK instruments into an AudioUnit</a> by Airy Andre
*/

View File

@@ -23,11 +23,10 @@ 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>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
@@ -37,15 +38,17 @@ This release of STK comes with four separate "project" directories:
<LI> The <I><B>ragamatic</B></I> project is just cool. Fire it up and be enlightened.<P></LI>
<LI> The <I><B>eguitar</B></I> project demonstrates how to make an electric guitar with feedback and distortion.<P></LI>
<LI> The <I><B>examples</B></I> project contains several simple programs that demonstrate audio input/output, including the audio internet streaming classes, as well as most of the tutorial programs.</LI>
</OL>
\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, ASIO or WASAPI 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. For WASAPI support, use the <TT>__WINDOWS_WASAPI__</TT> preprocessor definition. 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). Fairly old Visual C++ project files are provided in each project directory, though they may not work on newer versions of MSVS. 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>
@@ -55,6 +58,8 @@ Several options can be supplied to the <TT>configure</TT> script to customize th
<LI><TT>--with-oss</TT> to choose native OSS audio API support (linux only, no native OSS MIDI support)</LI>
<LI><TT>--with-jack</TT> to choose native JACK API support (linux and Macintosh OS-X)</LI>
<LI><TT>--with-core</TT> to choose Core Audio API support (Macintosh OS-X)</LI>
<LI><TT>--with-asio</TT> to choose ASIO Audio API support (Windows)</LI>
<LI><TT>--with-ds</TT> to choose Windows Direct Sound Audio API support (Windows)</LI>
</UL>
<P>
Note that it is possible to specify as many of the "--with-" options as desired to compile multi-API support. In addition, it is possible to specify the location of the STK rawwaves and the STK include path as follows:
@@ -75,6 +80,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:
@@ -83,7 +91,6 @@ All STK programs in this distribution take input control data in the form of <A
<OL>
<LI>Redirect or pipe SKINI scorefiles to an executable.</LI>
<LI>Pipe realtime SKINI input messages to an executable (not possible under Windows95/98).</LI>
<LI>Socket realtime SKINI input messages to an executable.</LI>
<LI>Acquire realtime MIDI messages from a MIDI port on your computer.</LI>
</OL>
@@ -154,12 +161,11 @@ where instruments include those described above and flags can be any or all of:
<LI><I>-om \<file name\></I> for MAT-file output,</LI>
<LI><I>-if \<file name\></I> for a SKINI formatted control file,</LI>
<LI><I>-ip</I> for realtime SKINI control input via piping,</LI>
<LI><I>-is \<port\></I> for realtime SKINI control input via socketing (with an optional port number),</LI>
<LI><I>-im \<port\></I> for MIDI control input (with optional port, -1 = virtual port where possible),</LI>
<LI><I>-s RATE</I> to specify a sample rate,</LI>
<LI><I>-n NUMBER</I> to specify multivoice polyphony</LI>
</UL>
The <i>-ip</i> and <i>-is</i> flags must be used when piping or socketing realtime SKINI control data to an STK program. The <i>-im</i> flag must be used to read MIDI control input from your MIDI port. Note that you can use all three input types simultaneously.
The <i>-ip</i> flag must be used when piping realtime SKINI control data to an STK program. The <i>-im</i> flag must be used to read MIDI control input from your MIDI port. Note that you can use both input types simultaneously.
Assuming a successful compilation of the <I><B>demo</B></I> program, typing:
@@ -178,16 +184,6 @@ There are a number of <A HREF="http://dev.scriptics.com">Tcl/Tk</A> GUIs supplie
wish < tcl/Physical.tcl | demo Clarinet -or -ip
\endcode
On WindowsXX and Unix platforms, the following operations are necessary to establish a socket connection between the Tcl/Tk GUI and the STK program:
<OL>
<LI>Open a DOS shell and start the STK program with the <I>-is</I> flag (ex. <I><B>demo Clarinet -or -is</B></I>).</LI>
<LI>Open the Tcl/Tk GUI (e.g. tcl/Physical.tcl) by double-clicking on it, or type <TT>wish < tcl/Physical.tcl</TT> in another DOS shell.</LI>
<LI>Establish the socket connection by selecting <I>Socket</I> under the Communications menu item in the Tcl/Tk GUI.</LI>
</OL>
Note that it is possible to specify a hostname when establishing the socket connection from the socket client. Thus, the STK socket server program and the Tcl/Tk GUI need not necessarily reside on the same computer.
\section midi Realtime MIDI Control Input:
On all supported realtime platforms, you can direct realtime MIDI input to the STK Clarinet by typing:

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-2009.
By Perry R. Cook and Gary P. Scavone, 1995--2014.
STK Classes - See the HTML documentation in the html directory for complete information.
@@ -19,20 +19,22 @@ 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
|
|- Effect - (Echo, Chorus, PitShift, PRCRev, JCRev, NRev)
|- Effect - (Echo, Chorus, PitShift, LentPitShift, PRCRev, JCRev, NRev, FreeVerb)
|
|- Voicer, Message, Skini, MidiFileIn, Phonemes, Sphere, Vector3D
|
|- Messager
|
|- Twang, Guitar
|
| .- FM - (HevyMetl, PercFlut, Rhodey, Wurley, TubeBell, BeeThree, FMVoices)
| |
| |- Modal - ModalBar
@@ -43,7 +45,7 @@ Stk -| UdpSocket
| |
| |- Resonate
| |
| |- PluckedTwo - Mandolin
| |- Mandolin
.- Instrmnt -|
|- Drummer
|
@@ -86,8 +88,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
@@ -117,45 +117,48 @@ Each class is listed either with some of the unit generators it uses,
or in terms of the algorithm it implements. All inherit from Instrmnt,
which inherits from Stk.
Simple.cpp Simple Instrument Pulse oscillator + resonant filtered noise
Plucked.cpp Basic Plucked String DelayA, OneZero, OnePole, Noise
StifKarp.cpp Plucked String with Stiffness DelayA, DelayL, OneZero, BiQuad, Noise
PluckTwo.cpp Not So Basic Pluck DelayL, DlineA, OneZero
Mandolin.cpp Commuted Mandolin <<flavor of PluckTwo>>
Bowed.cpp So So Bowed String DelayL, BowTabl, OnePole, BiQuad, WaveLoop, ADSR
Brass.cpp Not So Bad Brass Instrument DelayA, BiQuad, PoleZero, ADSR, WaveLoop
Clarinet.cpp Pretty Good Clarinet DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
BlowHole.cpp Clarinet w/ Tone & Vent Holes DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop, PoleZero
Saxofony.cpp A Faux Saxophone DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
Flute.cpp Pretty Good Flute JetTabl, DelayL, OnePole, PoleZero, Noise, ADSR, WaveLoop
BlowBotl.cpp Blown Bottle JetTabl, BiQuad, PoleZero, Noise, ADSR, WaveLoop
BandedWG.cpp Banded Waveguide Meta-Object Delay, BowTabl, ADSR, BiQuad
Modal.cpp N Resonances Envelope, WaveLoop, BiQuad, OnePole
ModalBar.cpp Various presets 4 Resonance Models
FM.cpp N Operator FM Master ADSR, WaveLoop, TwoZero
HevyMetl.cpp Distorted FM Synthesizer 3 Cascade with FB Modulator
PercFlut.cpp Percussive Flute 3 Cascade Operators
Rhodey.cpp Rhodes-Like Electric Piano 2 Parallel Simple FMs
Wurley.cpp Wurlitzer Electric Piano 2 Parallel Simple FMs
TubeBell.cpp Classic FM Bell 2 Parallel Simple FMs
FMVoices.cpp 3 Formant FM Voice 3 Carriers Share 1 Modulator
VoicForm.cpp 4 Formant Voice Synthesis FormSwep, SingWave, OnePole, OneZero, Envelope, Noise
BeeThree.cpp Cheezy Additive Organ 4 Oscillators Additive
Sampler.cpp Sampling Synthesizer 5 each ADSR, WvIn, WaveLoop, OnePole
Moog.cpp Swept Filter Sampler with Swept Filter
Resonate.cpp Filtered Noise ADSR, BiQuad, Noise
Drummer.cpp Drum Synthesizer Bunch of WvIns, and OnePole
Shakers.cpp PhISM statistical model for shakers and real-world sound effects
Mesh2D.cpp Two-dimensional, rectilinear digital waveguide mesh.
Whistle.cpp Hybrid physical/spectral model of a police whistle.
Simple.cpp Simple Instrument Pulse oscillator + resonant filtered noise
Plucked.cpp Basic Plucked String DelayA, OneZero, OnePole, Noise
Twang.cpp Not So Basic Pluck DelayL, DlineA, Fir, allows commuted synthesis
Mandolin.cpp Commuted Mandolin 2 Twangs
Guitar.cpp N-String Guitar N Twangs, bridge coupling, allows feedback and body filter
StifKarp.cpp Plucked String with Stiffness DelayA, DelayL, OneZero, BiQuad, Noise
Bowed.cpp So So Bowed String DelayL, BowTabl, OnePole, BiQuad, WaveLoop, ADSR
Brass.cpp Not So Bad Brass Instrument DelayA, BiQuad, PoleZero, ADSR, WaveLoop
Clarinet.cpp Pretty Good Clarinet DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
BlowHole.cpp Clarinet w/ Tone & Vent Holes DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop, PoleZero
Saxofony.cpp A Faux Saxophone DelayL, ReedTabl, OneZero, Envelope, Noise, WaveLoop
Flute.cpp Pretty Good Flute JetTabl, DelayL, OnePole, PoleZero, Noise, ADSR, WaveLoop
BlowBotl.cpp Blown Bottle JetTabl, BiQuad, PoleZero, Noise, ADSR, WaveLoop
BandedWG.cpp Banded Waveguide Meta-Object Delay, BowTabl, ADSR, BiQuad
Modal.cpp N Resonances Envelope, WaveLoop, BiQuad, OnePole
ModalBar.cpp Various presets 4 Resonance Models
FM.cpp N Operator FM Master ADSR, WaveLoop, TwoZero
HevyMetl.cpp Distorted FM Synthesizer 3 Cascade with FB Modulator
PercFlut.cpp Percussive Flute 3 Cascade Operators
Rhodey.cpp Rhodes-Like Electric Piano 2 Parallel Simple FMs
Wurley.cpp Wurlitzer Electric Piano 2 Parallel Simple FMs
TubeBell.cpp Classic FM Bell 2 Parallel Simple FMs
FMVoices.cpp 3 Formant FM Voice 3 Carriers Share 1 Modulator
VoicForm.cpp 4 Formant Voice Synthesis FormSwep, SingWave, OnePole, OneZero, Envelope, Noise
BeeThree.cpp Cheezy Additive Organ 4 Oscillators Additive
Sampler.cpp Sampling Synthesizer 5 each ADSR, WvIn, WaveLoop, OnePole
Moog.cpp Swept Filter Sampler with Swept Filter
Resonate.cpp Filtered Noise ADSR, BiQuad, Noise
Drummer.cpp Drum Synthesizer Bunch of WvIns, and OnePole
Shakers.cpp PhISM statistical model for shakers and real-world sound effects
Mesh2D.cpp Two-dimensional, rectilinear digital waveguide mesh.
Whistle.cpp Hybrid physical/spectral model of a police whistle.
Effect.h Effects Processor Base Class
JCRev.cpp Chowning Reverberator 3 series allpass units, 4 parallel combs, 2 stereo delays
NRev.cpp Another famous CCRMA Reverb 8 allpass, 6 parallel comb filters
PRCRev.cpp Dirt Cheap Reverb by Cook 2 allpass, 2 comb filters
Flanger.cpp Flanger Effects Processor DelayL, WaveLoop
Chorus.cpp Chorus Effects Processor DelayL, WaveLoop
PitShift.cpp Cheap Pitch Shifter DelayL
Effect.h Effects Processor Base Class
JCRev.cpp Chowning Reverberator 3 series allpass units, 4 parallel combs, 2 stereo delays
NRev.cpp Another famous CCRMA Reverb 8 allpass, 6 parallel comb filters
PRCRev.cpp Dirt Cheap Reverb by Cook 2 allpass, 2 comb filters
FreeVerb.cpp Jezar at Dreampoint's FreeVerb 4 allpass, 8 lowpass comb filters
Flanger.cpp Flanger Effects Processor DelayL, WaveLoop
Chorus.cpp Chorus Effects Processor DelayL, WaveLoop
PitShift.cpp Cheap Pitch Shifter DelayL
LentPitShift.cpp Pitch Shifter based Lent Algorithm
*********** OTHER SUPPORT CLASSES AND FILES **************

72
iOS/README-iOS.md Normal file
View File

@@ -0,0 +1,72 @@
##Setup
1. Clone or [download][download_link] the STK into your project's directory.
1. Open the **STK for iOS** folder, and drag and drop **STK.xcodeproj** into your Xcode project.
1. Open your project's settings, open the *Build Phases* tab. In the *Link Binary with Libraries* section, add **libSTK.a**.
![][linking_libSTK_screenshot]
1. In your project's settings, open the *Build Settings* tab. In the *Search Paths* section, double click on the field to the right of *Header Search Paths*, and add the path to the STK's **include** directory relative to your Xcode project's directory.
![][header_search_paths_screenshot]
##Usage
1. Import the STK classes in the source files you require.
* E.g. `#import "SineWave.h"`
1. Change the extension of Objective-C files that import STK files to **.mm**.
* E.g. **ViewController.m** —> **ViewController.mm**
You can also look at the [iOS Demo project](..projects/demo/iOS%20Demo) for a sample usage.
##Troubleshooting
###'FileName.h' file not found
If you get this error when `#import`ing an STK header, you have added the wrong header search path for the STK in your project's settings (see Step 4 in Setup)
The STK's header search path you need to add is the path to the STK's **include** directory relative to your project's directory (as if you were `cd`ing into it). For example, it is `stk/include/` if the stk directory is inside your project's directory, but it is `../stk/include/` if both share the same directory.
If this problem doesn't go away:
1. Delete **STK.xcodeproj** from your Xcode project
1. Move the STK directory within your project's directory.
1. Follow step 1 from **Setup**, add `stk/include` to the *Header Search Paths*.
###FileRead::open: could not open or find file (../../rawwaves/filename.raw)!
If you use a class that makes use of raw waves (such as `Mandolin`, `Wurley`, or `Rhodey`) you need to copy the STK's raw wave files into your bundle. You'll know you need to if you get this runtime error:
`FileRead::open: could not open or find file (../../rawwaves/filename.raw)!`
1. Open your project's settings, open the *Build Phases* tab.
1. In the *Copy Bundle Resources*, drag and drop **rawwaves.bundle** (it's located in **STK.xcodeproj**'s **Helpers** folder).
1. Then add this code before using a class that needs the raw waves:
```objective-c
NSBundle *rawwaveBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"rawwaves" withExtension:@"bundle"]];
stk::Stk::setRawwavePath([[rawwaveBundle resourcePath] UTF8String]);
```
###rawwaves.bundle: No such file or directory
This means that **rawwaves.bundle** hasn't been copied to the build folder, so you'll need to do it manually:
Select the rawwaves scheme:
![][rawwaves_scheme_screenshot]
Build it (⌘+B) then build your project's main scheme.
###Apple Mach-O Linker Error
This means that **STKLib.a** isn't being linked to your binary. Follow step 2 above in [Setup](#setup).
[download_link]: https://github.com/thestk/stk/archive/master.zip
[linking_libSTK_screenshot]: http://i.imgur.com/cLbGrtq.png
[header_search_paths_screenshot]: http://i.imgur.com/iBTC06h.png
[rawwaves_scheme_screenshot]: http://i.imgur.com/PKd7epf.png

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:STK for iOS.xcodeproj">
</FileRef>
</Workspace>

10
iOS/demo/README.MD Normal file
View File

@@ -0,0 +1,10 @@
##iOS Demo Xcode project
This project briefly shows how to manually integrate the STK static library into an Xcode project. See the **README** file in the STK's `iOS` directory for precise instructions.
Currently, this project does not output sound, it only shows how to generate audio samples from the STK classes within an iOS project, and how to control STK objects via UI controls.
Note the following:
* ViewController needs to be renamed with the **.mm** extension as it's importing STK files, which are C++.
* The header search paths in the *Build Settings* of **iOS Demo.xcodeproj** point to `../../include/` because the STK's `include` directory is two directories up relative to it.

View File

@@ -0,0 +1,524 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
B02FD53618C520D60009ECA9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD53518C520D60009ECA9 /* Foundation.framework */; };
B02FD53818C520D60009ECA9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD53718C520D60009ECA9 /* CoreGraphics.framework */; };
B02FD53A18C520D60009ECA9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD53918C520D60009ECA9 /* UIKit.framework */; };
B02FD54018C520D60009ECA9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B02FD53E18C520D60009ECA9 /* InfoPlist.strings */; };
B02FD54218C520D60009ECA9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B02FD54118C520D60009ECA9 /* main.m */; };
B02FD54618C520D60009ECA9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B02FD54518C520D60009ECA9 /* AppDelegate.m */; };
B02FD54818C520D60009ECA9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B02FD54718C520D60009ECA9 /* Images.xcassets */; };
B02FD54F18C520D70009ECA9 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD54E18C520D70009ECA9 /* XCTest.framework */; };
B02FD55018C520D70009ECA9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD53518C520D60009ECA9 /* Foundation.framework */; };
B02FD55118C520D70009ECA9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B02FD53918C520D60009ECA9 /* UIKit.framework */; };
B02FD55918C520D70009ECA9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B02FD55718C520D70009ECA9 /* InfoPlist.strings */; };
B02FD55B18C520D70009ECA9 /* iOS_DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B02FD55A18C520D70009ECA9 /* iOS_DemoTests.m */; };
B02FD57018C521560009ECA9 /* ViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = B02FD56F18C521560009ECA9 /* ViewController.mm */; };
B0779A8718D376F5004DA9B7 /* libSTK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B0779A8418D376A6004DA9B7 /* libSTK.a */; };
B0779A8B18D37C13004DA9B7 /* rawwaves.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B0779A8618D376A6004DA9B7 /* rawwaves.bundle */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
B02FD55218C520D70009ECA9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B02FD52A18C520D60009ECA9 /* Project object */;
proxyType = 1;
remoteGlobalIDString = B02FD53118C520D60009ECA9;
remoteInfo = "iOS Demo";
};
B0779A8318D376A6004DA9B7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B0AC5BEE18CB31DE00D860C0;
remoteInfo = STK;
};
B0779A8518D376A6004DA9B7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = B0EC33B718CB73A70005787B;
remoteInfo = rawwaves;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
B02FD53218C520D60009ECA9 /* iOS Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
B02FD53518C520D60009ECA9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
B02FD53718C520D60009ECA9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
B02FD53918C520D60009ECA9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
B02FD53D18C520D60009ECA9 /* iOS Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iOS Demo-Info.plist"; sourceTree = "<group>"; };
B02FD53F18C520D60009ECA9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
B02FD54118C520D60009ECA9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B02FD54318C520D60009ECA9 /* iOS Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iOS Demo-Prefix.pch"; sourceTree = "<group>"; };
B02FD54418C520D60009ECA9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
B02FD54518C520D60009ECA9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
B02FD54718C520D60009ECA9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
B02FD54D18C520D70009ECA9 /* iOS DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "iOS DemoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
B02FD54E18C520D70009ECA9 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
B02FD55618C520D70009ECA9 /* iOS DemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iOS DemoTests-Info.plist"; sourceTree = "<group>"; };
B02FD55818C520D70009ECA9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
B02FD55A18C520D70009ECA9 /* iOS_DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iOS_DemoTests.m; sourceTree = "<group>"; };
B02FD56E18C521560009ECA9 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
B02FD56F18C521560009ECA9 /* ViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewController.mm; sourceTree = "<group>"; };
B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = STK.xcodeproj; path = ../STK.xcodeproj; sourceTree = "<group>"; };
B0779A8918D37977004DA9B7 /* README.MD */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.MD; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
B02FD52F18C520D60009ECA9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B0779A8718D376F5004DA9B7 /* libSTK.a in Frameworks */,
B02FD53818C520D60009ECA9 /* CoreGraphics.framework in Frameworks */,
B02FD53A18C520D60009ECA9 /* UIKit.framework in Frameworks */,
B02FD53618C520D60009ECA9 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B02FD54A18C520D70009ECA9 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B02FD54F18C520D70009ECA9 /* XCTest.framework in Frameworks */,
B02FD55118C520D70009ECA9 /* UIKit.framework in Frameworks */,
B02FD55018C520D70009ECA9 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
B02FD52918C520D60009ECA9 = {
isa = PBXGroup;
children = (
B0779A8918D37977004DA9B7 /* README.MD */,
B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */,
B02FD53B18C520D60009ECA9 /* iOS Demo */,
B02FD55418C520D70009ECA9 /* iOS DemoTests */,
B02FD53418C520D60009ECA9 /* Frameworks */,
B02FD53318C520D60009ECA9 /* Products */,
);
sourceTree = "<group>";
};
B02FD53318C520D60009ECA9 /* Products */ = {
isa = PBXGroup;
children = (
B02FD53218C520D60009ECA9 /* iOS Demo.app */,
B02FD54D18C520D70009ECA9 /* iOS DemoTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
B02FD53418C520D60009ECA9 /* Frameworks */ = {
isa = PBXGroup;
children = (
B02FD53518C520D60009ECA9 /* Foundation.framework */,
B02FD53718C520D60009ECA9 /* CoreGraphics.framework */,
B02FD53918C520D60009ECA9 /* UIKit.framework */,
B02FD54E18C520D70009ECA9 /* XCTest.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
B02FD53B18C520D60009ECA9 /* iOS Demo */ = {
isa = PBXGroup;
children = (
B02FD54418C520D60009ECA9 /* AppDelegate.h */,
B02FD54518C520D60009ECA9 /* AppDelegate.m */,
B02FD56E18C521560009ECA9 /* ViewController.h */,
B02FD56F18C521560009ECA9 /* ViewController.mm */,
B02FD54718C520D60009ECA9 /* Images.xcassets */,
B02FD53C18C520D60009ECA9 /* Supporting Files */,
);
path = "iOS Demo";
sourceTree = "<group>";
};
B02FD53C18C520D60009ECA9 /* Supporting Files */ = {
isa = PBXGroup;
children = (
B02FD53D18C520D60009ECA9 /* iOS Demo-Info.plist */,
B02FD53E18C520D60009ECA9 /* InfoPlist.strings */,
B02FD54118C520D60009ECA9 /* main.m */,
B02FD54318C520D60009ECA9 /* iOS Demo-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
B02FD55418C520D70009ECA9 /* iOS DemoTests */ = {
isa = PBXGroup;
children = (
B02FD55A18C520D70009ECA9 /* iOS_DemoTests.m */,
B02FD55518C520D70009ECA9 /* Supporting Files */,
);
path = "iOS DemoTests";
sourceTree = "<group>";
};
B02FD55518C520D70009ECA9 /* Supporting Files */ = {
isa = PBXGroup;
children = (
B02FD55618C520D70009ECA9 /* iOS DemoTests-Info.plist */,
B02FD55718C520D70009ECA9 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
B0779A7F18D376A5004DA9B7 /* Products */ = {
isa = PBXGroup;
children = (
B0779A8418D376A6004DA9B7 /* libSTK.a */,
B0779A8618D376A6004DA9B7 /* rawwaves.bundle */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
B02FD53118C520D60009ECA9 /* iOS Demo */ = {
isa = PBXNativeTarget;
buildConfigurationList = B02FD55E18C520D70009ECA9 /* Build configuration list for PBXNativeTarget "iOS Demo" */;
buildPhases = (
B02FD52E18C520D60009ECA9 /* Sources */,
B02FD52F18C520D60009ECA9 /* Frameworks */,
B02FD53018C520D60009ECA9 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "iOS Demo";
productName = "iOS Demo";
productReference = B02FD53218C520D60009ECA9 /* iOS Demo.app */;
productType = "com.apple.product-type.application";
};
B02FD54C18C520D70009ECA9 /* iOS DemoTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = B02FD56118C520D70009ECA9 /* Build configuration list for PBXNativeTarget "iOS DemoTests" */;
buildPhases = (
B02FD54918C520D70009ECA9 /* Sources */,
B02FD54A18C520D70009ECA9 /* Frameworks */,
B02FD54B18C520D70009ECA9 /* Resources */,
);
buildRules = (
);
dependencies = (
B02FD55318C520D70009ECA9 /* PBXTargetDependency */,
);
name = "iOS DemoTests";
productName = "iOS DemoTests";
productReference = B02FD54D18C520D70009ECA9 /* iOS DemoTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
B02FD52A18C520D60009ECA9 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = "Ariel Elkin";
TargetAttributes = {
B02FD54C18C520D70009ECA9 = {
TestTargetID = B02FD53118C520D60009ECA9;
};
};
};
buildConfigurationList = B02FD52D18C520D60009ECA9 /* Build configuration list for PBXProject "iOS Demo" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = B02FD52918C520D60009ECA9;
productRefGroup = B02FD53318C520D60009ECA9 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = B0779A7F18D376A5004DA9B7 /* Products */;
ProjectRef = B0779A7E18D376A5004DA9B7 /* STK.xcodeproj */;
},
);
projectRoot = "";
targets = (
B02FD53118C520D60009ECA9 /* iOS Demo */,
B02FD54C18C520D70009ECA9 /* iOS DemoTests */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
B0779A8418D376A6004DA9B7 /* libSTK.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libSTK.a;
remoteRef = B0779A8318D376A6004DA9B7 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B0779A8618D376A6004DA9B7 /* rawwaves.bundle */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = rawwaves.bundle;
remoteRef = B0779A8518D376A6004DA9B7 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
B02FD53018C520D60009ECA9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B0779A8B18D37C13004DA9B7 /* rawwaves.bundle in Resources */,
B02FD54018C520D60009ECA9 /* InfoPlist.strings in Resources */,
B02FD54818C520D60009ECA9 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B02FD54B18C520D70009ECA9 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B02FD55918C520D70009ECA9 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
B02FD52E18C520D60009ECA9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B02FD57018C521560009ECA9 /* ViewController.mm in Sources */,
B02FD54618C520D60009ECA9 /* AppDelegate.m in Sources */,
B02FD54218C520D60009ECA9 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
B02FD54918C520D70009ECA9 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B02FD55B18C520D70009ECA9 /* iOS_DemoTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
B02FD55318C520D70009ECA9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = B02FD53118C520D60009ECA9 /* iOS Demo */;
targetProxy = B02FD55218C520D70009ECA9 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
B02FD53E18C520D60009ECA9 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
B02FD53F18C520D60009ECA9 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
B02FD55718C520D70009ECA9 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
B02FD55818C520D70009ECA9 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
B02FD55C18C520D70009ECA9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
B02FD55D18C520D70009ECA9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
B02FD55F18C520D70009ECA9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iOS Demo/iOS Demo-Prefix.pch";
HEADER_SEARCH_PATHS = (
../../include/,
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
INFOPLIST_FILE = "iOS Demo/iOS Demo-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
B02FD56018C520D70009ECA9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iOS Demo/iOS Demo-Prefix.pch";
HEADER_SEARCH_PATHS = (
../../include/,
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
INFOPLIST_FILE = "iOS Demo/iOS Demo-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
B02FD56218C520D70009ECA9 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iOS Demo.app/iOS Demo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iOS Demo/iOS Demo-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "iOS DemoTests/iOS DemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
B02FD56318C520D70009ECA9 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iOS Demo.app/iOS Demo";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "iOS Demo/iOS Demo-Prefix.pch";
INFOPLIST_FILE = "iOS DemoTests/iOS DemoTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
B02FD52D18C520D60009ECA9 /* Build configuration list for PBXProject "iOS Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B02FD55C18C520D70009ECA9 /* Debug */,
B02FD55D18C520D70009ECA9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B02FD55E18C520D70009ECA9 /* Build configuration list for PBXNativeTarget "iOS Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B02FD55F18C520D70009ECA9 /* Debug */,
B02FD56018C520D70009ECA9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
B02FD56118C520D70009ECA9 /* Build configuration list for PBXNativeTarget "iOS DemoTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
B02FD56218C520D70009ECA9 /* Debug */,
B02FD56318C520D70009ECA9 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = B02FD52A18C520D60009ECA9 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:iOS Demo.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>4E1BA790-84C0-4F40-AECE-98269B537CE6</string>
<key>IDESourceControlProjectName</key>
<string>iOS Demo</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>CB047168-D1C4-40BC-85A3-6EB0A20AD217</key>
<string>ssh://github.com/arielelkin/stk.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>iOS/Demo/iOS Demo.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>CB047168-D1C4-40BC-85A3-6EB0A20AD217</key>
<string>../../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/arielelkin/stk.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>CB047168-D1C4-40BC-85A3-6EB0A20AD217</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>CB047168-D1C4-40BC-85A3-6EB0A20AD217</string>
<key>IDESourceControlWCCName</key>
<string>stk</string>
</dict>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,14 @@
//
// AppDelegate.h
// iOS Demo
//
// Created by Ariel Elkin on 03/03/2014.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

View File

@@ -0,0 +1,25 @@
//
// AppDelegate.m
// iOS Demo
//
// Created by Ariel Elkin on 03/03/2014.
//
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil];
[self.window setRootViewController:vc];
[self.window makeKeyAndVisible];
return YES;
}
@end

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,12 @@
//
// ViewController.h
// iOS Demo
//
// Created by Ariel Elkin on 03/03/2014.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end

View File

@@ -0,0 +1,102 @@
//
// ViewController.m
// iOS Demo
//
// Created by Ariel Elkin on 03/03/2014.
//
#import "ViewController.h"
#import "SineWave.h"
#import "Brass.h"
#import "Mandolin.h"
@implementation ViewController {
stk::SineWave *sineWave;
stk::Brass *brass;
}
- (void)loadView {
self.view = [UIView new];
[self.view setBackgroundColor:[UIColor whiteColor]];
[self setupUI];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
NSUInteger samplesToGenerate = 1000;
//Test SineWave:
sineWave = new stk::SineWave();
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
float sample = sineWave->tick();
NSLog(@"SineWave sample: %f", sample);
}
//Test Brass:
brass = new stk::Brass();
brass->noteOn(400, 1);
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
float sample = brass->tick();
NSLog(@"Brass sample: %f", sample);
}
//Test Mandolin:
stk::Mandolin *mandolin = new stk::Mandolin(400);
mandolin->pluck(1);
for (NSUInteger i = 0; i < samplesToGenerate; i ++) {
float sample = mandolin->tick();
NSLog(@"Mandolin sample: %f", sample);
}
#pragma mark TODO - Audio playback
}
- (void)sineSliderMoved:(UISlider *)slider {
sineWave->setFrequency(slider.value);
NSLog(@"Setting SineWave frequency to %.2f", slider.value);
}
- (void)brassSliderMoved:(UISlider *)slider {
brass->setFrequency(slider.value);
NSLog(@"Setting Brass frequency to %.2f", slider.value);
}
- (void)setupUI {
//Add slider to control sine wave frequency:
UISlider *sineSlider = [[UISlider alloc] init];
[sineSlider addTarget:self action:@selector(sineSliderMoved:) forControlEvents:UIControlEventValueChanged];
[sineSlider setMinimumValue:0];
[sineSlider setMaximumValue:800];
[sineSlider setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:sineSlider];
NSDictionary *metrics = @{@"sliderWidth": @200};
NSArray *sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-40-[sineSlider(sliderWidth)]" options:0 metrics:metrics views:@{@"sineSlider": sineSlider}];
[self.view addConstraints:sliderConstraints];
//Add slider to control brass's frequency:
UISlider *brassSlider = [[UISlider alloc] init];
[brassSlider addTarget:self action:@selector(brassSliderMoved:) forControlEvents:UIControlEventValueChanged];
[brassSlider setMinimumValue:0];
[brassSlider setMaximumValue:800];
[brassSlider setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.view addSubview:brassSlider];
sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-40-[brassSlider(sliderWidth)]" options:0 metrics:metrics views:@{@"brassSlider": brassSlider}];
[self.view addConstraints:sliderConstraints];
sliderConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-40-[sineSlider]-[brassSlider]" options:0 metrics:nil views:@{@"sineSlider": sineSlider, @"brassSlider": brassSlider}];
[self.view addConstraints:sliderConstraints];
}
@end

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>stk.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

18
iOS/demo/iOS Demo/main.m Normal file
View File

@@ -0,0 +1,18 @@
//
// main.m
// iOS Demo
//
// Created by Ariel Elkin on 03/03/2014.
// Copyright (c) 2014 Ariel Elkin. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>stk.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,34 @@
//
// iOS_DemoTests.m
// iOS DemoTests
//
// Created by Ariel Elkin on 03/03/2014.
// Copyright (c) 2014 Ariel Elkin. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface iOS_DemoTests : XCTestCase
@end
@implementation iOS_DemoTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end

View File

@@ -11,10 +11,13 @@ 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 are in seconds and must be
positive.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -28,7 +31,7 @@ class ADSR : public Generator
DECAY, /*!< Decay */
SUSTAIN, /*!< Sustain */
RELEASE, /*!< Release */
DONE /*!< End of release */
IDLE /*!< Before attack / after release */
};
//! Default constructor.
@@ -43,34 +46,37 @@ class ADSR : public Generator
//! Set target = 0, state = \e ADSR::RELEASE.
void keyOff( void );
//! Set the attack rate.
//! Set the attack rate (gain / sample).
void setAttackRate( StkFloat rate );
//! Set the decay rate.
//! Set the target value for the attack (default = 1.0).
void setAttackTarget( StkFloat target );
//! Set the decay rate (gain / sample).
void setDecayRate( StkFloat rate );
//! Set the sustain level.
void setSustainLevel( StkFloat level );
//! Set the release rate.
//! Set the release rate (gain / sample).
void setReleaseRate( StkFloat rate );
//! Set the attack rate based on a time duration.
//! Set the attack rate based on a time duration (seconds).
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.
//! Set sustain level and attack, decay, and release time durations (seconds).
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 +108,7 @@ class ADSR : public Generator
StkFloat attackRate_;
StkFloat decayRate_;
StkFloat releaseRate_;
StkFloat releaseTime_;
StkFloat sustainLevel_;
};
@@ -120,10 +127,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 +147,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 +161,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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -57,13 +57,23 @@ 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:
};
inline StkFloat BeeThree :: tick( unsigned int )
{
register StkFloat temp;
StkFloat temp;
if ( modDepth_ > 0.0 ) {
temp = 1.0 + ( modDepth_ * vibrato_.tick() * 0.1 );
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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,7 +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 );
//! 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( StkFloat value, unsigned long tapDelay );
//! Return the last computed output value.
StkFloat lastOut( void ) const { return lastFrame_[0]; };
@@ -128,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
@@ -150,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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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

@@ -1,7 +1,7 @@
#ifndef STK_DELAYL_H
#define STK_DELAYL_H
#include "Delay.h"
#include "Filter.h"
namespace stk {
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -34,7 +34,7 @@ class Effect : public Stk
virtual void clear() = 0;
//! Set the mixture of input and "effected" levels in the output (0.0 = input only, 1.0 = effect only).
void setEffectMix( StkFloat mix );
virtual void setEffectMix( StkFloat mix );
protected:
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -46,9 +46,6 @@ class FM : public Instrmnt
//! Class destructor.
virtual ~FM( void );
//! Reset and clear all wave and envelope states.
void clear( void );
//! Load the rawwave filenames in waves.
void loadWaves( const char **filenames );
@@ -88,6 +85,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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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_;
@@ -70,7 +80,7 @@ class FMVoices : public FM
inline StkFloat FMVoices :: tick( unsigned int )
{
register StkFloat temp, temp2;
StkFloat temp, temp2;
temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
temp2 = vibrato_.tick() * modDepth_ * 0.1;
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -89,7 +89,7 @@ public:
virtual void normalize( StkFloat peak );
//! Return the file size in sample frames.
virtual unsigned long getSize( void ) const { return data_.frames(); };
virtual unsigned long getSize( void ) const { return file_.fileSize(); };
//! Return the input file sample rate in Hz (not the data read rate).
/*!
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/

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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 * 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 * 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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -88,7 +88,7 @@ inline StkFloat Fir :: tick( StkFloat input )
lastFrame_[0] = 0.0;
inputs_[0] = gain_ * input;
for ( unsigned int i=b_.size()-1; i>0; i-- ) {
for ( unsigned int i=(unsigned int)(b_.size())-1; i>0; i-- ) {
lastFrame_[0] += b_[i] * inputs_[i];
inputs_[i] = inputs_[i-1];
}
@@ -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
@@ -112,7 +112,7 @@ inline StkFrames& Fir :: tick( StkFrames& frames, unsigned int channel )
inputs_[0] = gain_ * *samples;
*samples = 0.0;
for ( i=b_.size()-1; i>0; i-- ) {
for ( i=(unsigned int)b_.size()-1; i>0; i-- ) {
*samples += b_[i] * inputs_[i];
inputs_[i] = inputs_[i-1];
}
@@ -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
@@ -139,7 +139,7 @@ inline StkFrames& Fir :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned
inputs_[0] = gain_ * *iSamples;
*oSamples = 0.0;
for ( i=b_.size()-1; i>0; i-- ) {
for ( i=(unsigned int)b_.size()-1; i>0; i-- ) {
*oSamples += b_[i] * inputs_[i];
inputs_[i] = inputs_[i-1];
}

View File

@@ -32,7 +32,7 @@ namespace stk {
- Vibrato Gain = 1
- Breath Pressure = 128
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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

251
include/FreeVerb.h Normal file
View File

@@ -0,0 +1,251 @@
#ifndef STK_FREEVERB_H
#define STK_FREEVERB_H
#include "Effect.h"
#include "Delay.h"
#include "OnePole.h"
namespace stk {
/***********************************************************************/
/*! \class FreeVerb
\brief Jezar at Dreampoint's FreeVerb, implemented in STK.
Freeverb is a free and open-source Schroeder reverberator
originally implemented in C++. The parameters of the reverberation
model are exceptionally well tuned. FreeVerb uses 8
lowpass-feedback-comb-filters in parallel, followed by 4 Schroeder
allpass filters in series. The input signal can be either mono or
stereo, and the output signal is stereo. The delay lengths are
optimized for a sample rate of 44100 Hz.
Ported to STK by Gregory Burlet, 2012.
*/
/***********************************************************************/
class FreeVerb : public Effect
{
public:
//! FreeVerb Constructor
/*!
Initializes the effect with default parameters. Note that these defaults
are slightly different than those in the original implementation of
FreeVerb [Effect Mix: 0.75; Room Size: 0.75; Damping: 0.25; Width: 1.0;
Mode: freeze mode off].
*/
FreeVerb();
//! Destructor
~FreeVerb();
//! Set the effect mix [0 = mostly dry, 1 = mostly wet].
void setEffectMix( StkFloat mix );
//! Set the room size (comb filter feedback gain) parameter [0,1].
void setRoomSize( StkFloat value );
//! Get the room size (comb filter feedback gain) parameter.
StkFloat getRoomSize( void );
//! Set the damping parameter [0=low damping, 1=higher damping].
void setDamping( StkFloat value );
//! Get the damping parameter.
StkFloat getDamping( void );
//! Set the width (left-right mixing) parameter [0,1].
void setWidth( StkFloat value );
//! Get the width (left-right mixing) parameter.
StkFloat getWidth( void );
//! Set the mode [frozen = 1, unfrozen = 0].
void setMode( bool isFrozen );
//! Get the current freeze mode [frozen = 1, unfrozen = 0].
StkFloat getMode( void );
//! Clears delay lines, etc.
void clear( void );
//! Return the specified channel value of the last computed stereo frame.
/*!
Use the lastFrame() function to get both values of the last
computed stereo frame. The \c channel argument must be 0 or 1
(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.
*/
StkFloat lastOut( unsigned int channel = 0 );
//! Input one or two samples to the effect and return the specified \c channel value of the computed stereo frame.
/*!
Use the lastFrame() function to get both values of the computed
stereo output frame. The \c channel argument must be 0 or 1 (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.
*/
StkFloat tick( StkFloat inputL, StkFloat inputR = 0.0, unsigned int channel = 0 );
//! Take two channels of the StkFrames object as inputs to the effect and replace with stereo outputs.
/*!
The StkFrames argument reference is returned. The stereo
inputs are taken from (and written back to) the StkFrames argument
starting at the specified \c channel. Therefore, the \c channel
argument must be less than ( channels() - 1 ) of 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 one or two channels of the \c iFrames object as inputs to the effect and write stereo outputs to the \c oFrames object.
/*!
The \c iFrames object reference is returned. The \c iChannel
argument must be less than the number of channels in the \c
iFrames argument (the first channel is specified by 0). If more
than one channel of data exists in \c iFrames starting from \c
iChannel, stereo data is input to the effect. The \c oChannel
argument must be less than ( channels() - 1 ) of the \c oFrames
argument. 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:
//! Update interdependent parameters.
void update( void );
// Clamp very small floats to zero, version from
// http://music.columbia.edu/pipermail/linux-audio-user/2004-July/013489.html .
// However, this is for 32-bit floats only.
//static inline StkFloat undenormalize( volatile StkFloat s ) {
// s += 9.8607615E-32f;
// return s - 9.8607615E-32f;
//}
static const int nCombs = 8;
static const int nAllpasses = 4;
static const int stereoSpread = 23;
static const StkFloat fixedGain;
static const StkFloat scaleWet;
static const StkFloat scaleDry;
static const StkFloat scaleDamp;
static const StkFloat scaleRoom;
static const StkFloat offsetRoom;
// Delay line lengths for 44100Hz sampling rate.
static int cDelayLengths[nCombs];
static int aDelayLengths[nAllpasses];
StkFloat g_; // allpass coefficient
StkFloat gain_;
StkFloat roomSizeMem_, roomSize_;
StkFloat dampMem_, damp_;
StkFloat wet1_, wet2_;
StkFloat dry_;
StkFloat width_;
bool frozenMode_;
// LBFC: Lowpass Feedback Comb Filters
Delay combDelayL_[nCombs];
Delay combDelayR_[nCombs];
OnePole combLPL_[nCombs];
OnePole combLPR_[nCombs];
// AP: Allpass Filters
Delay allPassDelayL_[nAllpasses];
Delay allPassDelayR_[nAllpasses];
};
inline StkFloat FreeVerb :: lastOut( unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
oStream_ << "FreeVerb::lastOut(): channel argument must be less than 2!";
handleError( StkError::FUNCTION_ARGUMENT );
}
#endif
return lastFrame_[channel];
}
inline StkFloat FreeVerb::tick( StkFloat inputL, StkFloat inputR, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel > 1 ) {
oStream_ << "FreeVerb::tick(): channel argument must be less than 2!";
handleError(StkError::FUNCTION_ARGUMENT);
}
#endif
StkFloat fInput = (inputL + inputR) * gain_;
StkFloat outL = 0.0;
StkFloat outR = 0.0;
// Parallel LBCF filters
for ( int i = 0; i < nCombs; i++ ) {
// Left channel
//StkFloat yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPL_[i].tick(FreeVerb::undenormalize(combDelayL_[i].nextOut()))));
StkFloat yn = fInput + (roomSize_ * combLPL_[i].tick( combDelayL_[i].nextOut() ) );
combDelayL_[i].tick(yn);
outL += yn;
// Right channel
//yn = fInput + (roomSize_ * FreeVerb::undenormalize(combLPR_[i].tick(FreeVerb::undenormalize(combDelayR_[i].nextOut()))));
yn = fInput + (roomSize_ * combLPR_[i].tick( combDelayR_[i].nextOut() ) );
combDelayR_[i].tick(yn);
outR += yn;
}
// Series allpass filters
for ( int i = 0; i < nAllpasses; i++ ) {
// Left channel
//StkFloat vn_m = FreeVerb::undenormalize(allPassDelayL_[i].nextOut());
StkFloat vn_m = allPassDelayL_[i].nextOut();
StkFloat vn = outL + (g_ * vn_m);
allPassDelayL_[i].tick(vn);
// calculate output
outL = -vn + (1.0 + g_)*vn_m;
// Right channel
//vn_m = FreeVerb::undenormalize(allPassDelayR_[i].nextOut());
vn_m = allPassDelayR_[i].nextOut();
vn = outR + (g_ * vn_m);
allPassDelayR_[i].tick(vn);
// calculate output
outR = -vn + (1.0 + g_)*vn_m;
}
// Mix output
lastFrame_[0] = outL*wet1_ + outR*wet2_ + inputL*dry_;
lastFrame_[1] = outR*wet1_ + outL*wet2_ + inputR*dry_;
/*
// Hard limiter ... there's not much else we can do at this point
if ( lastFrame_[0] >= 1.0 ) {
lastFrame_[0] = 0.9999;
}
if ( lastFrame_[0] <= -1.0 ) {
lastFrame_[0] = -0.9999;
}
if ( lastFrame_[1] >= 1.0 ) {
lastFrame_[1] = 0.9999;
}
if ( lastFrame_[1] <= -1.0 ) {
lastFrame_[1] = -0.9999;
}
*/
return lastFrame_[channel];
}
}
#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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/

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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/

View File

@@ -21,7 +21,7 @@ namespace stk {
Chris Rolfe and Damian Keller, though there are likely to be a
number of differences in the actual implementation.
by Gary Scavone, 2005 - 2009.
by Gary Scavone, 2005 - 2010.
*/
/***************************************************/
@@ -139,7 +139,8 @@ class Granulate: public Generator
unsigned long decayCount;
unsigned long delayCount;
unsigned long counter;
unsigned long pointer;
//unsigned long pointer;
StkFloat pointer;
unsigned long startPointer;
unsigned int repeats;
GrainState state;
@@ -155,7 +156,8 @@ class Granulate: public Generator
StkFrames data_;
std::vector<Grain> grains_;
Noise noise;
long gPointer_;
//long gPointer_;
StkFloat gPointer_;
// Global grain parameters.
unsigned int gDuration_;
@@ -173,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
@@ -186,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

199
include/Guitar.h Normal file
View File

@@ -0,0 +1,199 @@
#ifndef STK_GUITAR_H
#define STK_GUITAR_H
#include "Stk.h"
#include "Twang.h"
#include "OnePole.h"
#include "OneZero.h"
namespace stk {
/***************************************************/
/*! \class Guitar
\brief STK guitar model class.
This class implements a guitar model with an arbitrary number of
strings (specified during instantiation). Each string is
represented by an stk::Twang object. The model supports commuted
synthesis, as discussed by Smith and Karjalainen. It also includes
a basic body coupling model and supports feedback.
This class does not attempt voice management. Rather, most
functions support a parameter to specify a particular string
number and string (voice) management is assumed to occur
externally. Note that this class does not inherit from
stk::Instrmnt because of API inconsistencies.
This is a digital waveguide model, making its use possibly subject
to patents held by Stanford University, Yamaha, and others.
Control Change Numbers:
- Bridge Coupling Gain = 2
- Pluck Position = 4
- Loop Gain = 11
- Coupling Filter Pole = 1
- Pick Filter Pole = 128
by Gary P. Scavone, 2012.
*/
/***************************************************/
class Guitar : public Stk
{
public:
//! Class constructor, specifying an arbitrary number of strings (default = 6).
Guitar( unsigned int nStrings = 6, std::string bodyfile = "" );
//! Reset and clear all internal state.
void clear( void );
//! Set the string excitation, using either a soundfile or computed noise.
/*!
If no argument is provided, the std::string is empty, or an error
occurs reading the file data, an enveloped noise signal will be
generated for use as the pluck excitation.
*/
void setBodyFile( std::string bodyfile = "" );
//! Set the pluck position for one or all strings.
/*!
If the \c string argument is < 0, the pluck position is set
for all strings.
*/
void setPluckPosition( StkFloat position, int string = -1 );
//! Set the loop gain for one or all strings.
/*!
If the \c string argument is < 0, the loop gain is set for all
strings.
*/
void setLoopGain( StkFloat gain, int string = -1 );
//! Set instrument parameters for a particular frequency.
void setFrequency( StkFloat frequency, unsigned int string = 0 );
//! Start a note with the given frequency and amplitude.
/*!
If the \c amplitude parameter is less than 0.2, the string will
be undamped but it will not be "plucked."
*/
void noteOn( StkFloat frequency, StkFloat amplitude, unsigned int string = 0 );
//! Stop a note with the given amplitude (speed of decay).
void noteOff( StkFloat amplitude, unsigned int string = 0 );
//! Perform the control change specified by \e number and \e value (0.0 - 128.0).
/*!
If the \c string argument is < 0, then the control change is
applied to all strings (if appropriate).
*/
void controlChange( int number, StkFloat value, int string = -1 );
//! Return the last computed output value.
StkFloat lastOut( void ) { return lastFrame_[0]; };
//! Take an optional input sample and compute one output sample.
StkFloat tick( StkFloat input = 0.0 );
//! Take a channel of the \c iFrames object as inputs to the class 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& frames, unsigned int channel = 0 );
//! Take a channel of the \c iFrames object as inputs to the effect 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:
std::vector< stk::Twang > strings_;
std::vector< int > stringState_; // 0 = off, 1 = decaying, 2 = on
std::vector< unsigned int > decayCounter_;
std::vector< unsigned int > filePointer_;
std::vector< StkFloat > pluckGains_;
OnePole pickFilter_;
OnePole couplingFilter_;
StkFloat couplingGain_;
StkFrames excitation_;
StkFrames lastFrame_;
};
inline StkFloat Guitar :: tick( StkFloat input )
{
StkFloat temp, output = 0.0;
lastFrame_[0] /= strings_.size(); // evenly spread coupling across strings
for ( unsigned int i=0; i<strings_.size(); i++ ) {
if ( stringState_[i] ) {
temp = input;
// If pluckGain < 0.2, let string ring but don't pluck it.
if ( filePointer_[i] < excitation_.frames() && pluckGains_[i] > 0.2 )
temp += pluckGains_[i] * excitation_[filePointer_[i]++];
temp += couplingGain_ * couplingFilter_.tick( lastFrame_[0] ); // bridge coupling
output += strings_[i].tick( temp );
// Check if string energy has decayed sufficiently to turn it off.
if ( stringState_[i] == 1 ) {
if ( fabs( strings_[i].lastOut() ) < 0.001 ) decayCounter_[i]++;
else decayCounter_[i] = 0;
if ( decayCounter_[i] > (unsigned int) floor( 0.1 * Stk::sampleRate() ) ) {
stringState_[i] = 0;
decayCounter_[i] = 0;
}
}
}
}
return lastFrame_[0] = output;
}
inline StkFrames& Guitar :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
oStream_ << "Guitar::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 );
return frames;
}
inline StkFrames& Guitar :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
oStream_ << "Guitar::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 );
return iFrames;
}
} // stk namespace
#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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -53,13 +53,23 @@ 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:
};
inline StkFloat HevyMetl :: tick( unsigned int )
{
register StkFloat temp;
StkFloat temp;
temp = vibrato_.tick() * modDepth_ * 0.2;
waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -113,7 +113,7 @@ protected:
inline StkFloat Iir :: tick( StkFloat input )
{
unsigned int i;
size_t i;
outputs_[0] = 0.0;
inputs_[0] = gain_ * input;
@@ -136,13 +136,14 @@ 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
StkFloat *samples = &frames[channel];
unsigned int i, hop = frames.channels();
size_t i;
unsigned int hop = frames.channels();
for ( unsigned int j=0; j<frames.frames(); j++, samples += hop ) {
outputs_[0] = 0.0;
inputs_[0] = gain_ * *samples;
@@ -168,14 +169,15 @@ 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
StkFloat *iSamples = &iFrames[iChannel];
StkFloat *oSamples = &oFrames[oChannel];
unsigned int i, iHop = iFrames.channels(), oHop = oFrames.channels();
size_t i;
unsigned int iHop = iFrames.channels(), oHop = oFrames.channels();
for ( unsigned int j=0; j<iFrames.frames(); j++, iSamples += iHop, oSamples += oHop ) {
outputs_[0] = 0.0;
inputs_[0] = gain_ * *iSamples;

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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/

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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -22,6 +22,12 @@ class Instrmnt : public Stk
//! Class constructor.
Instrmnt( void ) { lastFrame_.resize( 1, 1, 0.0 ); };
//! Reset and clear all internal state (for subclasses).
/*!
Not all subclasses implement a clear() function.
*/
virtual void clear( void ) {};
//! Start a note with the given frequency and amplitude.
virtual void noteOn( StkFloat frequency, StkFloat amplitude ) = 0;
@@ -65,7 +71,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 +79,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 +89,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 +97,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 - 2009.
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--2014.
*/
/***************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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

263
include/LentPitShift.h Normal file
View File

@@ -0,0 +1,263 @@
#ifndef STK_LENTPITSHIFT_H
#define STK_LENTPITSHIFT_H
#include "Effect.h"
#include "Delay.h"
namespace stk {
/***************************************************/
/*! \class LentPitShift
\brief Pitch shifter effect class based on the Lent algorithm.
This class implements a pitch shifter using pitch
tracking and sample windowing and shifting.
by Francois Germain, 2009.
*/
/***************************************************/
class LentPitShift : public Effect
{
public:
//! Class constructor.
LentPitShift( StkFloat periodRatio = 1.0, int tMax = RT_BUFFER_SIZE );
~LentPitShift( void ) {
delete window;
delete dt;
delete dpt;
delete cumDt;
}
//! Reset and clear all internal state.
void clear( void );
//! Set the pitch shift factor (1.0 produces no shift).
void setShift( StkFloat shift );
//! Input one sample to the filter and return one output.
StkFloat tick( StkFloat input );
//! Take a channel of the StkFrames object as inputs to the filter 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 filter 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:
//! Apply the effect on the input samples and store it.
/*!
The samples stored in the input frame vector are processed
and the delayed result are stored in the output frame vector.
*/
void process( );
// Frame storage vectors for process function
StkFrames inputFrames;
StkFrames outputFrames;
int ptrFrames; // writing pointer
// Input delay line
Delay inputLine_;
int inputPtr;
// Output delay line
Delay outputLine_;
double outputPtr;
// Pitch tracker variables
unsigned long tMax_; // Maximal period measurable by the pitch tracker.
// It is also the size of the window used by the pitch tracker and
// the size of the frames that can be computed by the tick function
StkFloat threshold_; // Threshold of detection for the pitch tracker
unsigned long lastPeriod_; // Result of the last pitch tracking loop
StkFloat* dt; // Array containing the euclidian distance coefficients
StkFloat* cumDt; // Array containing the cumulative sum of the coefficients in dt
StkFloat* dpt; // Array containing the pitch tracking function coefficients
// Pitch shifter variables
StkFloat env[2]; // Coefficients for the linear interpolation when modifying the output samples
StkFloat* window; // Hamming window used for the input portion extraction
double periodRatio_; // Ratio of modification of the signal period
StkFrames zeroFrame; // Frame of tMax_ zero samples
// Coefficient delay line that could be used for a dynamic calculation of the pitch
//Delay* coeffLine_;
};
inline void LentPitShift::process()
{
StkFloat x_t; // input coefficient
StkFloat x_t_T; // previous input coefficient at T samples
StkFloat coeff; // new coefficient for the difference function
unsigned long alternativePitch = tMax_; // Global minimum storage
lastPeriod_ = tMax_+1; // Storage of the lowest local minimum under the threshold
// Loop variables
unsigned long delay_;
unsigned int n;
// Initialization of the dt coefficients. Since the
// frames are of tMax_ length, there is no overlapping
// between the successive windows where pitch tracking
// is performed.
for ( delay_=1; delay_<=tMax_; delay_++ )
dt[delay_] = 0.;
// Calculation of the dt coefficients and update of the input delay line.
for ( n=0; n<inputFrames.size(); n++ ) {
x_t = inputLine_.tick( inputFrames[ n ] );
for ( delay_=1; delay_<= tMax_; delay_++ ) {
x_t_T = inputLine_.tapOut( delay_ );
coeff = x_t - x_t_T;
dt[delay_] += coeff * coeff;
}
}
// Calculation of the pitch tracking function and test for the minima.
for ( delay_=1; delay_<=tMax_; delay_++ ) {
cumDt[delay_] = dt[delay_] + cumDt[delay_-1];
dpt[delay_] = dt[delay_] * delay_ / cumDt[delay_];
// Look for a minimum
if ( dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) {
// Check if the minimum is under the threshold
if ( dpt[delay_-1] < threshold_ ){
lastPeriod_ = delay_-1;
// If a minimum is found, we can stop the loop
break;
}
else if ( dpt[alternativePitch] > dpt[delay_-1] )
// Otherwise we store it if it is the current global minimum
alternativePitch = delay_-1;
}
}
// Test for the last period length.
if ( dpt[delay_]-dpt[delay_-1] < 0 ) {
if ( dpt[delay_] < threshold_ )
lastPeriod_ = delay_;
else if ( dpt[alternativePitch] > dpt[delay_] )
alternativePitch = delay_;
}
if ( lastPeriod_ == tMax_+1 )
// No period has been under the threshold so we used the global minimum
lastPeriod_ = alternativePitch;
// We put the new zero output coefficients in the output delay line and
// we get the previous calculated coefficients
outputLine_.tick( zeroFrame, outputFrames );
// Initialization of the Hamming window used in the algorithm
for ( int n=-(int)lastPeriod_; n<(int)lastPeriod_; n++ )
window[n+lastPeriod_] = (1 + cos(PI*n/lastPeriod_)) / 2 ;
long M; // Index of reading in the input delay line
long N; // Index of writing in the output delay line
double sample; // Temporary storage for the new coefficient
// We loop for all the frames of length lastPeriod_ presents between inputPtr and tMax_
for ( ; inputPtr<(int)(tMax_-lastPeriod_); inputPtr+=lastPeriod_ ) {
// Test for the decision of compression/expansion
while ( outputPtr < inputPtr ) {
// Coefficients for the linear interpolation
env[1] = fmod( outputPtr + tMax_, 1.0 );
env[0] = 1.0 - env[1];
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_.tapOut(M) * window[j] / 2.;
// Linear interpolation
outputLine_.addTo(env[0] * sample, N);
outputLine_.addTo(env[1] * sample, N-1);
}
outputPtr = outputPtr + lastPeriod_ * periodRatio_; // new output pointer
}
}
// Shifting of the pointers waiting for the new frame of length tMax_.
outputPtr -= tMax_;
inputPtr -= tMax_;
}
inline StkFloat LentPitShift :: tick( StkFloat input )
{
StkFloat sample;
inputFrames[ptrFrames] = input;
sample = outputFrames[ptrFrames++];
// Check for end condition
if ( ptrFrames == (int) inputFrames.size() ){
ptrFrames = 0;
process( );
}
return sample;
}
inline StkFrames& LentPitShift :: tick( StkFrames& frames, unsigned int channel )
{
#if defined(_STK_DEBUG_)
if ( channel >= frames.channels() ) {
oStream_ << "LentPitShift::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 );
}
return frames;
}
inline StkFrames& LentPitShift :: tick( StkFrames& iFrames, StkFrames& oFrames, unsigned int iChannel, unsigned int oChannel )
{
#if defined(_STK_DEBUG_)
if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) {
oStream_ << "LentPitShift::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 );
}
return iFrames;
}
} // stk namespace
#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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/

View File

@@ -22,7 +22,7 @@ namespace stk {
Tempo changes are internally tracked by the class and reflected in
the values returned by the function getTickSeconds().
by Gary P. Scavone, 2003 - 2009.
by Gary P. Scavone, 2003 - 2010.
*/
/**********************************************************************/
@@ -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 - 2009.
by Perry R. Cook and Gary P. Scavone, 1995--2014.
*/
/***************************************************/
@@ -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

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