├── .gitignore ├── Makefile ├── Project.xcconfig ├── README.md ├── addons.make ├── bin └── data │ └── 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 │ ├── 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 │ ├── sineblnk.raw │ ├── sinewave.raw │ ├── snardrum.raw │ ├── snglpeak.raw │ ├── tambourn.raw │ ├── tomhidrm.raw │ ├── tomlowdr.raw │ ├── tommiddr.raw │ └── twopeaks.raw ├── config.make ├── example_DrawSynth ├── Makefile ├── Project.xcconfig ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── 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 │ │ ├── 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 │ │ ├── sineblnk.raw │ │ ├── sinewave.raw │ │ ├── snardrum.raw │ │ ├── snglpeak.raw │ │ ├── tambourn.raw │ │ ├── tomhidrm.raw │ │ ├── tomlowdr.raw │ │ ├── tommiddr.raw │ │ └── twopeaks.raw │ │ └── verdana.ttf ├── config.make ├── example_DrawSynth.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── example_DrawSynth Debug.xcscheme │ │ │ └── example_DrawSynth Release.xcscheme │ └── xcuserdata │ │ └── abhi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── openFrameworks-Info.plist └── src │ ├── DrawSynth.cpp │ ├── DrawSynth.h │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example_FileLoop ├── Makefile ├── Project.xcconfig ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── beat.wav │ │ ├── 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 │ │ ├── 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 │ │ ├── sineblnk.raw │ │ ├── sinewave.raw │ │ ├── snardrum.raw │ │ ├── snglpeak.raw │ │ ├── tambourn.raw │ │ ├── tomhidrm.raw │ │ ├── tomlowdr.raw │ │ ├── tommiddr.raw │ │ └── twopeaks.raw │ │ └── verdana.ttf ├── config.make ├── example_FileLoop.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── example_FileLoop Debug.xcscheme │ │ └── example_FileLoop Release.xcscheme ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example_pitchShift ├── Makefile ├── Project.xcconfig ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── piano.wav │ │ └── verdana.ttf ├── config.make ├── example_pitchShift.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── example_pitchShift Debug.xcscheme │ │ │ └── example_pitchShift Release.xcscheme │ └── xcuserdata │ │ └── abhi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── openFrameworks-Info.plist └── src │ ├── BasicSampler.h │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example_polyphony ├── Makefile ├── Project.xcconfig ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── 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 │ │ ├── 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 │ │ ├── sineblnk.raw │ │ ├── sinewave.raw │ │ ├── snardrum.raw │ │ ├── snglpeak.raw │ │ ├── tambourn.raw │ │ ├── tomhidrm.raw │ │ ├── tomlowdr.raw │ │ ├── tommiddr.raw │ │ └── twopeaks.raw │ │ └── verdana.ttf ├── config.make ├── example_polyphony.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── example_polyphony Debug.xcscheme │ │ │ └── example_polyphony Release.xcscheme │ └── xcuserdata │ │ └── abhi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── example_simple ├── Makefile ├── Project.xcconfig ├── addons.make ├── bin │ └── data │ │ ├── .gitkeep │ │ ├── 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 │ │ ├── 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 │ │ ├── sineblnk.raw │ │ ├── sinewave.raw │ │ ├── snardrum.raw │ │ ├── snglpeak.raw │ │ ├── tambourn.raw │ │ ├── tomhidrm.raw │ │ ├── tomlowdr.raw │ │ ├── tommiddr.raw │ │ └── twopeaks.raw │ │ └── verdana.ttf ├── config.make ├── example_simple.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── example_simple Debug.xcscheme │ │ └── example_simple Release.xcscheme ├── openFrameworks-Info.plist └── src │ ├── main.cpp │ ├── ofApp.cpp │ └── ofApp.h ├── libs └── STK │ ├── 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 │ ├── 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 │ └── 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 │ ├── 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 │ ├── 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 ├── ofxStk.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── ofxStk Debug.xcscheme │ └── ofxStk Release.xcscheme ├── openFrameworks-Info.plist └── src └── ofxStk.h /.gitignore: -------------------------------------------------------------------------------- 1 | example_FileLoop/bin/example_FileLoopDebug.app 2 | 3 | example_simple/bin/example_simpleDebug.app 4 | 5 | example_DrawSynth/bin/example_DrawSynthDebug.app 6 | 7 | *.app 8 | 9 | *.xcuserstate 10 | 11 | *.xcuserstate 12 | 13 | *.xcuserstate 14 | 15 | *.xcbkptlist 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=$(realpath ../..) 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS) 17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #ofxStk 2 | ofxStk lets you use [The Synthesis Tool Kit](https://ccrma.stanford.edu/software/stk/index.html) inside openFrameworks. The offical repo for stk is here at https://github.com/thestk/stk. For features and issues you are better off posting there. I sync ofxStk with the offical Stk repo about once a month, or on demand 3 | 4 | 5 | ##Installation 6 | *** 7 | 8 | Step 1 - Do what you normally do for an add-on (project generator works well) 9 | 10 | Step 2 - Copy the 'rawwaves' folder from ofxStk/bin/data into bin/data of your project. 11 | 12 | ##### Note on Linux 13 | if your are on linux and your system is little endian you have to complie with the following option 14 | 15 | ``` 16 | -D__LITTLE_ENDIAN__ 17 | ``` 18 | 19 | 20 | ##How to use 21 | *** 22 | 23 | Stk already works well with openFrameworks so there is no need to wrap it onto a separate api. Your best resource would be [the stk documentation](https://ccrma.stanford.edu/software/stk/classes.html). You can also ask me questions on the [forum](http://forum.openframeworks.cc/t/ofxstk-synthesis-toolkit-addon/15989/3) 24 | 25 | ####steps to create a custom instrument 26 | 27 | 1. Subclass stk::Instrument 28 | 2. Override all the pure virtual functions in stk::Instrmnt 29 | 3. When overriding `virtual StkFloat tick( unsigned int channel = 0 ) = 0` make sure you set `lastFrame_` which is the last computed frame of audio, and return the output for the channel specified by the argument. Remember a frame is different than a sample- `a Frame a set of samples that contains one sample from each channel in an audio data stream.` 30 | 4. When overriding `StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0`,your job is to fill the specified frames starting at the specific channel. For example if your instrument is mono and tick(frames,1) is called, you fill the second channel of frames with your output. If your instrument is stereo and tick(frames,1) is called. you fill the second and third channel of frames with your output. Remember that lastFrame_ also has to be set in the function 31 | 5. If your instrument is stereo, you will have to override the constructor of stk:Instrmnt to resize the lastFrame_. so in your constructor you should have the line `lastFrame_.resize( 1, 2, 0.0 );` 32 | 33 | 34 | ##Notes 35 | *** 36 | 37 | I've tested on Mac OSX, IOS ,and linux so far. But getting it to work for other platforms should be just a matter of configuring the macros in the file "Stk.h" 38 | -------------------------------------------------------------------------------- /addons.make: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/addons.make -------------------------------------------------------------------------------- /bin/data/rawwaves/ahh.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/ahh.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/bassdrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/bassdrum.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/britestk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/britestk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/cowbell1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/cowbell1.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/crashcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/crashcym.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/dope.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/dope.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/eee.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/eee.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/fwavblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/fwavblnk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/halfwave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/halfwave.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/hihatcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/hihatcym.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/impuls10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/impuls10.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/impuls20.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/impuls20.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/impuls40.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/impuls40.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand1.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand10.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand11.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand11.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand12.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand12.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand2.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand3.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand4.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand5.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand6.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand7.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand8.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mand9.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mand9.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/mandpluk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/mandpluk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/marmstk1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/marmstk1.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/ooo.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/ooo.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/peksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/peksblnk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/ppksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/ppksblnk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/ridecymb.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/ridecymb.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/silence.raw: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bin/data/rawwaves/sineblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/sineblnk.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/sinewave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/sinewave.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/snardrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/snardrum.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/snglpeak.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/snglpeak.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/tambourn.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/tambourn.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/tomhidrm.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/tomhidrm.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/tomlowdr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/tomlowdr.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/tommiddr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/tommiddr.raw -------------------------------------------------------------------------------- /bin/data/rawwaves/twopeaks.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/bin/data/rawwaves/twopeaks.raw -------------------------------------------------------------------------------- /example_DrawSynth/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=../../.. 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /example_DrawSynth/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS) 17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 19 | -------------------------------------------------------------------------------- /example_DrawSynth/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxStk 3 | -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/.gitkeep -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/ahh.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/ahh.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/bassdrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/bassdrum.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/britestk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/britestk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/cowbell1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/cowbell1.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/crashcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/crashcym.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/dope.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/dope.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/eee.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/eee.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/fwavblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/fwavblnk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/halfwave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/halfwave.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/hihatcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/hihatcym.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/impuls10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/impuls10.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/impuls20.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/impuls20.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/impuls40.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/impuls40.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand1.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand10.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand11.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand11.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand12.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand12.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand2.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand3.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand4.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand5.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand6.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand7.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand8.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mand9.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mand9.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/mandpluk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/mandpluk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/marmstk1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/marmstk1.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/ooo.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/ooo.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/peksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/peksblnk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/ppksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/ppksblnk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/ridecymb.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/ridecymb.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/silence.raw: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/sineblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/sineblnk.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/sinewave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/sinewave.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/snardrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/snardrum.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/snglpeak.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/snglpeak.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/tambourn.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/tambourn.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/tomhidrm.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/tomhidrm.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/tomlowdr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/tomlowdr.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/tommiddr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/tommiddr.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/rawwaves/twopeaks.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/rawwaves/twopeaks.raw -------------------------------------------------------------------------------- /example_DrawSynth/bin/data/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_DrawSynth/bin/data/verdana.ttf -------------------------------------------------------------------------------- /example_DrawSynth/example_DrawSynth.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_DrawSynth/example_DrawSynth.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_DrawSynth/example_DrawSynth.xcodeproj/xcuserdata/abhi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | example_DrawSynth Debug.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | example_DrawSynth Release.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example_DrawSynth/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /example_DrawSynth/src/DrawSynth.cpp: -------------------------------------------------------------------------------- 1 | #include "DrawSynth.h" 2 | 3 | DrawSynth::DrawSynth(){ 4 | index = 0.0; 5 | } 6 | 7 | void DrawSynth::noteOn(StkFloat frequency, StkFloat amplitude){ 8 | adsr.keyOn(); 9 | setFrequency(frequency); 10 | gain = amplitude; 11 | } 12 | 13 | void DrawSynth::noteOff(StkFloat amplitude){ 14 | adsr.keyOff(); 15 | } 16 | 17 | void DrawSynth::setFrequency(StkFloat newFreq){ 18 | frequency = newFreq; 19 | } 20 | 21 | // inside tick you are responsible for setting lastFrame_ 22 | StkFloat DrawSynth::tick(unsigned int channel){ 23 | int tableSize = waveTable.getTableSize(); 24 | float frqTL = (float)tableSize/Stk::sampleRate(); 25 | float indexIncremet = frqTL * frequency; 26 | lastFrame_[0] = waveTable.tick(index); 27 | index+=indexIncremet; 28 | if (index >= tableSize - 1) { 29 | index = 0; 30 | } 31 | lastFrame_[0]*= adsr.tick(); 32 | lastFrame_[0]*=gain; 33 | return lastFrame_[0]; 34 | } 35 | 36 | StkFrames& DrawSynth::tick(StkFrames &frames,unsigned int channel){ 37 | StkFloat *samples = &frames[channel]; 38 | unsigned int hop = frames.channels(); 39 | for ( unsigned int i=0; igain = gain;} 46 | 47 | private: 48 | WaveTable waveTable; 49 | StkFloat frequency; 50 | ADSR adsr; 51 | float gain; 52 | float index; 53 | }; -------------------------------------------------------------------------------- /example_DrawSynth/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example_DrawSynth/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxStk.h" 5 | #include "DrawSynth.h" 6 | #include "ofxGui.h" 7 | 8 | class ofApp : public ofBaseApp{ 9 | 10 | public: 11 | void setup(); 12 | void update(); 13 | void draw(); 14 | 15 | void keyPressed(int key); 16 | void keyReleased(int key); 17 | void mouseMoved(int x, int y ); 18 | void mouseDragged(int x, int y, int button); 19 | void mousePressed(int x, int y, int button); 20 | void mouseReleased(int x, int y, int button); 21 | void windowResized(int w, int h); 22 | void dragEvent(ofDragInfo dragInfo); 23 | void gotMessage(ofMessage msg); 24 | 25 | void audioOut(ofSoundBuffer & buffer); 26 | 27 | // callback evertime user changes adsr envelope 28 | void adsrChanged(float &val); 29 | 30 | // checks if any keys are being held down; 31 | bool noNotesDown()const; 32 | 33 | // prevents the user from drawing illegal waves 34 | void cutWaveToPoint(ofPoint cutPoint); 35 | 36 | // creates a 5000 size waveTable from the wave drawing 37 | stk::StkFrames createWaveTableFromDrawing(); 38 | 39 | // takes the yValue inside the drawing region and converts it to 40 | // range -1 to 1, where -1 is rext bottom and 1 is rect top 41 | float transformYValue(float yValue)const ; 42 | 43 | ofPolyline wave; 44 | ofRectangle drawRegion; 45 | 46 | DrawSynth drawSynth; 47 | 48 | bool drawingBegan; 49 | bool keyDown; 50 | 51 | ofxPanel gui; 52 | ofxFloatSlider attack; 53 | ofxFloatSlider decay; 54 | ofxFloatSlider sustain; 55 | ofxFloatSlider release; 56 | ofxFloatSlider gain; 57 | 58 | ofTrueTypeFont instructions; 59 | 60 | ofSoundStream soundStream; 61 | 62 | 63 | bool aDown; 64 | bool sDown; 65 | bool dDown; 66 | bool fDown; 67 | bool gDown; 68 | bool hDown; 69 | bool jDown; 70 | bool kDown; 71 | bool lDown; 72 | }; 73 | -------------------------------------------------------------------------------- /example_FileLoop/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=../../.. 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /example_FileLoop/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS) 17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 19 | -------------------------------------------------------------------------------- /example_FileLoop/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxStk 3 | -------------------------------------------------------------------------------- /example_FileLoop/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/.gitkeep -------------------------------------------------------------------------------- /example_FileLoop/bin/data/beat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/beat.wav -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/ahh.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/ahh.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/bassdrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/bassdrum.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/britestk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/britestk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/cowbell1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/cowbell1.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/crashcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/crashcym.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/dope.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/dope.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/eee.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/eee.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/fwavblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/fwavblnk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/halfwave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/halfwave.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/hihatcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/hihatcym.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/impuls10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/impuls10.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/impuls20.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/impuls20.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/impuls40.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/impuls40.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand1.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand10.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand11.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand11.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand12.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand12.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand2.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand3.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand4.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand5.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand6.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand7.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand8.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mand9.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mand9.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/mandpluk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/mandpluk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/marmstk1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/marmstk1.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/ooo.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/ooo.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/peksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/peksblnk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/ppksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/ppksblnk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/ridecymb.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/ridecymb.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/silence.raw: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/sineblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/sineblnk.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/sinewave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/sinewave.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/snardrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/snardrum.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/snglpeak.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/snglpeak.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/tambourn.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/tambourn.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/tomhidrm.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/tomhidrm.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/tomlowdr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/tomlowdr.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/tommiddr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/tommiddr.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/rawwaves/twopeaks.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/rawwaves/twopeaks.raw -------------------------------------------------------------------------------- /example_FileLoop/bin/data/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_FileLoop/bin/data/verdana.ttf -------------------------------------------------------------------------------- /example_FileLoop/example_FileLoop.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_FileLoop/example_FileLoop.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_FileLoop/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /example_FileLoop/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example_FileLoop/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxStk.h" 5 | #include "ofxGui.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | 24 | void audioOut(ofSoundBuffer& buffer); 25 | void chorusParametersChanged(float &value); 26 | void reverbParametersChanged(float &value); 27 | void frequencyChanged(float &value); 28 | void filterCutoffChanged(float &value); 29 | 30 | ofxPanel panel; 31 | ofxFloatSlider frequency; 32 | ofxFloatSlider chorusDepth; 33 | ofxFloatSlider chorusFrequency; 34 | ofxFloatSlider reverbRoomSize; 35 | ofxFloatSlider filterCutoff; 36 | ofxToggle reverbOn; 37 | ofxToggle chorusOn; 38 | 39 | stk::FileLoop beat; 40 | stk::FreeVerb reverb; 41 | stk::Chorus chorus; 42 | stk::OneZero filter; 43 | 44 | ofSoundStream soundStream; 45 | 46 | ofTrueTypeFont instructions; 47 | bool shouldPlayAudio; 48 | }; 49 | -------------------------------------------------------------------------------- /example_pitchShift/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=../../.. 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /example_pitchShift/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS) 17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 19 | -------------------------------------------------------------------------------- /example_pitchShift/addons.make: -------------------------------------------------------------------------------- 1 | ofxStk 2 | -------------------------------------------------------------------------------- /example_pitchShift/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_pitchShift/bin/data/.gitkeep -------------------------------------------------------------------------------- /example_pitchShift/bin/data/piano.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_pitchShift/bin/data/piano.wav -------------------------------------------------------------------------------- /example_pitchShift/bin/data/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_pitchShift/bin/data/verdana.ttf -------------------------------------------------------------------------------- /example_pitchShift/example_pitchShift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_pitchShift/example_pitchShift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_pitchShift/example_pitchShift.xcodeproj/xcuserdata/abhi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | example_pitchShift Debug.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | example_pitchShift Release.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example_pitchShift/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /example_pitchShift/src/BasicSampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxStk.h" 5 | 6 | class BasicSampler: public stk::Instrmnt{ 7 | public: 8 | BasicSampler(){ 9 | sample = new stk::FileWvIn(ofToDataPath("piano.wav",true)); 10 | baseFrequency = 92.4986056779; 11 | pithShifter = new stk::PitShift(); 12 | pithShifter->setEffectMix(1.0); 13 | adsr.setAttackTime(10.0/1000.0); 14 | adsr.setDecayTime(200/1000.0); 15 | adsr.setSustainLevel(1.0); 16 | adsr.setReleaseTime(500.0/1000.0); 17 | } 18 | 19 | ~BasicSampler(){ 20 | delete pithShifter; 21 | delete sample; 22 | } 23 | 24 | void setFrequency(stk::StkFloat frequency ){ 25 | float shiftRatio = frequency/baseFrequency; 26 | pithShifter->setShift(shiftRatio); 27 | } 28 | 29 | 30 | void noteOn(stk::StkFloat frequency,stk::StkFloat amplitude ){ 31 | this->setFrequency( frequency ); 32 | this->amplitude = amplitude; 33 | adsr.keyOn(); 34 | sample->reset(); 35 | } 36 | 37 | void noteOff(stk::StkFloat amplitude ){ 38 | adsr.keyOff(); 39 | } 40 | 41 | // inside tick you are responsible for setting lastFrame_ 42 | stk::StkFloat tick(unsigned int channel = 0){ 43 | // we are using just the right channel of the sample 44 | // we do this by passing 1 to 'sample->tick' 45 | 46 | lastFrame_[0] = sample->tick(1); 47 | float input = lastFrame_[0]; 48 | lastFrame_[0] = pithShifter->tick(lastFrame_[0]); 49 | float output = lastFrame_[0]; 50 | 51 | lastFrame_[0] *= adsr.tick(); 52 | lastFrame_[0] *= amplitude; 53 | return lastFrame_[channel]; 54 | } 55 | 56 | // fills the specified 'channel' of 'frames' 57 | stk::StkFrames& tick(stk::StkFrames &frames,unsigned int channel = 0){ 58 | stk::StkFloat *samples = &frames[channel]; 59 | unsigned int hop = frames.channels(); 60 | for ( unsigned int i=0; i 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_polyphony/example_polyphony.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_polyphony/example_polyphony.xcodeproj/xcuserdata/abhi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | example_polyphony Debug.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | example_polyphony Release.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example_polyphony/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /example_polyphony/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example_polyphony/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxStk.h" 5 | 6 | struct MusicalNote { 7 | stk::StkFloat noteNumber; 8 | long voiceTag; 9 | }; 10 | 11 | class ofApp : public ofBaseApp{ 12 | 13 | public: 14 | void setup(); 15 | void update(); 16 | void draw(); 17 | 18 | void keyPressed(int key); 19 | void keyReleased(int key); 20 | void mouseMoved(int x, int y ); 21 | void mouseDragged(int x, int y, int button); 22 | void mousePressed(int x, int y, int button); 23 | void mouseReleased(int x, int y, int button); 24 | void windowResized(int w, int h); 25 | void dragEvent(ofDragInfo dragInfo); 26 | void gotMessage(ofMessage msg); 27 | 28 | void audioOut(ofSoundBuffer & buffer); 29 | 30 | stk::Voicer *voicer; 31 | 32 | MusicalNote c,d,e,f,g,a,b,c2,d2,e2; 33 | 34 | bool aDown; 35 | bool sDown; 36 | bool dDown; 37 | bool fDown; 38 | bool gDown; 39 | bool hDown; 40 | bool jDown; 41 | bool kDown; 42 | bool lDown; 43 | 44 | ofTrueTypeFont instructions; 45 | ofSoundStream soundStream; 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /example_simple/Makefile: -------------------------------------------------------------------------------- 1 | # Attempt to load a config.make file. 2 | # If none is found, project defaults in config.project.make will be used. 3 | ifneq ($(wildcard config.make),) 4 | include config.make 5 | endif 6 | 7 | # make sure the the OF_ROOT location is defined 8 | ifndef OF_ROOT 9 | OF_ROOT=../../.. 10 | endif 11 | 12 | # call the project makefile! 13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk 14 | -------------------------------------------------------------------------------- /example_simple/Project.xcconfig: -------------------------------------------------------------------------------- 1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. 2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED 3 | OF_PATH = ../../.. 4 | 5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE 6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" 7 | 8 | //ICONS - NEW IN 0072 9 | ICON_NAME_DEBUG = icon-debug.icns 10 | ICON_NAME_RELEASE = icon.icns 11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/ 12 | 13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to: 14 | //ICON_FILE_PATH = bin/data/ 15 | 16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS) 17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS) 18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) 19 | -------------------------------------------------------------------------------- /example_simple/addons.make: -------------------------------------------------------------------------------- 1 | ofxGui 2 | ofxStk 3 | -------------------------------------------------------------------------------- /example_simple/bin/data/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/.gitkeep -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/ahh.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/ahh.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/bassdrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/bassdrum.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/britestk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/britestk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/cowbell1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/cowbell1.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/crashcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/crashcym.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/dope.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/dope.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/eee.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/eee.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/fwavblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/fwavblnk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/halfwave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/halfwave.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/hihatcym.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/hihatcym.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/impuls10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/impuls10.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/impuls20.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/impuls20.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/impuls40.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/impuls40.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand1.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand10.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand10.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand11.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand11.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand12.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand12.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand2.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand2.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand3.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand3.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand4.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand4.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand5.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand5.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand6.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand6.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand7.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand7.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand8.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand8.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mand9.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mand9.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/mandpluk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/mandpluk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/marmstk1.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/marmstk1.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/ooo.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/ooo.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/peksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/peksblnk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/ppksblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/ppksblnk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/ridecymb.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/ridecymb.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/silence.raw: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/sineblnk.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/sineblnk.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/sinewave.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/sinewave.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/snardrum.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/snardrum.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/snglpeak.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/snglpeak.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/tambourn.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/tambourn.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/tomhidrm.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/tomhidrm.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/tomlowdr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/tomlowdr.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/tommiddr.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/tommiddr.raw -------------------------------------------------------------------------------- /example_simple/bin/data/rawwaves/twopeaks.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/rawwaves/twopeaks.raw -------------------------------------------------------------------------------- /example_simple/bin/data/verdana.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ahbee/ofxStk/f20e70e568045ad20c20cdc320855128c8a3812e/example_simple/bin/data/verdana.ttf -------------------------------------------------------------------------------- /example_simple/example_simple.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_simple/example_simple.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_simple/openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /example_simple/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ofMain.h" 2 | #include "ofApp.h" 3 | 4 | //======================================================================== 5 | int main( ){ 6 | ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context 7 | 8 | // this kicks off the running of my app 9 | // can be OF_WINDOW or OF_FULLSCREEN 10 | // pass in width and height too: 11 | ofRunApp(new ofApp()); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /example_simple/src/ofApp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ofMain.h" 4 | #include "ofxStk.h" 5 | #include "ofxGui.h" 6 | 7 | class ofApp : public ofBaseApp{ 8 | 9 | public: 10 | void setup(); 11 | void update(); 12 | void draw(); 13 | 14 | void keyPressed(int key); 15 | void keyReleased(int key); 16 | void mouseMoved(int x, int y ); 17 | void mouseDragged(int x, int y, int button); 18 | void mousePressed(int x, int y, int button); 19 | void mouseReleased(int x, int y, int button); 20 | void windowResized(int w, int h); 21 | void dragEvent(ofDragInfo dragInfo); 22 | void gotMessage(ofMessage msg); 23 | 24 | void audioOut(ofSoundBuffer& buffer); 25 | bool noNotesDown(); 26 | 27 | ofxPanel gui; 28 | ofxFloatSlider op4Feedback; 29 | ofxFloatSlider op3Gain; 30 | ofxFloatSlider lfoSpeed; 31 | ofxFloatSlider lfoDepth; 32 | 33 | stk::BeeThree synth; 34 | 35 | ofTrueTypeFont instructions; 36 | 37 | ofSoundStream soundStream; 38 | 39 | bool aDown; 40 | bool sDown; 41 | bool dDown; 42 | bool fDown; 43 | bool gDown; 44 | bool hDown; 45 | bool jDown; 46 | bool kDown; 47 | bool lDown; 48 | 49 | }; 50 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/include/Noise.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_NOISE_H 2 | #define STK_NOISE_H 3 | 4 | #include "Generator.h" 5 | #include 6 | 7 | namespace stk { 8 | 9 | /***************************************************/ 10 | /*! \class Noise 11 | \brief STK noise generator. 12 | 13 | Generic random number generation using the 14 | C rand() function. The quality of the rand() 15 | function varies from one OS to another. 16 | 17 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 18 | */ 19 | /***************************************************/ 20 | 21 | class Noise : public Generator 22 | { 23 | public: 24 | 25 | //! Default constructor that can also take a specific seed value. 26 | /*! 27 | If the seed value is zero (the default value), the random number generator is 28 | seeded with the system time. 29 | */ 30 | Noise( unsigned int seed = 0 ); 31 | 32 | //! Seed the random number generator with a specific seed value. 33 | /*! 34 | If no seed is provided or the seed value is zero, the random 35 | number generator is seeded with the current system time. 36 | */ 37 | void setSeed( unsigned int seed = 0 ); 38 | 39 | //! Return the last computed output value. 40 | StkFloat lastOut( void ) const { return lastFrame_[0]; }; 41 | 42 | //! Compute and return one output sample. 43 | StkFloat tick( void ); 44 | 45 | //! Fill a channel of the StkFrames object with computed outputs. 46 | /*! 47 | The \c channel argument must be less than the number of 48 | channels in the StkFrames argument (the first channel is specified 49 | by 0). However, range checking is only performed if _STK_DEBUG_ 50 | is defined during compilation, in which case an out-of-range value 51 | will trigger an StkError exception. 52 | */ 53 | StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ); 54 | 55 | protected: 56 | 57 | }; 58 | 59 | inline StkFloat Noise :: tick( void ) 60 | { 61 | return lastFrame_[0] = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 ); 62 | } 63 | 64 | inline StkFrames& Noise :: tick( StkFrames& frames, unsigned int channel ) 65 | { 66 | #if defined(_STK_DEBUG_) 67 | if ( channel >= frames.channels() ) { 68 | oStream_ << "Noise::tick(): channel and StkFrames arguments are incompatible!"; 69 | handleError( StkError::FUNCTION_ARGUMENT ); 70 | } 71 | #endif 72 | 73 | StkFloat *samples = &frames[channel]; 74 | unsigned int hop = frames.channels(); 75 | for ( unsigned int i=0; i 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 | -------------------------------------------------------------------------------- /libs/STK/include/Socket.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_SOCKET_H 2 | #define STK_SOCKET_H 3 | 4 | #include "Stk.h" 5 | 6 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #elif defined(__OS_WINDOWS__) 18 | 19 | #include 20 | 21 | #endif 22 | 23 | namespace stk { 24 | 25 | /***************************************************/ 26 | /*! \class Socket 27 | \brief STK internet socket abstract base class. 28 | 29 | This class provides common functionality for TCP and UDP internet 30 | socket server and client subclasses. This class also provides a 31 | number of static functions for use with external socket 32 | descriptors. 33 | 34 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 35 | */ 36 | /***************************************************/ 37 | 38 | class Socket : public Stk 39 | { 40 | public: 41 | 42 | enum ProtocolType { 43 | PROTO_TCP, 44 | PROTO_UDP 45 | }; 46 | 47 | //! Class constructor 48 | Socket(); 49 | 50 | //! Class destructor. 51 | virtual ~Socket(); 52 | 53 | //! Close the socket. 54 | static void close( int socket ); 55 | 56 | //! Return the socket descriptor. 57 | int id( void ) const { return soket_; }; 58 | 59 | //! Return the socket port number. 60 | int port( void ) const { return port_; }; 61 | 62 | //! Returns true if the socket descriptor is valid. 63 | static bool isValid( int socket ) { return socket != -1; }; 64 | 65 | //! If enable = false, the socket is set to non-blocking mode. When first created, sockets are by default in blocking mode. 66 | static void setBlocking( int socket, bool enable ); 67 | 68 | //! Write a buffer over the socket connection. Returns the number of bytes written or -1 if an error occurs. 69 | virtual int writeBuffer(const void *buffer, long bufferSize, int flags = 0) = 0; 70 | 71 | //! Read an input buffer, up to length \e bufferSize. Returns the number of bytes read or -1 if an error occurs. 72 | virtual int readBuffer(void *buffer, long bufferSize, int flags = 0) = 0; 73 | 74 | //! Write a buffer via the specified socket. Returns the number of bytes written or -1 if an error occurs. 75 | static int writeBuffer(int socket, const void *buffer, long bufferSize, int flags ); 76 | 77 | //! Read a buffer via the specified socket. Returns the number of bytes read or -1 if an error occurs. 78 | static int readBuffer(int socket, void *buffer, long bufferSize, int flags ); 79 | 80 | protected: 81 | 82 | int soket_; 83 | int port_; 84 | 85 | }; 86 | 87 | } // stk namespace 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /libs/STK/include/Sphere.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_SPHERE_H 2 | #define STK_SPHERE_H 3 | 4 | #include "Stk.h" 5 | #include "Vector3D.h" 6 | 7 | namespace stk { 8 | 9 | /***************************************************/ 10 | /*! \class Sphere 11 | \brief STK sphere class. 12 | 13 | This class implements a spherical ball with 14 | radius, mass, position, and velocity parameters. 15 | 16 | by Perry R. Cook, 1995--2017. 17 | */ 18 | /***************************************************/ 19 | 20 | class Sphere : public Stk 21 | { 22 | public: 23 | //! Constructor taking an initial radius value. 24 | Sphere( StkFloat radius = 1.0 ) { radius_ = radius; mass_ = 1.0; }; 25 | 26 | //! Set the 3D center position of the sphere. 27 | void setPosition( StkFloat x, StkFloat y, StkFloat z ) { position_.setXYZ(x, y, z); }; 28 | 29 | //! Set the 3D velocity of the sphere. 30 | void setVelocity( StkFloat x, StkFloat y, StkFloat z ) { velocity_.setXYZ(x, y, z); }; 31 | 32 | //! Set the radius of the sphere. 33 | void setRadius( StkFloat radius ) { radius_ = radius; }; 34 | 35 | //! Set the mass of the sphere. 36 | void setMass( StkFloat mass ) { mass_ = mass; }; 37 | 38 | //! Get the current position of the sphere as a 3D vector. 39 | Vector3D* getPosition( void ) { return &position_; }; 40 | 41 | //! Get the relative position of the given point to the sphere as a 3D vector. 42 | Vector3D* getRelativePosition( Vector3D *position ); 43 | 44 | //! Set the velocity of the sphere as a 3D vector. 45 | StkFloat getVelocity( Vector3D* velocity ); 46 | 47 | //! Returns the distance from the sphere boundary to the given position (< 0 if inside). 48 | StkFloat isInside( Vector3D *position ); 49 | 50 | //! Get the current sphere radius. 51 | StkFloat getRadius( void ) { return radius_; }; 52 | 53 | //! Get the current sphere mass. 54 | StkFloat getMass( void ) { return mass_; }; 55 | 56 | //! Increase the current sphere velocity by the given 3D components. 57 | void addVelocity( StkFloat x, StkFloat y, StkFloat z ); 58 | 59 | //! Move the sphere for the given time increment. 60 | void tick( StkFloat timeIncrement ); 61 | 62 | private: 63 | Vector3D position_; 64 | Vector3D velocity_; 65 | Vector3D workingVector_; 66 | StkFloat radius_; 67 | StkFloat mass_; 68 | }; 69 | 70 | inline void Sphere::tick( StkFloat timeIncrement ) 71 | { 72 | position_.setX(position_.getX() + (timeIncrement * velocity_.getX())); 73 | position_.setY(position_.getY() + (timeIncrement * velocity_.getY())); 74 | position_.setZ(position_.getZ() + (timeIncrement * velocity_.getZ())); 75 | }; 76 | 77 | } // stk namespace 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/include/UdpSocket.h: -------------------------------------------------------------------------------- 1 | #ifndef STK_UDPSOCKET_H 2 | #define STK_UDPSOCKET_H 3 | 4 | #include "Socket.h" 5 | 6 | namespace stk { 7 | 8 | /***************************************************/ 9 | /*! \class UdpSocket 10 | \brief STK UDP socket server/client class. 11 | 12 | This class provides a uniform cross-platform UDP socket 13 | server/client interface. Methods are provided for reading or 14 | writing data buffers. The constructor creates a UDP socket and 15 | binds it to the specified port. Note that only one socket can be 16 | bound to a given port on the same machine. 17 | 18 | UDP sockets provide unreliable, connection-less service. Messages 19 | can be lost, duplicated, or received out of order. That said, 20 | data transmission tends to be faster than with TCP connections and 21 | datagrams are not potentially combined by the underlying system. 22 | 23 | The user is responsible for checking the values returned by the 24 | read/write methods. Values less than or equal to zero indicate 25 | the occurence of an error. 26 | 27 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 28 | */ 29 | /***************************************************/ 30 | 31 | class UdpSocket : public Socket 32 | { 33 | public: 34 | //! Default constructor creates a local UDP socket on port 2006 (or the specified port number). 35 | /*! 36 | An StkError will be thrown if a socket error occurs during instantiation. 37 | */ 38 | UdpSocket( int port = 2006 ); 39 | 40 | //! The class destructor closes the socket instance. 41 | ~UdpSocket(); 42 | 43 | //! Set the address for subsequent outgoing data sent via the \e writeBuffer() function. 44 | /*! 45 | An StkError will be thrown if the host is unknown. 46 | */ 47 | void setDestination( int port = 2006, std::string hostname = "localhost" ); 48 | 49 | //! Send a buffer to the address specified with the \e setDestination() function. Returns the number of bytes written or -1 if an error occurs. 50 | /*! 51 | This function will fail if the default address (set with \e setDestination()) is invalid or has not been specified. 52 | */ 53 | int writeBuffer(const void *buffer, long bufferSize, int flags = 0); 54 | 55 | //! Read an input buffer, up to length \e bufferSize. Returns the number of bytes read or -1 if an error occurs. 56 | int readBuffer(void *buffer, long bufferSize, int flags = 0); 57 | 58 | //! Write a buffer to the specified socket. Returns the number of bytes written or -1 if an error occurs. 59 | int writeBufferTo(const void *buffer, long bufferSize, int port, std::string hostname = "localhost", int flags = 0 ); 60 | 61 | protected: 62 | 63 | //! A protected function for use in writing a socket address structure. 64 | /*! 65 | An StkError will be thrown if the host is unknown. 66 | */ 67 | void setAddress( struct sockaddr_in *address, int port = 2006, std::string hostname = "localhost" ); 68 | 69 | struct sockaddr_in address_; 70 | bool validAddress_; 71 | 72 | }; 73 | 74 | } // stk namespace 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/Asymp.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Asymp 3 | \brief STK asymptotic curve envelope class 4 | 5 | This class implements a simple envelope generator 6 | which asymptotically approaches a target value. 7 | The algorithm used is of the form: 8 | 9 | y[n] = a y[n-1] + (1-a) target, 10 | 11 | where a = exp(-T/tau), T is the sample period, and 12 | tau is a time constant. The user can set the time 13 | constant (default value = 0.3) and target value. 14 | Theoretically, this recursion never reaches its 15 | target, though the calculations in this class are 16 | stopped when the current value gets within a small 17 | threshold value of the target (at which time the 18 | current value is set to the target). It responds 19 | to \e keyOn and \e keyOff messages by ramping to 20 | 1.0 on keyOn and to 0.0 on keyOff. 21 | 22 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 23 | */ 24 | /***************************************************/ 25 | 26 | #include "Asymp.h" 27 | #include 28 | 29 | namespace stk { 30 | 31 | Asymp :: Asymp( void ) 32 | { 33 | value_ = 0.0; 34 | target_ = 0.0; 35 | state_ = 0; 36 | factor_ = exp( -1.0 / ( 0.3 * Stk::sampleRate() ) ); 37 | constant_ = 0.0; 38 | Stk::addSampleRateAlert( this ); 39 | } 40 | 41 | Asymp :: ~Asymp( void ) 42 | { 43 | Stk::removeSampleRateAlert( this ); 44 | } 45 | 46 | void Asymp :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 47 | { 48 | if ( !ignoreSampleRateChange_ ) { 49 | StkFloat tau = -1.0 / ( std::log( factor_ ) * oldRate ); 50 | factor_ = std::exp( -1.0 / ( tau * newRate ) ); 51 | } 52 | } 53 | 54 | void Asymp :: keyOn( void ) 55 | { 56 | this->setTarget( 1.0 ); 57 | } 58 | 59 | void Asymp :: keyOff( void ) 60 | { 61 | this->setTarget( 0.0 ); 62 | } 63 | 64 | void Asymp :: setTau( StkFloat tau ) 65 | { 66 | if ( tau <= 0.0 ) { 67 | oStream_ << "Asymp::setTau: negative or zero tau not allowed!"; 68 | handleError( StkError::WARNING ); return; 69 | } 70 | 71 | factor_ = std::exp( -1.0 / ( tau * Stk::sampleRate() ) ); 72 | constant_ = ( 1.0 - factor_ ) * target_; 73 | } 74 | 75 | void Asymp :: setTime( StkFloat time ) 76 | { 77 | if ( time <= 0.0 ) { 78 | oStream_ << "Asymp::setTime: negative or zero times not allowed!"; 79 | handleError( StkError::WARNING ); return; 80 | } 81 | 82 | StkFloat tau = -time / std::log( TARGET_THRESHOLD ); 83 | factor_ = std::exp( -1.0 / ( tau * Stk::sampleRate() ) ); 84 | constant_ = ( 1.0 - factor_ ) * target_; 85 | } 86 | 87 | void Asymp :: setT60( StkFloat t60 ) 88 | { 89 | if ( t60 <= 0.0 ) { 90 | oStream_ << "Asymp::setT60: negative or zero t60 not allowed!"; 91 | handleError( StkError::WARNING ); return; 92 | } 93 | 94 | setTau( t60 / 6.91 ); 95 | } 96 | 97 | void Asymp :: setTarget( StkFloat target ) 98 | { 99 | target_ = target; 100 | if ( value_ != target_ ) state_ = 1; 101 | constant_ = ( 1.0 - factor_ ) * target_; 102 | } 103 | 104 | void Asymp :: setValue( StkFloat value ) 105 | { 106 | state_ = 0; 107 | target_ = value; 108 | value_ = value; 109 | } 110 | 111 | } // stk namespace 112 | 113 | -------------------------------------------------------------------------------- /libs/STK/src/BeeThree.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class BeeThree 3 | \brief STK Hammond-oid organ FM synthesis instrument. 4 | 5 | This class implements a simple 4 operator 6 | topology, also referred to as algorithm 8 of 7 | the TX81Z. 8 | 9 | \code 10 | Algorithm 8 is : 11 | 1 --. 12 | 2 -\| 13 | +-> 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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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 | -------------------------------------------------------------------------------- /libs/STK/src/BlitSaw.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class BlitSaw 3 | \brief STK band-limited sawtooth wave class. 4 | 5 | This class generates a band-limited sawtooth waveform 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 sawtooth and the 9 | number of harmonics contained in the resulting signal. 10 | 11 | If nHarmonics is 0, then the signal will contain all harmonics up 12 | to half the sample rate. Note, however, that this setting may 13 | produce aliasing in the signal when the frequency is changing (no 14 | automatic modification of the number of harmonics is performed by 15 | the setFrequency() function). 16 | 17 | Based on initial code of Robin Davies, 2005. 18 | Modified algorithm code by Gary Scavone, 2005. 19 | */ 20 | /***************************************************/ 21 | 22 | #include "BlitSaw.h" 23 | 24 | namespace stk { 25 | 26 | BlitSaw:: BlitSaw( StkFloat frequency ) 27 | { 28 | if ( frequency <= 0.0 ) { 29 | oStream_ << "BlitSaw::BlitSaw: argument (" << frequency << ") must be positive!"; 30 | handleError( StkError::FUNCTION_ARGUMENT ); 31 | } 32 | 33 | nHarmonics_ = 0; 34 | this->reset(); 35 | this->setFrequency( frequency ); 36 | } 37 | 38 | BlitSaw :: ~BlitSaw() 39 | { 40 | } 41 | 42 | void BlitSaw :: reset() 43 | { 44 | phase_ = 0.0f; 45 | state_ = 0.0; 46 | lastFrame_[0] = 0.0; 47 | } 48 | 49 | void BlitSaw :: setFrequency( StkFloat frequency ) 50 | { 51 | if ( frequency <= 0.0 ) { 52 | oStream_ << "BlitSaw::setFrequency: argument (" << frequency << ") must be positive!"; 53 | handleError( StkError::WARNING ); return; 54 | } 55 | 56 | p_ = Stk::sampleRate() / frequency; 57 | C2_ = 1 / p_; 58 | rate_ = PI * C2_; 59 | this->updateHarmonics(); 60 | } 61 | 62 | void BlitSaw :: setHarmonics( unsigned int nHarmonics ) 63 | { 64 | nHarmonics_ = nHarmonics; 65 | this->updateHarmonics(); 66 | 67 | // I found that the initial DC offset could be minimized with an 68 | // initial state setting as given below. This initialization should 69 | // only happen before starting the oscillator for the first time 70 | // (but after setting the frequency and number of harmonics). I 71 | // struggled a bit to decide where best to put this and finally 72 | // settled on here. In general, the user shouldn't be messing with 73 | // the number of harmonics once the oscillator is running because 74 | // this is automatically taken care of in the setFrequency() 75 | // function. (GPS - 1 October 2005) 76 | state_ = -0.5 * a_; 77 | } 78 | 79 | void BlitSaw :: updateHarmonics( void ) 80 | { 81 | if ( nHarmonics_ <= 0 ) { 82 | unsigned int maxHarmonics = (unsigned int) floor( 0.5 * p_ ); 83 | m_ = 2 * maxHarmonics + 1; 84 | } 85 | else 86 | m_ = 2 * nHarmonics_ + 1; 87 | 88 | a_ = m_ / p_; 89 | } 90 | 91 | } // stk namespace 92 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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 1.0 on keyOn and to 0.0 on keyOff. 9 | 10 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 11 | */ 12 | /***************************************************/ 13 | 14 | #include "Envelope.h" 15 | 16 | namespace stk { 17 | 18 | Envelope :: Envelope( void ) : Generator() 19 | { 20 | target_ = 0.0; 21 | value_ = 0.0; 22 | rate_ = 0.001; 23 | state_ = 0; 24 | Stk::addSampleRateAlert( this ); 25 | } 26 | 27 | Envelope :: ~Envelope( void ) 28 | { 29 | Stk::removeSampleRateAlert( this ); 30 | } 31 | 32 | Envelope& Envelope :: operator= ( const Envelope& e ) 33 | { 34 | if ( this != &e ) { 35 | target_ = e.target_; 36 | value_ = e.value_; 37 | rate_ = e.rate_; 38 | state_ = e.state_; 39 | } 40 | 41 | return *this; 42 | } 43 | 44 | void Envelope :: sampleRateChanged( StkFloat newRate, StkFloat oldRate ) 45 | { 46 | if ( !ignoreSampleRateChange_ ) 47 | rate_ = oldRate * rate_ / newRate; 48 | } 49 | 50 | void Envelope :: setRate( StkFloat rate ) 51 | { 52 | if ( rate < 0.0 ) { 53 | oStream_ << "Envelope::setRate: argument must be >= 0.0!"; 54 | handleError( StkError::WARNING ); return; 55 | } 56 | 57 | rate_ = rate; 58 | } 59 | 60 | void Envelope :: setTime( StkFloat time ) 61 | { 62 | if ( time <= 0.0 ) { 63 | oStream_ << "Envelope::setTime: argument must be > 0.0!"; 64 | handleError( StkError::WARNING ); return; 65 | } 66 | 67 | rate_ = 1.0 / ( time * Stk::sampleRate() ); 68 | } 69 | 70 | void Envelope :: setTarget( StkFloat target ) 71 | { 72 | target_ = target; 73 | if ( value_ != target_ ) state_ = 1; 74 | } 75 | 76 | void Envelope :: setValue( StkFloat value ) 77 | { 78 | state_ = 0; 79 | target_ = value; 80 | value_ = value; 81 | lastFrame_[0] = value_; 82 | } 83 | 84 | } // stk namespace 85 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/PercFlut.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class PercFlut 3 | \brief STK percussive flute FM synthesis instrument. 4 | 5 | This class implements algorithm 4 of the TX81Z. 6 | 7 | \code 8 | Algorithm 4 is : 4->3--\ 9 | 2-- + -->1-->Out 10 | \endcode 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--2017. 26 | */ 27 | /***************************************************/ 28 | 29 | #include "PercFlut.h" 30 | 31 | namespace stk { 32 | 33 | PercFlut :: PercFlut( 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.50 * 1.000); 42 | this->setRatio(1, 3.00 * 0.995); 43 | this->setRatio(2, 2.99 * 1.005); 44 | this->setRatio(3, 6.00 * 0.997); 45 | gains_[0] = fmGains_[99]; 46 | gains_[1] = fmGains_[71]; 47 | gains_[2] = fmGains_[93]; 48 | gains_[3] = fmGains_[85]; 49 | 50 | adsr_[0]->setAllTimes( 0.05, 0.05, fmSusLevels_[14], 0.05); 51 | adsr_[1]->setAllTimes( 0.02, 0.50, fmSusLevels_[13], 0.5); 52 | adsr_[2]->setAllTimes( 0.02, 0.30, fmSusLevels_[11], 0.05); 53 | adsr_[3]->setAllTimes( 0.02, 0.05, fmSusLevels_[13], 0.01); 54 | 55 | twozero_.setGain( 0.0 ); 56 | modDepth_ = 0.005; 57 | } 58 | 59 | PercFlut :: ~PercFlut( void ) 60 | { 61 | } 62 | 63 | void PercFlut :: setFrequency( StkFloat frequency ) 64 | { 65 | #if defined(_STK_DEBUG_) 66 | if ( frequency <= 0.0 ) { 67 | oStream_ << "PercFlut::setFrequency: argument is less than or equal to zero!"; 68 | handleError( StkError::WARNING ); return; 69 | } 70 | #endif 71 | 72 | baseFrequency_ = frequency; 73 | } 74 | 75 | void PercFlut :: noteOn( StkFloat frequency, StkFloat amplitude ) 76 | { 77 | gains_[0] = amplitude * fmGains_[99] * 0.5; 78 | gains_[1] = amplitude * fmGains_[71] * 0.5; 79 | gains_[2] = amplitude * fmGains_[93] * 0.5; 80 | gains_[3] = amplitude * fmGains_[85] * 0.5; 81 | this->setFrequency( frequency ); 82 | this->keyOn(); 83 | } 84 | 85 | } // stk namespace 86 | -------------------------------------------------------------------------------- /libs/STK/src/PitShift.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class PitShift 3 | \brief STK simple pitch shifter effect class. 4 | 5 | This class implements a simple pitch shifter 6 | using delay lines. 7 | 8 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 9 | */ 10 | /***************************************************/ 11 | 12 | #include "PitShift.h" 13 | #include 14 | 15 | namespace stk { 16 | 17 | PitShift :: PitShift( void ) 18 | { 19 | delayLength_ = maxDelay - 24; 20 | halfLength_ = delayLength_ / 2; 21 | delay_[0] = 12; 22 | delay_[1] = maxDelay / 2; 23 | 24 | delayLine_[0].setMaximumDelay( maxDelay ); 25 | delayLine_[0].setDelay( delay_[0] ); 26 | delayLine_[1].setMaximumDelay( maxDelay ); 27 | delayLine_[1].setDelay( delay_[1] ); 28 | effectMix_ = 0.5; 29 | rate_ = 1.0; 30 | } 31 | 32 | void PitShift :: clear() 33 | { 34 | delayLine_[0].clear(); 35 | delayLine_[1].clear(); 36 | lastFrame_[0] = 0.0; 37 | } 38 | 39 | void PitShift :: setShift( StkFloat shift ) 40 | { 41 | if ( shift < 1.0 ) { 42 | rate_ = 1.0 - shift; 43 | } 44 | else if ( shift > 1.0 ) { 45 | rate_ = 1.0 - shift; 46 | } 47 | else { 48 | rate_ = 0.0; 49 | delay_[0] = halfLength_ + 12; 50 | } 51 | } 52 | 53 | StkFrames& PitShift :: tick( StkFrames& frames, unsigned int channel ) 54 | { 55 | #if defined(_STK_DEBUG_) 56 | if ( channel >= frames.channels() ) { 57 | oStream_ << "PitShift::tick(): channel and StkFrames arguments are incompatible!"; 58 | handleError( StkError::FUNCTION_ARGUMENT ); 59 | } 60 | #endif 61 | 62 | StkFloat *samples = &frames[channel]; 63 | unsigned int hop = frames.channels(); 64 | for ( unsigned int i=0; i= iFrames.channels() || oChannel >= oFrames.channels() ) { 74 | oStream_ << "PitShift::tick(): channel and StkFrames arguments are incompatible!"; 75 | handleError( StkError::FUNCTION_ARGUMENT ); 76 | } 77 | #endif 78 | 79 | StkFloat *iSamples = &iFrames[iChannel]; 80 | StkFloat *oSamples = &oFrames[oChannel]; 81 | unsigned int iHop = iFrames.channels(), oHop = oFrames.channels(); 82 | for ( unsigned int i=0; isetFrequency( 220.0 ); 38 | } 39 | 40 | Plucked :: ~Plucked( void ) 41 | { 42 | } 43 | 44 | void Plucked :: clear( void ) 45 | { 46 | delayLine_.clear(); 47 | loopFilter_.clear(); 48 | pickFilter_.clear(); 49 | } 50 | 51 | void Plucked :: setFrequency( StkFloat frequency ) 52 | { 53 | #if defined(_STK_DEBUG_) 54 | if ( frequency <= 0.0 ) { 55 | oStream_ << "Plucked::setFrequency: argument is less than or equal to zero!"; 56 | handleError( StkError::WARNING ); return; 57 | } 58 | #endif 59 | 60 | // Delay = length - filter delay. 61 | StkFloat delay = ( Stk::sampleRate() / frequency ) - loopFilter_.phaseDelay( frequency ); 62 | delayLine_.setDelay( delay ); 63 | 64 | loopGain_ = 0.995 + (frequency * 0.000005); 65 | if ( loopGain_ >= 1.0 ) loopGain_ = 0.99999; 66 | } 67 | 68 | void Plucked :: pluck( StkFloat amplitude ) 69 | { 70 | if ( amplitude < 0.0 || amplitude > 1.0 ) { 71 | oStream_ << "Plucked::pluck: amplitude is out of range!"; 72 | handleError( StkError::WARNING ); return; 73 | } 74 | 75 | pickFilter_.setPole( 0.999 - (amplitude * 0.15) ); 76 | pickFilter_.setGain( amplitude * 0.5 ); 77 | for ( unsigned long i=0; isetFrequency( frequency ); 85 | this->pluck( amplitude ); 86 | } 87 | 88 | void Plucked :: noteOff( StkFloat amplitude ) 89 | { 90 | if ( amplitude < 0.0 || amplitude > 1.0 ) { 91 | oStream_ << "Plucked::noteOff: amplitude is out of range!"; 92 | handleError( StkError::WARNING ); return; 93 | } 94 | 95 | loopGain_ = 1.0 - amplitude; 96 | } 97 | 98 | } // stk namespace 99 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/Rhodey.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Rhodey 3 | \brief STK Fender Rhodes-like electric piano 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--2017. 30 | */ 31 | /***************************************************/ 32 | 33 | #include "Rhodey.h" 34 | 35 | namespace stk { 36 | 37 | Rhodey :: Rhodey( 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); 46 | this->setRatio(1, 0.5); 47 | this->setRatio(2, 1.0); 48 | this->setRatio(3, 15.0); 49 | 50 | gains_[0] = fmGains_[99]; 51 | gains_[1] = fmGains_[90]; 52 | gains_[2] = fmGains_[99]; 53 | gains_[3] = fmGains_[67]; 54 | 55 | adsr_[0]->setAllTimes( 0.001, 1.50, 0.0, 0.04); 56 | adsr_[1]->setAllTimes( 0.001, 1.50, 0.0, 0.04); 57 | adsr_[2]->setAllTimes( 0.001, 1.00, 0.0, 0.04); 58 | adsr_[3]->setAllTimes( 0.001, 0.25, 0.0, 0.04); 59 | 60 | twozero_.setGain( 1.0 ); 61 | } 62 | 63 | Rhodey :: ~Rhodey( void ) 64 | { 65 | } 66 | 67 | void Rhodey :: setFrequency( StkFloat frequency ) 68 | { 69 | #if defined(_STK_DEBUG_) 70 | if ( frequency <= 0.0 ) { 71 | oStream_ << "Rhodey::setFrequency: argument is less than or equal to zero!"; 72 | handleError( StkError::WARNING ); return; 73 | } 74 | #endif 75 | 76 | baseFrequency_ = frequency * 2.0; 77 | 78 | for (unsigned int i=0; isetFrequency( baseFrequency_ * ratios_[i] ); 80 | } 81 | 82 | void Rhodey :: noteOn( StkFloat frequency, StkFloat amplitude ) 83 | { 84 | gains_[0] = amplitude * fmGains_[99]; 85 | gains_[1] = amplitude * fmGains_[90]; 86 | gains_[2] = amplitude * fmGains_[99]; 87 | gains_[3] = amplitude * fmGains_[67]; 88 | this->setFrequency( frequency ); 89 | this->keyOn(); 90 | } 91 | 92 | } // stk namespace 93 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/Simple.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Simple 3 | \brief STK wavetable/noise instrument. 4 | 5 | This class combines a looped wave, a 6 | noise source, a biquad resonance filter, 7 | a one-pole filter, and an ADSR envelope 8 | to create some interesting sounds. 9 | 10 | Control Change Numbers: 11 | - Filter Pole Position = 2 12 | - Noise/Pitched Cross-Fade = 4 13 | - Envelope Rate = 11 14 | - Gain = 128 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 17 | */ 18 | /***************************************************/ 19 | 20 | #include "Simple.h" 21 | #include "SKINImsg.h" 22 | 23 | namespace stk { 24 | 25 | Simple :: Simple( void ) 26 | { 27 | // Concatenate the STK rawwave path to the rawwave file 28 | loop_ = new FileLoop( (Stk::rawwavePath() + "impuls10.raw").c_str(), true ); 29 | 30 | filter_.setPole( 0.5 ); 31 | baseFrequency_ = 440.0; 32 | setFrequency( baseFrequency_ ); 33 | loopGain_ = 0.5; 34 | } 35 | 36 | Simple :: ~Simple( void ) 37 | { 38 | delete loop_; 39 | } 40 | 41 | void Simple :: keyOn( void ) 42 | { 43 | adsr_.keyOn(); 44 | } 45 | 46 | void Simple :: keyOff( void ) 47 | { 48 | adsr_.keyOff(); 49 | } 50 | 51 | void Simple :: noteOn( StkFloat frequency, StkFloat amplitude ) 52 | { 53 | this->keyOn(); 54 | this->setFrequency( frequency ); 55 | filter_.setGain( amplitude ); 56 | } 57 | void Simple :: noteOff( StkFloat amplitude ) 58 | { 59 | this->keyOff(); 60 | } 61 | 62 | void Simple :: setFrequency( StkFloat frequency ) 63 | { 64 | #if defined(_STK_DEBUG_) 65 | if ( frequency <= 0.0 ) { 66 | oStream_ << "Simple::setFrequency: argument is less than or equal to zero!"; 67 | handleError( StkError::WARNING ); return; 68 | } 69 | #endif 70 | 71 | biquad_.setResonance( frequency, 0.98, true ); 72 | loop_->setFrequency( frequency ); 73 | } 74 | 75 | void Simple :: controlChange( int number, StkFloat value ) 76 | { 77 | #if defined(_STK_DEBUG_) 78 | if ( Stk::inRange( value, 0.0, 128.0 ) == false ) { 79 | oStream_ << "Simple::controlChange: value (" << value << ") is out of range!"; 80 | handleError( StkError::WARNING ); return; 81 | } 82 | #endif 83 | 84 | StkFloat normalizedValue = value * ONE_OVER_128; 85 | if (number == __SK_Breath_) // 2 86 | filter_.setPole( 0.99 * (1.0 - (normalizedValue * 2.0)) ); 87 | else if (number == __SK_NoiseLevel_) // 4 88 | loopGain_ = normalizedValue; 89 | else if (number == __SK_ModFrequency_) { // 11 90 | normalizedValue /= 0.2 * Stk::sampleRate(); 91 | adsr_.setAttackRate( normalizedValue ); 92 | adsr_.setDecayRate( normalizedValue ); 93 | adsr_.setReleaseRate( normalizedValue ); 94 | } 95 | else if (number == __SK_AfterTouch_Cont_) // 128 96 | adsr_.setTarget( normalizedValue ); 97 | #if defined(_STK_DEBUG_) 98 | else { 99 | oStream_ << "Simple::controlChange: undefined control number (" << number << ")!"; 100 | handleError( StkError::WARNING ); 101 | } 102 | #endif 103 | } 104 | 105 | } // stk namespace 106 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/Sitar.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Sitar 3 | \brief STK sitar string model class. 4 | 5 | This class implements a sitar plucked string 6 | physical model based on the Karplus-Strong 7 | algorithm. 8 | 9 | This is a digital waveguide model, making its 10 | use possibly subject to patents held by 11 | Stanford University, Yamaha, and others. 12 | There exist at least two patents, assigned to 13 | Stanford, bearing the names of Karplus and/or 14 | Strong. 15 | 16 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 17 | */ 18 | /***************************************************/ 19 | 20 | #include "Sitar.h" 21 | 22 | namespace stk { 23 | 24 | Sitar :: Sitar( StkFloat lowestFrequency ) 25 | { 26 | if ( lowestFrequency <= 0.0 ) { 27 | oStream_ << "Sitar::Sitar: argument is less than or equal to zero!"; 28 | handleError( StkError::FUNCTION_ARGUMENT ); 29 | } 30 | 31 | unsigned long length = (unsigned long) ( Stk::sampleRate() / lowestFrequency + 1 ); 32 | delayLine_.setMaximumDelay( length ); 33 | delay_ = 0.5 * length; 34 | delayLine_.setDelay( delay_ ); 35 | targetDelay_ = delay_; 36 | 37 | loopFilter_.setZero( 0.01 ); 38 | loopGain_ = 0.999; 39 | 40 | envelope_.setAllTimes( 0.001, 0.04, 0.0, 0.5 ); 41 | this->clear(); 42 | } 43 | 44 | Sitar :: ~Sitar( void ) 45 | { 46 | } 47 | 48 | void Sitar :: clear( void ) 49 | { 50 | delayLine_.clear(); 51 | loopFilter_.clear(); 52 | } 53 | 54 | void Sitar :: setFrequency( StkFloat frequency ) 55 | { 56 | #if defined(_STK_DEBUG_) 57 | if ( frequency <= 0.0 ) { 58 | oStream_ << "Sitar::setFrequency: parameter is less than or equal to zero!"; 59 | handleError( StkError::WARNING ); return; 60 | } 61 | #endif 62 | 63 | targetDelay_ = (Stk::sampleRate() / frequency); 64 | delay_ = targetDelay_ * (1.0 + (0.05 * noise_.tick())); 65 | delayLine_.setDelay( delay_ ); 66 | loopGain_ = 0.995 + (frequency * 0.0000005); 67 | if ( loopGain_ > 0.9995 ) loopGain_ = 0.9995; 68 | } 69 | 70 | void Sitar :: pluck( StkFloat amplitude ) 71 | { 72 | envelope_.keyOn(); 73 | } 74 | 75 | void Sitar :: noteOn( StkFloat frequency, StkFloat amplitude ) 76 | { 77 | this->setFrequency( frequency ); 78 | this->pluck( amplitude ); 79 | amGain_ = 0.1 * amplitude; 80 | } 81 | 82 | void Sitar :: noteOff( StkFloat amplitude ) 83 | { 84 | if ( amplitude < 0.0 || amplitude > 1.0 ) { 85 | oStream_ << "Sitar::noteOff: amplitude is out of range!"; 86 | handleError( StkError::WARNING ); return; 87 | } 88 | 89 | loopGain_ = (StkFloat) 1.0 - amplitude; 90 | } 91 | 92 | } // stk namespace 93 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/TapDelay.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class TapDelay 3 | \brief STK non-interpolating tapped delay line class. 4 | 5 | This class implements a non-interpolating digital delay-line with 6 | an arbitrary number of output "taps". If the maximum length and 7 | tap delays are not specified during instantiation, a fixed maximum 8 | length of 4095 and a single tap delay of zero is set. 9 | 10 | A non-interpolating delay line is typically used in fixed 11 | delay-length applications, such as for reverberation. 12 | 13 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 14 | */ 15 | /***************************************************/ 16 | 17 | #include "TapDelay.h" 18 | 19 | namespace stk { 20 | 21 | TapDelay :: TapDelay( std::vector taps, unsigned long maxDelay ) 22 | { 23 | // Writing before reading allows delays from 0 to length-1. 24 | // If we want to allow a delay of maxDelay, we need a 25 | // delayline of length = maxDelay+1. 26 | if ( maxDelay < 1 ) { 27 | oStream_ << "TapDelay::TapDelay: maxDelay must be > 0!\n"; 28 | handleError( StkError::FUNCTION_ARGUMENT ); 29 | } 30 | 31 | for ( unsigned int i=0; i maxDelay ) { 33 | oStream_ << "TapDelay::TapDelay: maxDelay must be > than all tap delay values!\n"; 34 | handleError( StkError::FUNCTION_ARGUMENT ); 35 | } 36 | } 37 | 38 | if ( ( maxDelay + 1 ) > inputs_.size() ) 39 | inputs_.resize( maxDelay + 1, 1, 0.0 ); 40 | 41 | inPoint_ = 0; 42 | this->setTapDelays( taps ); 43 | } 44 | 45 | TapDelay :: ~TapDelay() 46 | { 47 | } 48 | 49 | void TapDelay :: setMaximumDelay( unsigned long delay ) 50 | { 51 | if ( delay < inputs_.size() ) return; 52 | 53 | for ( unsigned int i=0; i taps ) 64 | { 65 | for ( unsigned int i=0; i inputs_.size() - 1 ) { // The value is too big. 67 | oStream_ << "TapDelay::setTapDelay: argument (" << taps[i] << ") greater than maximum!\n"; 68 | handleError( StkError::WARNING ); return; 69 | } 70 | } 71 | 72 | if ( taps.size() != outPoint_.size() ) { 73 | outPoint_.resize( taps.size() ); 74 | delays_.resize( taps.size() ); 75 | lastFrame_.resize( 1, (unsigned int)taps.size(), 0.0 ); 76 | } 77 | 78 | for ( unsigned int i=0; i= taps[i] ) outPoint_[i] = inPoint_ - taps[i]; 81 | else outPoint_[i] = inputs_.size() + inPoint_ - taps[i]; 82 | delays_[i] = taps[i]; 83 | } 84 | } 85 | 86 | } // stk namespace 87 | 88 | -------------------------------------------------------------------------------- /libs/STK/src/Thread.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Thread 3 | \brief STK thread class. 4 | 5 | This class provides a uniform interface for cross-platform 6 | threads. On unix systems, the pthread library is used. Under 7 | Windows, the C runtime threadex functions are used. 8 | 9 | Each instance of the Thread class can be used to control a single 10 | thread process. Routines are provided to signal cancelation 11 | and/or joining with a thread, though it is not possible for this 12 | class to know the running status of a thread once it is started. 13 | 14 | For cross-platform compatability, thread functions should be 15 | declared as follows: 16 | 17 | THREAD_RETURN THREAD_TYPE thread_function(void *ptr) 18 | 19 | by Perry R. Cook and Gary P. Scavone, 1995--2017. 20 | */ 21 | /***************************************************/ 22 | 23 | #include "Thread.h" 24 | 25 | namespace stk { 26 | 27 | Thread :: Thread() 28 | { 29 | thread_ = 0; 30 | } 31 | 32 | Thread :: ~Thread() 33 | { 34 | } 35 | 36 | bool Thread :: start( THREAD_FUNCTION routine, void * ptr ) 37 | { 38 | if ( thread_ ) { 39 | oStream_ << "Thread:: a thread is already running!"; 40 | handleError( StkError::WARNING ); 41 | return false; 42 | } 43 | 44 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 45 | 46 | if ( pthread_create(&thread_, NULL, *routine, ptr) == 0 ) 47 | return true; 48 | 49 | #elif defined(__OS_WINDOWS__) 50 | unsigned thread_id; 51 | thread_ = _beginthreadex(NULL, 0, routine, ptr, 0, &thread_id); 52 | if ( thread_ ) return true; 53 | 54 | #endif 55 | return false; 56 | } 57 | 58 | bool Thread :: cancel() 59 | { 60 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 61 | 62 | if ( pthread_cancel(thread_) == 0 ) { 63 | return true; 64 | } 65 | 66 | #elif defined(__OS_WINDOWS__) 67 | 68 | TerminateThread((HANDLE)thread_, 0); 69 | return true; 70 | 71 | #endif 72 | return false; 73 | } 74 | 75 | bool Thread :: wait() 76 | { 77 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 78 | 79 | if ( pthread_join(thread_, NULL) == 0 ) { 80 | thread_ = 0; 81 | return true; 82 | } 83 | 84 | #elif defined(__OS_WINDOWS__) 85 | 86 | long retval = WaitForSingleObject( (HANDLE)thread_, INFINITE ); 87 | if ( retval == WAIT_OBJECT_0 ) { 88 | CloseHandle( (HANDLE)thread_ ); 89 | thread_ = 0; 90 | return true; 91 | } 92 | 93 | #endif 94 | return false; 95 | } 96 | 97 | void Thread :: testCancel(void) 98 | { 99 | #if (defined(__OS_IRIX__) || defined(__OS_LINUX__) || defined(__OS_MACOSX__)) 100 | 101 | pthread_testcancel(); 102 | 103 | #endif 104 | } 105 | 106 | } // stk namespace 107 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/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--2017. 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 | -------------------------------------------------------------------------------- /libs/STK/src/Wurley.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************/ 2 | /*! \class Wurley 3 | \brief STK Wurlitzer electric piano 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--2017. 30 | */ 31 | /***************************************************/ 32 | 33 | #include "Wurley.h" 34 | 35 | namespace stk { 36 | 37 | Wurley :: Wurley( 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); 46 | this->setRatio(1, 4.0); 47 | this->setRatio(2, -510.0); 48 | this->setRatio(3, -510.0); 49 | 50 | gains_[0] = fmGains_[99]; 51 | gains_[1] = fmGains_[82]; 52 | gains_[2] = fmGains_[92]; 53 | gains_[3] = fmGains_[68]; 54 | 55 | adsr_[0]->setAllTimes( 0.001, 1.50, 0.0, 0.04); 56 | adsr_[1]->setAllTimes( 0.001, 1.50, 0.0, 0.04); 57 | adsr_[2]->setAllTimes( 0.001, 0.25, 0.0, 0.04); 58 | adsr_[3]->setAllTimes( 0.001, 0.15, 0.0, 0.04); 59 | 60 | twozero_.setGain( 2.0 ); 61 | vibrato_.setFrequency( 8.0 ); 62 | } 63 | 64 | Wurley :: ~Wurley( void ) 65 | { 66 | } 67 | 68 | void Wurley :: setFrequency( StkFloat frequency ) 69 | { 70 | #if defined(_STK_DEBUG_) 71 | if ( frequency <= 0.0 ) { 72 | oStream_ << "Wurley::setFrequency: argument is less than or equal to zero!"; 73 | handleError( StkError::WARNING ); return; 74 | } 75 | #endif 76 | 77 | baseFrequency_ = frequency; 78 | waves_[0]->setFrequency( baseFrequency_ * ratios_[0]); 79 | waves_[1]->setFrequency( baseFrequency_ * ratios_[1]); 80 | waves_[2]->setFrequency( ratios_[2] ); // Note here a 'fixed resonance'. 81 | waves_[3]->setFrequency( ratios_[3] ); 82 | } 83 | 84 | void Wurley :: noteOn( StkFloat frequency, StkFloat amplitude ) 85 | { 86 | gains_[0] = amplitude * fmGains_[99]; 87 | gains_[1] = amplitude * fmGains_[82]; 88 | gains_[2] = amplitude * fmGains_[82]; 89 | gains_[3] = amplitude * fmGains_[68]; 90 | this->setFrequency( frequency ); 91 | this->keyOn(); 92 | } 93 | 94 | } // stk namespace 95 | -------------------------------------------------------------------------------- /openFrameworks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cc.openFrameworks.ofapp 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | CFBundleIconFile 20 | ${ICON} 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/ofxStk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ADSR.h" 3 | #include "Asymp.h" 4 | #include "BandedWG.h" 5 | #include "BeeThree.h" 6 | #include "BiQuad.h" 7 | #include "Blit.h" 8 | #include "BlitSaw.h" 9 | #include "BlitSquare.h" 10 | #include "BlowBotl.h" 11 | #include "BlowHole.h" 12 | #include "BowTable.h" 13 | #include "Bowed.h" 14 | #include "Brass.h" 15 | #include "Chorus.h" 16 | #include "Clarinet.h" 17 | #include "Cubic.h" 18 | #include "Delay.h" 19 | #include "DelayA.h" 20 | #include "DelayL.h" 21 | #include "Drummer.h" 22 | #include "Echo.h" 23 | #include "Effect.h" 24 | #include "Envelope.h" 25 | #include "FM.h" 26 | #include "FMVoices.h" 27 | #include "FileLoop.h" 28 | #include "FileRead.h" 29 | #include "FileWrite.h" 30 | #include "FileWvIn.h" 31 | #include "FileWvOut.h" 32 | #include "Filter.h" 33 | #include "Fir.h" 34 | #include "Flute.h" 35 | #include "FormSwep.h" 36 | #include "FreeVerb.h" 37 | #include "Function.h" 38 | #include "Generator.h" 39 | #include "Granulate.h" 40 | #include "Guitar.h" 41 | #include "HevyMetl.h" 42 | #include "Iir.h" 43 | #include "InetWvIn.h" 44 | #include "InetWvOut.h" 45 | #include "Instrmnt.h" 46 | #include "JCRev.h" 47 | #include "JetTable.h" 48 | #include "LentPitShift.h" 49 | #include "Mandolin.h" 50 | #include "Mesh2D.h" 51 | #include "Messager.h" 52 | #include "MidiFileIn.h" 53 | #include "Modal.h" 54 | #include "ModalBar.h" 55 | #include "Modulate.h" 56 | #include "Moog.h" 57 | #include "Mutex.h" 58 | #include "NRev.h" 59 | #include "Noise.h" 60 | #include "OnePole.h" 61 | #include "OneZero.h" 62 | #include "PRCRev.h" 63 | #include "PercFlut.h" 64 | #include "Phonemes.h" 65 | #include "PitShift.h" 66 | #include "Plucked.h" 67 | #include "PoleZero.h" 68 | #include "ReedTable.h" 69 | #include "Resonate.h" 70 | #include "Rhodey.h" 71 | #include "RtAudio.h" 72 | #include "RtMidi.h" 73 | #include "RtWvIn.h" 74 | #include "RtWvOut.h" 75 | #include "SKINImsg.h" 76 | #include "SKINItbl.h" 77 | #include "Sampler.h" 78 | #include "Saxofony.h" 79 | #include "Shakers.h" 80 | #include "Simple.h" 81 | #include "SineWave.h" 82 | #include "SingWave.h" 83 | #include "Sitar.h" 84 | #include "Skini.h" 85 | #include "Socket.h" 86 | #include "Sphere.h" 87 | #include "StifKarp.h" 88 | #include "Stk.h" 89 | #include "TapDelay.h" 90 | #include "TcpClient.h" 91 | #include "TcpServer.h" 92 | #include "Thread.h" 93 | #include "TubeBell.h" 94 | #include "Twang.h" 95 | #include "TwoPole.h" 96 | #include "TwoZero.h" 97 | #include "UdpSocket.h" 98 | #include "Vector3D.h" 99 | #include "VoicForm.h" 100 | #include "Voicer.h" 101 | #include "Whistle.h" 102 | #include "Wurley.h" 103 | #include "WvIn.h" 104 | #include "WvOut.h" 105 | --------------------------------------------------------------------------------