├── .gitignore ├── CMakeLists.txt ├── INSTALL.md ├── LICENSE ├── Makefile.in ├── README.md ├── STK.podspec ├── bin └── treesed ├── cmake └── FindCoreAudio.cmake ├── config ├── config.guess ├── config.sub └── install.sh ├── configure.ac ├── doc ├── README-Linux.txt ├── README-MacOSX.txt ├── README-SGI.txt ├── README-Win.txt ├── ReleaseNotes.txt ├── SKINI.txt ├── doxygen │ ├── Doxyfile │ ├── classes.txt │ ├── compile.txt │ ├── control.txt │ ├── crealtime.txt │ ├── download.txt │ ├── faq.txt │ ├── filtering.txt │ ├── footer.html │ ├── fundamentals.txt │ ├── header.html │ ├── header.tex │ ├── hello.txt │ ├── images │ │ ├── ccrma.gif │ │ ├── mcgill.gif │ │ └── princeton.gif │ ├── index.txt │ ├── information.txt │ ├── instruments.txt │ ├── links.txt │ ├── maillist.txt │ ├── multichannel.txt │ ├── polyvoices.txt │ ├── realtime.txt │ ├── skini.txt │ ├── system.txt │ ├── tutorial.txt │ └── usage.txt ├── hierarchy.txt ├── html │ ├── ccrma.gif │ ├── mcgill.gif │ └── princeton.gif └── treesed.html ├── iOS ├── README-iOS.md ├── STK.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── demo │ ├── README.md │ ├── iOS Demo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── iOS Demo.xccheckout │ ├── iOS Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── ViewController.h │ ├── ViewController.mm │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── iOS Demo-Info.plist │ ├── iOS Demo-Prefix.pch │ └── main.m │ └── iOS DemoTests │ ├── en.lproj │ └── InfoPlist.strings │ ├── iOS DemoTests-Info.plist │ └── iOS_DemoTests.m ├── include ├── ADSR.h ├── Asymp.h ├── BandedWG.h ├── BeeThree.h ├── BiQuad.h ├── Blit.h ├── BlitSaw.h ├── BlitSquare.h ├── BlowBotl.h ├── BlowHole.h ├── BowTable.h ├── Bowed.h ├── Brass.h ├── Chorus.h ├── Clarinet.h ├── Cubic.h ├── Delay.h ├── DelayA.h ├── DelayL.h ├── Drummer.h ├── Echo.h ├── Effect.h ├── Envelope.h ├── FM.h ├── FMVoices.h ├── FileLoop.h ├── FileRead.h ├── FileWrite.h ├── FileWvIn.h ├── FileWvOut.h ├── Filter.h ├── Fir.h ├── Flute.h ├── FormSwep.h ├── FreeVerb.h ├── Function.h ├── Generator.h ├── Granulate.h ├── Guitar.h ├── HevyMetl.h ├── Iir.h ├── InetWvIn.h ├── InetWvOut.h ├── Instrmnt.h ├── JCRev.h ├── JetTable.h ├── LentPitShift.h ├── Mandolin.h ├── Mesh2D.h ├── Messager.h ├── MidiFileIn.h ├── Modal.h ├── ModalBar.h ├── Modulate.h ├── Moog.h ├── Mutex.h ├── NRev.h ├── Noise.h ├── OnePole.h ├── OneZero.h ├── PRCRev.h ├── PercFlut.h ├── Phonemes.h ├── PitShift.h ├── Plucked.h ├── PoleZero.h ├── Recorder.h ├── ReedTable.h ├── Resonate.h ├── Rhodey.h ├── RtAudio.h ├── RtMidi.h ├── RtWvIn.h ├── RtWvOut.h ├── SKINImsg.h ├── SKINItbl.h ├── Sampler.h ├── Saxofony.h ├── Shakers.h ├── Simple.h ├── SineWave.h ├── SingWave.h ├── Sitar.h ├── Skini.h ├── Socket.h ├── Sphere.h ├── StifKarp.h ├── Stk.h ├── TapDelay.h ├── TcpClient.h ├── TcpServer.h ├── Thread.h ├── TubeBell.h ├── Twang.h ├── TwoPole.h ├── TwoZero.h ├── UdpSocket.h ├── Vector3D.h ├── VoicForm.h ├── Voicer.h ├── Whistle.h ├── Wurley.h ├── WvIn.h └── WvOut.h ├── m4 └── ax_cxx_compile_stdcxx.m4 ├── projects ├── demo │ ├── Banded │ ├── Banded.bat │ ├── CMakeLists.txt │ ├── Drums │ ├── Drums.bat │ ├── Makefile.in │ ├── Md2Skini.cpp │ ├── Md2Skini.dsp │ ├── Modal │ ├── Modal.bat │ ├── Physical │ ├── Physical.bat │ ├── Shakers │ ├── Shakers.bat │ ├── StkDemo │ ├── StkDemo.bat │ ├── Voice │ ├── Voice.bat │ ├── demo.cpp │ ├── demo.sln │ ├── demo.vcxproj │ ├── demo.vcxproj.filters │ ├── scores │ │ ├── README │ │ ├── bachfugue.ski │ │ ├── bookert.ski │ │ ├── chords.ski │ │ ├── doogie.ski │ │ ├── drumfunk.ski │ │ ├── drumtest.ski │ │ ├── duelingb.ski │ │ ├── fiddle.ski │ │ ├── flutbach.ski │ │ ├── funicula.ski │ │ ├── funskini.ski │ │ ├── lacrymos.ski │ │ ├── mandtune.ski │ │ ├── marimba2.ski │ │ ├── marimtst.ski │ │ ├── misacrio.ski │ │ ├── morazbel.ski │ │ ├── muneira.ski │ │ ├── organs.ski │ │ ├── pickdamp.ski │ │ ├── pictures.ski │ │ ├── riderson.ski │ │ ├── scales.ski │ │ ├── shaktest.ski │ │ ├── simplgft.ski │ │ ├── spain.ski │ │ ├── streetsf.ski │ │ ├── test.ski │ │ ├── thecars.ski │ │ ├── tubebell.ski │ │ └── vocaliz.ski │ ├── tcl │ │ ├── Banded.tcl │ │ ├── Demo.tcl │ │ ├── Drums.tcl │ │ ├── Modal.tcl │ │ ├── Physical.tcl │ │ ├── Shakers.tcl │ │ ├── Voice.tcl │ │ └── bitmaps │ │ │ ├── KFMod.xbm │ │ │ ├── KFiddl.xbm │ │ │ ├── KFloot.xbm │ │ │ ├── KHose.xbm │ │ │ ├── KModal.xbm │ │ │ ├── KPluk.xbm │ │ │ ├── KVoicForm.xbm │ │ │ ├── KVoiceFM.xbm │ │ │ ├── Klar.xbm │ │ │ ├── bamboo.xbm │ │ │ ├── cabasa.xbm │ │ │ ├── cokecan.xbm │ │ │ ├── guiro.xbm │ │ │ ├── kasm.xbm │ │ │ ├── maraca.xbm │ │ │ ├── phism.xbm │ │ │ ├── prc.xbm │ │ │ ├── prcFunny.xbm │ │ │ ├── rachet.xbm │ │ │ ├── sleighbell.xbm │ │ │ └── tambourine.xbm │ ├── utilities.cpp │ └── utilities.h ├── effects │ ├── CMakeLists.txt │ ├── Makefile.in │ ├── README-effects.txt │ ├── StkEffects │ ├── StkEffects.bat │ ├── effects.cpp │ ├── effects.sln │ ├── effects.vcxproj │ └── tcl │ │ └── Effects.tcl ├── eguitar │ ├── CMakeLists.txt │ ├── ElectricGuitar │ ├── ElectricGuitar.bat │ ├── Makefile.in │ ├── README-eguitar.txt │ ├── eguitar.cpp │ ├── eguitar.sln │ ├── eguitar.vcxproj │ ├── scores │ │ └── test.ski │ ├── tcl │ │ └── EGuitar.tcl │ ├── utilities.cpp │ └── utilities.h ├── examples │ ├── CMakeLists.txt │ ├── Makefile.in │ ├── audioprobe.cpp │ ├── audioprobe.vcxproj │ ├── audioprobe.vcxproj.filters │ ├── bethree.cpp │ ├── bethree.vcxproj │ ├── bethree.vcxproj.filters │ ├── controlbee.cpp │ ├── controlbee.vcxproj │ ├── controlbee.vcxproj.filters │ ├── crtsine.cpp │ ├── crtsine.vcxproj │ ├── crtsine.vcxproj.filters │ ├── duplex.cpp │ ├── duplex.vcxproj │ ├── duplex.vcxproj.filters │ ├── examples.sln │ ├── foursine.cpp │ ├── foursine.vcxproj │ ├── foursine.vcxproj.filters │ ├── grains.cpp │ ├── grains.vcxproj │ ├── grains.vcxproj.filters │ ├── inetIn.cpp │ ├── inetIn.vcxproj │ ├── inetIn.vcxproj.filters │ ├── inetOut.cpp │ ├── inetOut.vcxproj │ ├── inetOut.vcxproj.filters │ ├── libMakefile.in │ ├── midifiles │ │ ├── bwv772.mid │ │ ├── jesu.mid │ │ └── tango.mid │ ├── midiprobe.cpp │ ├── midiprobe.vcxproj │ ├── midiprobe.vcxproj.filters │ ├── play.cpp │ ├── play.vcxproj │ ├── play.vcxproj.filters │ ├── playsmf.cpp │ ├── playsmf.vcxproj │ ├── playsmf.vcxproj.filters │ ├── rawwaves │ │ └── sinewave.raw │ ├── record.cpp │ ├── record.vcxproj │ ├── record.vcxproj.filters │ ├── rtsine.cpp │ ├── rtsine.vcxproj │ ├── rtsine.vcxproj.filters │ ├── scores │ │ ├── bachfugue.ski │ │ └── bookert.ski │ ├── simple.tcl │ ├── sine.cpp │ ├── sine.vcxproj │ ├── sine.vcxproj.filters │ ├── sineosc.cpp │ ├── sineosc.vcxproj │ ├── sineosc.vcxproj.filters │ ├── threebees.cpp │ ├── threebees.vcxproj │ └── threebees.vcxproj.filters ├── ragamatic │ ├── CMakeLists.txt │ ├── Drone.cpp │ ├── Drone.h │ ├── Makefile.in │ ├── README-raga.txt │ ├── Raga │ ├── Raga.bat │ ├── Tabla.cpp │ ├── Tabla.h │ ├── VoicDrum.cpp │ ├── VoicDrum.h │ ├── ragamat.cpp │ ├── ragamat.vcxproj │ ├── ragamatic.sln │ ├── rawwaves │ │ ├── DrDoi1.raw │ │ ├── DrDoi2.raw │ │ ├── DrTak1.raw │ │ ├── DrTak2.raw │ │ ├── Drdak2.raw │ │ ├── Drdak3.raw │ │ ├── Drdak4.raw │ │ ├── Drddak1.raw │ │ ├── Drdee1.raw │ │ ├── Drdee2.raw │ │ ├── Drdoo1.raw │ │ ├── Drdoo2.raw │ │ ├── Drdoo3.raw │ │ ├── Drjun1.raw │ │ ├── Drjun2.raw │ │ ├── bee1.raw │ │ ├── dee1.raw │ │ ├── dee2.raw │ │ ├── din1.raw │ │ ├── gun1.raw │ │ ├── jun1.raw │ │ ├── jun2.raw │ │ ├── tak1.raw │ │ ├── tak2.raw │ │ ├── tak3.raw │ │ └── tak4.raw │ └── tcl │ │ ├── Raga.tcl │ │ └── bitmaps │ │ ├── prc.xbm │ │ ├── prcFunny.xbm │ │ ├── ragamat.bmp │ │ ├── ragamat.xbm │ │ ├── ragamat2.bmp │ │ └── ragamat2.xbm └── stk-template.zip ├── rawwaves ├── ahh.raw ├── bassdrum.raw ├── britestk.raw ├── cowbell1.raw ├── crashcym.raw ├── dope.raw ├── eee.raw ├── fwavblnk.raw ├── halfwave.raw ├── hihatcym.raw ├── impuls10.raw ├── impuls20.raw ├── impuls40.raw ├── makefunc.c ├── makemidi.c ├── makewavs.c ├── mand1.raw ├── mand10.raw ├── mand11.raw ├── mand12.raw ├── mand2.raw ├── mand3.raw ├── mand4.raw ├── mand5.raw ├── mand6.raw ├── mand7.raw ├── mand8.raw ├── mand9.raw ├── mandpluk.raw ├── marmstk1.raw ├── ooo.raw ├── peksblnk.raw ├── ppksblnk.raw ├── ridecymb.raw ├── silence.raw ├── sine.c ├── sineblnk.raw ├── sinewave.raw ├── snardrum.raw ├── snglpeak.raw ├── tambourn.raw ├── tomhidrm.raw ├── tomlowdr.raw ├── tommiddr.raw └── twopeaks.raw └── src ├── ADSR.cpp ├── Asymp.cpp ├── BandedWG.cpp ├── BeeThree.cpp ├── BiQuad.cpp ├── Blit.cpp ├── BlitSaw.cpp ├── BlitSquare.cpp ├── BlowBotl.cpp ├── BlowHole.cpp ├── Bowed.cpp ├── Brass.cpp ├── Chorus.cpp ├── Clarinet.cpp ├── Delay.cpp ├── DelayA.cpp ├── DelayL.cpp ├── Drummer.cpp ├── Echo.cpp ├── Envelope.cpp ├── FM.cpp ├── FMVoices.cpp ├── FileLoop.cpp ├── FileRead.cpp ├── FileWrite.cpp ├── FileWvIn.cpp ├── FileWvOut.cpp ├── Fir.cpp ├── Flute.cpp ├── FormSwep.cpp ├── FreeVerb.cpp ├── Granulate.cpp ├── Guitar.cpp ├── HevyMetl.cpp ├── Iir.cpp ├── InetWvIn.cpp ├── InetWvOut.cpp ├── JCRev.cpp ├── LentPitShift.cpp ├── Makefile.in ├── Mandolin.cpp ├── Mesh2D.cpp ├── Messager.cpp ├── MidiFileIn.cpp ├── Modal.cpp ├── ModalBar.cpp ├── Modulate.cpp ├── Moog.cpp ├── Mutex.cpp ├── NRev.cpp ├── Noise.cpp ├── OnePole.cpp ├── OneZero.cpp ├── PRCRev.cpp ├── PercFlut.cpp ├── Phonemes.cpp ├── PitShift.cpp ├── Plucked.cpp ├── PoleZero.cpp ├── Recorder.cpp ├── Resonate.cpp ├── Rhodey.cpp ├── RtAudio.cpp ├── RtMidi.cpp ├── RtWvIn.cpp ├── RtWvOut.cpp ├── Sampler.cpp ├── Saxofony.cpp ├── Shakers.cpp ├── Simple.cpp ├── SineWave.cpp ├── SingWave.cpp ├── Sitar.cpp ├── Skini.cpp ├── Socket.cpp ├── Sphere.cpp ├── StifKarp.cpp ├── Stk.cpp ├── TapDelay.cpp ├── TcpClient.cpp ├── TcpServer.cpp ├── Thread.cpp ├── TubeBell.cpp ├── Twang.cpp ├── TwoPole.cpp ├── TwoZero.cpp ├── UdpSocket.cpp ├── VoicForm.cpp ├── Voicer.cpp ├── Whistle.cpp ├── Wurley.cpp └── include ├── FunctionDiscoveryKeys_devpkey.h ├── asio.cpp ├── asio.h ├── asiodrivers.cpp ├── asiodrivers.h ├── asiodrvr.h ├── asiolist.cpp ├── asiolist.h ├── asiosys.h ├── dsound.h ├── ginclude.h ├── iasiodrv.h ├── iasiothiscallresolver.cpp ├── iasiothiscallresolver.h └── soundcard.h /LICENSE: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | Copyright (c) 1995-2023 Perry R. Cook and Gary P. Scavone 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | Any person wishing to distribute modifications to the Software is 17 | asked to send the modifications to the original developer so that they 18 | can be incorporated into the canonical version. This is, however, not 19 | a binding provision of this license. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 24 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 25 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 26 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | ### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in 2 | 3 | RM = /bin/rm 4 | 5 | REALTIME = @realtime@ 6 | 7 | all : 8 | cd src && $(MAKE) 9 | cd projects/demo && $(MAKE) libdemo 10 | ifeq ($(REALTIME),yes) 11 | cd projects/effects && $(MAKE) libeffects 12 | cd projects/ragamatic && $(MAKE) libragamat 13 | cd projects/eguitar && $(MAKE) libeguitar 14 | endif 15 | cd projects/examples && $(MAKE) -f libMakefile 16 | 17 | clean : 18 | $(RM) -f *~ 19 | cd src && $(MAKE) clean 20 | cd projects/demo && $(MAKE) clean 21 | ifeq ($(REALTIME),yes) 22 | cd projects/effects && $(MAKE) clean 23 | cd projects/ragamatic && $(MAKE) clean 24 | cd projects/eguitar && $(MAKE) clean 25 | endif 26 | cd projects/examples && $(MAKE) clean 27 | 28 | distclean: clean 29 | $(RM) -rf config.log config.status autom4te.cache Makefile 30 | cd src && $(MAKE) distclean 31 | cd projects/demo && $(MAKE) distclean 32 | ifeq ($(REALTIME),yes) 33 | cd projects/effects && $(MAKE) distclean 34 | cd projects/ragamatic && $(MAKE) distclean 35 | cd projects/eguitar && $(MAKE) distclean 36 | endif 37 | cd projects/examples && $(MAKE) distclean 38 | 39 | install: 40 | $(MAKE) -C src install 41 | 42 | -------------------------------------------------------------------------------- /STK.podspec: -------------------------------------------------------------------------------- 1 | # To lint the spec: 2 | # pod spec lint --skip-import-validation --allow-warnings 3 | # To publish: 4 | # pod trunk push STK.podspec --skip-import-validation --allow-warnings 5 | 6 | Pod::Spec.new do |spec| 7 | spec.name = 'STK' 8 | spec.version = '4.6.2' 9 | spec.summary = 'The Synthesis ToolKit in C++ is a set of open source audio signal processing and algorithmic synthesis classes.' 10 | spec.homepage = 'https://ccrma.stanford.edu/software/stk/' 11 | spec.source = { :git => 'https://github.com/thestk/stk.git', :tag => spec.version } 12 | spec.license = { :type => 'MIT' } 13 | spec.author = { "Ariel Elkin" => "ariel@arivibes.com" } 14 | spec.platform = :ios 15 | spec.ios.deployment_target = "10.0" 16 | spec.source_files = [ 17 | "src/*.cpp", 18 | "include/*.h" 19 | ] 20 | spec.public_header_files = [ 21 | "include/*.h", 22 | "include/SKINImsg.h", 23 | "include/SKINItbl.h" 24 | ] 25 | spec.exclude_files = [ 26 | "include/Thread.h", 27 | "src/Thread.cpp", 28 | "include/Mutex.h", 29 | "src/Mutex.cpp", 30 | "include/UdpSocket.h", 31 | "src/UdpSocket.cpp", 32 | "include/Socket.h", 33 | "src/Socket.cpp", 34 | "include/TcpClient.h", 35 | "src/TcpClient.cpp", 36 | "include/TcpServer.h", 37 | "src/TcpServer.cpp", 38 | "include/InetWvIn.h", 39 | "src/InetWvIn.cpp", 40 | "include/InetWvOut.h", 41 | "src/InetWvOut.cpp", 42 | "include/RtAudio.h", 43 | "src/RtAudio.cpp", 44 | "include/RtMidi.h", 45 | "src/RtMidi.cpp", 46 | "include/RtWvIn.h", 47 | "src/RtWvIn.cpp", 48 | "include/RtWvOut.h", 49 | "src/RtWvOut.cpp", 50 | "include/RtError.h" 51 | ] 52 | spec.preserve_paths = "README.MD" 53 | spec.resource_bundles = { "rawwaves": "rawwaves/*.raw" } 54 | spec.libraries = 'c++' 55 | end 56 | -------------------------------------------------------------------------------- /cmake/FindCoreAudio.cmake: -------------------------------------------------------------------------------- 1 | find_library(COREAUDIO_LIBRARY CoreAudio) 2 | find_library(COREAUDIO_FOUNDATION CoreFoundation) 3 | find_library(COREAUDIO_MIDI CoreMIDI) 4 | find_path(COREAUDIO_INCLUDE_DIRS CoreAudio/CoreAudio.h) 5 | 6 | include(FindPackageHandleStandardArgs) 7 | FIND_PACKAGE_HANDLE_STANDARD_ARGS( 8 | CoreAudio 9 | DEFAULT_MSG 10 | COREAUDIO_LIBRARY 11 | COREAUDIO_FOUNDATION 12 | COREAUDIO_MIDI 13 | COREAUDIO_INCLUDE_DIRS) 14 | 15 | mark_as_advanced( 16 | COREAUDIO_LIBRARY 17 | COREAUDIO_FOUNDATION 18 | COREAUDIO_MIDI 19 | COREAUDIO_INCLUDE_DIRS) 20 | 21 | 22 | -------------------------------------------------------------------------------- /config/install.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/config/install.sh -------------------------------------------------------------------------------- /doc/README-Linux.txt: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | By Perry R. Cook and Gary P. Scavone, 1995--2023. 4 | 5 | Please read the file README and INSTALL for more general STK information. 6 | 7 | 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. 8 | 9 | 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. 10 | 11 | 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). 12 | 13 | 14 | -------------------------------------------------------------------------------- /doc/README-MacOSX.txt: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | By Perry R. Cook and Gary P. Scavone, 1995--2023. 4 | 5 | Please read the file README and INSTALL for more general STK information. 6 | 7 | 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. 8 | 9 | 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. 10 | 11 | Tcl/Tk on OS X: 12 | 13 | The Tcl/Tk interpreter included in the Xcode package seems outdated. Try getting tcl-tk through HomeBrew for an updated version. 14 | 15 | 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. 16 | 17 | -------------------------------------------------------------------------------- /doc/README-SGI.txt: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | By Perry R. Cook and Gary P. Scavone, 1995--2023. 4 | 5 | Please read the file README and INSTALL for more general STK information. 6 | 7 | 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. 8 | -------------------------------------------------------------------------------- /doc/README-Win.txt: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | By Perry R. Cook and Gary P. Scavone, 1995--2023. 4 | 5 | Please read the file README.md for more general STK information. 6 | 7 | The configure script supports MinGW. 8 | 9 | STK has been built and tested on Windows platforms using Visual Studio. It is assumed here that you're familiar with Visual C++ and its particular idiosyncrasies. The currently supported version is VS2017. You can download the free non-commercial community edition from the Microsoft website. The folders in the projects directory contain VS2017 solution files. 10 | If you are creating a new stk application, it's easiest to use the supplied template: 11 | - Copy stk\projects\stk-template.zip to C:\Users\\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C++ Project\ 12 | - Start VS2017. 13 | - Select create new project... 14 | - Select Visual C++. 15 | - Select stk-template and enter your preferred project name and location. Note that if you do not put the project at the same level as stk\projects you will have to fix all paths in the project properties to match. 16 | - The template is based on one of the projects in the examples directory. Add/remove files as needed and edit main.cpp to taste. 17 | 18 | To use the Tcl/Tk GUIs, you will have to install Tcl/Tk and build using MinGW. 19 | 20 | With Windows XP and later, piping works as under unix. Simply fire up the script files (e.g. StkDemo.bat) by either double-clicking on them or from within a shell. 21 | 22 | The DirectSound, WASAPI and Steinberg ASIO audio APIs are supported for realtime audio input/output. The VS2017 project files included with this distribution are configured to use all supported APIs. The default (as in stk-template) is the DirectSound API (preprocessor definition __WINDOWS_DS__). 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. 23 | 24 | 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. 25 | 26 | Realtime MIDI input/output is supported by RtMidi using the winmm.lib API and requires the __WINDOWS_MM__ preprocessor definition. 27 | -------------------------------------------------------------------------------- /doc/doxygen/classes.txt: -------------------------------------------------------------------------------- 1 | /*! \page classes Class Documentation 2 | 3 | 9 | 10 | */ -------------------------------------------------------------------------------- /doc/doxygen/footer.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
The Synthesis ToolKit in C++ (STK)
©1995--2023 Perry R. Cook and Gary P. Scavone. All Rights Reserved.
7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /doc/doxygen/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | The Synthesis ToolKit in C++ (STK) 4 | 5 | 6 | 7 |
8 |    

9 | Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial

10 |
11 | -------------------------------------------------------------------------------- /doc/doxygen/header.tex: -------------------------------------------------------------------------------- 1 | \documentclass[letter]{book} 2 | \usepackage{makeidx} 3 | \usepackage{fancyhdr} 4 | \usepackage{graphicx} 5 | \usepackage{float} 6 | \usepackage{alltt} 7 | \usepackage{doxygen} 8 | \usepackage{hyperref} 9 | \makeindex 10 | \setcounter{tocdepth}{1} 11 | \setlength{\footrulewidth}{0.4pt} 12 | \begin{document} 13 | \begin{titlepage} 14 | \vspace*{7cm} 15 | \begin{center} 16 | {\Large User Manual}\\ 17 | \vspace*{0.5cm} 18 | {\Large The Synthesis ToolKit in C++}\\ 19 | \vspace*{1cm} 20 | {\large by Perry R. Cook and Gary P. Scavone}\\ 21 | \vspace*{0.5cm} 22 | {\small \copyright 1995--2007}\\ 23 | \end{center} 24 | \end{titlepage} 25 | \clearemptydoublepage 26 | \pagenumbering{roman} 27 | \rfoot[\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2007}]{} 28 | \lfoot[]{\fancyplain{}{\bfseries\scriptsize The Synthesis ToolKit in C++ by Perry R. Cook and Gary P. Scavone, \copyright~1995--2007}} 29 | \tableofcontents 30 | \clearemptydoublepage 31 | \pagenumbering{arabic} 32 | -------------------------------------------------------------------------------- /doc/doxygen/images/ccrma.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/doxygen/images/ccrma.gif -------------------------------------------------------------------------------- /doc/doxygen/images/mcgill.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/doxygen/images/mcgill.gif -------------------------------------------------------------------------------- /doc/doxygen/images/princeton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/doxygen/images/princeton.gif -------------------------------------------------------------------------------- /doc/doxygen/index.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/doxygen/index.txt -------------------------------------------------------------------------------- /doc/doxygen/instruments.txt: -------------------------------------------------------------------------------- 1 | /*! \page instruments Instruments 2 | 3 | The ToolKit comes with a wide variety of synthesis algorithms, all of which inherit from the stk::Instrmnt class. In this example, we'll fire up an instance of the stk::BeeThree FM synthesis class and show how its frequency can be modified over time. 4 | 5 | \include bethree.cpp 6 | 7 | We have used an Instrmnt pointer when referencing the BeeThree 8 | instance above, so it would be simple to replace the BeeThree class 9 | with any other STK instrument class. It should be noted, however, 10 | that a few classes do not respond to the setFrequency() function 11 | (e.g., Shakers, Drummer). 12 | 13 | The noteOn() function initiates an instrument attack. Instruments that are continuously excited (e.g., stk::Clarinet, stk::BeeThree) will continue to sound until stopped with a noteOff(). Impulsively excited instrument sounds (e.g., stk::Plucked, stk::Wurley) typically decay within a few seconds time, requiring subsequent noteOn() messages for re-attack. 14 | 15 | Instrument parameters can be precisely controlled as demonstrated above. A more flexible approach to instrument control, allowing arbitrary scorefile or realtime updates, is described in the next tutorial chapter. 16 | 17 | [Main tutorial page]   [Next tutorial] 18 | */ 19 | 20 | -------------------------------------------------------------------------------- /doc/doxygen/links.txt: -------------------------------------------------------------------------------- 1 | /*! \page links Miscellaneous Links 2 | 3 | - The %RtAudio WWW site 4 | 5 | - The %RtMidi WWW site 6 | 7 | - MoMu-Stk: A lightly modified version of STK that supports the iPhone platform (iPhone, iPad, iPod Touches) 8 | 9 | - StkX: A Cocoa STK Framework for Mac OS X by Woon Seung Yeo 10 | 11 | - Mobile STK: A port of STK for mobile devices by Georg Essl and Michael Rohs 12 | 13 | - ChucK: Concurrent, On-the-fly Audio Programming Language using STK unit generators 14 | 15 | - Kern Scores: A Library of Electronic Musical Scores (with automatic conversion to SKINI format) 16 | 17 | - MIDI to SKINI file converter by Craig Sapp 18 | 19 | - Kern Score to SKINI file converter by Craig Sapp 20 | 21 | - PeRColate: A Port of STK for Max/MSP 22 | 23 | - AUStk: a demo of integration of STK instruments into an AudioUnit by Airy Andre 24 | 25 | */ 26 | -------------------------------------------------------------------------------- /doc/doxygen/maillist.txt: -------------------------------------------------------------------------------- 1 | /*! \page maillist The Mail List 2 | 3 | An STK mailing list has been set up to facilitate communication among STK users. Subscribing to this list is your best way of keeping on top of new releases, bug fixes, and various user developments. 4 |

5 | For answers to frequently asked questions, check the list archives. 6 |

7 | To join send a message to <stk-request@ccrma.stanford.edu> 8 | with the contents: subscribe 9 | 10 |

11 | To be removed from the list send a message to <stk-request@ccrma.stanford.edu> 12 | with the contents: unsubscribe 13 | 14 | */ -------------------------------------------------------------------------------- /doc/doxygen/multichannel.txt: -------------------------------------------------------------------------------- 1 | /*! \page multichannel Multi-Channel I/O 2 | 3 | The ToolKit stk::WvIn and stk::WvOut classes (and their subclasses) support multi-channel audio data input and output. Several other abstract base classes, such as stk::Instrmnt, stk::Generator, and stk::Effect, also support multi-channel computations though not all of their subclasses produce or take multi-channel data. A set of interleaved audio samples representing a single time "slice" is referred to as a sample frame. At a sample rate of 44.1 kHz, a four-channel audio stream will have 44100 sample frames per second and a total of 176400 individual samples per second. 4 | 5 | Most STK classes process single-sample data streams via their 6 | tick() function. For classes supporting multi-channel data, 7 | one must distinguish the tick() functions taking or producing 8 | single \c StkFloat arguments from those taking stk::StkFrames& arguments. If 9 | a single-sample version of the tick() function is called for 10 | these classes, a full sample frame is computed but only a single value 11 | is either input and/or output. For example, if the single-sample 12 | tick() function is called for subclasses of WvOut, the sample 13 | argument is written to all channels in the one computed frame. For 14 | classes returning values, an optional \c channel argument specifies 15 | which channel value is returned from the computed frame (the default 16 | is always channel 0). To input and/or output multichannel data to 17 | these classes, the overloaded tick() functions taking 18 | StkFrames reference arguments should be used. 19 | 20 | Multi-channel support for realtime audio input and output is dependent on the audio device(s) available on your system. 21 | 22 | The following example demonstrates the use of the stk::FileWvOut class for 23 | creating a four channel, 16-bit AIFF formatted audio file. We will 24 | use four sinewaves of different frequencies for the first two seconds 25 | and then a single sinewave for the last two seconds. 26 | 27 | \include foursine.cpp 28 | 29 | [Main tutorial page]   [Next tutorial] 30 | */ 31 | -------------------------------------------------------------------------------- /doc/doxygen/polyvoices.txt: -------------------------------------------------------------------------------- 1 | /*! \page polyvoices Voice Management 2 | 3 | The previous tutorial chapters were concerned only with monophonic ToolKit instrument playback and control. At this point, it should be relatively clear that one can instantiate multiple instruments and perhaps sum together their outputs or even direct their outputs to separate channels. It is less clear how one might go about controlling a group of instruments. The stk::Voicer class is designed to serve just this purpose. 4 | 5 | The stk::Voicer class is a relatively simple voice manager. The user can dynamically add and delete instruments to/from its "control", with the option of controlling specific instruments via unique note tags and/or grouping sets of instruments via a "group" number. All sounding instrument outputs are summed and returned via the tick() function. The stk::Voicer class responds to noteOn, noteOff, setFrequency, pitchBend, and controlChange messages, automatically assigning incoming messages to the voices in its control. When all voices are sounding and a new noteOn is encountered, the stk::Voicer interrupts the oldest sounding voice. The user is responsible for creating and deleting all instrument instances. 6 | 7 | In the following example, we modify the controlbee.cpp program to make use of three stk::BeeThree instruments, all controlled using a stk::Voicer. 8 | 9 | \include threebees.cpp 10 | 11 | We have written this program to accept control messages from \c STDIN. Assuming the program is compiled as threebees, the three-voice SKINI scorefile bachfugue.ski (located in the scores directory with the examples) can be redirected to the program as: 12 | 13 | \code 14 | threebees < scores/bachfugue.ski 15 | \endcode 16 | 17 | For more fun, surf to Kern Scores for a huge assortment of other scorefiles that can be downloaded in the SKINI format. 18 | 19 | Another easy extension would be to add the \c stk::Messager::startMidiInput() function to the program and then play the instruments via a MIDI keyboard. 20 | 21 | [Main tutorial page] 22 | */ 23 | -------------------------------------------------------------------------------- /doc/doxygen/tutorial.txt: -------------------------------------------------------------------------------- 1 | /*! \page tutorial Tutorial 2 | 3 | The Synthesis ToolKit is a set of C++ classes. In order to go beyond the simple example programs we provide, it is necessary to know some basics about programming in C and C++. STK's "target audience" includes people who: 4 | - want to create audio DSP and/or synthesis programs 5 | - want to use our unit generators and input/output routines rather than code their own 6 | - want to learn about synthesis and processing algorithms 7 | - wish to teach real-time synthesis and processing and wish to use some of our classes and examples 8 | 9 | Most ToolKit programmers will likely end up writing a class or two for their own particular needs, but this task is typically simplified by making use of pre-existing STK classes (filters, oscillators, etc.). 10 | 11 | The following tutorial chapters describe many of the fundamental ToolKit concepts and classes. All tutorial programs are included in the projects/examples directory. 12 | 13 | -# \ref fundamentals 14 | -# \ref hello 15 | -# \ref compile 16 | -# \ref filtering 17 | -# \ref realtime 18 | -# \ref crealtime 19 | -# \ref instruments 20 | -# \ref controlin 21 | -# \ref multichannel 22 | -# \ref polyvoices 23 | 24 | */ 25 | -------------------------------------------------------------------------------- /doc/html/ccrma.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/html/ccrma.gif -------------------------------------------------------------------------------- /doc/html/mcgill.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/html/mcgill.gif -------------------------------------------------------------------------------- /doc/html/princeton.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/doc/html/princeton.gif -------------------------------------------------------------------------------- /iOS/STK.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS/demo/README.md: -------------------------------------------------------------------------------- 1 | ##iOS Demo Xcode project 2 | 3 | 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. 4 | 5 | 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. These samples need to be fed into an audio engine for them to be heard. 6 | 7 | Note the following: 8 | 9 | * ViewController needs to be renamed with the **.mm** extension as it's importing STK files, which are C++. 10 | * 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. 11 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo.xcodeproj/project.xcworkspace/xcshareddata/iOS Demo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 4E1BA790-84C0-4F40-AECE-98269B537CE6 9 | IDESourceControlProjectName 10 | iOS Demo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | CB047168-D1C4-40BC-85A3-6EB0A20AD217 14 | ssh://github.com/arielelkin/stk.git 15 | 16 | IDESourceControlProjectPath 17 | iOS/Demo/iOS Demo.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | CB047168-D1C4-40BC-85A3-6EB0A20AD217 21 | ../../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/arielelkin/stk.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | CB047168-D1C4-40BC-85A3-6EB0A20AD217 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | CB047168-D1C4-40BC-85A3-6EB0A20AD217 36 | IDESourceControlWCCName 37 | stk 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iOS Demo 4 | // 5 | // Created by Ariel Elkin on 03/03/2014. 6 | // 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iOS Demo 4 | // 5 | // Created by Ariel Elkin on 03/03/2014. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | #import "ViewController.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | 17 | ViewController *vc = [[ViewController alloc] initWithNibName:nil bundle:nil]; 18 | [self.window setRootViewController:vc]; 19 | 20 | [self.window makeKeyAndVisible]; 21 | 22 | return YES; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // iOS Demo 4 | // 5 | // Created by Ariel Elkin on 03/03/2014. 6 | // 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/iOS Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/iOS Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /iOS/demo/iOS Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iOS Demo 4 | // 5 | // Created by Ariel Elkin on 03/03/2014. 6 | // Copyright (c) 2014 Ariel Elkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /iOS/demo/iOS DemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iOS/demo/iOS DemoTests/iOS DemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /iOS/demo/iOS DemoTests/iOS_DemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // iOS_DemoTests.m 3 | // iOS DemoTests 4 | // 5 | // Created by Ariel Elkin on 03/03/2014. 6 | // Copyright (c) 2014 Ariel Elkin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface iOS_DemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation iOS_DemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /include/Effect.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_EFFECT_H 2 | #define STK_EFFECT_H 3 | 4 | #include "Stk.h" 5 | #include 6 | 7 | namespace stk { 8 | 9 | /***************************************************/ 10 | /*! \class Effect 11 | \brief STK abstract effects parent class. 12 | 13 | This class provides common functionality for STK effects 14 | subclasses. It is general enough to support both monophonic and 15 | polyphonic input/output classes. 16 | 17 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 18 | */ 19 | /***************************************************/ 20 | 21 | class Effect : public Stk 22 | { 23 | public: 24 | //! Class constructor. 25 | Effect( void ) { lastFrame_.resize( 1, 1, 0.0 ); }; 26 | 27 | //! Return the number of output channels for the class. 28 | unsigned int channelsOut( void ) const { return lastFrame_.channels(); }; 29 | 30 | //! Return an StkFrames reference to the last output sample frame. 31 | const StkFrames& lastFrame( void ) const { return lastFrame_; }; 32 | 33 | //! Reset and clear all internal state. 34 | virtual void clear() = 0; 35 | 36 | //! Set the mixture of input and "effected" levels in the output (0.0 = input only, 1.0 = effect only). 37 | virtual void setEffectMix( StkFloat mix ); 38 | 39 | protected: 40 | 41 | // Returns true if argument value is prime. 42 | bool isPrime( unsigned int number ); 43 | 44 | StkFrames lastFrame_; 45 | StkFloat effectMix_; 46 | 47 | }; 48 | 49 | inline void Effect :: setEffectMix( StkFloat mix ) 50 | { 51 | if ( mix < 0.0 ) { 52 | oStream_ << "Effect::setEffectMix: mix parameter is less than zero ... setting to zero!"; 53 | handleError( StkError::WARNING ); 54 | effectMix_ = 0.0; 55 | } 56 | else if ( mix > 1.0 ) { 57 | oStream_ << "Effect::setEffectMix: mix parameter is greater than 1.0 ... setting to one!"; 58 | handleError( StkError::WARNING ); 59 | effectMix_ = 1.0; 60 | } 61 | else 62 | effectMix_ = mix; 63 | } 64 | 65 | inline bool Effect :: isPrime( unsigned int number ) 66 | { 67 | if ( number == 2 ) return true; 68 | if ( number & 1 ) { 69 | for ( int i=3; i<(int)sqrt((double)number)+1; i+=2 ) 70 | if ( (number % i) == 0 ) return false; 71 | return true; // prime 72 | } 73 | else return false; // even 74 | } 75 | 76 | } // stk namespace 77 | 78 | #endif 79 | 80 | -------------------------------------------------------------------------------- /include/Function.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_FUNCTION_H 2 | #define STK_FUNCTION_H 3 | 4 | #include "Stk.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class Function 10 | \brief STK abstract function parent class. 11 | 12 | This class provides common functionality for STK classes that 13 | implement tables or other types of input to output function 14 | mappings. 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 17 | */ 18 | /***************************************************/ 19 | 20 | class Function : public Stk 21 | { 22 | public: 23 | //! Class constructor. 24 | Function( void ) { lastFrame_.resize( 1, 1, 0.0 ); }; 25 | 26 | //! Return the last computed output sample. 27 | StkFloat lastOut( void ) const { return lastFrame_[0]; }; 28 | 29 | //! Take one sample input and compute one sample of output. 30 | virtual StkFloat tick( StkFloat input ) = 0; 31 | 32 | protected: 33 | 34 | StkFrames lastFrame_; 35 | 36 | }; 37 | 38 | } // stk namespace 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /include/Generator.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_GENERATOR_H 2 | #define STK_GENERATOR_H 3 | 4 | #include "Stk.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class Generator 10 | \brief STK abstract unit generator parent class. 11 | 12 | This class provides limited common functionality for STK unit 13 | generator sample-source subclasses. It is general enough to 14 | support both monophonic and polyphonic output classes. 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 17 | */ 18 | /***************************************************/ 19 | 20 | class Generator : public Stk 21 | { 22 | public: 23 | 24 | //! Class constructor. 25 | Generator( void ) { lastFrame_.resize( 1, 1, 0.0 ); }; 26 | 27 | //! Return the number of output channels for the class. 28 | unsigned int channelsOut( void ) const { return lastFrame_.channels(); }; 29 | 30 | //! Return an StkFrames reference to the last output sample frame. 31 | const StkFrames& lastFrame( void ) const { return lastFrame_; }; 32 | 33 | //! Fill the StkFrames object with computed sample frames, starting at the specified channel. 34 | /*! 35 | The \c channel argument plus the number of output channels must 36 | be less than the number of channels in the StkFrames argument (the 37 | first channel is specified by 0). However, range checking is only 38 | performed if _STK_DEBUG_ is defined during compilation, in which 39 | case an out-of-range value will trigger an StkError exception. 40 | */ 41 | virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0; 42 | 43 | protected: 44 | 45 | StkFrames lastFrame_; 46 | }; 47 | 48 | } // stk namespace 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/ModalBar.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_MODALBAR_H 2 | #define STK_MODALBAR_H 3 | 4 | #include "Modal.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class ModalBar 10 | \brief STK resonant bar instrument class. 11 | 12 | This class implements a number of different 13 | struck bar instruments. It inherits from the 14 | Modal class. 15 | 16 | Control Change Numbers: 17 | - Stick Hardness = 2 18 | - Stick Position = 4 19 | - Vibrato Gain = 1 20 | - Vibrato Frequency = 11 21 | - Direct Stick Mix = 8 22 | - Volume = 128 23 | - Modal Presets = 16 24 | - Marimba = 0 25 | - Vibraphone = 1 26 | - Agogo = 2 27 | - Wood1 = 3 28 | - Reso = 4 29 | - Wood2 = 5 30 | - Beats = 6 31 | - Two Fixed = 7 32 | - Clump = 8 33 | 34 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 35 | */ 36 | /***************************************************/ 37 | 38 | class ModalBar : public Modal 39 | { 40 | public: 41 | //! Class constructor. 42 | ModalBar( void ); 43 | 44 | //! Class destructor. 45 | ~ModalBar( void ); 46 | 47 | //! Set stick hardness (0.0 - 1.0). 48 | void setStickHardness( StkFloat hardness ); 49 | 50 | //! Set stick position (0.0 - 1.0). 51 | void setStrikePosition( StkFloat position ); 52 | 53 | //! Select a bar preset (currently modulo 9). 54 | void setPreset( int preset ); 55 | 56 | //! Set the modulation (vibrato) depth (0.0 - 1.0). 57 | void setModulationDepth( StkFloat mDepth ); 58 | 59 | //! Perform the control change specified by \e number and \e value (0.0 - 128.0). 60 | void controlChange( int number, StkFloat value ); 61 | }; 62 | 63 | } // stk namespace 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/Mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_MUTEX_H 2 | #define STK_MUTEX_H 3 | 4 | #include "Stk.h" 5 | 6 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 7 | 8 | #include 9 | typedef pthread_mutex_t MUTEX; 10 | typedef pthread_cond_t CONDITION; 11 | 12 | #elif defined(__OS_WINDOWS__) 13 | 14 | #include 15 | #include 16 | typedef CRITICAL_SECTION MUTEX; 17 | typedef HANDLE CONDITION; 18 | 19 | #endif 20 | 21 | namespace stk { 22 | 23 | /***************************************************/ 24 | /*! \class Mutex 25 | \brief STK mutex class. 26 | 27 | This class provides a uniform interface for 28 | cross-platform mutex use. On Linux and IRIX 29 | systems, the pthread library is used. Under 30 | Windows, critical sections are used. 31 | 32 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 33 | */ 34 | /***************************************************/ 35 | 36 | class Mutex : public Stk 37 | { 38 | public: 39 | //! Default constructor. 40 | Mutex(); 41 | 42 | //! Class destructor. 43 | ~Mutex(); 44 | 45 | //! Lock the mutex. 46 | void lock(void); 47 | 48 | //! Unlock the mutex. 49 | void unlock(void); 50 | 51 | //! Wait indefinitely on the mutex condition variable. 52 | /*! 53 | The mutex must be locked before calling this function, and then 54 | subsequently unlocked after this function returns. 55 | */ 56 | void wait(void); 57 | 58 | //! Signal the condition variable. 59 | /*! 60 | The mutex must be locked before calling this function, and then 61 | subsequently unlocked after this function returns. 62 | */ 63 | void signal(void); 64 | 65 | protected: 66 | 67 | MUTEX mutex_; 68 | CONDITION condition_; 69 | 70 | }; 71 | 72 | } // stk namespace 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /include/Phonemes.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_PHONEMES_H 2 | #define STK_PHONEMES_H 3 | 4 | #include "Stk.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class Phonemes 10 | \brief STK phonemes table. 11 | 12 | This class does nothing other than declare a 13 | set of 32 static phoneme formant parameters 14 | and provide access to those values. 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 17 | */ 18 | /***************************************************/ 19 | 20 | class Phonemes : public Stk 21 | { 22 | public: 23 | 24 | Phonemes( void ); 25 | 26 | ~Phonemes( void ); 27 | 28 | //! Returns the phoneme name for the given index (0-31). 29 | static const char *name( unsigned int index ); 30 | 31 | //! Returns the voiced component gain for the given phoneme index (0-31). 32 | static StkFloat voiceGain( unsigned int index ); 33 | 34 | //! Returns the unvoiced component gain for the given phoneme index (0-31). 35 | static StkFloat noiseGain( unsigned int index ); 36 | 37 | //! Returns the formant frequency for the given phoneme index (0-31) and partial (0-3). 38 | static StkFloat formantFrequency( unsigned int index, unsigned int partial ); 39 | 40 | //! Returns the formant radius for the given phoneme index (0-31) and partial (0-3). 41 | static StkFloat formantRadius( unsigned int index, unsigned int partial ); 42 | 43 | //! Returns the formant gain for the given phoneme index (0-31) and partial (0-3). 44 | static StkFloat formantGain( unsigned int index, unsigned int partial ); 45 | 46 | private: 47 | 48 | static const char phonemeNames[][4]; 49 | static const StkFloat phonemeGains[][2]; 50 | static const StkFloat phonemeParameters[][4][3]; 51 | }; 52 | 53 | } // stk namespace 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /include/Sampler.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_SAMPLER_H 2 | #define STK_SAMPLER_H 3 | 4 | #include "Instrmnt.h" 5 | #include "ADSR.h" 6 | #include "FileLoop.h" 7 | #include "OnePole.h" 8 | 9 | namespace stk { 10 | 11 | /***************************************************/ 12 | /*! \class Sampler 13 | \brief STK sampling synthesis abstract base class. 14 | 15 | This instrument provides an ADSR envelope, a one-pole filter, and 16 | structures for an arbitrary number of attack and looped files. 17 | 18 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 19 | */ 20 | /***************************************************/ 21 | 22 | class Sampler : public Instrmnt 23 | { 24 | public: 25 | //! Default constructor. 26 | Sampler( void ); 27 | 28 | //! Class destructor. 29 | virtual ~Sampler( void ); 30 | 31 | //! Set instrument parameters for a particular frequency. 32 | virtual void setFrequency( StkFloat frequency ) = 0; 33 | 34 | //! Initiate the envelopes with a key-on event and reset the attack waves. 35 | void keyOn( void ); 36 | 37 | //! Signal a key-off event to the envelopes. 38 | void keyOff( void ); 39 | 40 | //! Stop a note with the given amplitude (speed of decay). 41 | virtual void noteOff( StkFloat amplitude ); 42 | 43 | //! Perform the control change specified by \e number and \e value (0.0 - 128.0). 44 | virtual void controlChange( int number, StkFloat value ) = 0; 45 | 46 | //! Compute and return one output sample. 47 | virtual StkFloat tick( unsigned int channel = 0 ) = 0; 48 | 49 | //! Fill a channel of the StkFrames object with computed outputs. 50 | /*! 51 | The \c channel argument must be less than the number of 52 | channels in the StkFrames argument (the first channel is specified 53 | by 0). However, range checking is only performed if _STK_DEBUG_ 54 | is defined during compilation, in which case an out-of-range value 55 | will trigger an StkError exception. 56 | */ 57 | virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0; 58 | 59 | protected: 60 | 61 | ADSR adsr_; 62 | std::vector attacks_; 63 | std::vector loops_; 64 | OnePole filter_; 65 | StkFloat baseFrequency_; 66 | std::vector attackRatios_; 67 | std::vector loopRatios_; 68 | StkFloat attackGain_; 69 | StkFloat loopGain_; 70 | 71 | }; 72 | 73 | } // stk namespace 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /include/TcpClient.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_TCPCLIENT_H 2 | #define STK_TCPCLIENT_H 3 | 4 | #include "Socket.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class TcpClient 10 | \brief STK TCP socket client class. 11 | 12 | This class provides a uniform cross-platform TCP socket client 13 | interface. Methods are provided for reading or writing data 14 | buffers to/from connections. 15 | 16 | TCP sockets are reliable and connection-oriented. A TCP socket 17 | client must be connected to a TCP server before data can be sent 18 | or received. Data delivery is guaranteed in order, without loss, 19 | error, or duplication. That said, TCP transmissions tend to be 20 | slower than those using the UDP protocol and data sent with 21 | multiple \e write() calls can be arbitrarily combined by the 22 | underlying system. 23 | 24 | The user is responsible for checking the values 25 | returned by the read/write methods. Values 26 | less than or equal to zero indicate a closed 27 | or lost connection or the occurence of an error. 28 | 29 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 30 | */ 31 | /***************************************************/ 32 | 33 | class TcpClient : public Socket 34 | { 35 | public: 36 | //! Default class constructor creates a socket client connection to the specified host and port. 37 | /*! 38 | An StkError will be thrown if a socket error occurs during instantiation. 39 | */ 40 | TcpClient( int port, std::string hostname = "localhost" ); 41 | 42 | //! The class destructor closes the socket instance, breaking any existing connections. 43 | ~TcpClient(); 44 | 45 | //! Connect the socket client to the specified host and port and returns the resulting socket descriptor. 46 | /*! 47 | If the socket client is already connected, that connection is 48 | terminated and a new connection is attempted. An StkError will be 49 | thrown if a socket error occurs. 50 | */ 51 | int connect( int port, std::string hostname = "localhost" ); 52 | 53 | //! Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occurs. 54 | int writeBuffer(const void *buffer, long bufferSize, int flags = 0); 55 | 56 | //! Read a buffer from the socket connection, up to length \e bufferSize. Returns the number of bytes read or -1 if an error occurs. 57 | int readBuffer(void *buffer, long bufferSize, int flags = 0); 58 | 59 | protected: 60 | 61 | }; 62 | 63 | } // stk namespace 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/TcpServer.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_TCPSERVER_H 2 | #define STK_TCPSERVER_H 3 | 4 | #include "Socket.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class TcpServer 10 | \brief STK TCP socket server class. 11 | 12 | This class provides a uniform cross-platform TCP socket server 13 | interface. Methods are provided for reading or writing data 14 | buffers to/from connections. 15 | 16 | TCP sockets are reliable and connection-oriented. A TCP socket 17 | server must accept a connection from a TCP client before data can 18 | be sent or received. Data delivery is guaranteed in order, 19 | without loss, error, or duplication. That said, TCP transmissions 20 | tend to be slower than those using the UDP protocol and data sent 21 | with multiple \e write() calls can be arbitrarily combined by the 22 | underlying system. 23 | 24 | The user is responsible for checking the values 25 | returned by the read/write methods. Values 26 | less than or equal to zero indicate a closed 27 | or lost connection or the occurence of an error. 28 | 29 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 30 | */ 31 | /***************************************************/ 32 | 33 | class TcpServer : public Socket 34 | { 35 | public: 36 | //! Default constructor creates a local socket server on port 2006 (or the specified port number). 37 | /*! 38 | An StkError will be thrown if a socket error occurs during instantiation. 39 | */ 40 | TcpServer( int port = 2006 ); 41 | 42 | //! The class destructor closes the socket instance, breaking any existing connections. 43 | ~TcpServer(); 44 | 45 | //! Extract the first pending connection request from the queue and create a new connection, returning the descriptor for the accepted socket. 46 | /*! 47 | If no connection requests are pending and the socket has not 48 | been set non-blocking, this function will block until a connection 49 | is present. If an error occurs, -1 is returned. 50 | */ 51 | int accept( void ); 52 | 53 | //! Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occurs. 54 | int writeBuffer(const void *buffer, long bufferSize, int flags = 0); 55 | 56 | //! Read a buffer from the socket connection, up to length \e bufferSize. Returns the number of bytes read or -1 if an error occurs. 57 | int readBuffer(void *buffer, long bufferSize, int flags = 0); 58 | 59 | protected: 60 | 61 | }; 62 | 63 | } // stk namespace 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/Vector3D.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_VECTOR3D_H 2 | #define STK_VECTOR3D_H 3 | 4 | #include "Stk.h" 5 | #include 6 | 7 | namespace stk { 8 | 9 | /***************************************************/ 10 | /*! \class Vector3D 11 | \brief STK 3D vector class. 12 | 13 | This class implements a three-dimensional vector. 14 | 15 | by Perry R. Cook, 1995--2023. 16 | */ 17 | /***************************************************/ 18 | 19 | class Vector3D : public Stk 20 | { 21 | 22 | public: 23 | //! Default constructor taking optional initial X, Y, and Z values. 24 | Vector3D( StkFloat x = 0.0, StkFloat y = 0.0, StkFloat z = 0.0 ) { setXYZ( x, y, z ); }; 25 | 26 | //! Get the current X value. 27 | StkFloat getX( void ) { return X_; }; 28 | 29 | //! Get the current Y value. 30 | StkFloat getY( void ) { return Y_; }; 31 | 32 | //! Get the current Z value. 33 | StkFloat getZ( void ) { return Z_; }; 34 | 35 | //! Calculate the vector length. 36 | StkFloat getLength( void ); 37 | 38 | //! Set the X, Y, and Z values simultaniously. 39 | void setXYZ( StkFloat x, StkFloat y, StkFloat z ) { X_ = x; Y_ = y; Z_ = z; }; 40 | 41 | //! Set the X value. 42 | void setX( StkFloat x ) { X_ = x; }; 43 | 44 | //! Set the Y value. 45 | void setY( StkFloat y ) { Y_ = y; }; 46 | 47 | //! Set the Z value. 48 | void setZ( StkFloat z ) { Z_ = z; }; 49 | 50 | protected: 51 | StkFloat X_; 52 | StkFloat Y_; 53 | StkFloat Z_; 54 | }; 55 | 56 | inline StkFloat Vector3D :: getLength( void ) 57 | { 58 | StkFloat temp; 59 | temp = X_ * X_; 60 | temp += Y_ * Y_; 61 | temp += Z_ * Z_; 62 | temp = sqrt( temp ); 63 | return temp; 64 | } 65 | 66 | } // stk namespace 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/WvIn.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_WVIN_H 2 | #define STK_WVIN_H 3 | 4 | #include "Stk.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class WvIn 10 | \brief STK audio input abstract base class. 11 | 12 | This class provides common functionality for a variety of audio 13 | data input subclasses. 14 | 15 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 16 | */ 17 | /***************************************************/ 18 | 19 | class WvIn : public Stk 20 | { 21 | public: 22 | //! Return the number of audio channels in the data or stream. 23 | unsigned int channelsOut( void ) const { return data_.channels(); }; 24 | 25 | //! Return an StkFrames reference to the last computed sample frame. 26 | /*! 27 | If no file data is loaded, an empty container is returned. 28 | */ 29 | const StkFrames& lastFrame( void ) const { return lastFrame_; }; 30 | 31 | //! Compute one sample frame and return the specified \c channel value. 32 | virtual StkFloat tick( unsigned int channel = 0 ) = 0; 33 | 34 | //! Fill the StkFrames object with computed sample frames, starting at the specified channel and return the same reference. 35 | virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0; 36 | 37 | protected: 38 | 39 | StkFrames data_; 40 | StkFrames lastFrame_; 41 | 42 | }; 43 | 44 | } // stk namespace 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/WvOut.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_WVOUT_H 2 | #define STK_WVOUT_H 3 | 4 | #include "Stk.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class WvOut 10 | \brief STK audio output abstract base class. 11 | 12 | This class provides common functionality for a variety of audio 13 | data output subclasses. 14 | 15 | Currently, WvOut is non-interpolating and the output rate is 16 | always Stk::sampleRate(). 17 | 18 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 19 | */ 20 | /***************************************************/ 21 | 22 | class WvOut : public Stk 23 | { 24 | public: 25 | 26 | //! Default constructor. 27 | WvOut( void ) : frameCounter_(0), clipping_(false) {}; 28 | 29 | //! Return the number of sample frames output. 30 | unsigned long getFrameCount( void ) const { return frameCounter_; }; 31 | 32 | //! Return the number of seconds of data output. 33 | StkFloat getTime( void ) const { return (StkFloat) frameCounter_ / Stk::sampleRate(); }; 34 | 35 | //! Returns \c true if clipping has been detected during output since instantiation or the last reset. 36 | bool clipStatus( void ) { return clipping_; }; 37 | 38 | //! Reset the clipping status to \c false. 39 | void resetClipStatus( void ) { clipping_ = false; }; 40 | 41 | //! Output a single sample to all channels in a sample frame. 42 | /*! 43 | An StkError is thrown if an output error occurs. 44 | */ 45 | virtual void tick( const StkFloat sample ) = 0; 46 | 47 | //! Output the StkFrames data. 48 | virtual void tick( const StkFrames& frames ) = 0; 49 | 50 | protected: 51 | 52 | // Check for sample clipping and clamp. 53 | StkFloat& clipTest( StkFloat& sample ); 54 | 55 | StkFrames data_; 56 | unsigned long frameCounter_; 57 | bool clipping_; 58 | 59 | }; 60 | 61 | inline StkFloat& WvOut :: clipTest( StkFloat& sample ) 62 | { 63 | bool clip = false; 64 | if ( sample > 1.0 ) { 65 | sample = 1.0; 66 | clip = true; 67 | } 68 | else if ( sample < -1.0 ) { 69 | sample = -1.0; 70 | clip = true; 71 | } 72 | 73 | if ( clip == true && clipping_ == false ) { 74 | // First occurrence of clipping since instantiation or reset. 75 | clipping_ = true; 76 | oStream_ << "WvOut: data value(s) outside +-1.0 detected ... clamping at outer bound!"; 77 | handleError( StkError::WARNING ); 78 | } 79 | 80 | return sample; 81 | } 82 | 83 | } // stk namespace 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /projects/demo/Banded: -------------------------------------------------------------------------------- 1 | wish < tcl/Banded.tcl | ./stk-demo BandedWG -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Banded.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Banded.tcl | stk-demo BandedWG -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(demo) 2 | 3 | file(GLOB DEMO_SRC "./*.cpp") 4 | 5 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}") 6 | 7 | add_executable(stk-demo "demo.cpp" "utilities.cpp") 8 | target_include_directories(stk-demo PRIVATE "./") 9 | target_link_libraries(stk-demo PUBLIC stk) -------------------------------------------------------------------------------- /projects/demo/Drums: -------------------------------------------------------------------------------- 1 | wish < tcl/Drums.tcl | ./stk-demo Drummer -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Drums.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Drums.tcl | stk-demo Drummer -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Modal: -------------------------------------------------------------------------------- 1 | wish < tcl/Modal.tcl | ./stk-demo ModalBar -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Modal.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Modal.tcl | stk-demo ModalBar -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Physical: -------------------------------------------------------------------------------- 1 | wish < tcl/Physical.tcl | ./stk-demo Clarinet -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Physical.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Physical.tcl | stk-demo Clarinet -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Shakers: -------------------------------------------------------------------------------- 1 | wish < tcl/Shakers.tcl | ./stk-demo Shakers -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Shakers.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Shakers.tcl | stk-demo Shakers -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/StkDemo: -------------------------------------------------------------------------------- 1 | wish < tcl/Demo.tcl | ./stk-demo Clarinet -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/StkDemo.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Demo.tcl | stk-demo Clarinet -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Voice: -------------------------------------------------------------------------------- 1 | wish < tcl/Voice.tcl | ./stk-demo FMVoices -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/Voice.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Voice.tcl | stk-demo FMVoices -or -ip 2 | -------------------------------------------------------------------------------- /projects/demo/demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2011 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demo", "demo.vcxproj", "{9EB1E236-C8B6-4AB8-B037-1222FE183ABE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {9EB1E236-C8B6-4AB8-B037-1222FE183ABE}.Debug|x86.ActiveCfg = Debug|Win32 15 | {9EB1E236-C8B6-4AB8-B037-1222FE183ABE}.Debug|x86.Build.0 = Debug|Win32 16 | {9EB1E236-C8B6-4AB8-B037-1222FE183ABE}.Release|x86.ActiveCfg = Release|Win32 17 | {9EB1E236-C8B6-4AB8-B037-1222FE183ABE}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D42DE6A6-2EBC-4622-9BB2-79E09E47156D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /projects/demo/scores/README: -------------------------------------------------------------------------------- 1 | Suggested Score/Instrument Pairings: 2 | 3 | BeeThree bookert.ski, organs.ski 4 | Rhodey doogie.ski 5 | Mandolin duelingb.ski 6 | Bowed muneira.ski, fiddle.ski 7 | PercFlut misacrio.ski 8 | ModalBar morazbel.ski 9 | Brass pictures.ski 10 | Wurley riderson.ski 11 | Flute simplgft.ski 12 | Clarinet simplgft.ski 13 | ModalBar spain.ski 14 | HevyMetl streetsf.ski 15 | Moog thecars.ski 16 | TubeBell tubebell.ski 17 | 18 | FMVoices lacrymos.ski, vocaliz.ski 19 | VoicForm lacrymos.ski, vocaliz.ski 20 | -------------------------------------------------------------------------------- /projects/demo/scores/doogie.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 72 88.899998 3 | NoteOff 0.400000 1 72 63.500000 4 | NoteOn 0.000000 1 71 101.600002 5 | NoteOff 0.400000 1 71 63.500000 6 | NoteOn 0.000000 1 69 63.500000 7 | NoteOff 0.320000 1 69 63.500000 8 | NoteOn 0.080000 1 71 101.600002 9 | NoteOff 1.200000 1 71 63.500000 10 | NoteOn 0.000000 1 67 76.200003 11 | NoteOff 0.320000 1 67 63.500000 12 | NoteOn 0.080000 1 64 38.100002 13 | NoteOff 0.320000 1 64 63.500000 14 | NoteOn 0.080000 1 67 101.600002 15 | NoteOff 0.800000 1 67 63.500000 16 | NoteOn 0.000000 1 69 127.000000 17 | NoteOff 0.320000 1 69 63.500000 18 | NoteOn 0.080000 1 69 76.200003 19 | NoteOff 2.000000 1 69 63.500000 20 | NoteOn 0.000000 1 60 114.299997 21 | NoteOff 0.400000 1 60 63.500000 22 | NoteOn 0.000000 1 62 63.500000 23 | NoteOff 0.400000 1 62 63.500000 24 | NoteOn 0.000000 1 64 63.500000 25 | NoteOff 0.400000 1 64 63.500000 26 | NoteOn 0.000000 1 62 88.899998 27 | NoteOff 1.200000 1 62 63.500000 28 | NoteOn 0.000000 1 60 38.100002 29 | NoteOff 0.480000 1 60 63.500000 30 | NoteOn 0.120000 1 60 127.000000 31 | ControlChange 0.000000 1 1 127.000000 32 | NoteOff 2.000000 1 60 63.500000 33 | -------------------------------------------------------------------------------- /projects/demo/scores/drumtest.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.300000 1 36 10.000000 3 | NoteOn 0.300000 1 36 50.000000 4 | NoteOn 0.300000 1 36 90.000000 5 | NoteOn 0.300000 1 36 127.000000 6 | 7 | NoteOn 0.300000 1 38 10.000000 8 | NoteOn 0.300000 1 38 50.000000 9 | NoteOn 0.300000 1 38 90.000000 10 | NoteOn 0.300000 1 38 127.000000 11 | 12 | NoteOn 0.300000 1 41 10.000000 13 | NoteOn 0.300000 1 41 50.000000 14 | NoteOn 0.300000 1 41 90.000000 15 | NoteOn 0.300000 1 41 127.000000 16 | 17 | NoteOn 0.300000 1 42 10.000000 18 | NoteOn 0.300000 1 42 50.000000 19 | NoteOn 0.300000 1 42 90.000000 20 | NoteOn 0.300000 1 42 127.000000 21 | 22 | NoteOn 0.300000 1 45 10.000000 23 | NoteOn 0.300000 1 45 50.000000 24 | NoteOn 0.300000 1 45 90.000000 25 | NoteOn 0.300000 1 45 127.000000 26 | 27 | NoteOn 0.300000 1 46 10.000000 28 | NoteOn 0.300000 1 46 50.000000 29 | NoteOn 0.300000 1 46 90.000000 30 | NoteOn 0.300000 1 46 127.000000 31 | 32 | NoteOn 0.300000 1 48 10.000000 33 | NoteOn 0.300000 1 48 50.000000 34 | NoteOn 0.300000 1 48 90.000000 35 | NoteOn 0.300000 1 48 127.000000 36 | 37 | NoteOn 0.300000 1 49 10.000000 38 | NoteOn 0.300000 1 49 50.000000 39 | NoteOn 0.300000 1 49 90.000000 40 | NoteOn 0.300000 1 49 127.000000 41 | 42 | NoteOn 0.300000 1 54 10.000000 43 | NoteOn 0.300000 1 54 50.000000 44 | NoteOn 0.300000 1 54 90.000000 45 | NoteOn 0.300000 1 54 127.000000 46 | 47 | NoteOn 0.300000 1 56 10.000000 48 | NoteOn 0.300000 1 56 50.000000 49 | NoteOn 0.300000 1 56 90.000000 50 | NoteOn 0.300000 1 56 127.000000 51 | 52 | NoteOn 0.300000 1 57 10.000000 53 | NoteOn 0.300000 1 57 50.000000 54 | NoteOn 0.300000 1 57 90.000000 55 | NoteOn 0.300000 1 57 127.000000 56 | 57 | Exit 58 | -------------------------------------------------------------------------------- /projects/demo/scores/duelingb.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 57 50.800001 3 | NoteOn 0.100000 1 57 50.800001 4 | NoteOn 0.100000 1 57 127.000000 5 | NoteOn 0.200000 1 59 63.500000 6 | NoteOff 0.100000 1 59 63.500000 7 | NoteOn 0.100000 1 61 127.000000 8 | NoteOff 0.100000 1 61 63.500000 9 | NoteOn 0.100000 1 62 127.000000 10 | NoteOff 0.100000 1 62 63.500000 11 | NoteOn 0.100000 1 64 114.299997 12 | NoteOn 0.200000 1 62 63.500000 13 | NoteOff 0.100000 1 62 63.500000 14 | NoteOn 0.100000 1 61 127.000000 15 | NoteOn 0.400000 1 69 127.000000 16 | NoteOn 0.200000 1 69 12.700000 17 | NoteOff 0.049977 1 69 63.500000 18 | NoteOn 0.049977 1 73 63.500000 19 | NoteOff 0.049977 1 73 63.500000 20 | NoteOn 0.049977 1 71 63.500000 21 | NoteOff 0.100000 1 71 63.500000 22 | NoteOn 0.100000 1 85 127.000000 23 | NoteOn 0.200000 1 45 50.800001 24 | NoteOff 0.400000 1 45 63.500000 25 | -------------------------------------------------------------------------------- /projects/demo/scores/lacrymos.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | ControlChange 0.000000 1 1 20.000000 3 | ControlChange 0.000000 1 4 22.000000 4 | NoteOn 0.000000 1 46 64.000000 5 | ControlChange 0.200000 1 4 8.000000 6 | NoteOff 0.800000 1 46 64.500000 7 | NoteOn 0.000000 1 51 74.000000 8 | NoteOff 0.750000 1 51 74.500000 9 | NoteOn 0.000000 1 53 84.000000 10 | ControlChange 0.000000 1 4 0.000000 11 | NoteOff 0.250000 1 53 84.500000 12 | NoteOn 0.000000 1 54 84.000000 13 | ControlChange 0.000000 1 4 10.000000 14 | NoteOff 1.500000 1 54 84.500000 15 | NoteOn 0.000000 1 54 84.000000 16 | ControlChange 0.000000 1 4 8.000000 17 | NoteOff 0.500000 1 54 84.500000 18 | NoteOn 0.000000 1 53 84.000000 19 | ControlChange 0.000000 1 4 0.000000 20 | NoteOff 0.500000 1 53 84.500000 21 | NoteOn 0.000000 1 51 84.000000 22 | NoteOff 0.500000 1 51 84.500000 23 | NoteOn 0.000000 1 53 84.000000 24 | ControlChange 0.000000 1 4 4.000000 25 | NoteOff 0.500000 1 53 84.500000 26 | NoteOn 0.000000 1 54 94.000000 27 | NoteOff 0.500000 1 54 94.500000 28 | NoteOn 0.000000 1 51 74.000000 29 | ControlChange 0.000000 1 4 0.000000 30 | NoteOff 1.000000 1 51 74.500000 31 | NoteOn 0.000000 1 46 32.000000 32 | ControlChange 0.000000 1 4 8.000000 33 | ControlChange 0.000000 1 1 40.000000 34 | NoteOff 1.950023 1 46 64.500000 35 | -------------------------------------------------------------------------------- /projects/demo/scores/mandtune.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000082 2 55 82 3 | NoteOff 1.000000 2 55 0 4 | NoteOn 0.000082 2 55 82 5 | NoteOff 0.700000 2 55 0 6 | NoteOn 0.000082 2 62 82 7 | NoteOff 0.600000 2 62 0 8 | NoteOn 0.000082 2 62 82 9 | NoteOff 1.000000 2 62 0 10 | NoteOn 0.000082 2 69 82 11 | NoteOff 0.500000 2 69 0 12 | ControlChange 0.100000 1 1 10 13 | ControlChange 0.100000 1 1 20 14 | ControlChange 0.100000 1 1 30 15 | ControlChange 0.100000 1 1 40 16 | ControlChange 0.100000 1 1 50 17 | NoteOn 0.000000 2 69 82 18 | ControlChange 0.100000 1 1 40 19 | ControlChange 0.100000 1 1 30 20 | ControlChange 0.100000 1 1 22 21 | ControlChange 0.100000 1 1 12 22 | NoteOn 0.000000 2 69 82 23 | ControlChange 0.100000 1 1 10 24 | ControlChange 0.100000 1 1 20 25 | ControlChange 0.100000 1 1 30 26 | ControlChange 0.100000 1 1 40 27 | ControlChange 0.100000 1 1 50 28 | ControlChange 0.100000 1 1 60 29 | ControlChange 0.100000 1 1 50 30 | ControlChange 0.100000 1 1 40 31 | ControlChange 0.100000 1 1 30 32 | ControlChange 0.100000 1 1 20 33 | ControlChange 0.100000 1 1 10 34 | ControlChange 0.100000 1 1 6 35 | NoteOn 0.000082 2 69 82 36 | NoteOff 1.000000 2 69 0 37 | NoteOn 0.000082 2 76 82 38 | NoteOff 0.800000 2 76 0 39 | NoteOn 0.000082 2 76 82 40 | NoteOff 0.800000 2 76 0 41 | NoteOn 0.000082 2 55 82 42 | NoteOn 0.200000 2 62 82 43 | NoteOn 0.100000 2 71 82 44 | NoteOn 0.200000 2 79 82 45 | NoteOff 1.000000 2 79 82 46 | -------------------------------------------------------------------------------- /projects/demo/scores/marimtst.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 32 88.899998 3 | NoteOn 0.050000 1 32 88.899998 4 | NoteOn 0.050000 1 32 88.899998 5 | NoteOn 0.050000 1 32 88.899998 6 | NoteOn 0.050000 1 32 88.899998 7 | StickHardness 0.000000 1 100 8 | NoteOn 0.050000 1 32 88.899998 9 | NoteOn 0.050000 1 32 88.899998 10 | NoteOn 0.050000 1 32 88.899998 11 | NoteOn 0.050000 1 32 88.899998 12 | NoteOn 0.050000 1 32 88.899998 13 | StickHardness 0.000000 1 80 14 | NoteOn 0.050000 1 32 88.899998 15 | NoteOn 0.050000 1 32 88.899998 16 | NoteOn 0.050000 1 32 88.899998 17 | NoteOn 0.050000 1 32 88.899998 18 | NoteOn 0.050000 1 32 88.899998 19 | StickHardness 0.000000 1 60 20 | NoteOn 0.050000 1 32 88.899998 21 | NoteOn 0.050000 1 32 88.899998 22 | NoteOn 0.050000 1 32 88.899998 23 | NoteOn 0.050000 1 32 88.899998 24 | NoteOn 0.050000 1 32 88.899998 25 | NoteOn 0.050000 1 32 88.899998 26 | StickHardness 0.000000 1 40 27 | NoteOn 0.050000 1 32 88.899998 28 | NoteOn 0.050000 1 32 88.899998 29 | NoteOn 0.050000 1 32 88.899998 30 | NoteOn 0.050000 1 32 88.899998 31 | NoteOn 0.050000 1 32 88.899998 32 | NoteOn 0.050000 1 32 88.899998 33 | StickHardness 0.000000 1 20 34 | NoteOn 0.050000 1 32 88.899998 35 | NoteOn 0.050000 1 32 88.899998 36 | NoteOn 0.050000 1 32 88.899998 37 | NoteOn 0.050000 1 32 88.899998 38 | NoteOn 0.050000 1 32 88.899998 39 | StickHardness 0.000000 1 10 40 | NoteOn 0.050000 1 32 88.899998 41 | NoteOn 0.050000 1 32 88.899998 42 | NoteOn 0.050000 1 32 88.899998 43 | NoteOn 0.050000 1 32 88.899998 44 | NoteOn 0.050000 1 32 88.899998 45 | NoteOn 0.050000 1 32 88.899998 46 | -------------------------------------------------------------------------------- /projects/demo/scores/pictures.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 72 127.000000 3 | NoteOff 0.540000 1 72 63.500000 4 | NoteOn 0.060000 1 70 127.000000 5 | NoteOff 0.540000 1 70 63.500000 6 | NoteOn 0.060000 1 75 127.000000 7 | NoteOff 0.540000 1 75 63.500000 8 | NoteOn 0.060000 1 77 127.000000 9 | NoteOff 0.270023 1 77 63.500000 10 | NoteOn 0.030023 1 70 127.000000 11 | ControlChange 0.000000 1 2 96.000000 12 | NoteOff 0.299728 1 70 63.500000 13 | NoteOn 0.000317 1 79 127.000000 14 | NoteOff 0.540000 1 79 63.500000 15 | NoteOn 0.060000 1 77 127.000000 16 | NoteOff 0.270023 1 77 63.500000 17 | NoteOn 0.030023 1 70 127.000000 18 | ControlChange 0.000000 1 2 96.000000 19 | NoteOff 0.299728 1 70 63.500000 20 | NoteOn 0.000317 1 79 127.000000 21 | NoteOff 0.540000 1 79 63.500000 22 | NoteOn 0.060000 1 75 127.000000 23 | NoteOff 0.540000 1 75 63.500000 24 | NoteOn 0.060000 1 77 127.000000 25 | NoteOff 0.540000 1 77 63.500000 26 | NoteOn 0.060000 1 72 127.000000 27 | NoteOff 0.540000 1 72 63.500000 28 | NoteOn 0.060000 1 70 127.000000 29 | NoteOff 0.540000 1 70 63.500000 30 | NoteOff 0.060000 1 70 63.500000 31 | -------------------------------------------------------------------------------- /projects/demo/scores/scales.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | PlayerSkill 0.0 2 100 3 | NoteOn 0.0 2 67 64 4 | NoteOff 0.5 2 67 0 5 | NoteOn 0.0 2 69 64 6 | NoteOff 0.5 2 69 0 7 | NoteOn 0.0 2 71 64 8 | NoteOff 0.5 2 71 0 9 | NoteOn 0.0 2 72 64 10 | NoteOff 0.5 2 72 0 11 | NoteOn 0.0 2 74 64 12 | NoteOff 0.5 2 74 0 13 | NoteOn 0.0 2 72 64 14 | NoteOff 0.5 2 72 0 15 | NoteOn 0.0 2 71 64 16 | NoteOff 0.5 2 71 0 17 | NoteOn 0.0 2 69 64 18 | NoteOff 0.5 2 69 0 19 | PlayerSkill 0.0 2 10 20 | NoteOn 0.0 2 67 64 21 | NoteOff 0.5 2 67 0 22 | NoteOn 0.0 2 69 64 23 | NoteOff 0.5 2 69 0 24 | NoteOn 0.0 2 71 64 25 | NoteOff 0.5 2 71 0 26 | NoteOn 0.0 2 72 64 27 | NoteOff 0.5 2 72 0 28 | NoteOn 0.0 2 74 64 29 | NoteOff 0.5 2 74 0 30 | NoteOn 0.0 2 72 64 31 | NoteOff 0.5 2 72 0 32 | NoteOn 0.0 2 71 64 33 | NoteOff 0.5 2 71 0 34 | NoteOn 0.0 2 69 64 35 | NoteOff 0.5 2 69 0 36 | Strumming 0.0 2 127 37 | PlayerSkill 0.0 2 127 38 | NoteOn 0.0 2 67 64 39 | NoteOff 0.5 2 67 0 40 | NoteOn 0.0 2 69 64 41 | NoteOff 0.5 2 69 0 42 | NoteOn 0.0 2 71 64 43 | NoteOff 0.5 2 71 0 44 | NoteOn 0.0 2 72 64 45 | NoteOff 0.5 2 72 0 46 | NoteOn 0.0 2 74 64 47 | NoteOff 0.5 2 74 0 48 | NoteOn 0.0 2 72 64 49 | NoteOff 0.5 2 72 0 50 | NoteOn 0.0 2 71 64 51 | NoteOff 0.5 2 71 0 52 | NoteOn 0.0 2 69 64 53 | NoteOff 0.5 2 69 0 54 | PlayerSkill 0.0 2 0 55 | NoteOn 0.0 2 67 64 56 | NoteOff 0.5 2 67 0 57 | NoteOn 0.0 2 69 64 58 | NoteOff 0.5 2 69 0 59 | NoteOn 0.0 2 71 64 60 | NoteOff 0.5 2 71 0 61 | NoteOn 0.0 2 72 64 62 | NoteOff 0.5 2 72 0 63 | NoteOn 0.0 2 74 64 64 | NoteOff 0.5 2 74 0 65 | NoteOn 0.0 2 72 64 66 | NoteOff 0.5 2 72 0 67 | NoteOn 0.0 2 71 64 68 | NoteOff 0.5 2 71 0 69 | NoteOn 0.0 2 69 64 70 | NoteOff 0.5 2 69 0 71 | NoteOn 0.0 2 67 64 72 | NoteOff 2.0 2 67 0 73 | -------------------------------------------------------------------------------- /projects/demo/scores/shaktest.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | 3 | Maraca 0.000000 1 4 | NoteOn 0.500000 1 80 10.000000 5 | NoteOn 0.500000 1 80 50.000000 6 | NoteOn 0.500000 1 80 90.000000 7 | NoteOn 0.500000 1 80 127.000000 8 | 9 | ControlChange 0.500000 1 1 1 10 | NoteOn 0.000000 1 80 64.000000 11 | ControlChange 0.500000 1 1 40 12 | NoteOn 0.000000 1 80 64.000000 13 | ControlChange 0.500000 1 1 80 14 | NoteOn 0.000000 1 80 64.000000 15 | ControlChange 0.500000 1 1 120 16 | NoteOn 0.000000 1 80 64.000000 17 | 18 | Maraca 0.500000 1 19 | ControlChange 0.000000 1 4 1 20 | NoteOn 0.000000 1 80 64.000000 21 | ControlChange 0.500000 1 4 40 22 | NoteOn 0.000000 1 80 64.000000 23 | ControlChange 0.500000 1 4 80 24 | NoteOn 0.000000 1 80 64.000000 25 | ControlChange 0.500000 1 4 120 26 | NoteOn 0.000000 1 80 64.000000 27 | 28 | Maraca 0.500000 1 29 | ControlChange 0.000000 1 11 1 30 | NoteOn 0.000000 1 80 64.000000 31 | ControlChange 1.000000 1 11 4 32 | NoteOn 0.000000 1 80 64.000000 33 | ControlChange 1.000000 1 11 16 34 | NoteOn 0.000000 1 80 64.000000 35 | ControlChange 1.000000 1 11 64 36 | NoteOn 0.000000 1 80 64.000000 37 | ControlChange 1.000000 1 11 128 38 | NoteOn 0.000000 1 80 64.000000 39 | 40 | Cabasa 0.500000 1 41 | NoteOn 0.000000 1 80 10.000000 42 | NoteOn 0.500000 1 80 50.000000 43 | NoteOn 0.500000 1 80 90.000000 44 | NoteOn 0.500000 1 80 127.000000 45 | 46 | Sekere 0.500000 1 47 | NoteOn 0.000000 1 80 10.000000 48 | NoteOn 0.500000 1 80 50.000000 49 | NoteOn 0.500000 1 80 90.000000 50 | NoteOn 0.500000 1 80 127.000000 51 | 52 | Tambourn 0.500000 1 53 | NoteOn 0.000000 1 80 10.000000 54 | NoteOn 0.500000 1 80 50.000000 55 | NoteOn 0.500000 1 80 90.000000 56 | NoteOn 0.500000 1 80 127.000000 57 | 58 | Sleighbl 0.500000 1 59 | NoteOn 0.000000 1 80 10.000000 60 | NoteOn 0.500000 1 80 50.000000 61 | NoteOn 0.500000 1 80 90.000000 62 | NoteOn 0.500000 1 80 127.000000 63 | 64 | Exit 65 | -------------------------------------------------------------------------------- /projects/demo/scores/simplgft.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 60 127.000000 3 | NoteOff 0.475011 1 60 63.500000 4 | NoteOn 0.025034 1 65 127.000000 5 | NoteOff 0.475011 1 65 63.500000 6 | NoteOn 0.025034 1 65 127.000000 7 | NoteOff 0.124989 1 65 63.500000 8 | NoteOn 0.124989 1 67 127.000000 9 | NoteOff 0.124989 1 67 63.500000 10 | NoteOn 0.124989 1 69 127.000000 11 | NoteOff 0.237506 1 69 63.500000 12 | NoteOn 0.012517 1 65 127.000000 13 | NoteOff 0.124989 1 65 63.500000 14 | NoteOn 0.124989 1 69 127.000000 15 | NoteOff 0.124989 1 69 63.500000 16 | NoteOn 0.124989 1 70 127.000000 17 | NoteOff 0.237506 1 70 63.500000 18 | NoteOn 0.012517 1 72 127.000000 19 | NoteOff 0.475011 1 72 63.500000 20 | NoteOn 0.025034 1 72 127.000000 21 | NoteOff 0.237506 1 72 63.500000 22 | NoteOn 0.012517 1 70 127.000000 23 | NoteOff 0.124989 1 70 63.500000 24 | NoteOn 0.124989 1 69 127.000000 25 | NoteOff 0.475011 1 69 63.500000 26 | NoteOn 0.025034 1 79 127.000000 27 | NoteOff 0.124989 1 79 63.500000 28 | NoteOn 0.124989 1 77 127.000000 29 | NoteOff 0.124989 1 77 63.500000 30 | NoteOn 0.124989 1 79 127.000000 31 | NoteOff 0.475011 1 79 63.500000 32 | NoteOn 0.025034 1 79 127.000000 33 | NoteOff 0.475011 1 79 63.500000 34 | NoteOn 0.025034 1 81 127.000000 35 | NoteOff 0.475011 1 81 63.500000 36 | NoteOn 0.025034 1 81 127.000000 37 | NoteOff 0.124989 1 81 63.500000 38 | NoteOn 0.124989 1 79 127.000000 39 | NoteOff 0.124989 1 79 63.500000 40 | NoteOn 0.124989 1 77 127.000000 41 | ControlChange 0.000000 1 1 32.000000 42 | NoteOff 0.475011 1 77 63.500000 43 | NoteOn 0.025034 1 65 127.000000 44 | NoteOff 0.475011 1 65 63.500000 45 | NoteOn 0.025034 1 41 127.000000 46 | NoteOff 0.950023 1 41 63.500000 47 | NoteOff 0.050023 1 41 63.500000 48 | -------------------------------------------------------------------------------- /projects/demo/scores/spain.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 48 88.899998 3 | NoteOff 0.416009 1 48 63.500000 4 | NoteOn 0.104036 1 53 101.600002 5 | NoteOff 0.312018 1 53 63.500000 6 | NoteOn 0.078005 1 56 63.500000 7 | NoteOn 0.130023 1 55 101.600002 8 | NoteOn 0.260000 1 51 76.200003 9 | NoteOn 0.130023 1 48 38.100002 10 | NoteOn 0.130023 1 53 101.600002 11 | NoteOn 0.520000 1 58 127.000000 12 | NoteOff 0.312018 1 58 63.500000 13 | NoteOn 0.078005 1 63 76.200003 14 | NoteOn 0.130023 1 62 114.299997 15 | NoteOff 0.416009 1 62 63.500000 16 | NoteOn 0.104036 1 58 127.000000 17 | NoteOn 0.130023 1 60 50.800001 18 | NoteOn 0.260000 1 56 88.899998 19 | NoteOn 0.260000 1 56 63.500000 20 | NoteOn 0.130023 1 63 76.200003 21 | NoteOn 0.260000 1 41 127.000000 22 | ControlChange 0.000000 1 1 127.000000 23 | NoteOff 1.950023 1 41 63.500000 24 | -------------------------------------------------------------------------------- /projects/demo/scores/streetsf.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 60 127.000000 3 | NoteOff 0.126032 1 60 63.500000 4 | NoteOn 0.014014 1 60 127.000000 5 | NoteOff 0.252018 1 60 63.500000 6 | NoteOn 0.028027 1 60 127.000000 7 | NoteOff 0.252018 1 60 63.500000 8 | NoteOn 0.028027 1 60 127.000000 9 | NoteOff 0.126032 1 60 63.500000 10 | NoteOn 0.014014 1 63 127.000000 11 | NoteOff 0.126032 1 63 63.500000 12 | NoteOn 0.014014 1 60 127.000000 13 | NoteOff 0.126032 1 60 63.500000 14 | NoteOn 0.014014 1 65 127.000000 15 | NoteOff 0.252018 1 65 63.500000 16 | NoteOn 0.028027 1 67 127.000000 17 | NoteOff 0.756009 1 67 63.500000 18 | NoteOn 0.084036 1 72 127.000000 19 | NoteOff 0.252018 1 72 63.500000 20 | NoteOn 0.028027 1 75 127.000000 21 | NoteOff 0.126032 1 75 63.500000 22 | NoteOn 0.014014 1 72 127.000000 23 | NoteOff 0.378005 1 72 63.500000 24 | NoteOn 0.042041 1 70 127.000000 25 | NoteOff 0.126032 1 70 63.500000 26 | NoteOn 0.014014 1 67 127.000000 27 | NoteOff 0.126032 1 67 63.500000 28 | NoteOn 0.014014 1 72 127.000000 29 | NoteOff 0.252018 1 72 63.500000 30 | NoteOn 0.028027 1 70 127.000000 31 | NoteOff 0.252018 1 70 63.500000 32 | NoteOn 0.028027 1 67 127.000000 33 | NoteOff 0.126032 1 67 63.500000 34 | NoteOn 0.014014 1 65 127.000000 35 | NoteOff 0.126032 1 65 63.500000 36 | NoteOn 0.014014 1 63 127.000000 37 | NoteOff 0.252018 1 63 63.500000 38 | NoteOn 0.028027 1 48 127.000000 39 | NoteOff 0.126032 1 48 63.500000 40 | NoteOn 0.014014 1 48 127.000000 41 | NoteOff 0.252018 1 48 63.500000 42 | NoteOn 0.028027 1 48 127.000000 43 | NoteOff 0.252018 1 48 63.500000 44 | NoteOn 0.028027 1 48 127.000000 45 | NoteOff 0.126032 1 48 63.500000 46 | NoteOn 0.014014 1 51 127.000000 47 | NoteOff 0.126032 1 51 63.500000 48 | NoteOn 0.014014 1 48 127.000000 49 | NoteOff 0.126032 1 48 63.500000 50 | NoteOn 0.014014 1 53 127.000000 51 | NoteOff 0.252018 1 53 63.500000 52 | NoteOn 0.028027 1 51 127.000000 53 | NoteOff 1.260000 1 51 63.500000 54 | NoteOn 0.140000 1 84 127.000000 55 | NoteOff 0.630023 1 84 63.500000 56 | NoteOff 0.070023 1 84 63.500000 57 | -------------------------------------------------------------------------------- /projects/demo/scores/test.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! SKINI File, Perry Cook */ 2 | NoteOn 0.2 1 60 127.000000 3 | NoteOff 0.6 1 60 63.500000 4 | -------------------------------------------------------------------------------- /projects/demo/scores/thecars.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 48 127.000000 3 | NoteOff 0.380000 1 48 63.500000 4 | NoteOn 0.020000 1 48 127.000000 5 | NoteOff 0.100000 1 48 63.500000 6 | NoteOn 0.100000 1 48 127.000000 7 | NoteOff 0.100000 1 48 63.500000 8 | NoteOn 0.100000 1 51 127.000000 9 | NoteOff 0.100000 1 51 63.500000 10 | NoteOn 0.100000 1 51 127.000000 11 | NoteOff 0.570023 1 51 63.500000 12 | NoteOn 0.030023 1 50 127.000000 13 | NoteOff 0.100000 1 50 63.500000 14 | NoteOn 0.100000 1 46 127.000000 15 | NoteOff 0.200000 1 46 63.500000 16 | NoteOn 0.200000 1 60 127.000000 17 | NoteOff 0.950023 1 60 63.500000 18 | NoteOn 0.050023 1 77 127.000000 19 | NoteOff 0.190023 1 77 63.500000 20 | NoteOn 0.010023 1 72 127.000000 21 | NoteOff 0.190023 1 72 63.500000 22 | NoteOn 0.010023 1 69 127.000000 23 | NoteOff 0.100000 1 69 63.500000 24 | NoteOn 0.100000 1 75 127.000000 25 | NoteOff 0.380000 1 75 63.500000 26 | NoteOn 0.020000 1 70 127.000000 27 | NoteOff 0.100000 1 70 63.500000 28 | NoteOn 0.100000 1 67 127.000000 29 | NoteOff 0.100000 1 67 63.500000 30 | NoteOn 0.100000 1 74 127.000000 31 | NoteOff 0.380000 1 74 63.500000 32 | NoteOn 0.020000 1 70 127.000000 33 | NoteOff 0.100000 1 70 63.500000 34 | NoteOn 0.100000 1 65 127.000000 35 | NoteOff 0.100000 1 65 63.500000 36 | NoteOn 0.100000 1 72 127.000000 37 | ControlChange 0.000000 1 1 20.000000 38 | NoteOff 1.000000 1 72 63.500000 39 | -------------------------------------------------------------------------------- /projects/demo/scores/tubebell.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! ToolKit96cpp SKINI File, Perry Cook */ 2 | NoteOn 0.000000 1 65 63.500000 3 | NoteOn 0.200000 1 73 101.600002 4 | NoteOn 0.200000 1 65 76.200003 5 | NoteOn 0.200000 1 75 114.299997 6 | NoteOn 0.200000 1 65 63.500000 7 | NoteOn 0.200000 1 72 76.200003 8 | NoteOn 0.200000 1 73 114.299997 9 | NoteOn 0.200000 1 65 50.800001 10 | NoteOn 0.200000 1 72 114.299997 11 | NoteOn 0.200000 1 65 63.500000 12 | NoteOn 0.200000 1 70 114.299997 13 | NoteOn 0.200000 1 65 50.800001 14 | NoteOn 0.200000 1 85 127.000000 15 | NoteOn 0.200000 1 65 76.200003 16 | NoteOn 0.200000 1 80 76.200003 17 | NoteOn 0.200000 1 46 127.000000 18 | ControlChange 0.000000 1 1 120.000000 19 | NoteOff 2.000000 1 46 63.500000 20 | -------------------------------------------------------------------------------- /projects/demo/utilities.h: -------------------------------------------------------------------------------- 1 | // Miscellaneous parsing and error functions for use with STK demo program. 2 | // 3 | // Gary P. Scavone, 1999. 4 | 5 | #include "Instrmnt.h" 6 | #include "FileWvOut.h" 7 | #include "Messager.h" 8 | 9 | int voiceByNumber(int number, stk::Instrmnt **instrument); 10 | 11 | int voiceByName(char *name, stk::Instrmnt **instrument); 12 | 13 | void usage(char *function); 14 | 15 | int checkArgs(int numArgs, char *args[]); 16 | 17 | int countVoices(int nArgs, char *args[]); 18 | 19 | bool parseArgs(int numArgs, char *args[], stk::WvOut **output, stk::Messager& messager); 20 | -------------------------------------------------------------------------------- /projects/effects/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(effects) 2 | 3 | file(GLOB EFFECTS_SRC "./*.cpp") 4 | 5 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}") 6 | 7 | add_executable(${PROJECT_NAME} ${EFFECTS_SRC}) 8 | target_include_directories(${PROJECT_NAME} PRIVATE "./") 9 | target_link_libraries(${PROJECT_NAME} PUBLIC stk) -------------------------------------------------------------------------------- /projects/effects/Makefile.in: -------------------------------------------------------------------------------- 1 | ### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in 2 | ### STK effects Makefile - for various flavors of unix 3 | 4 | PROGRAMS = 5 | RM = /bin/rm 6 | SRC_PATH = ../../src 7 | OBJECT_PATH = @object_path@ 8 | vpath %.o $(OBJECT_PATH) 9 | 10 | OBJECTS = Stk.o Generator.o Envelope.o SineWave.o \ 11 | Filter.o Delay.o DelayL.o OnePole.o \ 12 | Effect.o Echo.o PitShift.o Chorus.o LentPitShift.o \ 13 | PRCRev.o JCRev.o NRev.o FreeVerb.o \ 14 | FileRead.o WvIn.o FileWvIn.o WaveLoop.o Skini.o Messager.o 15 | 16 | INCLUDE = @include@ 17 | ifeq ($(strip $(INCLUDE)), ) 18 | INCLUDE = ../../include 19 | endif 20 | vpath %.h $(INCLUDE) 21 | 22 | CC = @CXX@ 23 | DEFS = @CPPFLAGS@ 24 | DEFS += @byte_order@ 25 | CFLAGS = @CXXFLAGS@ 26 | CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include 27 | LDFLAGS = @LDFLAGS@ 28 | LIBRARY = @LIBS@ 29 | 30 | REALTIME = @realtime@ 31 | ifeq ($(REALTIME),yes) 32 | PROGRAMS += effects 33 | OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o @objects@ 34 | endif 35 | 36 | RAWWAVES = @rawwaves@ 37 | ifeq ($(strip $(RAWWAVES)), ) 38 | RAWWAVES = ../../rawwaves/ 39 | endif 40 | DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\" 41 | 42 | %.o : $(SRC_PATH)/%.cpp $(OBJECT_PATH)/.placeholder 43 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 44 | 45 | %.o : ../../src/include/%.cpp $(OBJECT_PATH)/.placeholder 46 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 47 | 48 | all : $(PROGRAMS) 49 | 50 | $(OBJECT_PATH)/.placeholder: 51 | mkdir -vp $(OBJECT_PATH) 52 | touch $(OBJECT_PATH)/.placeholder 53 | 54 | effects: effects.cpp $(OBJECTS) 55 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o effects effects.cpp $(OBJECT_PATH)/*.o $(LIBRARY) 56 | 57 | libeffects: effects.cpp 58 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o effects effects.cpp -L../../src -lstk $(LIBRARY) 59 | 60 | $(OBJECTS) : Stk.h 61 | 62 | clean : 63 | $(RM) -f $(OBJECT_PATH)/*.o 64 | $(RM) -f $(PROGRAMS) *.exe 65 | $(RM) -fR *~ *.dSYM 66 | 67 | distclean: clean 68 | $(RM) Makefile 69 | 70 | strip : 71 | strip $(PROGRAMS) 72 | -------------------------------------------------------------------------------- /projects/effects/README-effects.txt: -------------------------------------------------------------------------------- 1 | The Synthesis ToolKit in C++ (STK) 2 | 3 | By Perry R. Cook and Gary P. Scavone, 1995--2023. 4 | 5 | EFFECTS PROJECT: 6 | 7 | This directory contains a program that demonstrates realtime duplex 8 | mode (simultaneous audio input and output) operation, as well as 9 | several simple delay-line based effects algorithms. Duplex mode 10 | operation is very hardware dependent. If you have trouble with this 11 | application, make sure your soundcard supports the desired sample rate 12 | and sample size (16-bit). 13 | 14 | NOTES: 15 | 16 | 1. This project will not run under WindowsNT or NeXTStep, due to lack 17 | of realtime audio input support. However, it should run under 18 | other flavors of Windows. 19 | 20 | 2. Audio input from either a microphone or line-input device MUST be 21 | available to the audio input port when the program is started. 22 | 23 | 3. Latency can be controlled using the nBufferFrames argument to the 24 | RtAudio openStream() function. The default settings in effects.cpp 25 | are relatively high because some Windows soundcard drivers crash if 26 | the settings are too low. 27 | -------------------------------------------------------------------------------- /projects/effects/StkEffects: -------------------------------------------------------------------------------- 1 | wish < tcl/Effects.tcl | ./effects -ip 2 | -------------------------------------------------------------------------------- /projects/effects/StkEffects.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Effects.tcl | effects -ip 2 | -------------------------------------------------------------------------------- /projects/effects/effects.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "effects", "effects.vcxproj", "{18C1E3D6-08AB-4087-8522-BCAF2E767BA7}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {18C1E3D6-08AB-4087-8522-BCAF2E767BA7}.Debug|x86.ActiveCfg = Debug|Win32 15 | {18C1E3D6-08AB-4087-8522-BCAF2E767BA7}.Debug|x86.Build.0 = Debug|Win32 16 | {18C1E3D6-08AB-4087-8522-BCAF2E767BA7}.Release|x86.ActiveCfg = Release|Win32 17 | {18C1E3D6-08AB-4087-8522-BCAF2E767BA7}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {FC9ECEAF-8EE9-48ED-9F13-E12A6505C643} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /projects/eguitar/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(eguitar) 2 | 3 | file(GLOB EGUITAR_SRC "./*.cpp") 4 | 5 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}") 6 | 7 | add_executable(${PROJECT_NAME} ${EGUITAR_SRC}) 8 | target_include_directories(${PROJECT_NAME} PRIVATE "./") 9 | target_link_libraries(${PROJECT_NAME} PUBLIC stk) -------------------------------------------------------------------------------- /projects/eguitar/ElectricGuitar: -------------------------------------------------------------------------------- 1 | wish < tcl/Eguitar.tcl | ./eguitar -or -ip 2 | -------------------------------------------------------------------------------- /projects/eguitar/ElectricGuitar.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/EGuitar.tcl | eguitar -or -ip 2 | -------------------------------------------------------------------------------- /projects/eguitar/Makefile.in: -------------------------------------------------------------------------------- 1 | ### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in 2 | ### STK eguitar Makefile - for various flavors of unix 3 | 4 | PROGRAMS = 5 | RM = /bin/rm 6 | SRC_PATH = ../../src 7 | OBJECT_PATH = @object_path@ 8 | vpath %.o $(OBJECT_PATH) 9 | 10 | OBJECTS = Stk.o Filter.o Fir.o Delay.o DelayL.o DelayA.o OnePole.o \ 11 | Effect.o JCRev.o Twang.o \ 12 | Guitar.o Noise.o Cubic.o \ 13 | FileRead.o WvIn.o FileWvIn.o FileWrite.o FileWvOut.o \ 14 | Skini.o Messager.o utilities.o 15 | 16 | INCLUDE = @include@ 17 | ifeq ($(strip $(INCLUDE)), ) 18 | INCLUDE = ../../include 19 | endif 20 | vpath %.h $(INCLUDE) 21 | 22 | CC = @CXX@ 23 | DEFS = @CPPFLAGS@ 24 | DEFS += @byte_order@ 25 | CFLAGS = @CXXFLAGS@ 26 | CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include 27 | LDFLAGS = @LDFLAGS@ 28 | LIBRARY = @LIBS@ 29 | 30 | REALTIME = @realtime@ 31 | ifeq ($(REALTIME),yes) 32 | PROGRAMS += eguitar 33 | OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o @objects@ 34 | endif 35 | 36 | RAWWAVES = @rawwaves@ 37 | ifeq ($(strip $(RAWWAVES)), ) 38 | RAWWAVES = ../../rawwaves/ 39 | endif 40 | DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\" 41 | 42 | %.o : $(SRC_PATH)/%.cpp $(OBJECT_PATH)/.placeholder 43 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 44 | 45 | %.o : ../../src/include/%.cpp $(OBJECT_PATH)/.placeholder 46 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 47 | 48 | all : $(PROGRAMS) 49 | 50 | $(OBJECT_PATH)/.placeholder: 51 | mkdir -vp $(OBJECT_PATH) 52 | touch $(OBJECT_PATH)/.placeholder 53 | 54 | eguitar: eguitar.cpp $(OBJECTS) 55 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o eguitar eguitar.cpp $(OBJECT_PATH)/*.o $(LIBRARY) 56 | 57 | libeguitar: eguitar.cpp 58 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o eguitar utilities.cpp eguitar.cpp -L../../src -lstk $(LIBRARY) 59 | 60 | $(OBJECTS) : Stk.h 61 | 62 | clean : 63 | $(RM) -f $(OBJECT_PATH)/*.o 64 | $(RM) -f $(PROGRAMS) *.exe 65 | $(RM) -fR *~ *.dSYM 66 | 67 | distclean: clean 68 | $(RM) Makefile 69 | 70 | strip : 71 | strip $(PROGRAMS) 72 | 73 | # Project specific objects: 74 | 75 | utilities.o: utilities.cpp 76 | $(CC) $(CFLAGS) $(DEFS) -c utilities.cpp -o $(OBJECT_PATH)/$@ 77 | -------------------------------------------------------------------------------- /projects/eguitar/README-eguitar.txt: -------------------------------------------------------------------------------- 1 | This is eguitar by Gary Scavone, McGill University, 2012. 2 | 3 | This is a program to create a simple electric guitar model using 4 | the STK Guitar class. The is model is derived in part from an 5 | implementation made by Nicholas Donaldson at McGill University in 6 | 2009. The distortion model is poor, using a simple soft-clipping 7 | expression provided by Charles R. Sullivan in "Extending the 8 | Karplus-String Algorithm to Synthesize Electric Guitar Timbres with 9 | Distortion and Feedback," Computer Music Journal, Vol.14 No.3, Fall 10 | 1990. Other distortion models would be better, such as that found 11 | in Pakarinen and Yeh's "A Review of Digital Techniques for Modeling 12 | Vacuum-Tube Guitar Amplifiers," Computer Music Journal, Vol 33 13 | No. 2, Summer 2009. 14 | 15 | This program performs simple voice management if all noteOn and 16 | noteOff events are on channel 0. Otherwise, channel values > 0 are 17 | mapped to specific string numbers. By default, the program creates 18 | a 6-string guitar. If the normalized noteOn() velocity is < 0.2, a 19 | string is undamped but not plucked (this is implemented in the 20 | stk::Guitar class). Thus, you can lightly depress a key on a MIDI 21 | keyboard and then experiment with string coupling. 22 | 23 | The Tcl/Tk GUI allows you to experiment with various parameter 24 | settings and that can be used in conjunction with a MIDI keyboard 25 | as: wish < tcl/EGuitar.tcl | ./eguitar -or -ip -im 1 26 | 27 | For the moment, this program does not support pitch bends. 28 | 29 | In the eguitar directory, type: 30 | 31 | > make 32 | 33 | to compile and then 34 | 35 | > ElectricGuitar.bat 36 | 37 | to run the program with the Tcl/Tk GUI. 38 | 39 | There are many improvements that could be made to this project. In 40 | particular, you could record real body responses from different 41 | guitars and use those with the Guitar class. As well, you could 42 | improve the distortion model and perhaps add some typical electric 43 | guitar effects, such as an echo. If you find any bugs, please let me 44 | know! 45 | -------------------------------------------------------------------------------- /projects/eguitar/eguitar.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eguitar", "eguitar.vcxproj", "{7714F3D3-F28C-4BEF-827B-78B2756890C9}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7714F3D3-F28C-4BEF-827B-78B2756890C9}.Debug|x86.ActiveCfg = Debug|Win32 15 | {7714F3D3-F28C-4BEF-827B-78B2756890C9}.Debug|x86.Build.0 = Debug|Win32 16 | {7714F3D3-F28C-4BEF-827B-78B2756890C9}.Release|x86.ActiveCfg = Release|Win32 17 | {7714F3D3-F28C-4BEF-827B-78B2756890C9}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {8FADFDB1-0C46-48DA-BE7F-592DC5BA7B9F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /projects/eguitar/scores/test.ski: -------------------------------------------------------------------------------- 1 | /* Howdy!! SKINI File, Perry Cook */ 2 | NoteOn 0.1 0 40 100.000000 3 | NoteOn 0.01 0 44 100.000000 4 | NoteOn 0.01 0 47 100.000000 5 | NoteOn 0.01 0 52 100.000000 6 | NoteOff 1.0 0 40 64.000000 7 | NoteOff 0.0 0 44 64.000000 8 | NoteOff 0.0 0 47 64.000000 9 | NoteOff 0.0 0 52 64.000000 10 | 11 | NoteOn 0.3 0 39 100.000000 12 | NoteOn 0.01 0 42 100.000000 13 | NoteOn 0.01 0 47 100.000000 14 | NoteOn 0.01 0 51 100.000000 15 | NoteOff 1.0 0 39 64.000000 16 | NoteOff 0.0 0 42 64.000000 17 | NoteOff 0.0 0 47 64.000000 18 | NoteOff 0.0 0 51 64.000000 19 | 20 | NoteOn 0.3 0 40 100.000000 21 | NoteOn 0.01 0 44 100.000000 22 | NoteOn 0.01 0 47 100.000000 23 | NoteOn 0.01 0 52 100.000000 24 | NoteOff 2.0 0 40 64.000000 25 | NoteOff 0.0 0 44 64.000000 26 | NoteOff 0.0 0 47 64.000000 27 | NoteOff 0.0 0 52 64.000000 -------------------------------------------------------------------------------- /projects/eguitar/utilities.h: -------------------------------------------------------------------------------- 1 | // Miscellaneous parsing and error functions for use with STK projects. 2 | // 3 | // Gary P. Scavone, 1999. 4 | 5 | #include "FileWvOut.h" 6 | #include "Messager.h" 7 | 8 | void usage(char *function); 9 | 10 | int checkArgs(int numArgs, char *args[]); 11 | 12 | bool parseArgs(int numArgs, char *args[], stk::WvOut **output, stk::Messager& messager); 13 | -------------------------------------------------------------------------------- /projects/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(examples) 2 | 3 | file(GLOB EXAMPLE_SRC "./*.cpp") 4 | 5 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}") 6 | 7 | foreach(src ${EXAMPLE_SRC}) 8 | get_filename_component(src_bin ${src} NAME_WE) 9 | add_executable(${src_bin} ${src}) 10 | target_link_libraries(${src_bin} PUBLIC stk) 11 | endforeach() 12 | -------------------------------------------------------------------------------- /projects/examples/audioprobe.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {3ead9678-8354-4498-93d3-e834328937f5} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {b628491f-dca8-4c24-b290-3216afda20c5} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /projects/examples/crtsine.cpp: -------------------------------------------------------------------------------- 1 | // crtsine.cpp STK tutorial program 2 | 3 | #include "SineWave.h" 4 | #include "RtAudio.h" 5 | using namespace stk; 6 | 7 | // This tick() function handles sample computation only. It will be 8 | // called automatically when the system needs a new buffer of audio 9 | // samples. 10 | int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, 11 | double streamTime, RtAudioStreamStatus status, void *dataPointer ) 12 | { 13 | SineWave *sine = (SineWave *) dataPointer; 14 | StkFloat *samples = (StkFloat *) outputBuffer; 15 | 16 | for ( unsigned int i=0; itick(); 18 | 19 | return 0; 20 | } 21 | 22 | int main() 23 | { 24 | // Set the global sample rate before creating class instances. 25 | Stk::setSampleRate( 44100.0 ); 26 | 27 | SineWave sine; 28 | RtAudio dac; 29 | 30 | // Figure out how many bytes in an StkFloat and setup the RtAudio stream. 31 | RtAudio::StreamParameters parameters; 32 | parameters.deviceId = dac.getDefaultOutputDevice(); 33 | parameters.nChannels = 1; 34 | RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32; 35 | unsigned int bufferFrames = RT_BUFFER_SIZE; 36 | if ( dac.openStream( ¶meters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&sine ) ) { 37 | std::cout << dac.getErrorText() << std::endl; 38 | goto cleanup; 39 | } 40 | 41 | sine.setFrequency(440.0); 42 | 43 | if ( dac.startStream() ) { 44 | std::cout << dac.getErrorText() << std::endl; 45 | goto cleanup; 46 | } 47 | 48 | // Block waiting here. 49 | char keyhit; 50 | std::cout << "\nPlaying ... press to quit.\n"; 51 | std::cin.get( keyhit ); 52 | 53 | // Shut down the output stream. 54 | dac.closeStream(); 55 | 56 | cleanup: 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /projects/examples/crtsine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {095692d5-cac5-43e2-8ddc-68dc17318426} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {fd8a8bb9-aa6c-4625-b1d0-638775adf4ff} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {a8934afd-f390-431c-be23-40b7ce501c09} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /projects/examples/duplex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {814114c0-fab4-4cc1-ae27-89ba6123b604} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {aa39f84f-28ef-40f0-a37a-bf42b59993e4} 10 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /projects/examples/foursine.cpp: -------------------------------------------------------------------------------- 1 | // foursine.cpp STK tutorial program 2 | 3 | #include "SineWave.h" 4 | #include "FileWvOut.h" 5 | #include 6 | 7 | using namespace stk; 8 | 9 | int main() 10 | { 11 | // Set the global sample rate before creating class instances. 12 | Stk::setSampleRate( 44100.0 ); 13 | 14 | int i; 15 | FileWvOut output; 16 | SineWave inputs[4]; 17 | 18 | // Set the sine wave frequencies. 19 | for ( i=0; i<4; i++ ) 20 | inputs[i].setFrequency( 220.0 * (i+1) ); 21 | 22 | // Define and open a 16-bit, four-channel AIFF formatted output file 23 | try { 24 | output.openFile( "foursine.aif", 4, FileWrite::FILE_AIF, Stk::STK_SINT16 ); 25 | } 26 | catch (StkError &) { 27 | exit( 1 ); 28 | } 29 | 30 | // Write two seconds of four sines to the output file 31 | StkFrames frames( 88200, 4 ); 32 | for ( i=0; i<4; i++ ) 33 | inputs[i].tick( frames, i ); 34 | 35 | output.tick( frames ); 36 | 37 | // Now write the first sine to all four channels for two seconds 38 | for ( i=0; i<88200; i++ ) { 39 | output.tick( inputs[0].tick() ); 40 | } 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /projects/examples/foursine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {b4d64f6d-a57d-4d85-8efe-24faba18ead8} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {bf2bfdb7-dd4a-43b6-bc8c-bce966b4861a} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {6557afcc-d351-4c05-ad0f-954add1fc12d} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /projects/examples/grains.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {50dfff55-f8fe-4482-ae01-217be7aae2b5} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {51912429-d12c-4a3f-b550-89bea136bf90} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {d2dbe46e-ec84-4f23-b2ef-1ce46c72c2b0} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | -------------------------------------------------------------------------------- /projects/examples/inetOut.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {f8dd2df4-bba7-43a7-b01d-41ed7849bb37} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {9b4700c8-a018-477c-af06-a0bd745ec0eb} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {b5d9311f-890e-4a3b-8bb4-404a2ae599b0} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | -------------------------------------------------------------------------------- /projects/examples/midifiles/bwv772.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/examples/midifiles/bwv772.mid -------------------------------------------------------------------------------- /projects/examples/midifiles/jesu.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/examples/midifiles/jesu.mid -------------------------------------------------------------------------------- /projects/examples/midifiles/tango.mid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/examples/midifiles/tango.mid -------------------------------------------------------------------------------- /projects/examples/midiprobe.cpp: -------------------------------------------------------------------------------- 1 | // midiprobe.cpp 2 | // 3 | // Simple program to check MIDI inputs and outputs. 4 | // 5 | // by Gary Scavone, 2003-2004. 6 | 7 | #include 8 | #include 9 | #include "RtMidi.h" 10 | 11 | int main() 12 | { 13 | RtMidiIn *midiin = 0; 14 | RtMidiOut *midiout = 0; 15 | 16 | // RtMidiIn constructor 17 | try { 18 | midiin = new RtMidiIn(); 19 | } 20 | catch ( RtMidiError &error ) { 21 | error.printMessage(); 22 | exit( EXIT_FAILURE ); 23 | } 24 | 25 | // Check inputs. 26 | unsigned int nPorts = midiin->getPortCount(); 27 | std::cout << "\nThere are " << nPorts << " MIDI input sources available.\n"; 28 | std::string portName; 29 | unsigned int i; 30 | for ( i=0; igetPortName(i); 33 | } 34 | catch ( RtMidiError &error ) { 35 | error.printMessage(); 36 | goto cleanup; 37 | } 38 | std::cout << " Input Port #" << i+1 << ": " << portName << '\n'; 39 | } 40 | 41 | // RtMidiOut constructor 42 | try { 43 | midiout = new RtMidiOut(); 44 | } 45 | catch ( RtMidiError &error ) { 46 | error.printMessage(); 47 | exit( EXIT_FAILURE ); 48 | } 49 | 50 | // Check outputs. 51 | nPorts = midiout->getPortCount(); 52 | std::cout << "\nThere are " << nPorts << " MIDI output ports available.\n"; 53 | for ( i=0; igetPortName(i); 56 | } 57 | catch ( RtMidiError &error ) { 58 | error.printMessage(); 59 | goto cleanup; 60 | } 61 | std::cout << " Output Port #" << i+1 << ": " << portName << '\n'; 62 | } 63 | std::cout << '\n'; 64 | 65 | // Clean up 66 | cleanup: 67 | delete midiin; 68 | delete midiout; 69 | 70 | return 0; 71 | } 72 | -------------------------------------------------------------------------------- /projects/examples/midiprobe.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {b2d176c7-f0d4-4c01-b70a-d94511c8dddb} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {dbc5af6a-0082-41ec-b9a4-81be71941424} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {6a2afe32-1d81-4bdb-91df-ad55434bc978} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /projects/examples/play.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d5b611e5-0a75-4dc8-8e19-4257179653ca} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {0b06e5ce-8306-471d-a4f9-160ad9662ba2} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {112a423d-b634-46ae-a610-d1064b755894} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | -------------------------------------------------------------------------------- /projects/examples/playsmf.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {d1c32884-d0a0-4b8c-a9e4-4e74fd0a8316} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {ac7e3e33-d36b-48d2-96ce-6b4f65be53f8} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {45ff8f9a-0fed-4938-9a49-9780565d77a6} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /projects/examples/rawwaves/sinewave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/examples/rawwaves/sinewave.raw -------------------------------------------------------------------------------- /projects/examples/record.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fb77f10b-cbdc-4b47-8466-071e755321ea} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {75ae5adb-f45a-4648-83e8-25dea3afddfe} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {1c217fa4-540d-4af9-a894-30bfaceaa844} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | Header Files 55 | 56 | 57 | Header Files 58 | 59 | 60 | -------------------------------------------------------------------------------- /projects/examples/rtsine.cpp: -------------------------------------------------------------------------------- 1 | // rtsine.cpp STK tutorial program 2 | 3 | #include "SineWave.h" 4 | #include "RtWvOut.h" 5 | #include 6 | 7 | using namespace stk; 8 | 9 | int main() 10 | { 11 | // Set the global sample rate before creating class instances. 12 | Stk::setSampleRate( 44100.0 ); 13 | Stk::showWarnings( true ); 14 | 15 | int nFrames = 100000; 16 | SineWave sine; 17 | RtWvOut *dac = 0; 18 | 19 | try { 20 | // Define and open the default realtime output device for one-channel playback 21 | dac = new RtWvOut( 1 ); 22 | } 23 | catch ( StkError & ) { 24 | exit( 1 ); 25 | } 26 | 27 | sine.setFrequency( 441.0 ); 28 | 29 | // Option 1: Use StkFrames 30 | /* 31 | StkFrames frames( nFrames, 1 ); 32 | try { 33 | dac->tick( sine.tick( frames ) ); 34 | } 35 | catch ( StkError & ) { 36 | goto cleanup; 37 | } 38 | */ 39 | 40 | // Option 2: Single-sample computations 41 | for ( int i=0; itick( sine.tick() ); 44 | } 45 | catch ( StkError & ) { 46 | goto cleanup; 47 | } 48 | } 49 | 50 | cleanup: 51 | delete dac; 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /projects/examples/rtsine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {87559e16-c65d-4b0d-91cd-29436ae42e30} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {a99a0677-8a7f-47f7-b87e-d62f42dee98d} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {581f8bb4-6550-447c-b753-7d81c4273e09} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | Header Files 52 | 53 | 54 | -------------------------------------------------------------------------------- /projects/examples/simple.tcl: -------------------------------------------------------------------------------- 1 | # A simple Tcl/Tk example script 2 | 3 | # Set initial control values 4 | set pitch 64.0 5 | set press 64.0 6 | 7 | # Configure main window 8 | wm title . "A Simple GUI" 9 | wm iconname . "simple" 10 | . config -bg black 11 | 12 | # Configure a "note-on" button 13 | frame .noteOn -bg black 14 | 15 | button .noteOn.on -text NoteOn -bg grey66 -command { noteOn $pitch $press } 16 | pack .noteOn.on -side left -padx 5 17 | pack .noteOn 18 | 19 | # Configure sliders 20 | frame .slider -bg black 21 | 22 | scale .slider.pitch -from 0 -to 128 -length 200 \ 23 | -command {changePitch } -variable pitch \ 24 | -orient horizontal -label "MIDI Note Number" \ 25 | -tickinterval 32 -showvalue true -bg grey66 26 | 27 | pack .slider.pitch -padx 10 -pady 10 28 | pack .slider -side left 29 | 30 | # Bind an X windows "close" event with the Exit routine 31 | bind . +myExit 32 | 33 | proc myExit {} { 34 | global pitch outID 35 | puts [format "NoteOff 0.0 1 %f 127" $pitch ] 36 | flush stdout 37 | puts [format "ExitProgram"] 38 | flush stdout 39 | close stdout 40 | exit 41 | } 42 | 43 | proc noteOn {pitchVal pressVal} { 44 | puts [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal] 45 | flush stdout 46 | } 47 | 48 | proc changePitch {value} { 49 | puts [format "PitchChange 0.0 1 %.3f" $value] 50 | flush stdout 51 | } 52 | 53 | bind . {+ center_the_toplevel %W } 54 | proc center_the_toplevel { w } { 55 | 56 | # Callback on the event for a toplevel 57 | # that should be centered on the screen 58 | 59 | # Make sure that we aren't configuring a child window 60 | if { [string equal $w [winfo toplevel $w]] } { 61 | 62 | # Calculate the desired geometry 63 | set width [winfo reqwidth $w] 64 | set height [winfo reqheight $w] 65 | set x [expr { ( [winfo vrootwidth $w] - $width ) / 2 }] 66 | set y [expr { ( [winfo vrootheight $w] - $height ) / 2 }] 67 | #set y 0 68 | 69 | # Hand the geometry off to the window manager 70 | wm geometry $w ${width}x${height}+${x}+${y} 71 | 72 | # Unbind so that this procedure is 73 | # not called again when the window manager finishes 74 | # centering the window. Also, revert geometry management 75 | # to internal default for subsequent size changes. 76 | bind $w {} 77 | wm geometry $w "" 78 | } 79 | 80 | return 81 | } 82 | -------------------------------------------------------------------------------- /projects/examples/sine.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {e502f99d-93ff-4f35-bafe-7e3f1cb66760} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {04e044e0-da39-4b71-bddd-a7a5df53ee0c} 10 | h;hpp;hxx;hm;inl 11 | 12 | 13 | {ad6ba706-7eb3-411a-aa61-692cb0ac7f1b} 14 | ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /projects/examples/sineosc.cpp: -------------------------------------------------------------------------------- 1 | // sineosc.cpp STK tutorial program 2 | 3 | #include "FileLoop.h" 4 | #include "FileWvOut.h" 5 | #include 6 | 7 | using namespace stk; 8 | 9 | int main() 10 | { 11 | // Set the global sample rate before creating class instances. 12 | Stk::setSampleRate( 44100.0 ); 13 | 14 | int nFrames = 100000; 15 | FileLoop input; 16 | FileWvOut output; 17 | 18 | try { 19 | // Load the sine wave file. 20 | input.openFile( "rawwaves/sinewave.raw", true ); 21 | 22 | // Open a 16-bit, one-channel WAV formatted output file 23 | output.openFile( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 ); 24 | } 25 | catch ( StkError & ) { 26 | exit( 1 ); 27 | } 28 | 29 | input.setFrequency( 440.0 ); 30 | 31 | // Option 1: Use StkFrames 32 | /* 33 | StkFrames frames( nFrames, 1 ); 34 | try { 35 | output.tick( input.tick( frames ) ); 36 | } 37 | catch ( StkError & ) { 38 | exit( 1 ); 39 | } 40 | */ 41 | 42 | // Option 2: Single-sample computations 43 | for ( int i=0; i 22 | 23 | namespace stk { 24 | 25 | Drone :: Drone( StkFloat lowestFrequency ) 26 | { 27 | if ( lowestFrequency <= 0.0 ) { 28 | oStream_ << "Drone::Drone: argument is less than or equal to zero!"; 29 | handleError( StkError::FUNCTION_ARGUMENT ); 30 | } 31 | 32 | unsigned long delays = (unsigned long) ( Stk::sampleRate() / lowestFrequency ); 33 | delayLine_.setMaximumDelay( delays + 1 ); 34 | 35 | this->setFrequency( 220.0 ); 36 | envelope_.setAllTimes( 2.0, 0.5, 0.0, 0.5 ); 37 | this->clear(); 38 | } 39 | 40 | Drone :: ~Drone( void ) 41 | { 42 | } 43 | 44 | void Drone :: clear( void ) 45 | { 46 | delayLine_.clear(); 47 | loopFilter_.clear(); 48 | } 49 | 50 | void Drone :: setFrequency( StkFloat frequency ) 51 | { 52 | #if defined(_STK_DEBUG_) 53 | if ( frequency <= 0.0 ) { 54 | oStream_ << "Drone::setFrequency: argument is less than or equal to zero!"; 55 | handleError( StkError::WARNING ); return; 56 | } 57 | #endif 58 | 59 | // Delay = length - approximate filter delay. 60 | StkFloat delay = (Stk::sampleRate() / frequency) - 0.5; 61 | delayLine_.setDelay( delay ); 62 | 63 | loopGain_ = 0.997 + (frequency * 0.000002); 64 | if ( loopGain_ >= 1.0 ) loopGain_ = 0.99999; 65 | } 66 | 67 | void Drone :: pluck( StkFloat amplitude ) 68 | { 69 | envelope_.keyOn(); 70 | } 71 | 72 | void Drone :: noteOn( StkFloat frequency, StkFloat amplitude ) 73 | { 74 | this->setFrequency( frequency ); 75 | this->pluck( amplitude ); 76 | } 77 | 78 | void Drone :: noteOff( StkFloat amplitude ) 79 | { 80 | if ( amplitude < 0.0 || amplitude > 1.0 ) { 81 | oStream_ << "Plucked::noteOff: amplitude is out of range!"; 82 | handleError( StkError::WARNING ); return; 83 | } 84 | 85 | loopGain_ = 1.0 - amplitude; 86 | } 87 | 88 | } // stk namespace 89 | -------------------------------------------------------------------------------- /projects/ragamatic/Makefile.in: -------------------------------------------------------------------------------- 1 | ### Do not edit -- Generated by 'configure --with-whatever' from Makefile.in 2 | ### STK ragamatic Makefile - for various flavors of unix 3 | 4 | PROGRAMS = 5 | RM = /bin/rm 6 | SRC_PATH = ../../src 7 | OBJECT_PATH = @object_path@ 8 | vpath %.o $(OBJECT_PATH) 9 | 10 | OBJECTS = Stk.o Noise.o ADSR.o \ 11 | DelayA.o Delay.o \ 12 | OnePole.o OneZero.o Skini.o \ 13 | Tabla.o Sitar.o \ 14 | Drone.o VoicDrum.o FileRead.o FileWvIn.o \ 15 | JCRev.o Messager.o 16 | 17 | INCLUDE = @include@ 18 | ifeq ($(strip $(INCLUDE)), ) 19 | INCLUDE = ../../include 20 | endif 21 | vpath %.h $(INCLUDE) 22 | 23 | CC = @CXX@ 24 | DEFS = @CPPFLAGS@ 25 | DEFS += @byte_order@ 26 | CFLAGS = @CXXFLAGS@ 27 | CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include 28 | LDFLAGS = @LDFLAGS@ 29 | LIBRARY = @LIBS@ 30 | 31 | REALTIME = @realtime@ 32 | ifeq ($(REALTIME),yes) 33 | PROGRAMS = ragamat 34 | OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o @objects@ 35 | endif 36 | 37 | RAWWAVES = @rawwaves@ 38 | ifeq ($(strip $(RAWWAVES)), ) 39 | RAWWAVES = ../../rawwaves/ 40 | endif 41 | DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\" 42 | 43 | %.o : $(SRC_PATH)/%.cpp $(OBJECT_PATH)/.placeholder 44 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 45 | 46 | %.o : ../../src/include/%.cpp $(OBJECT_PATH)/.placeholder 47 | $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ 48 | 49 | all : $(PROGRAMS) 50 | 51 | $(OBJECT_PATH)/.placeholder: 52 | mkdir -vp $(OBJECT_PATH) 53 | touch $(OBJECT_PATH)/.placeholder 54 | 55 | ragamat: ragamat.cpp $(OBJECTS) 56 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o ragamat ragamat.cpp $(OBJECT_PATH)/*.o $(LIBRARY) 57 | 58 | libragamat: ragamat.cpp Tabla.cpp Drone.cpp VoicDrum.cpp 59 | $(CC) $(LDFLAGS) $(CFLAGS) $(DEFS) -o ragamat Tabla.cpp Drone.cpp VoicDrum.cpp ragamat.cpp -L../../src -lstk $(LIBRARY) 60 | 61 | $(OBJECTS) : Stk.h 62 | 63 | clean : 64 | $(RM) -f $(OBJECT_PATH)/*.o 65 | $(RM) -f $(PROGRAMS) *.exe 66 | $(RM) -fR *~ *.dSYM 67 | 68 | distclean: clean 69 | $(RM) Makefile 70 | 71 | strip : 72 | strip $(PROGRAMS) 73 | 74 | # Project specific objects: 75 | 76 | Tabla.o: Tabla.cpp 77 | $(CC) $(CFLAGS) $(DEFS) -c Tabla.cpp -o $(OBJECT_PATH)/$@ 78 | 79 | Drone.o: Drone.cpp 80 | $(CC) $(CFLAGS) $(DEFS) -c Drone.cpp -o $(OBJECT_PATH)/$@ 81 | 82 | VoicDrum.o: VoicDrum.cpp 83 | $(CC) $(CFLAGS) $(DEFS) -c VoicDrum.cpp -o $(OBJECT_PATH)/$@ 84 | -------------------------------------------------------------------------------- /projects/ragamatic/README-raga.txt: -------------------------------------------------------------------------------- 1 | This is RagaMatic (tm) by Perry Cook. 2 | It was written for Ken Steiglitz's birthday in 1999. 3 | 4 | Sitar and Drones are physical models. 5 | Vocalize drums and Tabla drums are samples. 6 | 7 | In the RagaMatic directory, type: 8 | 9 | > make 10 | 11 | to compile and then 12 | 13 | > Raga.bat 14 | 15 | to have fun and achieve inner peace. 16 | 17 | If you ask me, I think this band needs a flute player too. If you 18 | like, team up and see if you can add the flute model to the project. 19 | This requires adding a few files to the Makefile, a few lines to the 20 | ragamat.cpp file (including how the flute player should play, etc.), 21 | and another slider to the TCL script to control the flute's 22 | contributions. This might only run on the fastest machines once 23 | you've added the flute. 24 | 25 | Since latency isn't much of an issue in raga-land, you might bump up 26 | the RT_BUFFER_SIZE in Stk.h to something around 1024, depending on the 27 | speed of your machine. 28 | 29 | All is Bliss... 30 | All is Bliss... 31 | -------------------------------------------------------------------------------- /projects/ragamatic/Raga: -------------------------------------------------------------------------------- 1 | wish < tcl/Raga.tcl | ./ragamat -ip 2 | -------------------------------------------------------------------------------- /projects/ragamatic/Raga.bat: -------------------------------------------------------------------------------- 1 | wish < tcl/Raga.tcl | ragamat -ip 2 | -------------------------------------------------------------------------------- /projects/ragamatic/ragamatic.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ragamatic", "ragamat.vcxproj", "{9ECEAC07-E32F-4ABB-945E-0334377C1828}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x86 = Debug|x86 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {9ECEAC07-E32F-4ABB-945E-0334377C1828}.Debug|x86.ActiveCfg = Debug|Win32 15 | {9ECEAC07-E32F-4ABB-945E-0334377C1828}.Debug|x86.Build.0 = Debug|Win32 16 | {9ECEAC07-E32F-4ABB-945E-0334377C1828}.Release|x86.ActiveCfg = Release|Win32 17 | {9ECEAC07-E32F-4ABB-945E-0334377C1828}.Release|x86.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {CC90B55D-4CB0-4EC2-A443-E298E8F25DB6} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/DrDoi1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/DrDoi1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/DrDoi2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/DrDoi2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/DrTak1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/DrTak1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/DrTak2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/DrTak2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdak2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdak2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdak3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdak3.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdak4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdak4.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drddak1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drddak1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdee1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdee1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdee2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdee2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdoo1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdoo1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdoo2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdoo2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drdoo3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drdoo3.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drjun1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drjun1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/Drjun2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/Drjun2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/bee1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/bee1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/dee1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/dee1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/dee2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/dee2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/din1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/din1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/gun1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/gun1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/jun1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/jun1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/jun2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/jun2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/tak1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/tak1.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/tak2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/tak2.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/tak3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/tak3.raw -------------------------------------------------------------------------------- /projects/ragamatic/rawwaves/tak4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/rawwaves/tak4.raw -------------------------------------------------------------------------------- /projects/ragamatic/tcl/bitmaps/ragamat.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/tcl/bitmaps/ragamat.bmp -------------------------------------------------------------------------------- /projects/ragamatic/tcl/bitmaps/ragamat2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/ragamatic/tcl/bitmaps/ragamat2.bmp -------------------------------------------------------------------------------- /projects/stk-template.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/projects/stk-template.zip -------------------------------------------------------------------------------- /rawwaves/ahh.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/ahh.raw -------------------------------------------------------------------------------- /rawwaves/bassdrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/bassdrum.raw -------------------------------------------------------------------------------- /rawwaves/britestk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/britestk.raw -------------------------------------------------------------------------------- /rawwaves/cowbell1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/cowbell1.raw -------------------------------------------------------------------------------- /rawwaves/crashcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/crashcym.raw -------------------------------------------------------------------------------- /rawwaves/dope.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/dope.raw -------------------------------------------------------------------------------- /rawwaves/eee.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/eee.raw -------------------------------------------------------------------------------- /rawwaves/fwavblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/fwavblnk.raw -------------------------------------------------------------------------------- /rawwaves/halfwave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/halfwave.raw -------------------------------------------------------------------------------- /rawwaves/hihatcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/hihatcym.raw -------------------------------------------------------------------------------- /rawwaves/impuls10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/impuls10.raw -------------------------------------------------------------------------------- /rawwaves/impuls20.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/impuls20.raw -------------------------------------------------------------------------------- /rawwaves/impuls40.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/impuls40.raw -------------------------------------------------------------------------------- /rawwaves/makefunc.c: -------------------------------------------------------------------------------- 1 | /**********************************************/ 2 | /** Utility to make various functions **/ 3 | /** like exponential and log gain curves. **/ 4 | /** **/ 5 | /** Included here: **/ 6 | /** Yamaha TX81Z curves for master gain, **/ 7 | /** Envelope Rates (in normalized units), **/ 8 | /** envelope sustain level, and more.... **/ 9 | /**********************************************/ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | void main() 16 | { 17 | int i,j; 18 | double temp; 19 | double data[128]; 20 | 21 | /*************** TX81Z Master Gain *************/ 22 | for (i=0;i<100;i++) { 23 | data[i] = pow(2.0,-(99-i)/10.0); 24 | } 25 | data[0] = 0.0; 26 | printf("double __FM4Op_gains[99] = {"); 27 | for (i=0;i<100;i++) { 28 | if (i%8 == 0) printf("\n"); 29 | printf("%lf,",data[i]); 30 | } 31 | printf("};\n"); 32 | /*************** TX81Z Sustain Level ***********/ 33 | for (i=0;i<16;i++) { 34 | data[i] = pow(2.0,-(15-i)/2.0); 35 | } 36 | data[0] = 0.0; 37 | printf("double __FM4Op_susLevels[16] = {"); 38 | for (i=0;i<16;i++) { 39 | if (i%8 == 0) printf("\n"); 40 | printf("%lf,",data[i]); 41 | } 42 | printf("};\n"); 43 | /****************** Attack Rate ***************/ 44 | for (i=0;i<32;i++) { 45 | data[i] = 6.0 * pow(5.7,-(i-1)/5.0); 46 | } 47 | printf("double __FM4Op_attTimes[16] = {"); 48 | for (i=0;i<32;i++) { 49 | if (i%8 == 0) printf("\n"); 50 | printf("%lf,",data[i]); 51 | } 52 | printf("};\n"); 53 | exit(1); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /rawwaves/makemidi.c: -------------------------------------------------------------------------------- 1 | /**********************************************/ 2 | /** Utility to make various functions **/ 3 | /** like exponential and log gain curves. **/ 4 | /** Specifically for direct MIDI parameter **/ 5 | /** conversions. **/ 6 | /** Included here: **/ 7 | /** A440 Referenced Equal Tempered Pitches **/ 8 | /** as a function of MIDI note number. **/ 9 | /** **/ 10 | /**********************************************/ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | void main() 17 | { 18 | int i,j; 19 | double temp; 20 | double data[128]; 21 | 22 | /********* Pitch as fn. of MIDI Note **********/ 23 | 24 | printf("double __MIDI_To_Pitch[128] = {"); 25 | for (i=0;i<128;i++) { 26 | if (i%8 == 0) printf("\n"); 27 | temp = 220.0 * pow(2.0,((double) i - 57) / 12.0); 28 | printf("%.2lf,",temp); 29 | } 30 | printf("};\n"); 31 | exit(1); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /rawwaves/mand1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand1.raw -------------------------------------------------------------------------------- /rawwaves/mand10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand10.raw -------------------------------------------------------------------------------- /rawwaves/mand11.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand11.raw -------------------------------------------------------------------------------- /rawwaves/mand12.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand12.raw -------------------------------------------------------------------------------- /rawwaves/mand2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand2.raw -------------------------------------------------------------------------------- /rawwaves/mand3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand3.raw -------------------------------------------------------------------------------- /rawwaves/mand4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand4.raw -------------------------------------------------------------------------------- /rawwaves/mand5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand5.raw -------------------------------------------------------------------------------- /rawwaves/mand6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand6.raw -------------------------------------------------------------------------------- /rawwaves/mand7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand7.raw -------------------------------------------------------------------------------- /rawwaves/mand8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand8.raw -------------------------------------------------------------------------------- /rawwaves/mand9.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mand9.raw -------------------------------------------------------------------------------- /rawwaves/mandpluk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/mandpluk.raw -------------------------------------------------------------------------------- /rawwaves/marmstk1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/marmstk1.raw -------------------------------------------------------------------------------- /rawwaves/ooo.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/ooo.raw -------------------------------------------------------------------------------- /rawwaves/peksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/peksblnk.raw -------------------------------------------------------------------------------- /rawwaves/ppksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/ppksblnk.raw -------------------------------------------------------------------------------- /rawwaves/ridecymb.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thestk/stk/6aacd357d76250bb7da2b1ddf675651828784bbc/rawwaves/ridecymb.raw -------------------------------------------------------------------------------- /rawwaves/silence.raw: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rawwaves/sine.c: -------------------------------------------------------------------------------- 1 | // Utility to make a rawwave sine table (assumes big-endian machine). 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define LENGTH 1024 8 | #define PI 3.14159265358979323846 9 | 10 | void main() 11 | { 12 | int i,j; 13 | double temp; 14 | short data[LENGTH + 2]; 15 | FILE *fd; 16 | 17 | fd = fopen("sinewave.raw","wb"); 18 | for (i=0; i Out 14 | 3 -/| 15 | 4 -- 16 | \endcode 17 | 18 | Control Change Numbers: 19 | - Operator 4 (feedback) Gain = 2 20 | - Operator 3 Gain = 4 21 | - LFO Speed = 11 22 | - LFO Depth = 1 23 | - ADSR 2 & 4 Target = 128 24 | 25 | The basic Chowning/Stanford FM patent expired 26 | in 1995, but there exist follow-on patents, 27 | mostly assigned to Yamaha. If you are of the 28 | type who should worry about this (making 29 | money) worry away. 30 | 31 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 32 | */ 33 | /***************************************************/ 34 | 35 | #include "BeeThree.h" 36 | 37 | namespace stk { 38 | 39 | BeeThree :: BeeThree( void ) 40 | : FM() 41 | { 42 | // Concatenate the STK rawwave path to the rawwave files 43 | for ( unsigned int i=0; i<3; i++ ) 44 | waves_[i] = new FileLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true ); 45 | waves_[3] = new FileLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true ); 46 | 47 | this->setRatio( 0, 0.999 ); 48 | this->setRatio( 1, 1.997 ); 49 | this->setRatio( 2, 3.006 ); 50 | this->setRatio( 3, 6.009 ); 51 | 52 | gains_[0] = fmGains_[95]; 53 | gains_[1] = fmGains_[95]; 54 | gains_[2] = fmGains_[99]; 55 | gains_[3] = fmGains_[95]; 56 | 57 | adsr_[0]->setAllTimes( 0.005, 0.003, 1.0, 0.01 ); 58 | adsr_[1]->setAllTimes( 0.005, 0.003, 1.0, 0.01 ); 59 | adsr_[2]->setAllTimes( 0.005, 0.003, 1.0, 0.01 ); 60 | adsr_[3]->setAllTimes( 0.005, 0.001, 0.4, 0.03 ); 61 | 62 | twozero_.setGain( 0.1 ); 63 | } 64 | 65 | BeeThree :: ~BeeThree( void ) 66 | { 67 | } 68 | 69 | void BeeThree :: noteOn( StkFloat frequency, StkFloat amplitude ) 70 | { 71 | gains_[0] = amplitude * fmGains_[95]; 72 | gains_[1] = amplitude * fmGains_[95]; 73 | gains_[2] = amplitude * fmGains_[99]; 74 | gains_[3] = amplitude * fmGains_[95]; 75 | this->setFrequency( frequency ); 76 | this->keyOn(); 77 | } 78 | 79 | } // stk namespace 80 | -------------------------------------------------------------------------------- /src/Blit.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Blit 3 | \brief STK band-limited impulse train class. 4 | 5 | This class generates a band-limited impulse train using a 6 | closed-form algorithm reported by Stilson and Smith in "Alias-Free 7 | Digital Synthesis of Classic Analog Waveforms", 1996. The user 8 | can specify both the fundamental frequency of the impulse train 9 | and the number of harmonics contained in the resulting signal. 10 | 11 | The signal is normalized so that the peak value is +/-1.0. 12 | 13 | If nHarmonics is 0, then the signal will contain all harmonics up 14 | to half the sample rate. Note, however, that this setting may 15 | produce aliasing in the signal when the frequency is changing (no 16 | automatic modification of the number of harmonics is performed by 17 | the setFrequency() function). 18 | 19 | Original code by Robin Davies, 2005. 20 | Revisions by Gary Scavone for STK, 2005. 21 | */ 22 | /***************************************************/ 23 | 24 | #include "Blit.h" 25 | 26 | namespace stk { 27 | 28 | Blit:: Blit( StkFloat frequency ) 29 | { 30 | if ( frequency <= 0.0 ) { 31 | oStream_ << "Blit::Blit: argument (" << frequency << ") must be positive!"; 32 | handleError( StkError::FUNCTION_ARGUMENT ); 33 | } 34 | 35 | nHarmonics_ = 0; 36 | this->setFrequency( frequency ); 37 | this->reset(); 38 | } 39 | 40 | Blit :: ~Blit() 41 | { 42 | } 43 | 44 | void Blit :: reset() 45 | { 46 | phase_ = 0.0; 47 | lastFrame_[0] = 0.0; 48 | } 49 | 50 | void Blit :: setFrequency( StkFloat frequency ) 51 | { 52 | if ( frequency <= 0.0 ) { 53 | oStream_ << "Blit::setFrequency: argument (" << frequency << ") must be positive!"; 54 | handleError( StkError::WARNING ); return; 55 | } 56 | 57 | p_ = Stk::sampleRate() / frequency; 58 | rate_ = PI / p_; 59 | this->updateHarmonics(); 60 | } 61 | 62 | void Blit :: setHarmonics( unsigned int nHarmonics ) 63 | { 64 | nHarmonics_ = nHarmonics; 65 | this->updateHarmonics(); 66 | } 67 | 68 | void Blit :: updateHarmonics( void ) 69 | { 70 | if ( nHarmonics_ <= 0 ) { 71 | unsigned int maxHarmonics = (unsigned int) floor( 0.5 * p_ ); 72 | m_ = 2 * maxHarmonics + 1; 73 | } 74 | else 75 | m_ = 2 * nHarmonics_ + 1; 76 | } 77 | 78 | } // stk namespace 79 | -------------------------------------------------------------------------------- /src/Chorus.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Chorus 3 | \brief STK chorus effect class. 4 | 5 | This class implements a chorus effect. It takes a monophonic 6 | input signal and produces a stereo output signal. 7 | 8 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "Chorus.h" 13 | 14 | namespace stk { 15 | 16 | Chorus :: Chorus( StkFloat baseDelay ) 17 | { 18 | lastFrame_.resize( 1, 2, 0.0 ); // resize lastFrame_ for stereo output 19 | delayLine_[0].setMaximumDelay( (unsigned long) (baseDelay * 1.414) + 2); 20 | delayLine_[0].setDelay( baseDelay ); 21 | delayLine_[1].setMaximumDelay( (unsigned long) (baseDelay * 1.414) + 2); 22 | delayLine_[1].setDelay( baseDelay ); 23 | baseLength_ = baseDelay; 24 | 25 | mods_[0].setFrequency( 0.2 ); 26 | mods_[1].setFrequency( 0.222222 ); 27 | modDepth_ = 0.05; 28 | effectMix_ = 0.5; 29 | this->clear(); 30 | } 31 | 32 | void Chorus :: clear( void ) 33 | { 34 | delayLine_[0].clear(); 35 | delayLine_[1].clear(); 36 | lastFrame_[0] = 0.0; 37 | lastFrame_[1] = 0.0; 38 | } 39 | 40 | void Chorus :: setModDepth( StkFloat depth ) 41 | { 42 | if ( depth < 0.0 || depth > 1.0 ) { 43 | oStream_ << "Chorus::setModDepth(): depth argument must be between 0.0 - 1.0!"; 44 | handleError( StkError::WARNING ); return; 45 | } 46 | 47 | modDepth_ = depth; 48 | }; 49 | 50 | void Chorus :: setModFrequency( StkFloat frequency ) 51 | { 52 | mods_[0].setFrequency( frequency ); 53 | mods_[1].setFrequency( frequency * 1.1111 ); 54 | } 55 | 56 | } // stk namespace 57 | -------------------------------------------------------------------------------- /src/DelayL.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class DelayL 3 | \brief STK linear interpolating delay line class. 4 | 5 | This class implements a fractional-length digital delay-line using 6 | first-order linear interpolation. If the delay and maximum length 7 | are not specified during instantiation, a fixed maximum length of 8 | 4095 and a delay of zero is set. 9 | 10 | Linear interpolation is an efficient technique for achieving 11 | fractional delay lengths, though it does introduce high-frequency 12 | signal attenuation to varying degrees depending on the fractional 13 | delay setting. The use of higher order Lagrange interpolators can 14 | typically improve (minimize) this attenuation characteristic. 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 17 | */ 18 | /***************************************************/ 19 | 20 | #include "DelayL.h" 21 | 22 | namespace stk { 23 | 24 | DelayL :: DelayL( StkFloat delay, unsigned long maxDelay ) 25 | { 26 | if ( delay < 0.0 ) { 27 | oStream_ << "DelayL::DelayL: delay must be >= 0.0!"; 28 | handleError( StkError::FUNCTION_ARGUMENT ); 29 | } 30 | 31 | if ( delay > (StkFloat) maxDelay ) { 32 | oStream_ << "DelayL::DelayL: maxDelay must be > than delay argument!"; 33 | handleError( StkError::FUNCTION_ARGUMENT ); 34 | } 35 | 36 | // Writing before reading allows delays from 0 to length-1. 37 | if ( maxDelay + 1 > inputs_.size() ) 38 | inputs_.resize( maxDelay + 1, 1, 0.0 ); 39 | 40 | inPoint_ = 0; 41 | this->setDelay( delay ); 42 | doNextOut_ = true; 43 | } 44 | 45 | DelayL :: ~DelayL() 46 | { 47 | } 48 | 49 | void DelayL :: setMaximumDelay( unsigned long delay ) 50 | { 51 | if ( delay < inputs_.size() ) return; 52 | inputs_.resize(delay + 1, 1, 0.0); 53 | } 54 | 55 | StkFloat DelayL :: tapOut( unsigned long tapDelay ) 56 | { 57 | long tap = inPoint_ - tapDelay - 1; 58 | while ( tap < 0 ) // Check for wraparound. 59 | tap += inputs_.size(); 60 | 61 | return inputs_[tap]; 62 | } 63 | 64 | void DelayL :: tapIn( StkFloat value, unsigned long tapDelay ) 65 | { 66 | long tap = inPoint_ - tapDelay - 1; 67 | while ( tap < 0 ) // Check for wraparound. 68 | tap += inputs_.size(); 69 | 70 | inputs_[tap] = value; 71 | } 72 | 73 | } // stk namespace 74 | -------------------------------------------------------------------------------- /src/Echo.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Echo 3 | \brief STK echo effect class. 4 | 5 | This class implements an echo effect. 6 | 7 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 8 | */ 9 | /***************************************************/ 10 | 11 | #include "Echo.h" 12 | #include 13 | 14 | namespace stk { 15 | 16 | Echo :: Echo( unsigned long maximumDelay ) : Effect() 17 | { 18 | this->setMaximumDelay( maximumDelay ); 19 | delayLine_.setDelay( length_ >> 1 ); 20 | effectMix_ = 0.5; 21 | this->clear(); 22 | } 23 | 24 | void Echo :: clear( void ) 25 | { 26 | delayLine_.clear(); 27 | lastFrame_[0] = 0.0; 28 | } 29 | 30 | void Echo :: setMaximumDelay( unsigned long delay ) 31 | { 32 | if ( delay == 0 ) { 33 | oStream_ << "Echo::setMaximumDelay: parameter cannot be zero!"; 34 | handleError( StkError::WARNING ); return; 35 | } 36 | 37 | length_ = delay; 38 | delayLine_.setMaximumDelay( delay ); 39 | } 40 | 41 | void Echo :: setDelay( unsigned long delay ) 42 | { 43 | if ( delay > length_ ) { 44 | oStream_ << "Echo::setDelay: parameter is greater than maximum delay length!"; 45 | handleError( StkError::WARNING ); return; 46 | } 47 | 48 | delayLine_.setDelay( delay ); 49 | } 50 | 51 | } // stk namespace 52 | -------------------------------------------------------------------------------- /src/Envelope.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Envelope 3 | \brief STK linear line envelope class. 4 | 5 | This class implements a simple linear line envelope generator 6 | which is capable of ramping to an arbitrary target value by a 7 | specified \e rate. It also responds to simple \e keyOn and \e 8 | keyOff messages, ramping to a specified target (default = 1.0) on 9 | keyOn and to a specified target (default = 0.0) on keyOff. 10 | 11 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 12 | */ 13 | /***************************************************/ 14 | 15 | #include "Envelope.h" 16 | #include 17 | 18 | namespace stk { 19 | 20 | Envelope :: Envelope( void ) : Generator() 21 | { 22 | target_ = 0.0; 23 | value_ = 0.0; 24 | rate_ = 0.001; 25 | state_ = 0; 26 | Stk::addSampleRateAlert( this ); 27 | } 28 | 29 | Envelope :: ~Envelope( void ) 30 | { 31 | Stk::removeSampleRateAlert( this ); 32 | } 33 | 34 | Envelope& Envelope :: operator= ( const Envelope& e ) 35 | { 36 | if ( this != &e ) { 37 | target_ = e.target_; 38 | value_ = e.value_; 39 | rate_ = e.rate_; 40 | state_ = e.state_; 41 | } 42 | 43 | return *this; 44 | } 45 | 46 | void Envelope :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 47 | { 48 | if ( !ignoreSampleRateChange_ ) 49 | rate_ = oldRate * rate_ / newRate; 50 | } 51 | 52 | void Envelope :: setRate( StkFloat rate ) 53 | { 54 | if ( rate < 0.0 ) { 55 | oStream_ << "Envelope::setRate: argument must be >= 0.0!"; 56 | handleError( StkError::WARNING ); return; 57 | } 58 | 59 | rate_ = rate; 60 | } 61 | 62 | void Envelope :: setTime( StkFloat time ) 63 | { 64 | if ( time <= 0.0 ) { 65 | oStream_ << "Envelope::setTime: argument must be > 0.0!"; 66 | handleError( StkError::WARNING ); return; 67 | } 68 | 69 | //rate_ = 1.0 / ( time * Stk::sampleRate() ); 70 | rate_ = fabs(target_ - value_) / ( time * Stk::sampleRate() ); 71 | } 72 | 73 | void Envelope :: setTarget( StkFloat target ) 74 | { 75 | target_ = target; 76 | if ( value_ != target_ ) state_ = 1; 77 | } 78 | 79 | void Envelope :: setValue( StkFloat value ) 80 | { 81 | state_ = 0; 82 | target_ = value; 83 | value_ = value; 84 | lastFrame_[0] = value_; 85 | } 86 | 87 | } // stk namespace 88 | -------------------------------------------------------------------------------- /src/Fir.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Fir 3 | \brief STK general finite impulse response filter class. 4 | 5 | This class provides a generic digital filter structure that can be 6 | used to implement FIR filters. For filters with feedback terms, 7 | the Iir class should be used. 8 | 9 | In particular, this class implements the standard difference 10 | equation: 11 | 12 | y[n] = b[0]*x[n] + ... + b[nb]*x[n-nb] 13 | 14 | The \e gain parameter is applied at the filter input and does not 15 | affect the coefficient values. The default gain value is 1.0. 16 | This structure results in one extra multiply per computed sample, 17 | but allows easy control of the overall filter gain. 18 | 19 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 20 | */ 21 | /***************************************************/ 22 | 23 | #include "Fir.h" 24 | #include 25 | 26 | namespace stk { 27 | 28 | Fir :: Fir() 29 | { 30 | // The default constructor should setup for pass-through. 31 | b_.push_back( 1.0 ); 32 | 33 | inputs_.resize( 1, 1, 0.0 ); 34 | } 35 | 36 | Fir :: Fir( std::vector &coefficients ) 37 | { 38 | // Check the arguments. 39 | if ( coefficients.size() == 0 ) { 40 | oStream_ << "Fir: coefficient vector must have size > 0!"; 41 | handleError( StkError::FUNCTION_ARGUMENT ); 42 | } 43 | 44 | gain_ = 1.0; 45 | b_ = coefficients; 46 | 47 | inputs_.resize( b_.size(), 1, 0.0 ); 48 | this->clear(); 49 | } 50 | 51 | Fir :: ~Fir() 52 | { 53 | } 54 | 55 | void Fir :: setCoefficients( std::vector &coefficients, bool clearState ) 56 | { 57 | // Check the argument. 58 | if ( coefficients.size() == 0 ) { 59 | oStream_ << "Fir::setCoefficients: coefficient vector must have size > 0!"; 60 | handleError( StkError::FUNCTION_ARGUMENT ); 61 | } 62 | 63 | if ( b_.size() != coefficients.size() ) { 64 | b_ = coefficients; 65 | inputs_.resize( b_.size(), 1, 0.0 ); 66 | } 67 | else { 68 | for ( unsigned int i=0; iclear(); 72 | } 73 | 74 | } // stk namespace 75 | -------------------------------------------------------------------------------- /src/HevyMetl.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class HevyMetl 3 | \brief STK heavy metal FM synthesis instrument. 4 | 5 | This class implements 3 cascade operators with 6 | feedback modulation, also referred to as 7 | algorithm 3 of the TX81Z. 8 | 9 | Algorithm 3 is : 4--\ 10 | 3-->2-- + -->1-->Out 11 | 12 | Control Change Numbers: 13 | - Total Modulator Index = 2 14 | - Modulator Crossfade = 4 15 | - LFO Speed = 11 16 | - LFO Depth = 1 17 | - ADSR 2 & 4 Target = 128 18 | 19 | The basic Chowning/Stanford FM patent expired 20 | in 1995, but there exist follow-on patents, 21 | mostly assigned to Yamaha. If you are of the 22 | type who should worry about this (making 23 | money) worry away. 24 | 25 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 26 | */ 27 | /***************************************************/ 28 | 29 | #include "HevyMetl.h" 30 | 31 | namespace stk { 32 | 33 | HevyMetl :: HevyMetl( void ) 34 | : FM() 35 | { 36 | // Concatenate the STK rawwave path to the rawwave files 37 | for ( unsigned int i=0; i<3; i++ ) 38 | waves_[i] = new FileLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true ); 39 | waves_[3] = new FileLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true ); 40 | 41 | this->setRatio(0, 1.0 * 1.000); 42 | this->setRatio(1, 4.0 * 0.999); 43 | this->setRatio(2, 3.0 * 1.001); 44 | this->setRatio(3, 0.5 * 1.002); 45 | 46 | gains_[0] = fmGains_[92]; 47 | gains_[1] = fmGains_[76]; 48 | gains_[2] = fmGains_[91]; 49 | gains_[3] = fmGains_[68]; 50 | 51 | adsr_[0]->setAllTimes( 0.001, 0.001, 1.0, 0.01); 52 | adsr_[1]->setAllTimes( 0.001, 0.010, 1.0, 0.50); 53 | adsr_[2]->setAllTimes( 0.010, 0.005, 1.0, 0.20); 54 | adsr_[3]->setAllTimes( 0.030, 0.010, 0.2, 0.20); 55 | 56 | twozero_.setGain( 2.0 ); 57 | vibrato_.setFrequency( 5.5 ); 58 | modDepth_ = 0.0; 59 | } 60 | 61 | HevyMetl :: ~HevyMetl( void ) 62 | { 63 | } 64 | 65 | void HevyMetl :: noteOn( StkFloat frequency, StkFloat amplitude ) 66 | { 67 | gains_[0] = amplitude * fmGains_[92]; 68 | gains_[1] = amplitude * fmGains_[76]; 69 | gains_[2] = amplitude * fmGains_[91]; 70 | gains_[3] = amplitude * fmGains_[68]; 71 | this->setFrequency( frequency ); 72 | this->keyOn(); 73 | } 74 | 75 | } // stk namespace 76 | -------------------------------------------------------------------------------- /src/LentPitShift.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class LentPitShift 3 | \brief Pitch shifter effect class based on the Lent algorithm. 4 | 5 | This class implements a pitch shifter using pitch 6 | tracking and sample windowing and shifting. 7 | 8 | by Francois Germain, 2009. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "LentPitShift.h" 13 | 14 | namespace stk { 15 | 16 | LentPitShift::LentPitShift( StkFloat periodRatio, int tMax ) 17 | : inputFrames(0.,tMax,1), outputFrames(0.,tMax,1), ptrFrames(0), inputPtr(0), outputPtr(0.), tMax_(tMax), periodRatio_(periodRatio), zeroFrame(0., tMax, 1) 18 | { 19 | window = new StkFloat[2*tMax_]; // Allocation of the array for the hamming window 20 | threshold_ = 0.1; // Default threshold for pitch tracking 21 | 22 | dt = new StkFloat[tMax+1]; // Allocation of the euclidian distance coefficient array. The first one is never used. 23 | cumDt = new StkFloat[tMax+1]; // Allocation of the cumulative sum array 24 | cumDt[0] = 0.; // Initialization of the first coefficient of the cumulative sum 25 | dpt = new StkFloat[tMax+1]; // Allocation of the pitch tracking function coefficient array 26 | dpt[0] = 1.; // Initialization of the first coefficient of dpt which is always the same 27 | 28 | // Initialisation of the input and output delay lines 29 | inputLine_.setMaximumDelay( 3 * tMax_ ); 30 | // The delay is choosed such as the coefficients are not read before being finalised. 31 | outputLine_.setMaximumDelay( 3 * tMax_ ); 32 | outputLine_.setDelay( 3 * tMax_ ); 33 | 34 | //Initialization of the delay line of pitch tracking coefficients 35 | //coeffLine_ = new Delay[512]; 36 | //for(int i=0;i 15 | 16 | namespace stk { 17 | 18 | Noise :: Noise( unsigned int seed ) 19 | { 20 | // Seed the random number generator 21 | this->setSeed( seed ); 22 | } 23 | 24 | void Noise :: setSeed( unsigned int seed ) 25 | { 26 | if ( seed == 0 ) 27 | srand( (unsigned int) time( NULL ) ); 28 | else 29 | srand( seed ); 30 | } 31 | 32 | } // stk namespace 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/OnePole.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class OnePole 3 | \brief STK one-pole filter class. 4 | 5 | This class implements a one-pole digital filter. A method is 6 | provided for setting the pole position along the real axis of the 7 | z-plane while maintaining a constant peak filter gain. 8 | 9 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 10 | */ 11 | /***************************************************/ 12 | 13 | #include "OnePole.h" 14 | 15 | namespace stk { 16 | 17 | OnePole :: OnePole( StkFloat thePole ) 18 | { 19 | b_.resize( 1 ); 20 | a_.resize( 2 ); 21 | a_[0] = 1.0; 22 | inputs_.resize( 1, 1, 0.0 ); 23 | outputs_.resize( 2, 1, 0.0 ); 24 | 25 | this->setPole( thePole ); 26 | } 27 | 28 | OnePole :: ~OnePole() 29 | { 30 | } 31 | 32 | void OnePole :: setPole( StkFloat thePole ) 33 | { 34 | if ( std::abs( thePole ) >= 1.0 ) { 35 | oStream_ << "OnePole::setPole: argument (" << thePole << ") should be less than 1.0!"; 36 | handleError( StkError::WARNING ); return; 37 | } 38 | 39 | // Normalize coefficients for peak unity gain. 40 | if ( thePole > 0.0 ) 41 | b_[0] = (StkFloat) (1.0 - thePole); 42 | else 43 | b_[0] = (StkFloat) (1.0 + thePole); 44 | 45 | a_[1] = -thePole; 46 | } 47 | 48 | void OnePole :: setCoefficients( StkFloat b0, StkFloat a1, bool clearState ) 49 | { 50 | if ( std::abs( a1 ) >= 1.0 ) { 51 | oStream_ << "OnePole::setCoefficients: a1 argument (" << a1 << ") should be less than 1.0!"; 52 | handleError( StkError::WARNING ); return; 53 | } 54 | 55 | b_[0] = b0; 56 | a_[1] = a1; 57 | 58 | if ( clearState ) this->clear(); 59 | } 60 | 61 | } // stk namespace 62 | -------------------------------------------------------------------------------- /src/OneZero.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class OneZero 3 | \brief STK one-zero filter class. 4 | 5 | This class implements a one-zero digital filter. A method is 6 | provided for setting the zero position along the real axis of the 7 | z-plane while maintaining a constant filter gain. 8 | 9 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 10 | */ 11 | /***************************************************/ 12 | 13 | #include "OneZero.h" 14 | #include 15 | 16 | namespace stk { 17 | 18 | OneZero :: OneZero( StkFloat theZero ) 19 | { 20 | b_.resize( 2 ); 21 | inputs_.resize( 2, 1, 0.0 ); 22 | 23 | this->setZero( theZero ); 24 | } 25 | 26 | OneZero :: ~OneZero( void ) 27 | { 28 | } 29 | 30 | void OneZero :: setZero( StkFloat theZero ) 31 | { 32 | // Normalize coefficients for unity gain. 33 | if ( theZero > 0.0 ) 34 | b_[0] = 1.0 / ((StkFloat) 1.0 + theZero); 35 | else 36 | b_[0] = 1.0 / ((StkFloat) 1.0 - theZero); 37 | 38 | b_[1] = -theZero * b_[0]; 39 | } 40 | 41 | void OneZero :: setCoefficients( StkFloat b0, StkFloat b1, bool clearState ) 42 | { 43 | b_[0] = b0; 44 | b_[1] = b1; 45 | 46 | if ( clearState ) this->clear(); 47 | } 48 | 49 | } // stk namespace 50 | -------------------------------------------------------------------------------- /src/PoleZero.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class PoleZero 3 | \brief STK one-pole, one-zero filter class. 4 | 5 | This class implements a one-pole, one-zero digital filter. A 6 | method is provided for creating an allpass filter with a given 7 | coefficient. Another method is provided to create a DC blocking 8 | filter. 9 | 10 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 11 | */ 12 | /***************************************************/ 13 | 14 | #include "PoleZero.h" 15 | 16 | namespace stk { 17 | 18 | PoleZero :: PoleZero() 19 | { 20 | // Default setting for pass-through. 21 | b_.resize( 2, 0.0 ); 22 | a_.resize( 2, 0.0 ); 23 | b_[0] = 1.0; 24 | a_[0] = 1.0; 25 | inputs_.resize( 2, 1, 0.0 ); 26 | outputs_.resize( 2, 1, 0.0 ); 27 | } 28 | 29 | PoleZero :: ~PoleZero() 30 | { 31 | } 32 | 33 | void PoleZero :: setCoefficients( StkFloat b0, StkFloat b1, StkFloat a1, bool clearState ) 34 | { 35 | if ( std::abs( a1 ) >= 1.0 ) { 36 | oStream_ << "PoleZero::setCoefficients: a1 argument (" << a1 << ") should be less than 1.0!"; 37 | handleError( StkError::WARNING ); return; 38 | } 39 | 40 | b_[0] = b0; 41 | b_[1] = b1; 42 | a_[1] = a1; 43 | 44 | if ( clearState ) this->clear(); 45 | } 46 | 47 | void PoleZero :: setAllpass( StkFloat coefficient ) 48 | { 49 | if ( std::abs( coefficient ) >= 1.0 ) { 50 | oStream_ << "PoleZero::setAllpass: argument (" << coefficient << ") makes filter unstable!"; 51 | handleError( StkError::WARNING ); return; 52 | } 53 | 54 | b_[0] = coefficient; 55 | b_[1] = 1.0; 56 | a_[0] = 1.0; // just in case 57 | a_[1] = coefficient; 58 | } 59 | 60 | void PoleZero :: setBlockZero( StkFloat thePole ) 61 | { 62 | if ( std::abs( thePole ) >= 1.0 ) { 63 | oStream_ << "PoleZero::setBlockZero: argument (" << thePole << ") makes filter unstable!"; 64 | handleError( StkError::WARNING ); return; 65 | } 66 | 67 | b_[0] = 1.0; 68 | b_[1] = -1.0; 69 | a_[0] = 1.0; // just in case 70 | a_[1] = -thePole; 71 | } 72 | 73 | } // stk namespace 74 | -------------------------------------------------------------------------------- /src/Sampler.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Sampler 3 | \brief STK sampling synthesis abstract base class. 4 | 5 | This instrument provides an ADSR envelope, a one-pole filter, and 6 | structures for an arbitrary number of attack and looped files. 7 | 8 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "Sampler.h" 13 | 14 | namespace stk { 15 | 16 | Sampler :: Sampler( void ) 17 | { 18 | // We don't make the waves here yet, because 19 | // we don't know what they will be. 20 | baseFrequency_ = 440.0; 21 | attackGain_ = 0.25; 22 | loopGain_ = 0.25; 23 | } 24 | 25 | Sampler :: ~Sampler( void ) 26 | { 27 | unsigned int i; 28 | for ( i=0; ireset(); 37 | 38 | // Start the envelope. 39 | adsr_.keyOn(); 40 | 41 | } 42 | 43 | void Sampler :: keyOff( void ) 44 | { 45 | adsr_.keyOff(); 46 | } 47 | 48 | void Sampler :: noteOff( StkFloat amplitude ) 49 | { 50 | this->keyOff(); 51 | } 52 | 53 | } // stk namespace 54 | -------------------------------------------------------------------------------- /src/SineWave.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class SineWave 3 | \brief STK sinusoid oscillator class. 4 | 5 | This class computes and saves a static sine "table" that can be 6 | shared by multiple instances. It has an interface similar to the 7 | WaveLoop class but inherits from the Generator class. Output 8 | values are computed using linear interpolation. 9 | 10 | The "table" length, set in SineWave.h, is 2048 samples by default. 11 | 12 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 13 | */ 14 | /***************************************************/ 15 | 16 | #include "SineWave.h" 17 | #include 18 | 19 | namespace stk { 20 | 21 | StkFrames SineWave :: table_; 22 | 23 | SineWave :: SineWave( void ) 24 | : time_(0.0), rate_(1.0), phaseOffset_(0.0) 25 | { 26 | if ( table_.empty() ) { 27 | table_.resize( TABLE_SIZE + 1, 1 ); 28 | StkFloat temp = 1.0 / TABLE_SIZE; 29 | for ( unsigned long i=0; i<=TABLE_SIZE; i++ ) 30 | table_[i] = sin( TWO_PI * i * temp ); 31 | } 32 | 33 | Stk::addSampleRateAlert( this ); 34 | } 35 | 36 | SineWave :: ~SineWave() 37 | { 38 | Stk::removeSampleRateAlert( this ); 39 | } 40 | 41 | void SineWave :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 42 | { 43 | if ( !ignoreSampleRateChange_ ) 44 | this->setRate( oldRate * rate_ / newRate ); 45 | } 46 | 47 | void SineWave :: reset( void ) 48 | { 49 | time_ = 0.0; 50 | lastFrame_[0] = 0; 51 | } 52 | 53 | void SineWave :: setFrequency( StkFloat frequency ) 54 | { 55 | // This is a looping frequency. 56 | this->setRate( TABLE_SIZE * frequency / Stk::sampleRate() ); 57 | } 58 | 59 | void SineWave :: addTime( StkFloat time ) 60 | { 61 | // Add an absolute time in samples. 62 | time_ += time; 63 | } 64 | 65 | void SineWave :: addPhase( StkFloat phase ) 66 | { 67 | // Add a time in cycles (one cycle = TABLE_SIZE). 68 | time_ += TABLE_SIZE * phase; 69 | } 70 | 71 | void SineWave :: addPhaseOffset( StkFloat phaseOffset ) 72 | { 73 | // Add a phase offset relative to any previous offset value. 74 | time_ += ( phaseOffset - phaseOffset_ ) * TABLE_SIZE; 75 | phaseOffset_ = phaseOffset; 76 | } 77 | 78 | } // stk namespace 79 | -------------------------------------------------------------------------------- /src/SingWave.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class SingWave 3 | \brief STK "singing" looped soundfile class. 4 | 5 | This class loops a specified soundfile and modulates it both 6 | periodically and randomly to produce a pitched musical sound, like 7 | a simple voice or violin. In general, it is not be used alone 8 | because of "munchkinification" effects from pitch shifting. 9 | Within STK, it is used as an excitation source for other 10 | instruments. 11 | 12 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 13 | */ 14 | /***************************************************/ 15 | 16 | #include "SingWave.h" 17 | 18 | namespace stk { 19 | 20 | SingWave :: SingWave( std::string fileName, bool raw ) 21 | { 22 | // An exception could be thrown here. 23 | wave_.openFile( fileName, raw ); 24 | 25 | rate_ = 1.0; 26 | sweepRate_ = 0.001; 27 | 28 | modulator_.setVibratoRate( 6.0 ); 29 | modulator_.setVibratoGain( 0.04 ); 30 | modulator_.setRandomGain( 0.005 ); 31 | 32 | this->setFrequency( 75.0 ); 33 | pitchEnvelope_.setRate( 1.0 ); 34 | this->tick(); 35 | this->tick(); 36 | pitchEnvelope_.setRate( sweepRate_ * rate_ ); 37 | } 38 | 39 | SingWave :: ~SingWave() 40 | { 41 | } 42 | 43 | void SingWave :: setFrequency( StkFloat frequency ) 44 | { 45 | StkFloat temp = rate_; 46 | rate_ = wave_.getSize() * frequency / Stk::sampleRate(); 47 | temp -= rate_; 48 | if ( temp < 0) temp = -temp; 49 | pitchEnvelope_.setTarget( rate_ ); 50 | pitchEnvelope_.setRate( sweepRate_ * temp ); 51 | } 52 | 53 | } // stk namespace 54 | -------------------------------------------------------------------------------- /src/Socket.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Socket 3 | \brief STK internet socket abstract base class. 4 | 5 | This class provides common functionality for TCP and UDP internet 6 | socket server and client subclasses. 7 | 8 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "Socket.h" 13 | 14 | namespace stk { 15 | 16 | Socket :: Socket() 17 | { 18 | soket_ = -1; 19 | port_ = -1; 20 | } 21 | 22 | Socket :: ~Socket() 23 | { 24 | this->close( soket_ ); 25 | 26 | #if defined(__OS_WINDOWS__) 27 | 28 | WSACleanup(); 29 | 30 | #endif 31 | } 32 | 33 | void Socket :: close( int socket ) 34 | { 35 | if ( !isValid( socket ) ) return; 36 | 37 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 38 | 39 | ::close( socket ); 40 | 41 | #elif defined(__OS_WINDOWS__) 42 | 43 | ::closesocket( socket ); 44 | 45 | #endif 46 | } 47 | 48 | void Socket :: setBlocking( int socket, bool enable ) 49 | { 50 | if ( !isValid( socket ) ) return; 51 | 52 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 53 | 54 | int tmp = ::fcntl( socket, F_GETFL, 0 ); 55 | if ( tmp >= 0 ) 56 | tmp = ::fcntl( socket, F_SETFL, enable ? (tmp &~ O_NONBLOCK) : (tmp | O_NONBLOCK) ); 57 | 58 | #elif defined(__OS_WINDOWS__) 59 | 60 | unsigned long non_block = !enable; 61 | ioctlsocket( socket, FIONBIO, &non_block ); 62 | 63 | #endif 64 | } 65 | 66 | int Socket :: writeBuffer(int socket, const void *buffer, long bufferSize, int flags ) 67 | { 68 | if ( !isValid( socket ) ) return -1; 69 | return send( socket, (const char *)buffer, bufferSize, flags ); 70 | } 71 | 72 | int Socket :: readBuffer(int socket, void *buffer, long bufferSize, int flags ) 73 | { 74 | if ( !isValid( socket ) ) return -1; 75 | return recv( socket, (char *)buffer, bufferSize, flags ); 76 | } 77 | 78 | } // stk namespace 79 | -------------------------------------------------------------------------------- /src/Sphere.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Sphere 3 | \brief STK sphere class. 4 | 5 | This class implements a spherical ball with 6 | radius, mass, position, and velocity parameters. 7 | 8 | by Perry R. Cook, 1995--2023. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "Sphere.h" 13 | #include 14 | 15 | namespace stk { 16 | 17 | Vector3D* Sphere::getRelativePosition( Vector3D* position ) 18 | { 19 | workingVector_.setXYZ(position->getX() - position_.getX(), 20 | position->getY() - position_.getY(), 21 | position->getZ() - position_.getZ()); 22 | return &workingVector_; 23 | }; 24 | 25 | StkFloat Sphere::getVelocity( Vector3D* velocity ) 26 | { 27 | velocity->setXYZ( velocity_.getX(), velocity_.getY(), velocity_.getZ() ); 28 | return velocity_.getLength(); 29 | }; 30 | 31 | StkFloat Sphere::isInside( Vector3D *position ) 32 | { 33 | // Return directed distance from aPosition to spherical boundary ( < 34 | // 0 if inside). 35 | StkFloat distance; 36 | Vector3D *tempVector; 37 | 38 | tempVector = this->getRelativePosition( position ); 39 | distance = tempVector->getLength(); 40 | return distance - radius_; 41 | }; 42 | 43 | void Sphere::addVelocity(StkFloat x, StkFloat y, StkFloat z) 44 | { 45 | velocity_.setX(velocity_.getX() + x); 46 | velocity_.setY(velocity_.getY() + y); 47 | velocity_.setZ(velocity_.getZ() + z); 48 | } 49 | 50 | } // stk namespace 51 | -------------------------------------------------------------------------------- /src/TubeBell.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class TubeBell 3 | \brief STK tubular bell (orchestral chime) FM 4 | synthesis instrument. 5 | 6 | This class implements two simple FM Pairs 7 | summed together, also referred to as algorithm 8 | 5 of the TX81Z. 9 | 10 | \code 11 | Algorithm 5 is : 4->3--\ 12 | + --> Out 13 | 2->1--/ 14 | \endcode 15 | 16 | Control Change Numbers: 17 | - Modulator Index One = 2 18 | - Crossfade of Outputs = 4 19 | - LFO Speed = 11 20 | - LFO Depth = 1 21 | - ADSR 2 & 4 Target = 128 22 | 23 | The basic Chowning/Stanford FM patent expired 24 | in 1995, but there exist follow-on patents, 25 | mostly assigned to Yamaha. If you are of the 26 | type who should worry about this (making 27 | money) worry away. 28 | 29 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 30 | */ 31 | /***************************************************/ 32 | 33 | #include "TubeBell.h" 34 | 35 | namespace stk { 36 | 37 | TubeBell :: TubeBell( void ) 38 | : FM() 39 | { 40 | // Concatenate the STK rawwave path to the rawwave files 41 | for ( unsigned int i=0; i<3; i++ ) 42 | waves_[i] = new FileLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true ); 43 | waves_[3] = new FileLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true ); 44 | 45 | this->setRatio(0, 1.0 * 0.995); 46 | this->setRatio(1, 1.414 * 0.995); 47 | this->setRatio(2, 1.0 * 1.005); 48 | this->setRatio(3, 1.414 * 1.000); 49 | 50 | gains_[0] = fmGains_[94]; 51 | gains_[1] = fmGains_[76]; 52 | gains_[2] = fmGains_[99]; 53 | gains_[3] = fmGains_[71]; 54 | 55 | adsr_[0]->setAllTimes( 0.005, 4.0, 0.0, 0.04); 56 | adsr_[1]->setAllTimes( 0.005, 4.0, 0.0, 0.04); 57 | adsr_[2]->setAllTimes( 0.001, 2.0, 0.0, 0.04); 58 | adsr_[3]->setAllTimes( 0.004, 4.0, 0.0, 0.04); 59 | 60 | twozero_.setGain( 0.5 ); 61 | vibrato_.setFrequency( 2.0 ); 62 | } 63 | 64 | TubeBell :: ~TubeBell( void ) 65 | { 66 | } 67 | 68 | void TubeBell :: noteOn( StkFloat frequency, StkFloat amplitude ) 69 | { 70 | gains_[0] = amplitude * fmGains_[94]; 71 | gains_[1] = amplitude * fmGains_[76]; 72 | gains_[2] = amplitude * fmGains_[99]; 73 | gains_[3] = amplitude * fmGains_[71]; 74 | this->setFrequency( frequency ); 75 | this->keyOn(); 76 | } 77 | 78 | } // stk namespace 79 | -------------------------------------------------------------------------------- /src/TwoPole.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class TwoPole 3 | \brief STK two-pole filter class. 4 | 5 | This class implements a two-pole digital filter. A method is 6 | provided for creating a resonance in the frequency response while 7 | maintaining a nearly constant filter gain. 8 | 9 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 10 | */ 11 | /***************************************************/ 12 | 13 | #include "TwoPole.h" 14 | #include 15 | 16 | namespace stk { 17 | 18 | TwoPole :: TwoPole( void ) 19 | { 20 | b_.resize( 1 ); 21 | a_.resize( 3 ); 22 | inputs_.resize( 1, 1, 0.0 ); 23 | outputs_.resize( 3, 1, 0.0 ); 24 | b_[0] = 1.0; 25 | a_[0] = 1.0; 26 | 27 | Stk::addSampleRateAlert( this ); 28 | } 29 | 30 | TwoPole :: ~TwoPole() 31 | { 32 | Stk::removeSampleRateAlert( this ); 33 | } 34 | 35 | void TwoPole :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 36 | { 37 | if ( !ignoreSampleRateChange_ ) { 38 | oStream_ << "TwoPole::sampleRateChanged: you may need to recompute filter coefficients!"; 39 | handleError( StkError::WARNING ); 40 | } 41 | } 42 | 43 | void TwoPole :: setResonance( StkFloat frequency, StkFloat radius, bool normalize ) 44 | { 45 | #if defined(_STK_DEBUG_) 46 | if ( frequency < 0.0 || frequency > 0.5 * Stk::sampleRate() ) { 47 | oStream_ << "TwoPole::setResonance: frequency argument (" << frequency << ") is out of range!"; 48 | handleError( StkError::WARNING ); return; 49 | } 50 | if ( radius < 0.0 || radius >= 1.0 ) { 51 | oStream_ << "TwoPole::setResonance: radius argument (" << radius << ") is out of range!"; 52 | handleError( StkError::WARNING ); return; 53 | } 54 | #endif 55 | 56 | a_[2] = radius * radius; 57 | a_[1] = (StkFloat) -2.0 * radius * cos(TWO_PI * frequency / Stk::sampleRate()); 58 | 59 | if ( normalize ) { 60 | // Normalize the filter gain ... not terribly efficient. 61 | StkFloat real = 1 - radius + (a_[2] - radius) * cos(TWO_PI * 2 * frequency / Stk::sampleRate()); 62 | StkFloat imag = (a_[2] - radius) * sin(TWO_PI * 2 * frequency / Stk::sampleRate()); 63 | b_[0] = sqrt( pow(real, 2) + pow(imag, 2) ); 64 | } 65 | } 66 | 67 | void TwoPole :: setCoefficients( StkFloat b0, StkFloat a1, StkFloat a2, bool clearState ) 68 | { 69 | b_[0] = b0; 70 | a_[1] = a1; 71 | a_[2] = a2; 72 | 73 | if ( clearState ) this->clear(); 74 | } 75 | 76 | } // stk namespace 77 | -------------------------------------------------------------------------------- /src/TwoZero.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class TwoZero 3 | \brief STK two-zero filter class. 4 | 5 | This class implements a two-zero digital filter. A method is 6 | provided for creating a "notch" in the frequency response while 7 | maintaining a constant filter gain. 8 | 9 | by Perry R. Cook and Gary P. Scavone, 1995--2023. 10 | */ 11 | /***************************************************/ 12 | 13 | #include "TwoZero.h" 14 | #include 15 | 16 | namespace stk { 17 | 18 | TwoZero :: TwoZero( void ) 19 | { 20 | b_.resize( 3, 0.0 ); 21 | inputs_.resize( 3, 1, 0.0 ); 22 | b_[0] = 1.0; 23 | 24 | Stk::addSampleRateAlert( this ); 25 | } 26 | 27 | TwoZero :: ~TwoZero() 28 | { 29 | Stk::removeSampleRateAlert( this ); 30 | } 31 | 32 | void TwoZero :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 33 | { 34 | if ( !ignoreSampleRateChange_ ) { 35 | oStream_ << "TwoZero::sampleRateChanged: you may need to recompute filter coefficients!"; 36 | handleError( StkError::WARNING ); 37 | } 38 | } 39 | 40 | void TwoZero :: setCoefficients( StkFloat b0, StkFloat b1, StkFloat b2, bool clearState ) 41 | { 42 | b_[0] = b0; 43 | b_[1] = b1; 44 | b_[2] = b2; 45 | 46 | if ( clearState ) this->clear(); 47 | } 48 | 49 | void TwoZero :: setNotch( StkFloat frequency, StkFloat radius ) 50 | { 51 | #if defined(_STK_DEBUG_) 52 | if ( frequency < 0.0 || frequency > 0.5 * Stk::sampleRate() ) { 53 | oStream_ << "TwoZero::setNotch: frequency argument (" << frequency << ") is out of range!"; 54 | handleError( StkError::WARNING ); return; 55 | } 56 | if ( radius < 0.0 ) { 57 | oStream_ << "TwoZero::setNotch: radius argument (" << radius << ") is negative!"; 58 | handleError( StkError::WARNING ); return; 59 | } 60 | #endif 61 | 62 | b_[2] = radius * radius; 63 | b_[1] = -2.0 * radius * cos(TWO_PI * frequency / Stk::sampleRate()); 64 | 65 | // Normalize the filter gain. 66 | if ( b_[1] > 0.0 ) // Maximum at z = 0. 67 | b_[0] = 1.0 / ( 1.0 + b_[1] + b_[2] ); 68 | else // Maximum at z = -1. 69 | b_[0] = 1.0 / ( 1.0 - b_[1] + b_[2] ); 70 | b_[1] *= b_[0]; 71 | b_[2] *= b_[0]; 72 | } 73 | 74 | } // stk namespace 75 | -------------------------------------------------------------------------------- /src/include/asiodrivers.h: -------------------------------------------------------------------------------- 1 | #ifndef __AsioDrivers__ 2 | #define __AsioDrivers__ 3 | 4 | #include "ginclude.h" 5 | 6 | #if MAC 7 | #include "CodeFragments.hpp" 8 | 9 | class AsioDrivers : public CodeFragments 10 | 11 | #elif WINDOWS 12 | #include 13 | #include "asiolist.h" 14 | 15 | class AsioDrivers : public AsioDriverList 16 | 17 | #elif SGI || BEOS 18 | #include "asiolist.h" 19 | 20 | class AsioDrivers : public AsioDriverList 21 | 22 | #else 23 | #error implement me 24 | #endif 25 | 26 | { 27 | public: 28 | AsioDrivers(); 29 | ~AsioDrivers(); 30 | 31 | bool getCurrentDriverName(char *name); 32 | long getDriverNames(char **names, long maxDrivers); 33 | bool loadDriver(char *name); 34 | void removeCurrentDriver(); 35 | long getCurrentDriverIndex() {return curIndex;} 36 | protected: 37 | unsigned long connID; 38 | long curIndex; 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/include/asiodrvr.h: -------------------------------------------------------------------------------- 1 | /* 2 | Steinberg Audio Stream I/O API 3 | (c) 1996, Steinberg Soft- und Hardware GmbH 4 | charlie (May 1996) 5 | 6 | asiodrvr.h 7 | c++ superclass to implement asio functionality. from this, 8 | you can derive whatever required 9 | */ 10 | 11 | #ifndef _asiodrvr_ 12 | #define _asiodrvr_ 13 | 14 | // cpu and os system we are running on 15 | #include "asiosys.h" 16 | // basic "C" interface 17 | #include "asio.h" 18 | 19 | class AsioDriver; 20 | extern AsioDriver *getDriver(); // for generic constructor 21 | 22 | #if WINDOWS 23 | #include 24 | #include "combase.h" 25 | #include "iasiodrv.h" 26 | class AsioDriver : public IASIO ,public CUnknown 27 | { 28 | public: 29 | AsioDriver(LPUNKNOWN pUnk, HRESULT *phr); 30 | 31 | DECLARE_IUNKNOWN 32 | // Factory method 33 | static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr); 34 | // IUnknown 35 | virtual HRESULT STDMETHODCALLTYPE NonDelegatingQueryInterface(REFIID riid,void **ppvObject); 36 | 37 | #else 38 | 39 | class AsioDriver 40 | { 41 | public: 42 | AsioDriver(); 43 | #endif 44 | virtual ~AsioDriver(); 45 | 46 | virtual ASIOBool init(void* sysRef); 47 | virtual void getDriverName(char *name); // max 32 bytes incl. terminating zero 48 | virtual long getDriverVersion(); 49 | virtual void getErrorMessage(char *string); // max 124 bytes incl. 50 | 51 | virtual ASIOError start(); 52 | virtual ASIOError stop(); 53 | 54 | virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels); 55 | virtual ASIOError getLatencies(long *inputLatency, long *outputLatency); 56 | virtual ASIOError getBufferSize(long *minSize, long *maxSize, 57 | long *preferredSize, long *granularity); 58 | 59 | virtual ASIOError canSampleRate(ASIOSampleRate sampleRate); 60 | virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate); 61 | virtual ASIOError setSampleRate(ASIOSampleRate sampleRate); 62 | virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources); 63 | virtual ASIOError setClockSource(long reference); 64 | 65 | virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp); 66 | virtual ASIOError getChannelInfo(ASIOChannelInfo *info); 67 | 68 | virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, 69 | long bufferSize, ASIOCallbacks *callbacks); 70 | virtual ASIOError disposeBuffers(); 71 | 72 | virtual ASIOError controlPanel(); 73 | virtual ASIOError future(long selector, void *opt); 74 | virtual ASIOError outputReady(); 75 | }; 76 | #endif 77 | -------------------------------------------------------------------------------- /src/include/asiolist.h: -------------------------------------------------------------------------------- 1 | #ifndef __asiolist__ 2 | #define __asiolist__ 3 | 4 | #define DRVERR -5000 5 | #define DRVERR_INVALID_PARAM DRVERR-1 6 | #define DRVERR_DEVICE_ALREADY_OPEN DRVERR-2 7 | #define DRVERR_DEVICE_NOT_FOUND DRVERR-3 8 | 9 | #define MAXPATHLEN 512 10 | #define MAXDRVNAMELEN 128 11 | 12 | struct asiodrvstruct 13 | { 14 | int drvID; 15 | CLSID clsid; 16 | char dllpath[MAXPATHLEN]; 17 | char drvname[MAXDRVNAMELEN]; 18 | LPVOID asiodrv; 19 | struct asiodrvstruct *next; 20 | }; 21 | 22 | typedef struct asiodrvstruct ASIODRVSTRUCT; 23 | typedef ASIODRVSTRUCT *LPASIODRVSTRUCT; 24 | 25 | class AsioDriverList { 26 | public: 27 | AsioDriverList(); 28 | ~AsioDriverList(); 29 | 30 | LONG asioOpenDriver (int,VOID **); 31 | LONG asioCloseDriver (int); 32 | 33 | // nice to have 34 | LONG asioGetNumDev (VOID); 35 | LONG asioGetDriverName (int,char *,int); 36 | LONG asioGetDriverPath (int,char *,int); 37 | LONG asioGetDriverCLSID (int,CLSID *); 38 | 39 | // or use directly access 40 | LPASIODRVSTRUCT lpdrvlist; 41 | int numdrv; 42 | }; 43 | 44 | typedef class AsioDriverList *LPASIODRIVERLIST; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/include/asiosys.h: -------------------------------------------------------------------------------- 1 | #ifndef __asiosys__ 2 | #define __asiosys__ 3 | 4 | #if defined(_WIN32) || defined(_WIN64) 5 | #undef MAC 6 | #define PPC 0 7 | #define WINDOWS 1 8 | #define SGI 0 9 | #define SUN 0 10 | #define LINUX 0 11 | #define BEOS 0 12 | 13 | #define NATIVE_INT64 0 14 | #define IEEE754_64FLOAT 1 15 | 16 | #elif BEOS 17 | #define MAC 0 18 | #define PPC 0 19 | #define WINDOWS 0 20 | #define PC 0 21 | #define SGI 0 22 | #define SUN 0 23 | #define LINUX 0 24 | 25 | #define NATIVE_INT64 0 26 | #define IEEE754_64FLOAT 1 27 | 28 | #ifndef DEBUG 29 | #define DEBUG 0 30 | #if DEBUG 31 | void DEBUGGERMESSAGE(char *string); 32 | #else 33 | #define DEBUGGERMESSAGE(a) 34 | #endif 35 | #endif 36 | 37 | #elif SGI 38 | #define MAC 0 39 | #define PPC 0 40 | #define WINDOWS 0 41 | #define PC 0 42 | #define SUN 0 43 | #define LINUX 0 44 | #define BEOS 0 45 | 46 | #define NATIVE_INT64 0 47 | #define IEEE754_64FLOAT 1 48 | 49 | #ifndef DEBUG 50 | #define DEBUG 0 51 | #if DEBUG 52 | void DEBUGGERMESSAGE(char *string); 53 | #else 54 | #define DEBUGGERMESSAGE(a) 55 | #endif 56 | #endif 57 | 58 | #else // MAC 59 | 60 | #define MAC 1 61 | #define PPC 1 62 | #define WINDOWS 0 63 | #define PC 0 64 | #define SGI 0 65 | #define SUN 0 66 | #define LINUX 0 67 | #define BEOS 0 68 | 69 | #define NATIVE_INT64 0 70 | #define IEEE754_64FLOAT 1 71 | 72 | #ifndef DEBUG 73 | #define DEBUG 0 74 | #if DEBUG 75 | void DEBUGGERMESSAGE(char *string); 76 | #else 77 | #define DEBUGGERMESSAGE(a) 78 | #endif 79 | #endif 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/include/ginclude.h: -------------------------------------------------------------------------------- 1 | #ifndef __gInclude__ 2 | #define __gInclude__ 3 | 4 | #if SGI 5 | #undef BEOS 6 | #undef MAC 7 | #undef WINDOWS 8 | // 9 | #define ASIO_BIG_ENDIAN 1 10 | #define ASIO_CPU_MIPS 1 11 | #elif defined WIN32 12 | #undef BEOS 13 | #undef MAC 14 | #undef SGI 15 | #define WINDOWS 1 16 | #define ASIO_LITTLE_ENDIAN 1 17 | #define ASIO_CPU_X86 1 18 | #elif BEOS 19 | #undef MAC 20 | #undef SGI 21 | #undef WINDOWS 22 | #define ASIO_LITTLE_ENDIAN 1 23 | #define ASIO_CPU_X86 1 24 | // 25 | #else 26 | #define MAC 1 27 | #undef BEOS 28 | #undef WINDOWS 29 | #undef SGI 30 | #define ASIO_BIG_ENDIAN 1 31 | #define ASIO_CPU_PPC 1 32 | #endif 33 | 34 | // always 35 | #define NATIVE_INT64 0 36 | #define IEEE754_64FLOAT 1 37 | 38 | #endif // __gInclude__ 39 | -------------------------------------------------------------------------------- /src/include/iasiodrv.h: -------------------------------------------------------------------------------- 1 | #include "asiosys.h" 2 | #include "asio.h" 3 | 4 | /* Forward Declarations */ 5 | 6 | #ifndef __ASIODRIVER_FWD_DEFINED__ 7 | #define __ASIODRIVER_FWD_DEFINED__ 8 | typedef interface IASIO IASIO; 9 | #endif /* __ASIODRIVER_FWD_DEFINED__ */ 10 | 11 | interface IASIO : public IUnknown 12 | { 13 | 14 | virtual ASIOBool init(void *sysHandle) = 0; 15 | virtual void getDriverName(char *name) = 0; 16 | virtual long getDriverVersion() = 0; 17 | virtual void getErrorMessage(char *string) = 0; 18 | virtual ASIOError start() = 0; 19 | virtual ASIOError stop() = 0; 20 | virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0; 21 | virtual ASIOError getLatencies(long *inputLatency, long *outputLatency) = 0; 22 | virtual ASIOError getBufferSize(long *minSize, long *maxSize, 23 | long *preferredSize, long *granularity) = 0; 24 | virtual ASIOError canSampleRate(ASIOSampleRate sampleRate) = 0; 25 | virtual ASIOError getSampleRate(ASIOSampleRate *sampleRate) = 0; 26 | virtual ASIOError setSampleRate(ASIOSampleRate sampleRate) = 0; 27 | virtual ASIOError getClockSources(ASIOClockSource *clocks, long *numSources) = 0; 28 | virtual ASIOError setClockSource(long reference) = 0; 29 | virtual ASIOError getSamplePosition(ASIOSamples *sPos, ASIOTimeStamp *tStamp) = 0; 30 | virtual ASIOError getChannelInfo(ASIOChannelInfo *info) = 0; 31 | virtual ASIOError createBuffers(ASIOBufferInfo *bufferInfos, long numChannels, 32 | long bufferSize, ASIOCallbacks *callbacks) = 0; 33 | virtual ASIOError disposeBuffers() = 0; 34 | virtual ASIOError controlPanel() = 0; 35 | virtual ASIOError future(long selector,void *opt) = 0; 36 | virtual ASIOError outputReady() = 0; 37 | }; 38 | --------------------------------------------------------------------------------