Version 4.1.2

This commit is contained in:
Gary Scavone
2009-03-24 23:02:13 -04:00
committed by Stephen Sinclair
parent 6e0d1955a8
commit 586b0add5f
125 changed files with 7301 additions and 5337 deletions

View File

@@ -40,7 +40,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -157,6 +157,12 @@ int main(int argc,char *argv[])
case __SK_ControlChange_:
j = (int) byte2;
switch(j) {
case __SK_PitchChange_:
sprintf(s,"PitchChange\t%.3f %d %.1f\n",0.0,channel,byte3);
if (writeFile) {
fprintf(file,"PitchChange\t%.3f %d %.1f\n",dt,channel,byte3);
}
break;
case __SK_Volume_:
sprintf(s,"Volume\t%.3f %d %.1f\n",0.0,channel,byte3);
if (writeFile) {

View File

@@ -1 +1 @@
wish < tcl/Modal.tcl | demo ModalBar -or -ip
wish < tcl/Modal.tcl | ./demo ModalBar -or -ip

View File

@@ -1 +1 @@
wish < tcl/Physical.tcl | demo Clarinet -or -ip
wish < tcl/Physical.tcl | ./demo Clarinet -or -ip

View File

@@ -1 +1 @@
wish < tcl/Demo.tcl | demo Clarinet -or -ip
wish < tcl/Demo.tcl | ./demo Clarinet -or -ip

View File

@@ -1 +1 @@
wish < tcl/Voice.tcl | demo FMVoices -or -ip
wish < tcl/Voice.tcl | ./demo FMVoices -or -ip

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <signal.h>
#include <math.h>
#include <iostream.h>
#include <iostream>
bool done;
static void finish(int ignore){ done = true; }
@@ -28,12 +28,13 @@ int main(int argc, char *argv[])
Reverb *reverb = 0;
Voicer *voicer = 0;
int i, nVoices = 1;
MY_FLOAT volume = 1.0;
MY_FLOAT t60 = 1.0; // in seconds
// If you want to change the default sample rate (set in Stk.h), do
// it before instantiating any objects! If the sample rate is
// specified in the command line, it will override this setting.
Stk::setSampleRate( 22050.0 );
Stk::setSampleRate( 44100.0 );
// Check the command-line arguments for errors and to determine
// the number of WvOut objects to be instantiated (in utilities.cpp).
@@ -67,6 +68,11 @@ int main(int argc, char *argv[])
goto cleanup;
}
// Set the number of ticks between realtime messages (default =
// RT_BUFFER_SIZE).
messager->setRtDelta( 64 );
// Set the reverb parameters.
reverb = new PRCRev( t60 );
reverb->setEffectMix(0.2);
@@ -86,7 +92,7 @@ int main(int argc, char *argv[])
nTicks = messager->getDelta();
for ( i=0; i<nTicks; i++ ) {
sample = reverb->tick( voicer->tick() );
sample = volume * reverb->tick( voicer->tick() );
for ( j=0; j<nOutputs; j++ ) output[j]->tick(sample);
}
@@ -111,6 +117,10 @@ int main(int argc, char *argv[])
case __SK_ControlChange_:
if (byte2 == 44.0)
reverb->setEffectMix(byte3 * ONE_OVER_128);
else if (byte2 == 7.0)
volume = byte3 * ONE_OVER_128;
else if (byte2 == 49.0)
voicer->setFrequency( byte3 );
else
voicer->controlChange( (int) byte2, byte3 );
break;
@@ -127,6 +137,10 @@ int main(int argc, char *argv[])
voicer->pitchBend( byte2 );
break;
case __SK_Volume_:
volume = byte2 * ONE_OVER_128;
break;
case __SK_ProgramChange_:
if ( voice != (int) byte2 ) {
voicer->silence();
@@ -167,7 +181,7 @@ int main(int argc, char *argv[])
for ( i=0; i<nVoices; i++ ) delete instrument[i];
free(instrument);
cout << "\nStk demo finished ... goodbye.\n" << endl;
std::cout << "\nStk demo finished ... goodbye.\n" << std::endl;
return 0;
}

View File

@@ -8,6 +8,7 @@ set velocity 96.0
set cont1 0.0
set cont2 10.0
set cont4 20.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -194,22 +195,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Breath Pressure" \
@@ -226,6 +221,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Breath Noise" \
@@ -244,9 +245,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -3,6 +3,7 @@ set press 64.0
set cont1 0.0
set cont2 64.0
set cont4 64.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -82,22 +83,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Strike Vigor" \
@@ -114,6 +109,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Stick Position" \
@@ -132,9 +133,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -6,6 +6,7 @@ set press 64.0
set cont1 0.0
set cont2 20.0
set cont4 64.0
set cont7 128.0
set cont11 64.0
set cont44 24.0
set outID "stdout"
@@ -93,22 +94,16 @@ pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure reverb slider
frame .reverb -bg black
scale .reverb.mix -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
pack .reverb.mix -padx 10 -pady 10
pack .reverb
# Configure sliders
frame .left -bg black
frame .right -bg black
scale .left.volume -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 7} \
-orient horizontal -label "Volume" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont7
scale .left.bPressure -from 0 -to 128 -length 200 \
-command {changePress } -variable press \
-orient horizontal -label "Breath Pressure" \
@@ -125,6 +120,12 @@ scale .left.cont2 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont2
scale .right.reverb -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Reverb Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont44
scale .right.cont4 -from 0 -to 128 -length 200 \
-command {printWhatz "ControlChange 0.0 1 " 4} \
-orient horizontal -label "Breath Noise" \
@@ -143,9 +144,11 @@ scale .right.cont1 -from 0 -to 128 -length 200 \
-tickinterval 32 -showvalue true -bg grey66 \
-variable cont1
pack .left.volume -padx 10 -pady 10
pack .left.bPressure -padx 10 -pady 10
pack .left.pitch -padx 10 -pady 10
pack .left.cont2 -padx 10 -pady 10
pack .right.reverb -padx 10 -pady 10
pack .right.cont4 -padx 10 -pady 10
pack .right.cont11 -padx 10 -pady 10
pack .right.cont1 -padx 10 -pady 10

View File

@@ -1 +1 @@
wish < tcl/Effects.tcl | effects -ip
wish < tcl/Effects.tcl | ./effects -ip

View File

@@ -29,7 +29,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtDuplex.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -22,7 +22,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif

View File

@@ -5,8 +5,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
Instrmnt *instrument = 0;
RtWvOut *output = 0;

View File

@@ -8,8 +8,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
Instrmnt *instrument = 0;
RtWvOut *output = 0;

View File

@@ -16,7 +16,8 @@
#include "RtDuplex.h"
#include <stdio.h>
#if defined(__OS_LINUX_) || defined(__OS_IRIX__)
#if defined(__OS_LINUX__) || defined(__OS_IRIX__)
#include <unistd.h>
#include <sched.h>
#endif

View File

@@ -0,0 +1,77 @@
### STK examples Makefile - for various flavors of unix
PROGRAMS = sine play record io tcpIn tcpOut sineosc rtsine bethree controlbee foursine threebees
RM = /bin/rm
INCLUDE = @include@
ifeq ($(strip $(INCLUDE)), )
INCLUDE = ../../include
endif
vpath %.h $(INCLUDE)
CC = @CXX@
DEFS = @byte_order@
DEFS += @debug@
CFLAGS = @cflags@
CFLAGS += @warn@ -I$(INCLUDE)
LIBRARY = @LIBS@
LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
DEFS += @audio_apis@
DEFS += @midiator@
endif
RAWWAVES = @rawwaves@
ifeq ($(strip $(RAWWAVES)), )
RAWWAVES = ../../rawwaves/
endif
DEFS += -DRAWWAVE_PATH=\"$(RAWWAVES)\"
all : $(PROGRAMS)
$(OBJECTS) : Stk.h
clean :
-rm $(PROGRAMS)
strip :
strip $(PROGRAMS)
#play: play.cpp Stk.o WvIn.o WvOut.o RtWvOut.o RtAudio.o
play: play.cpp
$(CC) $(CFLAGS) $(DEFS) -o play play.cpp -L../../src $(LIBRARY) -lstk
record: record.cpp
$(CC) $(CFLAGS) $(DEFS) -o record record.cpp -L../../src $(LIBRARY) -lstk
sine: sine.cpp
$(CC) $(CFLAGS) $(DEFS) -o sine sine.cpp -L../../src $(LIBRARY) -lstk
io: io.cpp
$(CC) $(CFLAGS) $(DEFS) -o io io.cpp -L../../src $(LIBRARY) -lstk
tcpIn: tcpIn.cpp
$(CC) $(CFLAGS) $(DEFS) -o tcpIn tcpIn.cpp -L../../src $(LIBRARY) -lstk
tcpOut: tcpOut.cpp
$(CC) $(CFLAGS) $(DEFS) -o tcpOut tcpOut.cpp -L../../src $(LIBRARY) -lstk
sineosc: sineosc.cpp
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp -L../../src $(LIBRARY) -lstk
rtsine: rtsine.cpp
$(CC) $(CFLAGS) $(DEFS) -o rtsine rtsine.cpp -L../../src $(LIBRARY) -lstk
bethree: bethree.cpp
$(CC) $(CFLAGS) $(DEFS) -o bethree bethree.cpp -L../../src $(LIBRARY) -lstk
controlbee: controlbee.cpp
$(CC) $(CFLAGS) $(DEFS) -o controlbee controlbee.cpp -L../../src $(LIBRARY) -lstk
foursine: foursine.cpp
$(CC) $(CFLAGS) $(DEFS) -o foursine foursine.cpp -L../../src $(LIBRARY) -lstk
threebees: threebees.cpp
$(CC) $(CFLAGS) $(DEFS) -o threebees threebees.cpp -L../../src $(LIBRARY) -lstk

View File

@@ -44,12 +44,10 @@ int main(int argc, char *argv[])
exit(0);
}
// Set the global STK sample rate to the file rate.
Stk::setSampleRate( input->getFileRate() );
// Set input read rate.
// Set input read rate based on the default STK sample rate.
float rate = 1.0;
if ( argc == 3 ) rate = atof(argv[2]);
rate = input->getFileRate() / Stk::sampleRate();
if ( argc == 3 ) rate *= atof(argv[2]);
input->setRate( rate );
// Find out how many channels we have.
@@ -57,7 +55,7 @@ int main(int argc, char *argv[])
// Define and open the realtime output device
try {
output = new RtWvOut( channels, Stk::sampleRate(), 0, 512, 4 );
output = new RtWvOut( channels, Stk::sampleRate(), 0, RT_BUFFER_SIZE, 4 );
}
catch (StkError &) {
goto cleanup;

View File

@@ -15,7 +15,6 @@
#include "WaveLoop.h"
#include "WvOut.h"
#include <stdlib.h>
#include <iostream.h>
void usage(void) {
// Error function in case of incorrect command-line
@@ -68,7 +67,7 @@ main(int argc, char *argv[])
// Define and open the soundfile for output. Other file
// format options include: WVOUT_SND, WVOUT_AIF, WVOUT_MAT,
// and WVOUT_RAW. Other data type options include:
// STK_SINT8, STK_SINT32, STK_FLOAT32, and STK_FLOAT64.
// STK_SINT8, STK_SINT32, MY_FLOAT32, and MY_FLOAT64.
try {
output = new WvOut( argv[2], channels, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
}

View File

@@ -8,8 +8,9 @@
int main()
{
// Set the global sample rate before creating class instances.
// Set the global sample rate and rawwave path before creating class instances.
Stk::setSampleRate( 44100.0 );
Stk::setRawwavePath( "../../rawwaves/" );
int i;
RtWvOut *output = 0;

View File

@@ -49,7 +49,7 @@ void Drone :: setFrequency(MY_FLOAT frequency)
{
MY_FLOAT freakency = frequency;
if ( frequency <= 0.0 ) {
cerr << "Drone: setFrequency parameter is less than or equal to zero!" << endl;
std::cerr << "Drone: setFrequency parameter is less than or equal to zero!" << std::endl;
freakency = 220.0;
}
@@ -73,7 +73,7 @@ void Drone :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
this->pluck(amplitude);
#if defined(_STK_DEBUG_)
cerr << "Drone: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
std::cerr << "Drone: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << std::endl;
#endif
}
@@ -81,16 +81,16 @@ void Drone :: noteOff(MY_FLOAT amplitude)
{
loopGain = (MY_FLOAT) 1.0 - amplitude;
if ( loopGain < 0.0 ) {
cerr << "Drone: noteOff amplitude greater than 1.0!" << endl;
std::cerr << "Drone: noteOff amplitude greater than 1.0!" << std::endl;
loopGain = 0.0;
}
else if ( loopGain > 1.0 ) {
cerr << "Drone: noteOff amplitude less than or zero!" << endl;
std::cerr << "Drone: noteOff amplitude less than or zero!" << std::endl;
loopGain = (MY_FLOAT) 0.99999;
}
#if defined(_STK_DEBUG_)
cerr << "Drone: NoteOff amplitude = " << amplitude << endl;
std::cerr << "Drone: NoteOff amplitude = " << amplitude << std::endl;
#endif
}

View File

@@ -30,7 +30,7 @@ LIBRARY += @frameworks@
REALTIME = @realtime@
ifeq ($(REALTIME),yes)
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Socket.o
DEFS += @sound_api@
DEFS += @audio_apis@
DEFS += @midiator@
endif
@@ -66,4 +66,4 @@ Drone.o: Drone.cpp
$(CC) $(CFLAGS) $(DEFS) -c Drone.cpp -o $(OBJECT_PATH)/$@
VoicDrum.o: VoicDrum.cpp
$(CC) $(CFLAGS) $(DEFS) -c VoicDrum.cpp -o $(OBJECT_PATH)/$@
$(CC) $(CFLAGS) $(DEFS) -c VoicDrum.cpp -o $(OBJECT_PATH)/$@

View File

@@ -1 +1 @@
wish < tcl/Raga.tcl | ragamat -ip
wish < tcl/Raga.tcl | ./ragamat -ip

View File

@@ -40,16 +40,16 @@ Tabla :: ~Tabla()
void Tabla :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "Tabla: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << endl;
std::cerr << "Tabla: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << std::endl;
#endif
MY_FLOAT gain = amplitude;
if ( amplitude > 1.0 ) {
cerr << "Tabla: noteOn amplitude parameter is greater than 1.0!" << endl;
std::cerr << "Tabla: noteOn amplitude parameter is greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( amplitude < 0.0 ) {
cerr << "Tabla: noteOn amplitude parameter is less than 0.0!" << endl;
std::cerr << "Tabla: noteOn amplitude parameter is less than 0.0!" << std::endl;
return;
}
@@ -115,9 +115,9 @@ void Tabla :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Number Sounding = " << nSounding << endl;
for (i=0; i<nSounding; i++) cerr << sounding[i] << " ";
cerr << "\n";
std::cerr << "Number Sounding = " << nSounding << std::endl;
for (i=0; i<nSounding; i++) std::cerr << sounding[i] << " ";
std::cerr << "\n";
#endif
}

View File

@@ -40,16 +40,16 @@ VoicDrum :: ~VoicDrum()
void VoicDrum :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
{
#if defined(_STK_DEBUG_)
cerr << "VoicDrum: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << endl;
std::cerr << "VoicDrum: NoteOn instrument = " << instrument << ", amplitude = " << amplitude << std::endl;
#endif
MY_FLOAT gain = amplitude;
if ( amplitude > 1.0 ) {
cerr << "VoicDrum: noteOn amplitude parameter is greater than 1.0!" << endl;
std::cerr << "VoicDrum: noteOn amplitude parameter is greater than 1.0!" << std::endl;
gain = 1.0;
}
else if ( amplitude < 0.0 ) {
cerr << "VoicDrum: noteOn amplitude parameter is less than 0.0!" << endl;
std::cerr << "VoicDrum: noteOn amplitude parameter is less than 0.0!" << std::endl;
return;
}
@@ -112,9 +112,9 @@ void VoicDrum :: noteOn(MY_FLOAT instrument, MY_FLOAT amplitude)
}
#if defined(_STK_DEBUG_)
cerr << "Number Sounding = " << nSounding << endl;
for (i=0; i<nSounding; i++) cerr << sounding[i] << " ";
cerr << "\n";
std::cerr << "Number Sounding = " << nSounding << std::endl;
for (i=0; i<nSounding; i++) std::cerr << sounding[i] << " ";
std::cerr << "\n";
#endif
}