Version 3.2

This commit is contained in:
Gary Scavone
2013-09-25 14:47:10 +02:00
committed by Stephen Sinclair
parent 4b6500d3de
commit 3f126af4e5
443 changed files with 11772 additions and 8060 deletions

123
projects/effects/Chorus.cpp Normal file
View File

@@ -0,0 +1,123 @@
/******************************************/
/* Chorus Effect Applied to Soundfile */
/* by Perry Cook, 1996 */
/******************************************/
#include "Chorus.h"
Chorus :: Chorus(MY_FLOAT baseDelay)
{
delayLine[0] = new DLineL((long) (baseDelay * 1.414) + 2);
delayLine[1] = new DLineL((long) (baseDelay) + 2);
delayLine[0]->setDelay(baseDelay);
delayLine[1]->setDelay(baseDelay);
baseLength = baseDelay;
// Concatenate the STK RAWWAVE_PATH to the rawwave file
char temp[128];
strcpy(temp, RAWWAVE_PATH);
mods[0] = new RawWvIn(strcat(temp,"rawwaves/sinewave.raw"),"looping");
strcpy(temp, RAWWAVE_PATH);
mods[1] = new RawWvIn(strcat(temp,"rawwaves/sinewave.raw"),"looping");
mods[0]->setFreq(0.2);
mods[1]->setFreq(0.222222);
modDepth = 0.05;
effectMix = (MY_FLOAT) 0.5;
this->clear();
}
Chorus :: ~Chorus()
{
delete delayLine[0];
delete delayLine[1];
delete mods[0];
delete mods[1];
}
void Chorus :: clear()
{
delayLine[0]->clear();
delayLine[1]->clear();
lastOutL = (MY_FLOAT) 0.0;
lastOutR = (MY_FLOAT) 0.0;
}
void Chorus :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
}
void Chorus :: setModDepth(MY_FLOAT depth)
{
modDepth = depth;
}
void Chorus :: setModFreq(MY_FLOAT freq)
{
mods[0]->setFreq(freq);
mods[1]->setFreq(freq*1.1111);
}
MY_FLOAT Chorus :: lastOutput()
{
return (lastOutL + lastOutR) * (MY_FLOAT) 0.5;
}
MY_FLOAT Chorus :: lastOutputL()
{
return lastOutL;
}
MY_FLOAT Chorus :: lastOutputR()
{
return lastOutR;
}
MY_FLOAT Chorus :: tick(MY_FLOAT input)
{
delayLine[0]->setDelay(baseLength * 0.707 * (1.0 + mods[0]->tick()));
delayLine[1]->setDelay(baseLength * 0.5 * (1.0 - mods[1]->tick()));
lastOutL = input * (1.0 - effectMix);
lastOutL += effectMix * delayLine[0]->tick(input);
lastOutR = input * (1.0 - effectMix);
lastOutR += effectMix * delayLine[1]->tick(input);
return (lastOutL + lastOutR) * (MY_FLOAT) 0.5;
}
/************** Test Main Program *********************/
/*
int main(int argc, char *argv[])
{
FILE *soundIn,*soundOut;
short data;
float efMix,maxDel;
Chorus *effect;
if (argc==5) {
soundIn = fopen(argv[3],"rb");
soundOut = fopen(argv[4],"wb");
if (soundIn && soundOut) {
efMix = atof(argv[1]);
maxDel = atof(argv[2]);
effect = new Chorus(maxDel);
effect->setEffectMix(efMix);
while (fread(&data,2,1,soundIn)) {
data = effect->tick(data);
fwrite(&data,2,1,soundOut);
}
delete effect;
fclose(soundIn);
fclose(soundOut);
}
else {
printf("Can't open one of the files\n");
}
}
else {
printf("useage: Chorus mix maxDelay soundIn.snd soundOut.snd\n");
printf("0.0 <= mix <= 1.0\n");
printf("maxDelay is in samples\n");
printf("soundfiles are 16 bit linear mono or stereo\n");
}
}
*/

37
projects/effects/Chorus.h Normal file
View File

@@ -0,0 +1,37 @@
/******************************************/
/* Chorus Effect */
/* by Perry Cook, 1996 */
/******************************************/
#if !defined(__Chorus_h)
#define __Chorus_h
#include "Object.h"
#include "DLineL.h"
#include "RawWvIn.h"
class Chorus : public Object
{
protected:
DLineL *delayLine[2];
RawWvIn *mods[2];
MY_FLOAT baseLength;
MY_FLOAT modDepth;
MY_FLOAT lastOutL;
MY_FLOAT lastOutR;
MY_FLOAT effectMix;
public:
Chorus(MY_FLOAT baseDelay);
~Chorus();
void clear();
void setModDepth(MY_FLOAT depth);
void setModFreq(MY_FLOAT freq);
void setEffectMix(MY_FLOAT mix);
MY_FLOAT lastOutput();
MY_FLOAT lastOutputL();
MY_FLOAT lastOutputR();
MY_FLOAT tick(MY_FLOAT input);
};
#endif

44
projects/effects/Echo.cpp Normal file
View File

@@ -0,0 +1,44 @@
/******************************************/
/* Echo Effect */
/* by Perry Cook, 1996 */
/******************************************/
#include "Echo.h"
Echo :: Echo(MY_FLOAT longestDelay)
{
length = (long) longestDelay + 2;
delayLine = new DLineN(length);
effectMix = 0.5;
this->clear();
this->setDelay(longestDelay);
}
Echo :: ~Echo()
{
delete delayLine;
}
void Echo :: clear()
{
delayLine->clear();
lastOut = 0.0;
}
void Echo :: setDelay(MY_FLOAT delay)
{
delayLine->setDelay(delay);
}
void Echo :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
}
MY_FLOAT Echo :: tick(MY_FLOAT input)
{
lastOut = effectMix * delayLine->tick(input);
lastOut += input * (1.0 - effectMix);
return lastOut;
}

30
projects/effects/Echo.h Normal file
View File

@@ -0,0 +1,30 @@
/******************************************/
/* Echo Effect Applied to Soundfile */
/* by Perry Cook, 1996 */
/******************************************/
#if !defined(__Echo_h)
#define __Echo_h
#include "Object.h"
#include "DLineN.h"
class Echo : public Object
{
protected:
DLineN *delayLine;
long length;
MY_FLOAT lastOut;
MY_FLOAT effectMix;
public:
Echo(MY_FLOAT longestDelay);
~Echo();
void clear();
void setDelay(MY_FLOAT delay);
void setEffectMix(MY_FLOAT mix);
MY_FLOAT lastOutput();
MY_FLOAT tick(MY_FLOAT input);
};
#endif

1
projects/effects/GUIeffects Executable file
View File

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

60
projects/effects/Makefile Normal file
View File

@@ -0,0 +1,60 @@
# Effects Makefile
OS = $(shell uname)
# The following definition indicates the relative location of
# the core STK classes.
STK_PATH = ../../src/
O_FILES = Object.o Reverb.o PRCRev.o JCRev.o \
NRev.o RtAudio.o DLineN.o Filter.o \
RtDuplex.o SKINI11.o Envelope.o Echo.o \
PitShift.o DLineL.o Chorus.o RawWvIn.o \
WvIn.o ByteSwap.o StkError.o Controller.o \
RtMidi.o
RM = /bin/rm
ifeq ($(OS),IRIX) # These are for SGI
INSTR = effects
CC = CC -O2 -D__OS_IRIX_ # -g -fullwarn -D__SGI_CC__
LIBRARY = -L/usr/sgitcl/lib -laudio -lmd -lm -lpthread
INCLUDE = -I../../include
endif
ifeq ($(OS),Linux) # These are for Linux
INSTR = effects
CC = g++ -O3 -Wall -D__OS_Linux_ # -g
LIBRARY = -lpthread -lm #-lasound
INCLUDE = -I../../include
endif
%.o : $(STK_PATH)%.cpp
$(CC) $(INCLUDE) -c $(<) -o $@
all: $(INSTR)
clean :
rm *.o
rm $(INSTR)
cleanIns :
rm $(INSTR)
strip :
strip $(INSTR)
effects: effects.cpp $(O_FILES)
$(CC) $(INCLUDE) -o effects effects.cpp $(O_FILES) $(LIBRARY)
# $(O_FILES) :
Echo.o: Echo.cpp
$(CC) $(INCLUDE) -c Echo.cpp
PitShift.o: PitShift.cpp
$(CC) $(INCLUDE) -c PitShift.cpp
Chorus.o: Chorus.cpp
$(CC) $(INCLUDE) -c Chorus.cpp

View File

@@ -0,0 +1,53 @@
# STK Makefile for Effects project- SGI solo version (non-GNU Makefile utilities version)
# The following definition indicates the relative location of
# the core STK classes.
STK_PATH = ../../src/
O_FILES = $(STK_PATH)Object.o $(STK_PATH)Envelope.o $(STK_PATH)Filter.o \
$(STK_PATH)DLineL.o $(STK_PATH)DLineN.o $(STK_PATH)ByteSwap.o \
$(STK_PATH)SKINI11.o $(STK_PATH)WvIn.o $(STK_PATH)RawWvIn.o \
$(STK_PATH)Reverb.o $(STK_PATH)PRCRev.o $(STK_PATH)JCRev.o \
$(STK_PATH)NRev.o $(STK_PATH)RtAudio.o $(STK_PATH)RtMidi.o \
$(STK_PATH)RtDuplex.o $(STK_PATH)StkError.o $(STK_PATH)Controller.o
O_LOCAL_FILES = Echo.o PitShift.o Chorus.o
RM = /bin/rm
INSTR = effects
CC = CC -O2 -D__OS_IRIX_ # -g -fullwarn -D__SGI_CC__
LIBRARY = -L/usr/sgitcl/lib -laudio -lmd -lm -lpthread
INCLUDE = -I../../include/
.SUFFIXES: .cpp
.cpp.o: $(O_FILES)
$(CC) $(INCLUDE) -c -o $@ $<
all: $(INSTR)
effects: effects.cpp $(O_FILES) $(O_LOCAL_FILES)
$(CC) -o effects effects.cpp $(O_FILES) $(O_LOCAL_FILES) $(LIBRARY) $(INCLUDE)
clean :
rm *.o
rm $(STK_PATH)*.o
rm $(INSTR)
cleanIns :
rm $(INSTR)
strip :
strip $(INSTR)
# $(O_FILES) :
Echo.o: Echo.cpp
$(CC) $(INCLUDE) -c Echo.cpp
PitShift.o: PitShift.cpp
$(CC) $(INCLUDE) -c PitShift.cpp
Chorus.o: Chorus.cpp
$(CC) $(INCLUDE) -c Chorus.cpp

View File

@@ -0,0 +1,106 @@
/*********************************************/
/* PitchShift Effect */
/* by Perry Cook, 1996 */
/*********************************************/
#include "PitShift.h"
PitShift :: PitShift()
{
delayLine[0] = new DLineL((long) 1024);
delayLine[1] = new DLineL((long) 1024);
delay[0] = 12;
delay[1] = 512;
delayLine[0]->setDelay(delay[0]);
delayLine[1]->setDelay(delay[1]);
effectMix = (MY_FLOAT) 0.5;
rate = 1.0;
}
PitShift :: ~PitShift()
{
delete delayLine[0];
delete delayLine[1];
}
void PitShift :: setEffectMix(MY_FLOAT mix)
{
effectMix = mix;
}
void PitShift :: setShift(MY_FLOAT shift)
{
if (shift < 1.0) {
rate = 1.0 - shift;
}
else if (shift > 1.0) {
rate = 1.0 - shift;
}
else {
rate = 0.0;
delay[0] = 512;
}
}
MY_FLOAT PitShift :: lastOutput()
{
return lastOut;
}
MY_FLOAT PitShift :: tick(MY_FLOAT input)
{
delay[0] = delay[0] + rate;
while (delay[0] > 1012) delay[0] -= 1000;
while (delay[0] < 12) delay[0] += 1000;
delay[1] = delay[0] + 500;
while (delay[1] > 1012) delay[1] -= 1000;
while (delay[1] < 12) delay[1] += 1000;
delayLine[0]->setDelay(delay[0]);
delayLine[1]->setDelay(delay[1]);
env[1] = fabs(delay[0] - 512) * 0.002;
env[0] = 1.0 - env[1];
lastOut = env[0] * delayLine[0]->tick(input);
lastOut += env[1] * delayLine[1]->tick(input);
lastOut *= effectMix;
lastOut += (1.0 - effectMix) * input;
return lastOut;
}
/************** Test Main Program *********************/
/*
int main(int argc, char *argv[])
{
FILE *soundIn,*soundOut;
short data;
float efMix,pitchshift;
PitShift *effect;
if (argc==5) {
soundIn = fopen(argv[3],"rb");
soundOut = fopen(argv[4],"wb");
if (soundIn && soundOut) {
efMix = atof(argv[1]);
pitchshift = atof(argv[2]);
effect = new PitShift();
effect->setShift(pitchshift);
effect->setEffectMix(efMix);
while (fread(&data,2,1,soundIn)) {
data = effect->tick(data);
fwrite(&data,2,1,soundOut);
}
delete effect;
fclose(soundIn);
fclose(soundOut);
}
else {
printf("Can't open one of the files\n");
}
}
else {
printf("useage: pitshift mix shiftRate soundIn.snd soundOut.snd\n");
printf("0.0 <= mix <= 1.0\n");
printf("maxDelay is in samples\n");
printf("soundfiles are 16 bit linear mono or stereo\n");
}
}
*/

View File

@@ -0,0 +1,32 @@
/*********************************************/
/* PitchShift Effect */
/* by Perry Cook, 1996 */
/*********************************************/
#if !defined(__PitShift_h)
#define __PitShift_h
#include "Object.h"
#include "DLineL.h"
class PitShift : public Object
{
protected:
DLineL *delayLine[2];
MY_FLOAT lastOut;
MY_FLOAT delay[2];
MY_FLOAT env[2];
MY_FLOAT effectMix;
MY_FLOAT rate;
public:
PitShift();
~PitShift();
void clear();
void setShift(MY_FLOAT shift);
void setEffectMix(MY_FLOAT mix);
virtual MY_FLOAT lastOutput();
MY_FLOAT tick(MY_FLOAT input);
};
#endif

View File

@@ -0,0 +1,16 @@
STK: A ToolKit of Audio Synthesis Classes and Instruments in C++
Version 3.2
By Perry R. Cook, 1995-2000
and Gary P. Scavone, 1997-2000.
EFFECTS PROJECT:
This directory contains a program that demonstrates realtime duplex mode (simultaneous audio input and output) operation, as well as several simple delay-line based effects algorithms. Proper duplex mode operation is very hardware dependent. If you have trouble with this application, make sure your soundcard supports the desired sample rate and sample size (16-bit).
NOTES:
1. This project will not run under WindowsNT or NeXTStep, due to lack of realtime audio input support. However, it should run under Windows2000.
2. Audio input from either a microphone or line-input device MUST be available to the audio input port when the program is started.

View File

View File

@@ -0,0 +1,171 @@
/************** Effects Program *********************/
#include "RtDuplex.h"
#include "SKINI11.h"
#include "SKINI11.msg"
#include "Envelope.h"
#include "PRCRev.h"
#include "JCRev.h"
#include "NRev.h"
#include "Echo.h"
#include "PitShift.h"
#include "Chorus.h"
// The input control handler.
#include "Controller.h"
void usage(void) {
/* Error function in case of incorrect command-line argument specifications */
printf("\nuseage: effects flag \n");
printf(" where flag = -ip for realtime SKINI input by pipe\n");
printf(" (won't work under Win95/98),\n");
printf(" and flag = -is for realtime SKINI input by socket.\n");
exit(0);
}
int main(int argc,char *argv[])
{
MY_FLOAT inSample = 0.0;
MY_FLOAT lastSample = 0.0;
MY_FLOAT byte2, byte3;
long i, nTicks;
int type, effect = 0;
int controlMask = 0;
bool done;
Controller *controller;
if (argc != 2) usage();
if (!strcmp(argv[1],"-is") )
controlMask |= STK_SOCKET;
else if (!strcmp(argv[1],"-ip") )
controlMask |= STK_PIPE;
else
usage();
Envelope *envelope = new Envelope;
PRCRev *prcrev = new PRCRev(2.0);
JCRev *jcrev = new JCRev(2.0);
NRev *nrev = new NRev(2.0);
Echo *echo = new Echo(SRATE); // one second delay
PitShift *shifter = new PitShift();
Chorus *chorus = new Chorus(5000.0);
SKINI11 *score = new SKINI11();
RtDuplex *inout;
try {
inout = new RtDuplex(1, SRATE);
// Instantiate the input message controller.
controller = new Controller( controlMask );
}
catch (StkError& m) {
m.printMessage();
exit(0);
}
// The runtime loop begins here:
done = FALSE;
while (!done) {
nTicks = controller->getNextMessage();
if (nTicks == -1)
done = TRUE;
for (i=0; i<nTicks; i++) {
if (effect == 0)
inSample = inout->tick(envelope->tick() * echo->tick(lastSample));
else if (effect == 1)
inSample = inout->tick(envelope->tick() * shifter->tick(lastSample));
else if (effect == 2)
inSample = inout->tick(envelope->tick() * chorus->tick(lastSample));
else if (effect == 3)
inSample = inout->tick(envelope->tick() * prcrev->tick(lastSample));
else if (effect == 4)
inSample = inout->tick(envelope->tick() * jcrev->tick(lastSample));
else if (effect == 5)
inSample = inout->tick(envelope->tick() * nrev->tick(lastSample));
lastSample = inSample;
}
type = controller->getType();
if (type > 0) {
// parse the input control message
byte2 = controller->getByte2();
byte3 = controller->getByte3();
switch(type) {
case __SK_NoteOn_:
if (byte3 == 0) { // velocity is zero ... really a NoteOff
envelope->setRate(0.001);
envelope->setTarget(0.0);
}
else { // really a NoteOn
envelope->setRate(0.001);
envelope->setTarget(1.0);
}
break;
case __SK_NoteOff_:
envelope->setRate(0.001);
envelope->setTarget(0.0);
break;
case __SK_ControlChange_:
if (byte2 == 20) effect = (int) byte3; // effect change
else if (byte2 == 44) { // effects mix
echo->setEffectMix(byte3*NORM_7);
shifter->setEffectMix(byte3*NORM_7);
chorus->setEffectMix(byte3*NORM_7);
prcrev->setEffectMix(byte3*NORM_7);
jcrev->setEffectMix(byte3*NORM_7);
nrev->setEffectMix(byte3*NORM_7);
}
else if (byte2 == 22) { // effect1 parameter change
echo->setDelay(byte3*NORM_7*SRATE*0.95 + 2);
shifter->setShift(byte3*NORM_7*3 + 0.25);
chorus->setModFreq(byte3*NORM_7);
}
else if (byte2 == 23) { // effect1 parameter change
chorus->setModDepth(byte3*NORM_7*0.2);
}
break;
}
}
}
envelope->setRate(0.001);
envelope->setTarget(0.0);
for (i=0;i<SRATE;i++) { /* let the sound settle a bit */
if (effect == 0)
inSample = inout->tick(envelope->tick() * echo->tick(lastSample));
else if (effect == 1)
inSample = inout->tick(envelope->tick() * shifter->tick(lastSample));
else if (effect == 2)
inSample = inout->tick(envelope->tick() * chorus->tick(lastSample));
else if (effect == 3)
inSample = inout->tick(envelope->tick() * prcrev->tick(lastSample));
else if (effect == 4)
inSample = inout->tick(envelope->tick() * jcrev->tick(lastSample));
else if (effect == 5)
inSample = inout->tick(envelope->tick() * nrev->tick(lastSample));
lastSample = inSample;
}
delete inout;
delete echo;
delete shifter;
delete chorus;
delete prcrev;
delete jcrev;
delete nrev;
delete score;
delete envelope;
delete controller;
printf("effects finished ... goodbye.\n");
return 0;
}

View File

@@ -0,0 +1,260 @@
# Microsoft Developer Studio Project File - Name="effects" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=effects - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "effects.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "effects.mak" CFG="effects - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "effects - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "effects - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "effects - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__OS_Win_" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib dsound.lib winmm.lib /nologo /subsystem:console /machine:I386
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "effects - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__OS_Win_" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib dsound.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "effects - Win32 Release"
# Name "effects - Win32 Debug"
# Begin Source File
SOURCE=..\..\src\ByteSwap.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\ByteSwap.h
# End Source File
# Begin Source File
SOURCE=.\Chorus.cpp
# End Source File
# Begin Source File
SOURCE=.\Chorus.h
# End Source File
# Begin Source File
SOURCE=..\..\src\Controller.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\Controller.h
# End Source File
# Begin Source File
SOURCE=..\..\src\DLineL.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\DLineL.h
# End Source File
# Begin Source File
SOURCE=..\..\src\DLineN.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\DLineN.h
# End Source File
# Begin Source File
SOURCE=.\Echo.cpp
# End Source File
# Begin Source File
SOURCE=.\Echo.h
# End Source File
# Begin Source File
SOURCE=.\effects.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\Envelope.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\Envelope.h
# End Source File
# Begin Source File
SOURCE=..\..\src\Filter.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\Filter.h
# End Source File
# Begin Source File
SOURCE=..\..\src\JCRev.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\JCRev.h
# End Source File
# Begin Source File
SOURCE=..\..\src\NRev.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\NRev.h
# End Source File
# Begin Source File
SOURCE=..\..\src\Object.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\Object.h
# End Source File
# Begin Source File
SOURCE=.\PitShift.cpp
# End Source File
# Begin Source File
SOURCE=.\PitShift.h
# End Source File
# Begin Source File
SOURCE=..\..\src\PRCRev.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\PRCRev.h
# End Source File
# Begin Source File
SOURCE=..\..\src\RawWvIn.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\RawWvIn.h
# End Source File
# Begin Source File
SOURCE=..\..\src\Reverb.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\Reverb.h
# End Source File
# Begin Source File
SOURCE=..\..\src\RtAudio.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\src\RtDuplex.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\RtDuplex.h
# End Source File
# Begin Source File
SOURCE=..\..\src\RtMidi.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\RtMidi.h
# End Source File
# Begin Source File
SOURCE=..\..\src\SKINI11.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\SKINI11.h
# End Source File
# Begin Source File
SOURCE=..\..\src\StkError.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\StkError.h
# End Source File
# Begin Source File
SOURCE=..\..\src\WvIn.cpp
# End Source File
# Begin Source File
SOURCE=..\..\include\WvIn.h
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "effects"=.\effects.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,219 @@
set mixlevel 64.0
set effect1 64.0
set effect2 64.0
set effect 0
set outID "stdout"
set commtype "stdout"
# Configure main window
wm title . "STK Effects Controller"
wm iconname . "Effects"
. config -bg black
# Configure "communications" menu
menu .menu -tearoff 0
menu .menu.communication -tearoff 0
.menu add cascade -label "Communication" -menu .menu.communication \
-underline 0
.menu.communication add radio -label "Console" -variable commtype \
-value "stdout" -command { setComm }
.menu.communication add radio -label "Socket" -variable commtype \
-value "socket" -command { setComm }
. configure -menu .menu
# Configure title display
label .title -text "STK Effects Controller" \
-font {Times 14 bold} -background white \
-foreground darkred -relief raised
label .title2 -text "by Gary P. Scavone\n Center for Computer Research in Music & Acoustics (CCRMA) \n Stanford University" \
-font {Times 12 bold} -background white \
-foreground darkred -relief raised
pack .title -padx 5 -pady 10
pack .title2 -padx 5 -pady 10
# Configure "note-on" buttons
frame .noteOn -bg black
button .noteOn.on -text NoteOn -bg grey66 -command { noteOn 64.0 64.0 }
button .noteOn.off -text NoteOff -bg grey66 -command { noteOff 64.0 127.0 }
button .noteOn.exit -text "Exit Program" -bg grey66 -command myExit
pack .noteOn.on -side left -padx 5
pack .noteOn.off -side left -padx 5 -pady 10
pack .noteOn.exit -side left -padx 5 -pady 10
pack .noteOn
# Configure sliders
frame .left -bg black
scale .left.effectsmix -from 0 -to 127 -length 400 \
-command {printWhatz "ControlChange 0.0 1 " 44} \
-orient horizontal -label "Effects Mix" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable mixlevel
scale .left.effect1 -from 0 -to 127 -length 400 \
-command {printWhatz "ControlChange 0.0 1 " 22} \
-orient horizontal -label "Echo Delay" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable effect1
scale .left.effect2 -from 0 -to 127 -length 400 \
-command {printWhatz "ControlChange 0.0 1 " 23} \
-orient horizontal -label "Disabled" \
-tickinterval 32 -showvalue true -bg grey66 \
-variable effect2
pack .left.effectsmix -padx 10 -pady 3
pack .left.effect1 -padx 10 -pady 3
pack .left.effect2 -padx 10 -pady 3
pack .left -side left
# Configure effect select buttons
frame .effectSelect -bg black
pack .effectSelect -side right -padx 5 -pady 5
radiobutton .effectSelect.echo -text "Echo" -variable effect -relief flat \
-value 0 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
radiobutton .effectSelect.shifter -text "Pitch Shift" -variable effect -relief flat \
-value 1 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
radiobutton .effectSelect.chorus -text "Chorus" -variable effect -relief flat \
-value 2 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
radiobutton .effectSelect.prcrev -text "PRC Reverb" -variable effect -relief flat \
-value 3 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
radiobutton .effectSelect.jcrev -text "JC Reverb" -variable effect -relief flat \
-value 4 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
radiobutton .effectSelect.nrev -text "NRev Reverb" -variable effect -relief flat \
-value 5 -command {changeEffect "ControlChange 0.0 1 " 20 $effect}
pack .effectSelect.echo -pady 2 -padx 5 -side top -anchor w -fill x
pack .effectSelect.shifter -pady 2 -padx 5 -side top -anchor w -fill x
pack .effectSelect.chorus -pady 2 -padx 5 -side top -anchor w -fill x
pack .effectSelect.prcrev -pady 2 -padx 5 -side top -anchor w -fill x
pack .effectSelect.jcrev -pady 2 -padx 5 -side top -anchor w -fill x
pack .effectSelect.nrev -pady 2 -padx 5 -side top -anchor w -fill x
proc myExit {} {
global outID
puts $outID [format "NoteOff 0.0 1 64 127" ]
flush $outID
puts $outID [format "ExitProgram"]
flush $outID
close $outID
exit
}
proc noteOn {pitchVal pressVal} {
global outID
puts $outID [format "NoteOn 0.0 1 %f %f" $pitchVal $pressVal]
flush $outID
}
proc noteOff {pitchVal pressVal} {
global outID
puts $outID [format "NoteOff 0.0 1 %f %f" $pitchVal $pressVal]
flush $outID
}
proc printWhatz {tag value1 value2 } {
global outID
puts $outID [format "%s %i %f" $tag $value1 $value2]
flush $outID
}
proc changeEffect {tag value1 value2 } {
global outID
if ($value2==0) {
.left.effect1 config -state normal -label "Echo Delay"
.left.effect2 config -state disabled -label "Disabled"
}
if ($value2==1) {
.left.effect1 config -state normal -label "Pitch Shift Amount"
.left.effect2 config -state disabled -label "Disabled"
}
if ($value2==2) {
.left.effect1 config -state normal -label "Chorus Modulation Frequency"
.left.effect2 config -state normal -label "Chorus Modulation Depth"
}
if {$value2>=3 && $value2<=5} {
.left.effect1 config -state disabled -label "Disabled"
.left.effect2 config -state disabled -label "Disabled"
}
puts $outID [format "%s %i %f" $tag $value1 $value2]
flush $outID
}
# Bind an X windows "close" event with the Exit routine
bind . <Destroy> +myExit
# Socket connection procedure
set d .socketdialog
proc setComm {} {
global outID
global commtype
global d
if {$commtype == "stdout"} {
if { [string compare "stdout" $outID] } {
set i [tk_dialog .dialog "Break Socket Connection?" {You are about to break an existing socket connection ... is this what you want to do?} "" 0 Cancel OK]
switch $i {
0 {set commtype "socket"}
1 {close $outID
set outID "stdout"}
}
}
} elseif { ![string compare "stdout" $outID] } {
set sockport 2001
set sockhost localhost
toplevel $d
wm title $d "STK Client Socket Connection"
wm resizable $d 0 0
grab $d
label $d.message -text "Specify a socket host and port number below (if different than the STK defaults shown) and then click the \"Connect\" button to invoke a socket-client connection attempt to the STK socket server." \
-background white -font {Helvetica 10 bold} \
-wraplength 3i -justify left
frame $d.sockhost
entry $d.sockhost.entry -width 15
label $d.sockhost.text -text "Socket Host:" \
-font {Helvetica 10 bold}
frame $d.sockport
entry $d.sockport.entry -width 15
label $d.sockport.text -text "Socket Port:" \
-font {Helvetica 10 bold}
pack $d.message -side top -padx 5 -pady 10
pack $d.sockhost.text -side left -padx 1 -pady 2
pack $d.sockhost.entry -side right -padx 5 -pady 2
pack $d.sockhost -side top -padx 5 -pady 2
pack $d.sockport.text -side left -padx 1 -pady 2
pack $d.sockport.entry -side right -padx 5 -pady 2
pack $d.sockport -side top -padx 5 -pady 2
$d.sockhost.entry insert 0 $sockhost
$d.sockport.entry insert 0 $sockport
frame $d.buttons
button $d.buttons.cancel -text "Cancel" -bg grey66 \
-command { set commtype "stdout"
set outID "stdout"
destroy $d }
button $d.buttons.connect -text "Connect" -bg grey66 \
-command {
set sockhost [$d.sockhost.entry get]
set sockport [$d.sockport.entry get]
set err [catch {socket $sockhost $sockport} outID]
if {$err == 0} {
destroy $d
} else {
tk_dialog $d.error "Socket Error" {Error: Unable to make socket connection. Make sure the STK socket server is first running and that the port number is correct.} "" 0 OK
} }
pack $d.buttons.cancel -side left -padx 5 -pady 10
pack $d.buttons.connect -side right -padx 5 -pady 10
pack $d.buttons -side bottom -padx 5 -pady 10
}
}