Forgive the gigantic commit; I'm importing "rsynth". It's not really such

a big library, and it's not commonly installed anywhere, and it's GPL.

Actually, a good chunk of rsynth can be removed (all the stuff related
to perl modules and text-to-speech, which we won't need for Stella). I'll
prune it when I figure out exactly what I can keep...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1111 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2006-06-11 07:13:29 +00:00
parent 8c7469c0ce
commit 815a111b25
125 changed files with 33448 additions and 34 deletions

View File

@ -13,7 +13,7 @@
## See the file "license" for information on usage and redistribution of ## See the file "license" for information on usage and redistribution of
## this file, and for a DISCLAIMER OF ALL WARRANTIES. ## this file, and for a DISCLAIMER OF ALL WARRANTIES.
## ##
## $Id: Makefile,v 1.24 2006-06-09 02:45:11 urchlay Exp $ ## $Id: Makefile,v 1.25 2006-06-11 07:13:19 urchlay Exp $
## ##
## Based on code from ScummVM - Scumm Interpreter ## Based on code from ScummVM - Scumm Interpreter
## Copyright (C) 2002-2004 The ScummVM project ## Copyright (C) 2002-2004 The ScummVM project
@ -28,7 +28,7 @@ srcdir ?= .
DEFINES := DEFINES :=
LDFLAGS := LDFLAGS :=
INCLUDES := INCLUDES :=
LIBS := LIBS := -Lsrc/emucore -lrsynth
OBJS := OBJS :=
PROF := PROF :=
@ -67,6 +67,7 @@ endif
####################################################################### #######################################################################
EXECUTABLE := stella$(EXEEXT) EXECUTABLE := stella$(EXEEXT)
RSYNTH = src/emucore/librsynth.a
all: tags $(EXECUTABLE) all: tags $(EXECUTABLE)
@ -92,6 +93,10 @@ MODULES += \
src/gui \ src/gui \
src/common src/common
$(RSYNTH): $(RSYNTH_OBJS)
( cd src/emucore/rsynth && ./configure && make Rsynth/librsynth.a ) && \
cp src/emucore/rsynth/Rsynth/librsynth.a src/emucore
###################################################################### ######################################################################
# The build rules follow - normally you should have no need to # The build rules follow - normally you should have no need to
# touch whatever comes after here. # touch whatever comes after here.
@ -108,7 +113,7 @@ DEPDIRS = $(addsuffix /$(DEPDIR),$(MODULE_DIRS))
DEPFILES = DEPFILES =
# The build rule for the Stella executable # The build rule for the Stella executable
$(EXECUTABLE): $(OBJS) $(EXECUTABLE): $(OBJS) $(RSYNTH)
$(LD) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) $(PROF) -o $@ $(LD) $(LDFLAGS) $(PRE_OBJS_FLAGS) $+ $(POST_OBJS_FLAGS) $(LIBS) $(PROF) -o $@
distclean: clean distclean: clean

View File

@ -13,22 +13,27 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: AtariVox.cxx,v 1.1 2006-06-09 02:45:11 urchlay Exp $ // $Id: AtariVox.cxx,v 1.2 2006-06-11 07:13:19 urchlay Exp $
//============================================================================ //============================================================================
#include "Event.hxx" #include "Event.hxx"
#include "AtariVox.hxx" #include "AtariVox.hxx"
#include "SpeakJet.hxx"
#define DEBUG_ATARIVOX 1 #define DEBUG_ATARIVOX 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVox::AtariVox(Jack jack, const Event& event) AtariVox::AtariVox(Jack jack, const Event& event)
: Controller(jack, event), : Controller(jack, event),
mySpeakJet(0),
mySystem(0),
myPinState(0), myPinState(0),
myShiftCount(0),
myShiftRegister(0), myShiftRegister(0),
myShiftCount(0) myLastDataWriteCycle(0)
{ {
myType = Controller::AtariVox; myType = Controller::AtariVox;
mySpeakJet = new SpeakJet();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -36,6 +41,11 @@ AtariVox::~AtariVox()
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariVox::setSystem(System *system) {
mySystem = system;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AtariVox::read(DigitalPin pin) bool AtariVox::read(DigitalPin pin)
{ {
@ -54,6 +64,72 @@ Int32 AtariVox::read(AnalogPin)
return maximumResistance; return maximumResistance;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariVox::clockDataIn(bool value)
{
// bool oldValue = myPinState & 0x01;
myPinState = (myPinState & 0xfe) | value;
uInt32 cycle = mySystem->cycles();
if(DEBUG_ATARIVOX)
cerr << "AtariVox: value "
<< value
<< " written to DATA line at "
<< mySystem->cycles()
<< " (-"
<< myLastDataWriteCycle
<< "=="
<< (mySystem->cycles() - myLastDataWriteCycle)
<< ")"
<< endl;
if(value && (myShiftCount == 0)) {
if(DEBUG_ATARIVOX)
cerr << "value && (myShiftCount == 0), returning" << endl;
return;
}
if(cycle < myLastDataWriteCycle || cycle > myLastDataWriteCycle + 1000) {
// If this is the first write this frame, or if it's been a long time
// since the last write, start a new data byte.
myShiftRegister = 0;
myShiftCount = 0;
}
if(cycle < myLastDataWriteCycle || cycle >= myLastDataWriteCycle + 62) {
// If this is the first write this frame, or if it's been 62 cycles
// since the last write, shift this bit into the current byte.
if(DEBUG_ATARIVOX)
cerr << "cycle >= myLastDataWriteCycle + 62, shiftIn("
<< value << ")" << endl;
shiftIn(value);
}
myLastDataWriteCycle = cycle;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariVox::shiftIn(bool value)
{
myShiftRegister >>= 1;
myShiftRegister |= (value << 15);
if(++myShiftCount == 10) {
myShiftCount = 0;
myShiftRegister >>= 6;
if(!(myShiftRegister & (1<<9)))
cerr << "AtariVox: bad start bit" << endl;
else if((myShiftRegister & 1))
cerr << "AtariVox: bad stop bit" << endl;
else
{
uInt8 data = ((myShiftRegister >> 1) & 0xff);
cerr << "AtariVox: output byte " << ((int)(data)) << endl;
mySpeakJet->write(data);
}
myShiftRegister = 0;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariVox::write(DigitalPin pin, bool value) void AtariVox::write(DigitalPin pin, bool value)
{ {
@ -66,25 +142,7 @@ void AtariVox::write(DigitalPin pin, bool value)
// Pin 1 is the DATA line, used to output serial data to the // Pin 1 is the DATA line, used to output serial data to the
// speakjet // speakjet
case One: case One:
if(DEBUG_ATARIVOX) clockDataIn(value);
cerr << "AtariVox: value " << value << " written to DATA line" << endl;
myShiftRegister >>= 1;
myShiftRegister |= (value << 15);
// cerr << myShiftRegister << endl;
if(++myShiftCount == 10) {
myShiftCount = 0;
myShiftRegister >>= 6;
// cerr << "(<<6) == " << myShiftRegister << endl;
if(!(myShiftRegister & (1<<9)))
cerr << "AtariVox: bad start bit" << endl;
else if((myShiftRegister & 1))
cerr << "AtariVox: bad stop bit" << endl;
else
cerr << "AtariVox: output byte "
<< ((myShiftRegister >> 1) & 0xff)
<< endl;
myShiftRegister = 0;
}
break; break;
// Pin 2 is the SDA line, used to output data to the 24LC256 // Pin 2 is the SDA line, used to output data to the 24LC256
@ -92,10 +150,25 @@ void AtariVox::write(DigitalPin pin, bool value)
// I'm not even trying to emulate this right now :( // I'm not even trying to emulate this right now :(
case Two: case Two:
if(DEBUG_ATARIVOX) if(DEBUG_ATARIVOX)
cerr << "AtariVox: value " << value << " written to SDA line" << endl; cerr << "AtariVox: value "
<< value
<< " written to SDA line at cycle "
<< mySystem->cycles()
<< endl;
break; break;
// Pin 2 is the SCLK line, used to output clock data to the 24LC256
// serial EEPROM, using the I2C protocol.
// I'm not even trying to emulate this right now :(
case Three: case Three:
if(DEBUG_ATARIVOX)
cerr << "AtariVox: value "
<< value
<< " written to SCLK line at cycle "
<< mySystem->cycles()
<< endl;
break;
case Four: case Four:
default: default:
break; break;

View File

@ -14,21 +14,26 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: AtariVox.hxx,v 1.1 2006-06-09 02:45:11 urchlay Exp $ // $Id: AtariVox.hxx,v 1.2 2006-06-11 07:13:19 urchlay Exp $
//============================================================================ //============================================================================
#ifndef ATARIVOX_HXX #ifndef ATARIVOX_HXX
#define ATARIVOX_HXX #define ATARIVOX_HXX
#include "bspf.hxx" #include "bspf.hxx"
#include "System.hxx"
#include "Control.hxx" #include "Control.hxx"
#include "SpeakJet.hxx"
/** /**
Alex Herbert's AtariVox "controller": A speech synthesizer and Richard Hutchinson's AtariVox "controller": A speech synthesizer and
storage device. storage device.
This code owes a great debt to Alex Herbert's AtariVox documentation and
driver code.
@author B. Watson @author B. Watson
@version $Id: AtariVox.hxx,v 1.1 2006-06-09 02:45:11 urchlay Exp $ @version $Id: AtariVox.hxx,v 1.2 2006-06-11 07:13:19 urchlay Exp $
*/ */
class AtariVox : public Controller class AtariVox : public Controller
{ {
@ -76,18 +81,49 @@ class AtariVox : public Controller
*/ */
virtual void write(DigitalPin pin, bool value); virtual void write(DigitalPin pin, bool value);
void setSystem(System *system);
private:
void clockDataIn(bool value);
void shiftIn(bool value);
private:
// How far off (in CPU cycles) can each write occur from when it's
// supposed to happen? Eventually, this will become a user-settable
// property... or it may turn out to be unnecessary.
enum { TIMING_SLOP = 0 };
private:
// Instance of SpeakJet which will actually do the talking for us.
// In the future, we'll support both real and emulated SpeakJet
// chips; for now we only emulate it.
SpeakJet *mySpeakJet;
// Hang on to a reference to the system, for timing purposes. Data
// bits are supposed to come in 62 CPU cycles apart (plus or minus
// TIMING_SLOP), so we need to be able to call mySystem.cycles().
System *mySystem;
private: private:
// State of the output pins // State of the output pins
uInt8 myPinState; uInt8 myPinState;
// How many bits have been shifted into the shift register?
uInt8 myShiftCount;
private:
// Shift register. Data comes in serially: // Shift register. Data comes in serially:
// 1 start bit, always 0 // 1 start bit, always 0
// 8 data bits, LSB first // 8 data bits, LSB first
// 1 stop bit, always 0 // 1 stop bit, always 1
uInt16 myShiftRegister; uInt16 myShiftRegister;
// How many bits have been shifted into the shift register? private:
uInt8 myShiftCount; // When did the last data write start, in CPU cycles?
// The real SpeakJet chip reads data at 19200 bits/sec. Alex's
// driver code sends data at 62 CPU cycles per bit, which is
// "close enough".
uInt32 myLastDataWriteCycle;
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Console.cxx,v 1.90 2006-06-09 02:45:11 urchlay Exp $ // $Id: Console.cxx,v 1.91 2006-06-11 07:13:19 urchlay Exp $
//============================================================================ //============================================================================
#include <assert.h> #include <assert.h>
@ -141,6 +141,8 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
myControllers[0] = new Joystick(leftjack, *myEvent); myControllers[0] = new Joystick(leftjack, *myEvent);
} }
AtariVox *vox = 0;
// Construct right controller // Construct right controller
if(right == "BOOSTER-GRIP") if(right == "BOOSTER-GRIP")
{ {
@ -160,7 +162,7 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
} }
else if(right == "ATARIVOX") else if(right == "ATARIVOX")
{ {
myControllers[1] = new AtariVox(rightjack, *myEvent); myControllers[1] = vox = new AtariVox(rightjack, *myEvent);
} }
else else
{ {
@ -182,6 +184,11 @@ Console::Console(const uInt8* image, uInt32 size, const string& md5,
// Now, we can construct the system and components // Now, we can construct the system and components
mySystem = new System(13, 6); mySystem = new System(13, 6);
// AtariVox is a smart peripheral; it needs access to the system
// cycles counter, so it needs a reference to the System
if(vox)
vox->setSystem(mySystem);
M6502* m6502; M6502* m6502;
if(myOSystem->settings().getString("cpu") == "low") if(myOSystem->settings().getString("cpu") == "low")
m6502 = new M6502Low(1); m6502 = new M6502Low(1);

View File

@ -0,0 +1,163 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SpeakJet.cxx,v 1.1 2006-06-11 07:13:19 urchlay Exp $
//============================================================================
#include "SpeakJet.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpeakJet::SpeakJet()
{
spawnThread();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SpeakJet::~SpeakJet()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SpeakJet::spawnThread()
{
ourThread = SDL_CreateThread(thread, 0);
ourInputSemaphore = SDL_CreateSemaphore(1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int SpeakJet::thread(void *data) {
cerr << "rsynth thread spawned" << endl;
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SpeakJet::write(uInt8 code)
{
const char *rsynthPhones = xlatePhoneme(code);
cerr << "rsynth: \"" << rsynthPhones << "\"" << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char *SpeakJet::xlatePhoneme(uInt8 code)
{
if(code <= 6)
return " ";
if(code >= 128 && code <= 199)
return ourPhonemeTable[ code - 128 ];
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 *SpeakJet::getSamples(int *count) {
*count = 0;
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SpeakJet::chipReady()
{
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/*
Table of rsynth phonemes, indexed by SpeakJet phoneme code number.
Table is offset by 128 bytes (ourPhonemeTable[0] is code #128)
see rsynth/phones.def for definitions of rsynth phonemes.
We prefix a "'" to the rsynth phoneme for stress or a ","
for relax.
FIXME: This will need a lot of tweaking, once I get a real
SpeakJet to test with.
*/
const char *SpeakJet::ourPhonemeTable[] = {
//"rsynth phoneme(s) (phones.def)", // SJ phonemes (p. 16 in SJ manual)
"i:", // 128 IY See, Even, Feed
"I", // 129 IH Sit, Fix, Pin
"eI", // 130 EY Hair, Gate, Beige
"E", // 131 EH Met, Check, Red
"{", // 132 AY Hat, Fast, Fan
"A:", // 133 AX Cotten // maybe "@" instead?
"V", // 134 UX Luck, Up, Uncle
"Q", // 135 OH Hot, Clock, Fox
"A:", // 136 AW Father, Fall
"oU", // 137 OW Comb, Over, Hold
"U", // 138 UH Book, Could, Should
"u:", // 139 UW Food, June
"m", // 140 MM Milk, Famous,
"n", // 141 NE Nip, Danger, Thin
"n", // 142 NO No, Snow, On
"N", // 143 NGE Think, Ping
"N", // 144 NGO Hung, Song
"l", // 145 LE Lake, Alarm, Lapel
"l", // 146 LO Clock, Plus, Hello
"w", // 147 WW Wool, Sweat
"r", // 148 RR Ray, Brain, Over
"I@", // 149 IYRR Clear, Hear, Year
"e@", // 150 EYRR Hair, Stair, Repair
"3:", // 151 AXRR Fir, Bird, Burn
"A:", // 152 AWRR Part, Farm, Yarn
"Qr", // 153 OWRR Corn, Four, Your [*]
"eI", // 154 EYIY Gate, Ate, Ray
"aI", // 155 OHIY Mice, Fight, White
"OI", // 156 OWIY Boy, Toy, Voice
"aI", // 157 OHIH Sky, Five, I
"j", // 158 IYEH Yes, Yarn, Million
"el", // 159 EHLL Saddle, Angle, Spell [*]
"U@", // 160 IYUW Cute, Few // maybe u
"aU", // 161 AXUW Brown, Clown, Thousan
"U@", // 162 IHWW Two, New, Zoo
"aU", // 163 AYWW Our, Ouch, Owl
"@U", // 164 OWWW Go, Hello, Snow // maybe "oU"?
"dZ", // 165 JH Dodge, Jet, Savage
"v", // 166 VV Vest, Even,
"z", // 167 ZZ Zoo, Zap
"Z", // 168 ZH Azure, Treasure
"D", // 169 DH There, That, This
"b", // 170 BE Bear, Bird, Beed ???
"b", // 171 BO Bone, Book Brown ???
"b", // 172 EB Cab, Crib, Web ???
"b", // 173 OB Bob, Sub, Tub ???
"d", // 174 DE Deep, Date, Divide ???
"d", // 175 DO Do, Dust, Dog ???
"d", // 176 ED Could, Bird ???
"d", // 177 OD Bud, Food ???
"g", // 178 GE Get, Gate, Guest, ???
"g", // 179 GO Got, Glue, Goo ???
"g", // 180 EG Peg, Wig ???
"g", // 181 OG Dog, Peg ???
"tS", // 182 CH Church, Feature, March
"h", // 183 HE Help, Hand, Hair
"h", // 184 HO Hoe, Hot, Hug
"hw", // 185 WH Who, Whale, White [*]
"f", // 186 FF Food, Effort, Off
"s", // 187 SE See, Vest, Plus
"s", // 188 SO So, Sweat ???
"S", // 189 SH Ship, Fiction, Leash
"T", // 190 TH Thin, month
"t", // 191 TT Part, Little, Sit
"t", // 192 TU To, Talk, Ten
"ts", // 193 TS Parts, Costs, Robots
"k", // 194 KE Can't, Clown, Key
"k", // 195 KO Comb, Quick, Fox ???
"k", // 196 EK Speak, Task ???
"k", // 197 OK Book, Took, October ???
"p", // 198 PE People, Computer
"p" // 199 PO Paw, Copy ???
};

View File

@ -0,0 +1,187 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: SpeakJet.hxx,v 1.1 2006-06-11 07:13:19 urchlay Exp $
//============================================================================
#ifndef SPEAKJET_HXX
#define SPEAKJET_HXX
/**
Emulation of the Magnevation SpeakJet.
This is the speech synthesizer chip used in the AtariVox.
See AtariVox.hxx and .cxx for AtariVox specifics.
This class doesn't attempt 100% accurate emulation of the SpeakJet,
as the chip contains a proprietary algorithm that does some complex
modelling (in other words, it doesn't just string samples together).
For this emulation, I use a library called rsynth, which does something
similar (models the human vocal/nasal tract), but is implemented
in a totally different way. You might say I'm emulating the spirit
of the SpeakJet, not the letter :)
Implementation details:
Both rsynth and the SpeakJet take a stream of phoneme codes and produce
audio output.
My SpeakJet class accepts the SpeakJet phonemes, one at a time, and
translates them to rsynth phonemes (which are not quite one-to-one
equivalent). As each phoneme is translated, it's added to a phoneme
buffer.
Because of the way rsynth is implemented, it needs a full word's worth
of phonemes in its buffer before its speech function is called. This
means I'll only call rsynth_phones() when I receive a SpeakJet code that
indicates a pause, or end-of-word, or a control code (set parameters
or such). This will result in a slight delay (typically, games will
send one SJ code per frame).
Also due to rsynth's implementation, I have to run it in a thread. This
is because rsynth_phones() is a monolithic function that needs a string
of phonemes, and takes a while to run (for the word "testing", it takes
1/4 second on an Athlon 64 @ 1800MHz). We can't have the emulator pause
for a quarter second while this happens, so I'll call rsynth_phones()
in a separate thread, and have it fill a buffer from which our main
thread will pull as much data as it needs. A typical word will be
30-40 thousand samples, and we only need fragsize/2 samples at a time.
As always when using threads, there will be locking in play...
rsynth's output is always 16-bit samples. This class will have to
convert them to 8-bit samples before feeding them to the SDL audio
buffer.
When using the AtariVox, we'll use SDL stereo sound. The regular TIA
sound will come out the left channel, and the speech will come out
the right. This isn't ideal, but it's the easiest way to mix the two
(I don't want to add an SDL_mixer dependency). The real SpeakJet uses a
separate speaker from the 2600 (the 2600 TIA sound comes from the TV,
the SJ sound comes from a set of PC speakers), so splitting them to
the left and right channels isn't unreasonable... However, it means
no game can simultaneously use stereo sound and the AtariVox (for now,
anyway).
@author B. Watson
@version $Id: SpeakJet.hxx,v 1.1 2006-06-11 07:13:19 urchlay Exp $
*/
#include "bspf.hxx"
extern "C" {
#include <SDL.h>
#include <SDL_thread.h>
#include "rsynth/rsynth.h"
}
class SpeakJet
{
public:
/**
Create a new SpeakJet with given buffer size. We use a circular linked
list of fixed size, each node being a buffer of bufferSize 8-bit
samples.
@param bufferSize The size of each output buffer, presumably equal
to fragsize/2.
*/
SpeakJet();
~SpeakJet();
public:
/**
Writes a SpeakJet phoneme (or other code).
These are the codes from page 16 of the Speaket User Manual.
Not all codes are emulated. In particular, the non-speech noises
(200 thru 254) will be treated as silence. Also, not all the
control codes will actually work (will document later).
@param code The SpeakJet code being written to the emulated chip
*/
void write(uInt8 code);
/**
Returns a buffer full of 8-bit samples. This should be called every
frame or so, or else the older buffers will get overwritten by new
data.
@param count This will be set to the number of samples that are
returned. Value ranges from 0 to bufferSize.
*/
uInt8 *getSamples(int *count);
/**
Returns false if the phonemeBuffer is full, true otherwise.
*/
bool chipReady();
// function that spawns the rsynth thread
void spawnThread();
// function that the rsynth thread runs...
static int thread(void *data);
private:
enum { INPUT_BUFFER_SIZE = 128 };
uInt16 myBufferSize;
// True if last code was 20 thru 29
bool needParameter;
// phonemeBuffer holds *translated* phonemes (e.g. rsynth phonemes,
// not SpeakJet phonemes).
char phonemeBuffer[INPUT_BUFFER_SIZE];
uInt8 phonemeCount; // number of phonemes in the phonemeBuffer
static const char *ourPhonemeTable[];
SDL_Thread *ourThread;
// We use this semaphore like so:
// Main thread locks it initially
// Main thread gathers up phonemes, storing in the input buffer,
// until it hits a pause/space,
// then unlocks the semaphore.
// The rsynth thread blocks on the semaphore until the main thread
// is done feeding data into the buffer.
// When the rsynth thread unblocks, it quickly copies the buffer to
// a private buffer, then unlocks the semaphore so the main thread
// can re-use the buffer.
SDL_sem *ourInputSemaphore;
// Each output buffer also needs its own locking semaphore:
// rsynth thread locks each buffer as it fills it, then unlocks it
// when it's done, and moves on to the next buffer in the circular
// list (blocking if it's locked).
// When the main thread is ready to play audio, it grabs its idea
// of what the next buffer is (blocking if it's locked), locks it, mixes
// its contents with the TIA audio data (if it's not an empty buffer),
// clears the buffer, then unlocks it.
// Note that, if the rsynth thread has been sleeping a while, all
// the buffers might be empty.
// When the rsynth thread runs out of input, it should probably
// listen on a condition, so it can be woken up when there's something
// to do.
private:
// Convert a SpeakJet phoneme into one or more rsynth phonemes.
// Input range is 0 to 255, but not all codes are supported yet.
static const char *xlatePhoneme(uInt8 code);
};
#endif

View File

@ -45,6 +45,7 @@ MODULE_OBJS := \
src/emucore/Random.o \ src/emucore/Random.o \
src/emucore/Serializer.o \ src/emucore/Serializer.o \
src/emucore/Settings.o \ src/emucore/Settings.o \
src/emucore/SpeakJet.o \
src/emucore/Switches.o \ src/emucore/Switches.o \
src/emucore/TIA.o \ src/emucore/TIA.o \
src/emucore/TIASnd.o \ src/emucore/TIASnd.o \

View File

@ -0,0 +1 @@
yes

View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,482 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -0,0 +1,741 @@
Change 2707 on 2003/07/06 by nick@llama
SuSE 8.2 and gcc-3.* support
Mainly adding -fno-scrict-aliasing and removing -Werrors (for now)
Change 2636 on 2003/01/08 by nick@nickwork
Some tidy up on RedHat 7.1
Change 2635 on 2003/01/07 by nick@dromedary
Depends on Audio::Data
Change 2630 on 2003/01/05 by nick@dromedary
Decouple dict (and hence db routines) from rest of
text-to-phones stuff.
Change 2629 on 2003/01/05 by nick@dromedary
Restore ability to make CC=g++
Change 2628 on 2003/01/05 by nick@dromedary
Perl bindings for librsynth.a
Change 2627 on 2003/01/05 by nick@dromedary
Move Elements.pm under perl Rsynth dir
Change 2626 on 2003/01/04 by nick@dromedary
Nearly there - restructure once more to make
a usable library at two levels - text and phonetics
Change 2625 on 2003/01/04 by nick@dromedary
More cleanup of obsolete files.
Change 2624 on 2003/01/04 by nick@bactrian
Typo in ansi-izeing
Change 2623 on 2003/01/04 by nick@dromedary
Moderernize autoconf stuff
Change 2622 on 2003/01/04 by nick@dromedary
Cleanup and move things about so distribution
isn't full of my junk
Change 2621 on 2003/01/03 by nick@dromedary
More C++ isms and memory leak fixes.
Change 2620 on 2003/01/03 by nick@dromedary
More pickyness from build with CC=g++
Change 2619 on 2003/01/03 by nick@dromedary
More API cleanup and portability.
Change 2618 on 2003/01/03 by nick@bactrian
Correct dependancies
Change 2617 on 2003/01/03 by nick@dromedary
Lost edit
Change 2616 on 2003/01/03 by nick@dromedary
Re-structure API to remove most of the globals
(Also re-indent.)
Change 2615 on 2003/01/03 by nick@dromedary
Comments etc. after amp_adj changes.
Change 2614 on 2003/01/03 by nick@dromedary
Remove sops to K&R C - this is 21st century.
Change 2613 on 2003/01/03 by nick@dromedary
Move amp adjsutments into Elements.def
Convert 'an' to nasal fraction.
Loose 'a1' as it never does anything in cascade scheme.
Change 2612 on 2003/01/03 by nick@dromedary
Collect all dB adjustments of /^a\w+/ paramters into one place.
Change 2611 on 2003/01/02 by nick@dromedary
[E] and [{] seemed to be swapped.
Extraction of F1..F3 from CD is less helpful than expected
very hard to get John and Jill's cardinal vowels to look
right on tkvdgm.
Change 2610 on 2003/01/02 by nick@dromedary
Tweak near-equivalence script, avoid $Id: Change.log,v 1.1 2006-06-11 07:13:19 urchlay Exp $ in phtoelm.def
Change 2609 on 2003/01/02 by nick@dromedary
Re-arange code to allow dominance on a per-paramter basis
Change 2608 on 2003/01/02 by nick@dromedary
Avoid special elements for affricates where lengths of normal
elements sound acceptable.
Loose "QQ" as dummy target element in middle of fricatives.
(Prepare QQ to become [?] when we can do per-parameter rank
targeting.)
Correct av for closure parts of voiced stops.
Change 2607 on 2003/01/02 by nick@dromedary
Read new Elements.def format
Change 2606 on 2003/01/02 by nick@dromedary
Loose dict/ipa strings in favour of one sampa string.
Make font slot short and fill with Unicode.
Change 2605 on 2003/01/02 by nick@dromedary
Re-format without "error in fixed" term now we don't have it.
Change 2604 on 2003/01/02 by nick@dromedary
Drop 'stdy' slot in element data and use stdy*(1-prop) instead.
(Having established that making all data was like that did
not make things worse.)
Change 2603 on 2003/01/01 by nick@dromedary
Prune the #if 0 code now that new voice scheme and removal
of 1st difference seems to work.
Also re-instate long mis-understood 'avc' parameter.
Change 2602 on 2003/01/01 by nick@dromedary
Remove some entries for words written the same but
with different pronounciation when latter cause poblems
e.g. we want gin to be [dZIn] not [gIn] (Latter seems wrong)
and put to be [pUt] not golfer's [pVt].
Change 2601 on 2002/12/31 by nick@dromedary
More oddities - none of stops "stop" - weird - added
no-source and external duration to KY GY and seems to help
(Do same for [bptd]?)
Change 2600 on 2002/12/31 by nick@dromedary
Velars [kg] had no stimulus on in/out - no wonder they were weak!
Change 2598 on 2002/12/30 by nick@dromedary
"Restore" naive "f0 decline with stress pulses" approach for
un-assisted text-to-speech. Festival as a front end is
of course much better, but this restores stand-alone "prosody"
element.
Change 2597 on 2002/12/30 by nick@dromedary
Gate more messages with -v (verbose) switch
Change 2596 on 2002/12/30 by nick@dromedary
Festival binding.
Change 2595 on 2002/12/29 by nick@dromedary
Mend ability to say text files. Reset dumb F0 scheme on ',' etc.
as well as end of sentence.
Add a mode to use .pho file F0 data but ignore its duration data.
Correct pronounciation of 'diphones' in beep (dip-hones indeed!).
Change 2594 on 2002/12/28 by nick@dromedary
Another try at ms -> num-of-frames interpolation.
(Goal is to avoid non-stop elements which vanish as they
get 0 time.)
Change 2593 on 2002/12/28 by nick@dromedary
General overhaul of Elements.def removing duplicates
and correcting accidentally identical elements.
Change 2591 on 2002/12/28 by nick@dromedary
"Correct" fix contribution term
Change 2590 on 2002/12/28 by nick@dromedary
More info in and tidier plot file.
Turn on parameter smoothing by default.
Change 2589 on 2002/12/28 by nick@dromedary
Turn of debug :-(
Change 2588 on 2002/12/28 by nick@dromedary
Improve mbrola .pho file interpollation:
- allow length reduction for non stops
- invent new attribute 'stl' (stop locus) to mark in/out
elements of stops so only central part is marked as stp
(with above this means in/put can change length).
- Remove specific [A:] etc. entries in phtoelem.def and handle
':' in phtoelm.c
Change 2587 on 2002/12/28 by nick@dromedary
At least attempt all vowels on IPA diagram.
(Missing ones F1,F2,F2 from IPA CD.)
Change 2586 on 2002/12/27 by nick@dromedary
Better error messages for phone translation problems
Change 2585 on 2002/12/27 by nick@dromedary
Experimental "rsc" resonator to lift centre of spectrum.
Inspired by frequent occurance of such in LPC spectra from tkscope.
Change 2584 on 2002/12/27 by nick@dromedary
Tweak [{] based on tkscope analysis of IPA CD
Change 2581 on 2002/12/27 by nick@dromedary
Make 1st half of [D] same as 2nd half (looks like an
old experiment that got left in.
Change 2580 on 2002/12/27 by nick@dromedary
Try waiting longer for /dev/dsp
Change 2579 on 2002/12/24 by nick@dromedary
First pass at adding Copyright and LGPL/GPL notices.
Change 2576 on 2002/12/23 by nick@dromedary
Switch to piece-wise linear/quadratic voicing waveform.
Change 2575 on 2002/12/23 by nick@dromedary
Add "Medi" (Welsh woman's christian name) to dict for personal
reasons ;-)
Change 2574 on 2002/12/23 by nick@dromedary
#if to switch between taking 1st diff of output + lowpass
or not doing either (supposed to be equivalent).
The non-diff case should make it easier to inject specific
voice waveform.
Change 2573 on 2002/12/23 by nick@dromedary
Some light tidying
Change 2570 on 2002/12/22 by nick@dromedary
Update comments, experiment with pitch-sync cascade update
Change 2564 on 2002/12/19 by nick@dromedary
Tune [N] based on tkscope analysis of "Sounds of IPA" CD
- match f4/f5/f6 to John Well's and then adjust [N]'s fn..f3
and bandwidths till it looks best.
Change 2563 on 2002/12/19 by nick@dromedary
Back port the try severl times tweak
Change 2550 on 2002/12/15 by nick@dromedary
SAMPA corrections for sylabic consonants
Change 2549 on 2002/12/15 by nick@dromedary
Update/add SAMPA labels for Klatt/MITalk phones
Change 2548 on 2002/12/12 by nick@dromedary
Add SAMPA IPA Unicode HTML and script for manipulating it.
Change 2547 on 2002/12/10 by nick@dromedary
Place holders for high central vowels [1] and [}]
Change 2545 on 2002/12/09 by nick@dromedary
Add x-sampa [4] [K] [?]
Change 2544 on 2002/12/04 by nick@dromedary
Restore speed from -S
- some clicks seem to be "rapid" changes in f2
i.e. go away with more steps as in -S 10 -m 1
Change 2543 on 2002/12/04 by nick@dromedary
Adjust global gain to avoid clipping on /Q/
Change 2542 on 2002/12/03 by nick@dromedary
Add check for f1-f2-f3-f4 spacing and correct problems
it showed
- raise fixed f4 above common f3 in several elements
- move f1/f2 of /A/ to rp values as perl tkvdgm
Update tkvdgm to get data from Elements.def via Elements.pm
Change 2541 on 2002/11/28 by nick@dromedary
Clean up tracks of /N/ - still not right (sounds too much like /n/)
Change 2540 on 2002/11/28 by nick@dromedary
Amplitude investigations - plot avg power
Allow amp/db fudge factor experiments.
Change 2539 on 2002/11/26 by nick@dromedary
Compute and plot output amplitude.
Change 2538 on 2002/11/25 by nick@dromedary
Tweak duration code with comment till we are clearer
about effects to shortened durations on the parameter
interpollation.
Change 2537 on 2002/11/25 by nick@dromedary
Support say -f whatever.pho
where whatever.pho is a mbrola phone/duration/f0 file.
Interpolation between durations in ms and frames is
still a little rough. Also have some issues when specified
duration is less than duration of stops (and maybe some others.)
Change 2536 on 2002/11/24 by nick@dromedary
end-of-weekend checkin
Change 2535 on 2002/11/24 by nick@dromedary
Some initial mbrola compatibility tweaks
Change 2528 on 2002/11/19 by nick@dromedary
Separate voice and parameter data for plotting
Change 2527 on 2002/11/19 by nick@dromedary
Parameter track plotting
Change 2526 on 2002/11/18 by nick@dromedary
Start reconciling element params and synth params
Change 2525 on 2002/11/18 by nick@dromedary
Start of cleanup removing uses of old Klatt code
Change 2524 on 2002/11/17 by nick@dromedary
Allow study of old synth
Change 2522 on 2002/11/17 by nick@dromedary
Overhaul voice generation - amplitude and basic sound
should now be sample rate independant.
Change 2521 on 2002/11/13 by nick@dromedary
Update comments, play with sox stats
Change 2519 on 2002/11/08 by nick@dromedary
Show phone table
Change 2503 on 2002/10/05 by nick@bactrian
Update to modern linux's math.h
Change 2222 on 2001/05/22 by nick@dromedary
Clean up f1 too close to f2, f2 to f3 etc.
Change 2213 on 2001/04/30 by nick@dromedary
Honour gain terms in impulse response output.
Change 2212 on 2001/04/24 by nick@pluto
Boost af gain (i.e. stop * 0.25),
move [k] near its voiced analogue [g] and apply
same changes.
Change 2211 on 2001/04/24 by nick@pluto
[g] edits
- av for in/out is low, av for 'nail' is high.
- silence/burst
Change 2210 on 2001/04/24 by nick@pluto
Support for getting impluse response from frame parameters.
Change 2209 on 2001/04/24 by nick@pluto
Apply Klatt f1..f3, b1..b3 to [g]
Change 2208 on 2001/04/24 by nick@pluto
Mark fmtelm as executable.
Change 2207 on 2001/04/23 by nick@dromedary
Add element trace.
Change 2206 on 2001/04/23 by nick@dromedary
Add klatt mapping table. Order parms as perl MITalk book by default.
Change 2205 on 2001/04/23 by nick@dromedary
Rename variables to match parameter struct slot names.
Change 2204 on 2001/04/20 by nick@bactrian
Modern nas needs -lXt
Change 2202 on 2001/04/17 by nick@dromedary
A few systematic adjustments
Change 2201 on 2001/04/17 by nick@dromedary
Perl version of Elements.def read/write prior to systematic changes.
Change 2200 on 2001/04/17 by nick@dromedary
Finish off the basic osay/say nsynth/opsynth decoupling.
Change 2199 on 2001/04/17 by nick@dromedary
Branch Elements
Change 2198 on 2001/04/17 by nick@pluto
Makefile tweak to allow nasay to build.
Make some of checking Linux only.
Change 2197 on 2001/04/16 by nick@dromedary
More flexible sorting.
Change 2195 on 2001/04/16 by nick@dromedary
Byteswapping issues in au_file
Change 2194 on 2001/04/16 by nick@dromedary
Bounds checking.
A hack for 8kHz issue, seems skirt of r5c is aliasing ?
Change 2193 on 2001/04/16 by nick@dromedary
Fix gross C->perl->C mis-re-translation in dB routine.
Change 2191 on 2001/04/15 by nick@dromedary
Start of new synth.
Change 2190 on 2001/04/15 by nick@dromedary
Tweak parameters-for-plot dump
Change 2189 on 2001/04/14 by nick@dromedary
Filter efficency and use new features in tkanal.
Change 2186 on 2001/04/13 by nick@dromedary
More features for analysing rsynth element tables.
Change 2113 on 2001/01/27 by nick@dromedary
Work better on modern linux (SuSE6.4)
Change 1536 on 1999/11/27 by nick@bactrian_nt
Win32 fixes
Change 1496 on 1999/11/09 by nick@bactrian
Cleanup alignment generation process
Change 1481 on 1999/09/27 by nick@pluto
Remove near duplicate file
Change 1480 on 1999/09/27 by nick@pluto
Inherit minor tweak on work version of txt710.dat
Change 1478 on 1999/09/26 by nick@bactrian
Configure searches /usr/local on linux where gcc suggests /usr
as prefix.
Bug fix in db API.
Change 1476 on 1999/09/24 by nick@bactrian
Builds to use /dev/dspW (16 bit) under OSS
Change 1475 on 1999/09/22 by nick@bactrian
Correct gdbm abstraction
Change 1474 on 1999/09/22 by nick@bactrian
Update autoconf versions, config.guess etc.
Change 1455 on 1999/09/02 by nick@bactrian
On-the-road Monterey/San Jose/Dallas changes
Change 1316 on 1999/05/14 by nick@ni-s
Update manifest
Change 1226 on 1999/03/12 by nick@pluto
Do not skip source for of Makefile, config.h etc.
Change 1224 on 1999/03/11 by nick@pluto
MANIFEST stuff
Change 1215 on 1999/02/20 by nick@camel
Fixup for Win32
Change 1214 on 1999/02/20 by nick@ni-s
Add Makefile
Change 1213 on 1999/02/20 by nick@ni-s
Add "align" stuff
Change 1205 on 1999/01/23 by nick@camel
Update for VC++6.0
Change 1204 on 1999/01/23 by nick@camel
Add VC++ package
Change 898 on 1998/06/02 by nick@ni-s
F/B splitting of text-only trie works
Change 895 on 1998/06/01 by nick@ni-s
Re-start from degenerate case (with bugs...)
Change 893 on 1998/05/31 by nick@ni-s
Bad splits break re-finding
Change 892 on 1998/05/30 by nick@ni-s
Don't match if cannot split both word and phon
Change 891 on 1998/05/30 by nick@ni-s
Basic splitting working, problem with silly partition on
Dutchmen/Dutchman
Change 890 on 1998/05/30 by nick@ni-s
Separate functions for forward/backward insert
Change 889 on 1998/05/30 by nick@ni-s
Split functions
Change 888 on 1998/05/30 by nick@ni-s
Dual disjoint trees
Change 887 on 1998/05/29 by nick@pluto
Fridays changes - try stack of nodes
Change 886 on 1998/05/28 by nick@pluto
End of Thur - backward match stuff
Change 885 on 1998/05/28 by nick@pluto
After re-structure to allow guess/build
Change 884 on 1998/05/28 by nick@pluto
End of Wednesday
Change 883 on 1998/05/26 by nick@ni-s
dtree seems to build
Change 882 on 1998/05/26 by nick@ni-s
Missed file
Change 881 on 1998/05/26 by nick@pluto
Add autoconf input file, remove Makefile as it is built
Change 880 on 1998/05/26 by nick@pluto
Support db as well as gdbm, update to latest autoconf
Change 879 on 1998/05/25 by nick@ni-s
Pre s-rule messing
Change 878 on 1998/05/25 by nick@ni-s
Added consonat rules as far as 's' from LPD side-bars
Change 877 on 1998/05/25 by nick@ni-s
Re-structure for stand-alone guess for debug
Change 876 on 1998/05/25 by nick@ni-s
Snapshot more rule changes
Change 875 on 1998/05/25 by nick@ni-s
Switched text.c rules to lower case
Change 874 on 1998/05/25 by nick@ni-s
Pre-downcase
Change 873 on 1998/05/24 by nick@ni-s
More rule tweaks
Change 872 on 1998/05/24 by nick@ni-s
1st round of rule-fixups by cross check with CUVOALD
Change 870 on 1998/05/23 by nick@ni-s
Open as ktext
Change 869 on 1998/05/23 by nick@ni-s
Add integer version of synth
Change 868 on 1998/05/23 by nick@ni-s
Wilbur's pitch floor tweak.
Change 867 on 1998/05/23 by nick@camel
Builds under mingw32
Change 866 on 1998/05/23 by nick@camel
Works on Win32 (watch the volume...)
Change 865 on 1998/05/23 by nick@camel
Links under borland
Change 864 on 1998/05/23 by nick@camel
Gross fixup
Change 863 on 1998/05/23 by nick@camel
Win32-side fixup
Change 861 on 1998/05/23 by nick@ni-s
Raw timidity win32 stuff
Change 860 on 1998/05/23 by nick@ni-s
gcc 2.8 fussyness
Change 858 on 1998/05/23 by nick@ni-s
Import /home/nick/speak/rsynth
Change 857 on 1998/05/23 by nick@ni-s
Import /home/nick/speak/rsynth-2.0
Change 856 on 1998/05/23 by nick@ni-s
Import /tmp/rsynth
Change 855 on 1998/05/23 by nick@ni-s
Version 1.99
Change 854 on 1998/05/23 by nick@ni-s
"ntalk" May 7 1994
Change 853 on 1998/05/23 by nick@ni-s
Version c. 'Feb 24 1994' rsynth.tar.Z
Change 852 on 1998/05/23 by nick@ni-s
Version "rsynth_cuvolad.tar.gz"
Change 851 on 1998/05/23 by nick@ni-s
Version released as 'nsynth.tar.gz'
Change 850 on 1998/05/23 by nick@ni-s
Original 'synth.tar.gz'

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,169 @@
$Id: INSTALL,v 1.1 2006-06-11 07:13:20 urchlay Exp $
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source directory by typing `make clean'. To also remove the files
that `configure' created (so you can compile the package for a
different kind of computer), type `make distclean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Using a Different Build Directory
=================================
You can compile the package in a different directory from the one
containing the source code. Doing so allows you to compile it on more
than one kind of computer at the same time. To do this, you must use a
version of `make' that supports the `VPATH' variable, such as GNU
`make'. `cd' to the directory where you want the object files and
executables to go and run the `configure' script. `configure'
automatically checks for the source code in the directory that
`configure' is in and in `..'.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Save the results of the tests in FILE instead of `config.cache'.
Set FILE to `/dev/null' to disable caching, for debugging
`configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -0,0 +1,114 @@
COPYING GPL
COPYING.LIB LGPL
Change.log What has happened
Elements.def Definition of elements
INSTALL How to install
MANIFEST This file
MANIFEST.SKIP Things that don't get included here
Makefile.in Pre configure Makefile
OldChanges Changes from RCS days
PORTING Outline of audio driver needs
kmap Phone mappings
README Please do ;-)
Revision.c Clunky way of setting revision
Rsynth/Audio.pm Perl API to this
Rsynth/Audio.xs Perl C bindings
Rsynth/Elements.pm Perl access to Elements
Rsynth/Makefile.PL Perl API build
Rsynth/t/elem.t Test low level Perl API
Rsynth/t/phones.t Test data
Rsynth/phtoelm.def Phone to element data
Rsynth/typemap Perl/C type conversion
Sampa.pm Perl code to read sampa.htm
aufile.c Sun .au file writer
aufile.h Sun .au file writer
charset.c Locale and charcter set choices
charset.h
config.guess configure support
config.h.in configure support
config.sub configure support
config/NeXTplay.c
config/config.win32
config/dummyplay.c
config/freebsdplay.c
config/hpuxplay.c
config/alsaplay.c New ALSA Audio driver
config/ossplay.c OSS Audio driver
config/make_dist
config/mmsystem.h
config/naplay.c NAS Audio Driver
config/pipeplay.c
config/sgiplay.c
config/sunplay.c
config/sunplay_mm.c
config/win32play.c
configure Generated build script
configure.in configure support
darray.c Dynamic array C code
darray.h
dat2au Perl script for something ...
dbif.h DB/GDBM abstraction for dictionary
deutsch.c Some support for german
deutsch.h Some support for german
dict.c Dictionary code
dict.h
dlookup.c Dictionary lookup command line application
efix
elements.c Element code
elmdgm Vowel parameter display/edit tool
english.c Letter to Sound rules
english.h
euler.pho MBrola style pho file ( say -f euler.pho )
euler.txt Plain text of above ( say < euler.txt )
festival/.festivalrc Copy to ~/.festivalrc to enable rsynth as a voice for festival
festival/lib/rsynth.scm Festival Hackery
festival/lib/voices/english/rsynth_br_f/festvox/rsynth_br_f.scm
festival/lib/voices/english/rsynth_br_f/mrpa-sampa
festival/lib/voices/english/rsynth_br_m/festvox/rsynth_br_m.scm
festival/lib/voices/english/rsynth_br_m/mrpa-sampa
fmtelem Re-format Elements.def
fmtfeat Re-format phfeat.h
fsay Use via festival
getarg.c Command line parser
getargs.h
getrev Build assist script
guess.c Command line tool to test letter to sound rules
holmes.c Element parameter interpolation
hplay.h Audio driver API
hpuxcc.doc
iam.txt Test data
install.sh configure support
l2u.c uLaw conversion tables
l2u.h
lang.h
ldbdict perl dump of DB dictionary
ldict perl dump of GDBM dictionary
mbrola.txt Test data
mkdictdb.c Build DB/GDBM dictionary from CMU style file
naplay.c NAS audio driver
opsynth.c Core synth
phfeat.h Phoneme features
phones.c Phoneme table
phones.def Guts of phoneme table
phones.h
phrases.txt Test data
phtoelm.c Phoneme to element layer
phtoelm.h
plotparm.h
prune_elm Perl script that for Elements.def
rsynth.h Main header
sampa.htm SAMPA IPA tables as UTF-8 HTML
sample Test data
say.c Algrorithmic conversion of numbers etc.
say.h
saydate Demo
saymain.c main() of ./say application
showphone perl/Tk app to display phones.def
text test data
text.c Letter to sound driver
text.h
tkvdgm Old perl/Tk app to show vowel diagram from formants
tracks gnuplot dumpped interpollated parameters
trie.c Trie lookup code
trie.h
useconfig.h configure support

View File

@ -0,0 +1,21 @@
[%~]$
\.[oa]$
\.d$
\.(bak|bck|save|old|db|plot|dat|bs|au)$
\b(RCS|CVS|comments|Solaris|makefiles|SunOS.*)/
\b[ab]Dict$
\b(align|710)\b
text710\.
\bcheck\b
(sampa|dist|misc|voice|dict|anal|attic|MITalk|mappings|Rsynth/blib)/
\bconfig\.h$
\brulebuild
\brulecheck
(GNU)?[Mm]akefile$
hplay\.c
Rsynth/Audio\.c
pm_to_blib
^(say|nasay|rsynth|mkdictdb|dlookup|guess|mid|small|tiny)$
config\.(cache|status|log)$
autom4te.cache/.*
^phtoelm.def

View File

@ -0,0 +1,166 @@
# $Id: Makefile,v 1.1 2006-06-11 07:13:20 urchlay Exp $
SRCDIR = .
CC = gcc
RANLIB = ranlib
PREFIX = /usr/local
BIN_DIR = $(PREFIX)/bin
LIB_DIR = $(PREFIX)/lib/dict
LDLIBS = -lm -lgdbm -ldb -L/usr/local/lib -lasound
XLIBS = -L/usr/X11R6/lib64 -lXt -L/usr/X11R6/lib64 -lX11 -lnsl
CFLAGS = -g -O2
CPPFLAGS = -I. -I. -I/usr/local/include -I/usr/X11R6/include
DEFS = -DDICT_DIR=\"$(LIB_DIR)\" -DDEFAULT_DICT=\"$(DEFAULT_DICT)\"
PROGS = say mkdictdb dlookup mkdictdb dlookup
ADICT =
BDICT =
BUILD = perlstuff
DICTS =
PERL = /usr/bin/perl
FESTIVAL =
DEFAULT_DICT = b
INSTALL = /usr/bin/ginstall -c
INSTALL_PROG = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
EXTRA_INST = install_perl
MESSAGE = Hello there
LIBRARY = Rsynth/librsynth.a
.c.o :
$(CC) $(CFLAGS) $(CPPFLAGS) -IRsynth $(DEFS) -c -o $@ $<
all :: $(PROGS) $(BUILD)
check :: all perl_check
(./say $(MESSAGE) || ./nasay $(MESSAGE))
SYNOBJ = opsynth.o elements.o holmes.o trie.o phtoelm.o darray.o
PHONOBJ = say.o phones.o text.o english.o deutsch.o charset.o
$(LIBRARY) : $(SYNOBJ) $(PHONOBJ)
$(AR) rc $@ $(SYNOBJ) $(PHONOBJ)
$(RANLIB) $@
SAY_OBJS = $(PHONOBJ) l2u.o aufile.o getarg.o Revision.o dict.o saymain.o
say : $(LIBRARY) $(SAY_OBJS) hplay.o
$(CC) -o $@ $(LDFLAGS) $(SAY_OBJS) $(SYNOBJ) hplay.o $(LIBRARY) $(LDLIBS)
nasay : $(LIBRARY) $(SAY_OBJS) naplay.o
$(CC) -o $@ $(LDFLAGS) $(SAY_OBJS) $(SYNOBJ) naplay.o $(LIBRARY) $(XLIBS) $(LDLIBS)
mkdictdb : mkdictdb.o $(LIBRARY)
$(CC) -o $@ $(LDFLAGS) mkdictdb.o $(LIBRARY) $(LDLIBS)
dlookup : dlookup.o getarg.o $(LIBRARY)
$(CC) -o $@ $(LDFLAGS) dlookup.o getarg.o dict.o $(LIBRARY) $(LDLIBS)
clean ::
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) clean ; fi
rm -f $(LIBRARY) $(PROGS) $(DICTS) *.o tmp.par core *~ *% ,* .e[cks]1
distclean :: clean
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) distclean ; fi
rm -f Makefile config.status config.h config.log config.cache hplay.c
hplay.o : hplay.c getargs.h hplay.h
aDict.db : $(ADICT) mkdictdb
LANG=en_US mkdictdb $(ADICT) aDict.db
touch $@
bDict.db : $(BDICT) mkdictdb
LANG=en_GB mkdictdb $(BDICT) bDict.db
touch $@
install : $(PROGS) $(DICTS) $(EXTRA_INST)
mkdir -p $(PREFIX) $(BIN_DIR) $(LIB_DIR)
for f in $(PROGS); do \
$(INSTALL_PROG) $$f $(BIN_DIR); \
done
$(INSTALL) -d $(LIB_DIR)
for f in $(DICTS); do \
$(INSTALL_DATA) $$f $(LIB_DIR); \
done
perl_check :
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) test ; fi
perlstuff : $(LIBRARY) Rsynth/Makefile.PL
cd Rsynth && $(PERL) Makefile.PL && $(MAKE) PERL=$(PERL)
festival :
install_perl :
cd Rsynth && $(MAKE) PERL=$(PERL) install
install_festival :
phtoelm.def : Rsynth/phtoelm.def
$(INSTALL_DATA) $< $@
# This bit of Makefile only works if GNU make is available
# The classic make version would have `$(SRCDIR)/getrev $(SRCDIR)`
# which does not work as it gets evaluated by 'sh' once we have cd'ed
# elsewhere. GNU make scheme uses := and $(shell...) to evaluate
# REVISION once at Makefile parse time
# It is really only needed by developer
REVISION := $(shell $(SRCDIR)/getrev $(SRCDIR))
distribution:
rm -rf /tmp/rsynth-$(REVISION)
mkdir /tmp/rsynth-$(REVISION)
(cd $(SRCDIR); tar cf - `cat MANIFEST` ) | (cd /tmp/rsynth-$(REVISION); tar xf - )
(cd /tmp; tar cvf - rsynth-$(REVISION) ) | gzip -c > $(SRCDIR)/../rsynth-$(REVISION).tar.gz
disttest :
rm -rf /tmp/rsynth-$(REVISION)
mkdir /tmp/rsynth-$(REVISION)
(cd $(SRCDIR); tar cf - `cat MANIFEST` ) | (cd /tmp/rsynth-$(REVISION); tar xf - )
(cd /tmp/rsynth-$(REVISION); CC=$(CC) configure ; make CC=$(CC) -k check)
#MM Fri Jan 2 11:28:16 2004
aufile.o: aufile.c config.h useconfig.h getargs.h l2u.h hplay.h aufile.h
charset.o: charset.c charset.h
darray.o: darray.c config.h useconfig.h darray.h
deutsch.o: deutsch.c config.h darray.h lang.h say.h deutsch.h
dict.o: dict.c config.h charset.h phones.h phones.def useconfig.h dbif.h \
lang.h darray.h dict.h
dlookup.o: dlookup.c config.h useconfig.h dict.h lang.h darray.h phones.h \
phones.def getargs.h english.h
elements.o: elements.c config.h rsynth.h darray.h trie.h phfeat.h \
Elements.def
english.o: english.c config.h darray.h lang.h say.h charset.h english.h \
phones.h phones.def
getarg.o: getarg.c config.h useconfig.h getargs.h
guess.o: guess.c darray.h charset.h text.h phones.h phones.def lang.h \
english.h say.h
holmes.o: holmes.c config.h useconfig.h rsynth.h darray.h trie.h \
getargs.h plotparm.h hplay.h
hplay.o: hplay.c config.h useconfig.h l2u.h getargs.h hplay.h
l2u.o: l2u.c
mkdictdb.o: mkdictdb.c config.h useconfig.h trie.h darray.h phones.h \
phones.def charset.h dbif.h
opsynth.o: opsynth.c config.h useconfig.h rsynth.h darray.h trie.h \
plotparm.h
phones.o: phones.c config.h phones.h phones.def
phtoelm.o: phtoelm.c config.h useconfig.h rsynth.h darray.h trie.h \
hplay.h phfeat.h phtoelm.def
Revision.o: Revision.c
rulebuild.o: rulebuild.c config.h useconfig.h darray.h lang.h english.h \
phones.h phones.def charset.h text.h say.h
say.o: say.c config.h useconfig.h darray.h rsynth.h trie.h hplay.h dict.h \
lang.h text.h getargs.h phones.h phones.def aufile.h charset.h \
english.h deutsch.h say.h
saymain.o: saymain.c config.h useconfig.h darray.h rsynth.h trie.h \
hplay.h dict.h lang.h text.h getargs.h phones.h phones.def aufile.h \
charset.h english.h deutsch.h say.h
text.o: text.c config.h useconfig.h darray.h phtoelm.h lang.h text.h \
say.h
trie.o: trie.c config.h useconfig.h trie.h

View File

@ -0,0 +1,145 @@
# $Id: Makefile.in,v 1.1 2006-06-11 07:13:22 urchlay Exp $
VPATH = @srcdir@
SRCDIR = @srcdir@
CC = @CC@
RANLIB = @RANLIB@
PREFIX = @prefix@
BIN_DIR = $(PREFIX)/bin
LIB_DIR = $(PREFIX)/lib/dict
LDLIBS = @LIBS@
XLIBS = @XLIBS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
DEFS = -DDICT_DIR=\"$(LIB_DIR)\" -DDEFAULT_DICT=\"$(DEFAULT_DICT)\"
PROGS = @PROGS@
ADICT = @ADICT@
BDICT = @BDICT@
BUILD = @BUILD@
DICTS = @DICTS@
PERL = @PERL@
FESTIVAL = @FESTIVAL@
DEFAULT_DICT = @DEFAULT_DICT@
INSTALL = @INSTALL@
INSTALL_PROG = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
EXTRA_INST = @EXTRA_INST@
MESSAGE = Hello there
LIBRARY = Rsynth/librsynth.a
.c.o :
$(CC) $(CFLAGS) $(CPPFLAGS) -IRsynth $(DEFS) -c -o $@ $<
all :: $(PROGS) $(BUILD)
check :: all perl_check
(./say $(MESSAGE) || ./nasay $(MESSAGE))
SYNOBJ = opsynth.o elements.o holmes.o trie.o phtoelm.o darray.o
PHONOBJ = say.o phones.o text.o english.o deutsch.o charset.o
$(LIBRARY) : $(SYNOBJ) $(PHONOBJ)
$(AR) rc $@ $(SYNOBJ) $(PHONOBJ)
$(RANLIB) $@
SAY_OBJS = $(PHONOBJ) l2u.o aufile.o getarg.o Revision.o dict.o saymain.o
say : $(LIBRARY) $(SAY_OBJS) hplay.o
$(CC) -o $@ $(LDFLAGS) $(SAY_OBJS) $(SYNOBJ) hplay.o $(LIBRARY) $(LDLIBS)
nasay : $(LIBRARY) $(SAY_OBJS) naplay.o
$(CC) -o $@ $(LDFLAGS) $(SAY_OBJS) $(SYNOBJ) naplay.o $(LIBRARY) $(XLIBS) $(LDLIBS)
mkdictdb : mkdictdb.o $(LIBRARY)
$(CC) -o $@ $(LDFLAGS) mkdictdb.o $(LIBRARY) $(LDLIBS)
dlookup : dlookup.o getarg.o $(LIBRARY)
$(CC) -o $@ $(LDFLAGS) dlookup.o getarg.o dict.o $(LIBRARY) $(LDLIBS)
clean ::
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) clean ; fi
rm -f $(LIBRARY) $(PROGS) $(DICTS) *.o tmp.par core *~ *% ,* .e[cks]1
distclean :: clean
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) distclean ; fi
rm -f Makefile config.status config.h config.log config.cache hplay.c
hplay.o : hplay.c getargs.h hplay.h
aDict.db : $(ADICT) mkdictdb
LANG=en_US mkdictdb $(ADICT) aDict.db
touch $@
bDict.db : $(BDICT) mkdictdb
LANG=en_GB mkdictdb $(BDICT) bDict.db
touch $@
install : $(PROGS) $(DICTS) $(EXTRA_INST)
mkdir -p $(PREFIX) $(BIN_DIR) $(LIB_DIR)
for f in $(PROGS); do \
$(INSTALL_PROG) $$f $(BIN_DIR); \
done
$(INSTALL) -d $(LIB_DIR)
for f in $(DICTS); do \
$(INSTALL_DATA) $$f $(LIB_DIR); \
done
perl_check :
if test -f Rsynth/Makefile ; then cd Rsynth && make PERL=$(PERL) test ; fi
perlstuff : $(LIBRARY) Rsynth/Makefile.PL
cd Rsynth && $(PERL) Makefile.PL && $(MAKE) PERL=$(PERL)
festival :
install_perl :
cd Rsynth && $(MAKE) PERL=$(PERL) install
install_festival :
phtoelm.def : Rsynth/phtoelm.def
$(INSTALL_DATA) $< $@
@make_dist@
#MM Fri Jan 2 11:28:16 2004
aufile.o: aufile.c config.h useconfig.h getargs.h l2u.h hplay.h aufile.h
charset.o: charset.c charset.h
darray.o: darray.c config.h useconfig.h darray.h
deutsch.o: deutsch.c config.h darray.h lang.h say.h deutsch.h
dict.o: dict.c config.h charset.h phones.h phones.def useconfig.h dbif.h \
lang.h darray.h dict.h
dlookup.o: dlookup.c config.h useconfig.h dict.h lang.h darray.h phones.h \
phones.def getargs.h english.h
elements.o: elements.c config.h rsynth.h darray.h trie.h phfeat.h \
Elements.def
english.o: english.c config.h darray.h lang.h say.h charset.h english.h \
phones.h phones.def
getarg.o: getarg.c config.h useconfig.h getargs.h
guess.o: guess.c darray.h charset.h text.h phones.h phones.def lang.h \
english.h say.h
holmes.o: holmes.c config.h useconfig.h rsynth.h darray.h trie.h \
getargs.h plotparm.h hplay.h
hplay.o: hplay.c config.h useconfig.h l2u.h getargs.h hplay.h
l2u.o: l2u.c
mkdictdb.o: mkdictdb.c config.h useconfig.h trie.h darray.h phones.h \
phones.def charset.h dbif.h
opsynth.o: opsynth.c config.h useconfig.h rsynth.h darray.h trie.h \
plotparm.h
phones.o: phones.c config.h phones.h phones.def
phtoelm.o: phtoelm.c config.h useconfig.h rsynth.h darray.h trie.h \
hplay.h phfeat.h phtoelm.def
Revision.o: Revision.c
rulebuild.o: rulebuild.c config.h useconfig.h darray.h lang.h english.h \
phones.h phones.def charset.h text.h say.h
say.o: say.c config.h useconfig.h darray.h rsynth.h trie.h hplay.h dict.h \
lang.h text.h getargs.h phones.h phones.def aufile.h charset.h \
english.h deutsch.h say.h
saymain.o: saymain.c config.h useconfig.h darray.h rsynth.h trie.h \
hplay.h dict.h lang.h text.h getargs.h phones.h phones.def aufile.h \
charset.h english.h deutsch.h say.h
text.o: text.c config.h useconfig.h darray.h phtoelm.h lang.h text.h \
say.h
trie.o: trie.c config.h useconfig.h trie.h

View File

@ -0,0 +1,42 @@
$Log: not supported by cvs2svn $
# Revision 1.13 1994/11/08 13:30:50 a904209
# 2.0 release
#
# Revision 1.12 1994/11/04 13:32:31 a904209
# 1.99.1 - Change configure stuff
#
# Revision 1.11 1994/11/02 10:55:31 a904209
# Add autoconf. Tested on SunOS/Solaris
#
# Revision 1.10 1994/10/04 17:12:50 a904209
# 3rd pre-release
#
# Revision 1.9 1994/10/04 09:08:27 a904209
# Next Patch merge
#
# Revision 1.8 1994/10/03 08:41:47 a904209
# 2nd pre-release
#
# Revision 1.7 1994/09/19 15:48:29 a904209
# Split hplay.c, gdbm dictionary, start of f0 contour, netaudio and HP ports
#
# Revision 1.6 1994/04/15 16:47:37 a904209
# Edits for Solaris2.3 (aka SunOs 5.3)
#
# Revision 1.5 1994/02/24 15:03:05 a904209
# Added contributed linux, NeXT and SGI ports.
#
# Revision 1.4 93/11/18 16:28:56 a904209
# Migrated nsyth.c towards Jon's scheme - merge still incomplete
#
# Revision 1.3 93/11/16 14:32:34 a904209
# Added RCS Ids, partial merge of Jon's new klatt/parwave
#
# Revision 1.2 93/11/16 14:30:48 a904209
# Applied suggested linux patches and added partial SGI support
#
# Revision 1.1 93/11/16 14:26:09 a904209
# Add RCS version control to original posting
#
# First posting of rsynth-0.9.tar.Z

View File

@ -0,0 +1,61 @@
Hopefully most of unix/compiler variant issues should be handled by configure
process. Thus porting issues should reduce (for UNIX-ish machines at least)
to writing the audio driver.
The interface to the driver is defined in hplay.h.
There are three routines:
extern int audio_init PROTO((int argc, char *argv[]));
Do what ever is necessary to initialize audio.
You can process any command line arguments to influence the
behaviour. Use getargs() function to make this easy.
Where it make sense copy options from other drivers e.g. -r for
sample rate.
This routine should also define the global variable samp_rate
to define sample rate to the core synth.
Sample rates in 8 - 12kHz range work best due to as yet unresolved
problems with some of the digital filters.
extern void audio_play PROTO((int n, short *data));
Send a block of 'n' 16 bit signed linear samples to the
audio device. If your device requires uLaw samples (US telephone standard)
then l2u.h defines routines which may help (example is Sun driver).
extern void audio_term PROTO((void));
Close down audio device, probably waiting for buffer(s) to empty.
To test your driver (which should be called xxxxplay.c where xxxx describes
the system/hardware), link it to hplay.c, and "make".
The brave/experienced might like to obtain and install GNU autoconf-2.0 (or
latter?) and the GNU m4 it needs (m4-1.3 or latter), and try and get the new
driver auto configured.
When you have written your driver please contact me (nick@ing-simmons.net)
if you are willing to let others use it. Please let me know the output of
config.guess script to assist in merging into autoconf.
------------------------------------------------------------------------
Perfomance issues.
For best speed in DSP is done in "float",
but with strict IEEE-754 compliance turned off where possible.
This is fastest because in general for modern RISC processors
(e.g. SPARCs or at least some of them ...)
- There is no integer multiply hardware
- There IS floating point multiply hardware
- Floating point multiply hardware cannot handle "double" in one pass.
- Some of IEEE-754 options (e.g. denormals) are handled via software traps.
Modern x86 (Athlon/P4 do okay with float as well.)
The computations in opsynth.c should dominate the cpu requirements
of the other levels.

View File

@ -0,0 +1,233 @@
This is a text to speech system produced by integrating various pieces
of code and tables of data, which are all (I believe) suitable
for use in OpenSource projects.
The files in this distribution are either under GPL or LGPL.
For best quality it is highly desirable to use one of the dictionaries
suggested below.
The uses GNU autoconf to build a configure script.
The generic install instructions are in INSTALL, but basically
it works like this :
configure
make
make check
say --help
say Something of your choice
make -n install # see what it is going to do
make install # copy program(s) to /usr/local/bin
configure --help and INSTALL file explain configure options
which may help.
To allow the package to be built when installer cannot install the
GNU gdbm package in the "normal" place you can specify a pathname
to the gdbm source directory as follows :
configure --with-gdbm=<path-to-gdbm>
e.g.
configure --with-gdbm=$HOME/gdbm
Currently there are the following drivers that are actively
maintained by me:
1. Linux - ALSA or OSS
OSS driver will probably work on netbsd/freebsd etc.
configure should sort this out.
2. Windows - I will be supporting it, but it may not work
in this version.
3. Any machine for which a nas/netaudio port exists.
And for which configure can find the include files and libraries.
(Nas "net audio server" does for audio what X11 does for graphics.)
There are also drivers from the really old rsynth code
which are still there:
* Sun SPARCStations - written & tested by me (when at TI)
on SunOS4.1.3 and Solaris2.3
* NeXT
* SGI - this built on "mips-sgi-irix4.0.5H"
* HPUX
Dictionaries:
Dictionaries convert words in "text" to phonemes in "arpabet"
symbols. The arpabet symbols are then "expanded" into an ASCII
representation of the IPA.
The IPA representation is SAMPA, as defined by J C Wells at UCL see:
http://www.phon.ucl.ac.uk/home/sampa/home.htm
Dictionary databases can be built from either of two ftp'able
sources:
1. The Carnegie Mellon Pronouncing Dictionary [cmudict.0.1] is Copyright
1993 by Carnegie Mellon University. Use of this dictionary, for any
research or commercial purpose, is completely unrestricted. If you
make use of or redistribute this material, we would appreciate
acknowlegement of its origin.
ftp://ftp.cs.cmu.edu/project/fgdata/dict
Latest seems to be cmudict.0.6.gz
2. "beep" from
ftp://svr-ftp.eng.cam.ac.uk/pub/comp.speech/dictionaries
Latest seems to be beep-1.0.tar.gz
This is a direct desendant of CUVOLAD (british pronounciation)
(as used by previous releases of rsynth), and so
has a more restrictive copyright than CMU dictionary.
dict.c looks for bDict.db by default. b is for british e.g. beep
I use aDict.db for CMU (american) dictionary.
You can then :
say -d a schedule # sked...
say -d b schedule # shed...
It is simplest to obtain dictionaries prior to configuring the
package and tell it where the source are at configure time:
configure --with-aDict=../dict/cmudict.0.6 --with-bDict=../dict/beep-1.0
If you have already built/installed the package you can
gdbm from it as follows:
mkdictdb main-dictionary-file bDict.db
mv bDict.db /usr/local/lib
Expect a few messages from mkdictdb about words it does not like
in either dictionary.
It should not be too hard to port it to other hardware. For a discussion of
these issues see PORTING.
Use say --help to get a list of command line options.
There is an experimental hook to allow you to "say" .pho files intended
for MBrola diphone synth. This is used to provide a hacky back-end
for Festival.
Projects:
Plan is to pre-analyze the dictionaries and produce better letter
to sound rules and smaller exception dictionaries.
Add more of IPA repertiore so that synth can attempt more languages.
Improve quality.
The components (top down ) :
saymain.c
C main() function.
Initializes lower layers and then converts words from
command line or "stdin" to phonemes.
say.c / say.h
Some "normalization" of the text is performed, in particular
numbers can be represented as sequences of digits.
dict.c / dict.h
As of this release uses a GNU "gdbm" database which has been
pre-loaded with a pronounciation dictionary.
text.c / english.c / text.h
An implementation of US Naval Research Laboratory rules
for converting english (american?) text to phonemes.
Based on the version on the comp.speech archives, main changes
were in the encoding of the phonemes from the so called "arpabet"
to a more concise form used in the above dictionary.
This form (which is nmemonic if you know the International Phonetic
Alphabet), is described in the dictionary documentation. It is
also very close to that described in the postings by Evan Kirshenbaum
(evan@hplerk.hpl.hp.com) to sci.lang and alt.usage.english. (The
differences are in the vowels and are probably due to the differences
between Britsh and American english).
saynum.c
Code for "saying" numbers derived from same source as above.
It has been modified to call the higher level routines recursively
rather producing phonemes directly. This will allow any systematic
changes (e.g. British vs American switch) to affect numbers without
having to change this module.
holmes.c / holmes.h / elements.c / elements.def
My implementation of a phoneme to "vocal tract parameters" system
described by Holmes et. al. [1]
The original used an Analogue Hardware synthesizer.
opsynth.c / rsynth.h
My re-implementation of the "Klatt" synthesizer, described
in Klatt [2].
hplay.c / hplay.h
hplay.h describes a common interface.
hplay.c is a link to play/xxxplay.c
Acknowledgements :
Particular thanks to
Tony Robinson ajr@eng.cam.ac.uk
for providing FTP site for alpha testing, and telnet access to a
variety of machines.
Many thanks to
Axel Belinfante Axel.Belinfante@cs.utwente.nl (World Wide Web)
Jon Iles J.P.Iles@cs.bham.ac.uk
Rob Hooft hooft@EMBL-Heidelberg.de (linux stuff)
Thierry Excoffier exco@ligiahp3.univ-lyon1.fr (playpipe for hpux)
Markus Gyger mgyger@itr.ch (HPUX port)
Ben Stuyts ben@stuyts.nl (NeXT port)
Stephen Hocking <sysseh@devetir.qld.gov.au> (Preliminary Netaudio port)
Greg Renda <greg@ncd.com> (Netaudio cleanup)
Tracey Bernath <bernath@bnr.ca> (Netaudio testing)
"Tom Benoist" <ben@ifx.com> (SGI Port)
Andrew Anselmo <anselmo@ERXSG.rl.plh.af.mil> (SGI testing)
Mark Hanning-Lee <markhl@iris-355.jpl.nasa.gov> (SGI testing)
Cornelis van der Laan <nils@ims.uni-stuttgart.de> (freebsd)
for assisting me in puting this package together.
References :
[1] Holmes J. N., Mattingly I, and Shearme J. (1964)
"Speech Synthesis by Rule" , Language Speech 7, 127-143
[2] Dennis H. Klatt (1980)
"Software for a Cascade/Parallel Formant Synthesizer",
J. Acoust. Soc. Am. 67(3), March 1980.

View File

@ -0,0 +1,21 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
char *Revision = "Revision: 3.0.0";
char *say_ident = "@(#)say 3.0.1 2001/04/17"; /* so 'what' works */

View File

@ -0,0 +1,10 @@
package Rsynth::Audio;
use XSLoader;
our $VERSION = '0.01';
use Audio::Data ();
XSLoader::load "Rsynth::Audio";
1;
__END__

View File

@ -0,0 +1,156 @@
/*
Copyright (c) 1996, 2001 Nick Ing-Simmons. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
*/
#define PERL_NO_GET_CONTEXT
#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>
#include "Audio.m"
AudioVtab *AudioVptr;
#include "rsynth.h"
#include "english.h"
lang_t *lang = &English;
static void *
Rsynth_sample(void *user_data,float sample,unsigned nsamp, rsynth_t *rsynth)
{
dTHX;
Audio *au = (Audio *) user_data;
float *p = Audio_more(aTHX_ au,1);
/* FIXME - avoid this divide my adjusting gain on create */
*p = sample/32768;
return user_data;
}
static Elm_t *
SVtoElm(pTHX_ SV *sv)
{
if (sv_isobject(sv) && SvTYPE(SvRV(sv)) == SVt_PVHV)
{
HV *hv = (HV *) SvRV(sv);
SV **svp = hv_fetch(hv,"idx",3,0);
if (svp)
{
Elm_t *elm = &Elements[SvIV(*svp)];
return elm;
}
}
croak("%_ is not an Element",sv);
return NULL;
}
MODULE = Rsynth::Audio PACKAGE = Rsynth::Element PREFIX = elm_
void
elm_update(SV *sv)
CODE:
{
if (sv_isobject(sv) && SvTYPE(SvRV(sv)) == SVt_PVHV)
{
HV *hv = (HV *) SvRV(sv);
SV **svp = hv_fetch(hv,"idx",3,0);
if (svp)
{
Elm_t *elm = &Elements[SvIV(*svp)];
unsigned p;
for (p = 0; p < nEparm; p++)
{
char *pname = Ep_name[p];
svp = hv_fetch(hv,pname,strlen(pname),0);
if (svp)
{
if (SvROK(*svp) && SvTYPE(SvRV(*svp)) == SVt_PVAV)
{
AV *av = (AV *) SvRV(*svp);
if (av_len(av) != 4)
{
croak("%_->{%s} has %d values",sv,pname,av_len(av)+1);
}
svp = av_fetch(av, 0, 0);
if (svp)
{
elm->p[p].stdy = (float) SvNV(*svp);
}
svp = av_fetch(av, 1, 0);
if (svp)
{
elm->p[p].prop = (char) SvIV(*svp);
}
svp = av_fetch(av, 2, 0);
if (svp)
{
elm->p[p].ed = (char) SvIV(*svp);
}
svp = av_fetch(av, 3, 0);
if (svp)
{
elm->p[p].id = (char) SvIV(*svp);
}
svp = av_fetch(av, 4, 0);
if (svp)
{
elm->p[p].rk = (char) SvIV(*svp);
}
}
else
{
croak("%_->{%s} isn't an array",sv,pname);
}
}
}
XSRETURN(0);
}
}
croak("%_ is not an Element",sv);
XSRETURN(0);
}
MODULE = Rsynth::Audio PACKAGE = Rsynth::Audio PREFIX = rsynth_
PROTOTYPES: ENABLE
rsynth_t *
rsynth_new(char *Class, Audio *au, float F0Hz = 133.3, float ms_per_frame = 10.0, long gain = 57)
CODE:
{
speaker_t *speaker = rsynth_speaker(F0Hz, gain, Elements);
RETVAL = rsynth_init(au->rate,ms_per_frame, speaker,Rsynth_sample,0,au);
}
OUTPUT:
RETVAL
void
rsynth_interpolate(rsynth_t *rsynth,SV *elm,SV *f0ref = 0)
CODE:
{
STRLEN len = 0;
unsigned char *eptr = (unsigned char *) SvPV(elm,len);
float *f0 = 0;
unsigned nf0 = 0;
rsynth_flush(rsynth,rsynth_interpolate(rsynth, eptr, len, f0, nf0));
XSRETURN(0);
}
void
rsynth_pho(rsynth_t *rsynth, char *file, int dodur = 1, char *phones = "sampa")
void
rsynth_phones(rsynth_t *rsynth, char *s, int len = strlen(s))
void
say_string(rsynth_t *rsynth, char *s)
void
rsynth_term(rsynth_t *rsynth)
BOOT:
{
AudioVptr = (AudioVtab *) SvIV(perl_get_sv("Audio::Data::AudioVtab",0));
}

View File

@ -0,0 +1,219 @@
package Rsynth::Elements;
use strict;
use Exporter;
use base 'Exporter';
use vars qw(@EXPORT %elem %parms @pNames @eNames);
@EXPORT = qw(read_elements write_elements write_features feature
height front round features
%elem %parms @pNames @eNames);
use Getopt::Std;
# use Sampa ();
my %opt;
getopts('c',\%opt);
my %height = ( hgh => 1.0, lax => 0.8, smh => 0.67, mdl => 0.5, lmd => 0.33, low => 0 );
my %front = ( fnt => 1.0, cnt => 0.5, bck => 0);
my %round = ( unr => 0, rnd => 1);
my %unit = (f1 => 10, f2 => 20, f3 => 100);
sub rank
{
my $name = shift;
my $hash = shift;
my $e = shift;
my $f = $e->{features};
my @h = grep { exists $hash->{$_} } keys %$f;
die "No $name : ".$e->{sampa}.' '.join(' ',keys %$f).' : '.join(' ',keys %$hash) unless @h == 1;
return $hash->{$h[0]};
}
sub height { rank(height => \%height, @_) }
sub front { rank(front => \%front, @_) }
sub round { rank(round => \%round, @_) }
my %fset;
my @fNames;
my $file = "Elements.def";
sub NULL () {undef}
sub feature
{
my $f = shift;
unless (exists $fset{$f})
{
$fset{$f} = @fNames;
push(@fNames,$f);
}
}
sub features
{
my $e = shift;
return sort { $fset{$a} <=> $fset{$b} } keys %{$e->{features}};
}
foreach my $h (\%round,\%height,\%front)
{
foreach my $f ( sort { $h->{$a} <=> $h->{$b} } keys %$h )
{
feature($f);
}
}
feature('vwl');
feature('dip');
sub read_elements
{
$file = shift if @_;
open(my $eh,$file) || die "Cannot read $file:$!";
my $name;
while(<$eh>)
{
if (/^\{(".*",\s*.*),\s*(\/\*.*\*\/)?\s*$/)
{
my %args;
my (@args) = split(/\s*,\s*/,$1);
my @feat = split(/\|/,pop(@args));
my %feat;
foreach my $f (@feat)
{
next unless $f =~ /^[a-z]/i;
$feat{$f} = 1;
feature($f);
}
($name,@args) = map(eval($_),@args);
push(@args,\%feat);
foreach my $parm (qw(rk du ud unicode sampa features))
{
$args{$parm} = shift(@args);
$parms{$parm} = $args{$parm};
}
utf8::decode($args{unicode});
$elem{$name} = bless {%args,name => $name, idx => scalar(@eNames)},'Rsynth::Element';
push(@eNames,$name);
}
elsif (/^\s*\{\s*(.*?)\s*\},?\s*\/\*\s*(\w+)/)
{
my $parm = $2;
my @val = split(/\s*,\s*/,$1);
if ($parm =~ /^a/)
{
$val[0] = 0 if ($val[0] < 0);
$val[0] = sprintf("%+6.1f",$val[0]);
}
unless (exists $parms{$parm})
{
$parms{$parm} = $val[0];
push(@pNames,$parm);
}
$elem{$name}{$parm} = [@val];
}
}
my $nf = @fNames;
# warn "$nf features: @fNames\n";
close($eh);
}
sub write_features
{
for (my $i=0; $i < @fNames; $i++)
{
my $val = ($i) ? (1 << ($i-1)) : 0;
printf "#define $fNames[$i] 0x%08x\n",$val;
}
}
sub write_elements
{
my $fh = shift;
unless (ref $fh)
{
open(my $tmp,">$fh") || die "Cannot open $fh:$!";
$fh = $tmp;
}
binmode($fh,":utf8");
my $save = select $fh;
print $fh <<'END';
/*
Copyright (c) 1994,2001-2004 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
END
my @ename = @eNames;
while (@ename)
{
my $name = shift(@ename);
my @feat = features($elem{$name});
my $sampa = $elem{$name}{sampa};
my @args = qw(rk du ud);
@args = @{$elem{$name}}{@args};
my $uni = $elem{$name}{unicode};
utf8::encode($elem{$name}{unicode});
foreach my $k (qw(unicode sampa))
{
my $v = $elem{$name}{$k};
if (defined $v)
{
$v =~ s#([\\"])#\\$1#g;
$v =~ s/([^\x20-\x7e])/sprintf("\\%03o",ord($1))/eg;
}
$v = (defined $v) ? qq["$v"] : 'NULL';
push(@args,$v);
}
push(@args,(@feat) ? join('|',@feat) : 0);
printf qq({"$name", %3d,%2d,%2d,%s,%s,%s, /* [$uni] */\n {\n),@args;
my @pname = @pNames;
while (@pname)
{
my $parm = shift(@pname);
my @vals = @{$elem{$name}{$parm}};
if ($elem{$name}{features}{vwl} && exists $unit{$parm})
{
my $u = $unit{$parm};
$vals[0] = int($vals[0]/$u+0.5)*$u;
}
printf " {%6g,%4d,%3d,%3d,%3d}%s /* %-3s */\n",
@vals,((@pname) ? ',' : ' '),$parm;
}
printf " }\n}%s\n",((@ename) ? ",\n" : ' ');
}
select $save;
}
{
package Rsynth::Phones;
our %phtoelm;
do "Rsynth/phtoelm.def";
our @U = '@U';
sub NULL () {return ()};
sub COMMENT {}
sub enter
{
my ($sampa,@seq) = @_;
$phtoelm{$sampa} = [@seq];
}
}
1;

View File

@ -0,0 +1,33 @@
use ExtUtils::MakeMaker;
use File::Basename;
my $audio = ".../Audio";
eval "require Audio::Data";
unless ($@)
{
$audio = dirname($INC{"Audio/Data.pm"});
}
else
{
warn "_Need_ Audio::Data:$@"
}
WriteMakefile(
NAME => "Rsynth::Audio",
MYEXTLIB => "librsynth.a",
INC => "-I.. -I$audio",
TYPEMAPS => ["typemap","$audio/typemap"],
VERSION_FROM => "Audio.pm",
PREREQ_PM => { 'Audio::Data' => 1.000 },
PREREQ_FATAL => 1,
);
package MY;
sub post_initialize
{
my ($self) = @_;
my ($ret) = '';
$self->{PM}->{'phtoelm.def'} = $self->catfile('$(INST_LIBDIR)','phtoelm.def');
return $ret;
}

View File

@ -0,0 +1,111 @@
COMMENT("We are using COMMENT() so this file can be perl or C");
COMMENT("Silences");
enter(".","END",NULL); COMMENT("This is 1st non-aware upper layer can inject");
enter(" ","Q",NULL); COMMENT("This is 1st non-aware upper layer can inject");
enter("_","Q",NULL); COMMENT("'mbrola' compatibility");
enter("#","Q",NULL); COMMENT("'mbrola' compatibility");
COMMENT("Affricates (compounds) - put before singles to aid lookup");
enter("tS","T","CH",NULL);
enter("dZ","D","DY","DZ","ZH","ZH",NULL);
COMMENT("Plosives");
enter("p","P","PY","PZ",NULL);
enter("b","B","BY","BZ",NULL);
enter("t","T","TY","TZ",NULL);
enter("d","D","DY","DZ",NULL);
enter("k","K","KY","KZ",NULL);
enter("g","G","GY","GZ",NULL);
enter("?","QQ",NULL); COMMENT("stop-ness - not quite glottal stop");
COMMENT("Nasals");
enter("m","M",NULL);
enter("n","N",NULL);
enter("N","NG",NULL);
COMMENT("Trills and flaps");
enter("4","DT",NULL);
enter("rr","R","QQ","R",NULL);
enter("R","RX",NULL);
enter("`","RX",NULL); COMMENT("rhoticity diacritic - fallback");
COMMENT("Fricatives");
enter("f","F",NULL);
enter("v","V",NULL);
enter("T","TH",NULL);
enter("D","DH",NULL);
enter("s","S",NULL);
enter("z","Z",NULL);
enter("S","SH",NULL);
enter("Z","ZH",NULL);
enter("x","X",NULL);
enter("h","H",NULL);
COMMENT("Latterals");
enter("l","L",NULL);
enter("K","HL",NULL);
enter("5","LL",NULL);
COMMENT("Approximants");
enter("w","W",NULL);
enter("j","Y",NULL);
enter("r","R",NULL);
COMMENT("Dipthongs");
enter("eI","AI","I",NULL);
enter("aI","IE","I",NULL);
enter("OI","OI","I",NULL);
enter("aU","AI","OV",NULL);
enter("@U","OA","OV",NULL);
enter("I@","IA","IB",NULL);
enter("e@","AIR","IB",NULL);
enter("U@","OOR","IB",NULL);
enter("O@","OI","IB",NULL);
enter("oU","o","OV",NULL);
COMMENT("close vowels");
enter("i","EE",NULL);
enter("y","YY",NULL);
enter("1","EY",NULL);
enter("}","JU",NULL);
enter("M","UW",NULL);
enter("u","UU",NULL);
COMMENT("lax vowels");
enter("I","I",NULL);
enter("Y","IU",NULL);
enter("U","OO",NULL);
COMMENT("close-mid vowels");
enter("e","e",NULL);
enter("e~","eN",NULL);
enter("2","EU",NULL);
enter("@\\","Ur",NULL);
enter("8","UR",NULL);
enter("7","UE",NULL);
enter("o","o",NULL);
enter("o~","oN",NULL);
COMMENT("schwa");
enter("@","A",NULL);
COMMENT("open-mid vowels");
enter("E","EH",NULL);
enter("9","oe",NULL);
enter("9~","oeN",NULL);
enter("3","ER",NULL);
enter("3\\","Er",NULL);
enter("V","U",NULL);
enter("O","AW",NULL);
enter("{","AA",NULL);
enter("6","AA",NULL);
COMMENT("open vowels");
enter("a", "a",NULL);
enter("a~", "aN",NULL);
enter("&", "OE",NULL);
enter("A","AR",NULL);
enter("Q","O",NULL);

View File

@ -0,0 +1,28 @@
use Test::More( tests => 42 );
BEGIN { use_ok("Rsynth::Audio") }
BEGIN { use_ok("Rsynth::Elements") }
use Audio::Play;
read_elements("../Elements.def");
my $elm = '';
# Next line isn't general - all phones happen to be single SAMPA chars
for my $ph (split(//,'sInT.frQm.elIm@nts'))
{
my $list = $Rsynth::Phones::phtoelm{$ph};
ok(defined($list),"Mapping for $ph");
foreach my $ename (@{$list})
{
my $e = $elem{$ename};
ok(defined($e),"Element for $ename");
$elm .= chr($e->{idx});
$elm .= chr($e->{du});
}
}
my $au = Audio::Data->new(rate => 11025);
my $synth = Rsynth::Audio->new($au);
is(ref($synth),"Rsynth::Audio","Correct class");
$synth->interpolate($elm);
ok($au->duration > 1.0,"Created some samples");
my $svr = Audio::Play->new;
$svr->play($au) if $svr;

View File

@ -0,0 +1,16 @@
use Test::More( tests => 5 );
BEGIN { use_ok("Rsynth::Audio") }
use Audio::Play;
my $au = Audio::Data->new(rate => 11025);
my $synth = Rsynth::Audio->new($au);
is(ref($synth),"Rsynth::Audio","Correct class");
$synth->phones("sInTIsIs frQm p3l");
# print "# ",$au->duration,"\n";
ok($au->duration > 1.0,"Created some samples");
my $svr = Audio::Play->new;
$svr->play($au) if $svr;
$au->length(0);
is($au->duration,0,"Cleared samples");
$synth->say_string("Plain text too!");
ok($au->duration > 1.0,"Created some samples");
$svr->play($au) if $svr;

View File

@ -0,0 +1,22 @@
TYPEMAP
rsynth_t * T_RSYNTH
Elm_t * T_ELM
INPUT
T_RSYNTH
if (sv_isobject($arg)) {
$var = ($type) SvIV((SV*)SvRV($arg));
}
else
croak(\"$var is not an object\")
T_ELM
$var = ($type) SVtoElm(aTHX_ $arg);
OUTPUT
T_RSYNTH
sv_setref_iv($arg, (Class) ? Class : \"${Package}\", (IV) $var);
T_ELM
ElmToSV(aTHX_ $arg, $var);

View File

@ -0,0 +1,28 @@
package Sampa;
use Exporter;
use base qw(Exporter);
@EXPORT_OK = qw(%unicode %description %example);
open(my $sampa,"sampa.htm") || die "Cannot open sampa.htm:$!";
while (<$sampa>)
{
my @td = m!<td[^>]*>([^<>]*)</td>!g;
if (@td >= 5)
{
my ($sampa,$IPA,$hex,$dec,$desc,$example) = @td;
die "$IPA != $dec" unless $IPA =~ /&#$dec;/;
die "0x$hex != $dec" unless hex($hex) == $dec;
$sampa =~ s/&amp;/&/;
$unicode{$sampa} = chr($dec);
$description{$sampa} = $desc;
$example{$sampa} = $example;
# warn "'$sampa' => $dec\n";
}
elsif (/<td>/)
{
warn "Skip [@td]:$_";
}
}
1;
__END__

View File

@ -0,0 +1,241 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include <stdio.h>
#include <fcntl.h>
#include "useconfig.h"
#include "getargs.h"
#include "l2u.h"
#include "hplay.h"
#include "aufile.h"
#ifndef HAVE_FTRUNCATE
#ifdef HAVE_CHSIZE
#define ftruncate(fd,size) chsize(fd,size)
#else
#define ftruncate(fd,size) /* oh well */
#endif
#endif
static const short endian = 0x1234;
#define SUN_MAGIC 0x2e736e64 /* Really '.snd' */
#define SUN_HDRSIZE 24 /* Size of minimal header */
#define SUN_UNSPEC ((unsigned)(~0)) /* Unspecified data size */
#define SUN_ULAW 1 /* u-law encoding */
#define SUN_LIN_8 2 /* Linear 8 bits */
#define SUN_LIN_16 3 /* Linear 16 bits */
file_write_p file_write = NULL;
file_term_p file_term = NULL;
static char *linear_file;
static char *au_file;
static int au_fd = -1; /* file descriptor for .au ulaw file */
static int linear_fd = -1;
static unsigned au_encoding = SUN_ULAW;
static unsigned au_size = 0;
static void wblong(int fd, unsigned long x);
static void
wblong(int fd, long unsigned int x)
{
int i;
for (i = 24; i >= 0; i -= 8)
{
char byte = (char) ((x >> i) & 0xFF);
write(fd, &byte, 1);
}
}
extern void au_header(int fd,unsigned enc,unsigned rate,unsigned size,char *comment);
void
au_header(int fd, unsigned int enc, unsigned int rate, unsigned int size, char *comment)
{
if (!comment)
comment = "";
wblong(fd, SUN_MAGIC);
wblong(fd, SUN_HDRSIZE + strlen(comment));
wblong(fd, size);
wblong(fd, enc);
wblong(fd, rate);
wblong(fd, 1); /* channels */
write(fd, comment, strlen(comment));
}
static void aufile_write(int n,short *data);
static void
aufile_write(int n, short int *data)
{
if (n > 0)
{
if (linear_fd >= 0)
{
unsigned size = n * sizeof(short);
if (write(linear_fd, data, n * sizeof(short)) != (int) size)
perror("write");
}
if (au_fd >= 0)
{
if (au_encoding == SUN_LIN_16)
{
unsigned size = n * sizeof(short);
if (*((const char *)(&endian)) == 0x12)
{
if (write(au_fd, data, size) != (int) size)
perror("write");
else
au_size += size;
}
else
{
int i;
for (i=0; i < n; i++)
{
if (write(au_fd, ((char *)data)+1, 1) != 1)
perror("write");
if (write(au_fd, ((char *)data)+0, 1) != 1)
perror("write");
au_size += 2;
data++;
}
}
}
else if (au_encoding == SUN_ULAW)
{
unsigned char *plabuf = (unsigned char *) malloc(n);
if (plabuf)
{
unsigned char *p = plabuf;
unsigned char *e = p + n;
while (p < e)
{
*p++ = short2ulaw(*data++);
}
if (write(au_fd, plabuf, n) != n)
perror(au_file);
else
au_size += n;
free(plabuf);
}
else
{
fprintf(stderr, "%s : No memory for ulaw data\n", program);
}
}
else
{
abort();
}
}
}
}
static void aufile_term(void);
static void
aufile_term(void)
{
/* Finish ulaw file */
if (au_fd >= 0)
{
off_t here = lseek(au_fd, 0L, SEEK_CUR);
if (here >= 0)
{
/* can seek this file - truncate it */
ftruncate(au_fd, here);
/* Now go back and overwite header with actual size */
if (lseek(au_fd, 8L, SEEK_SET) == 8)
{
wblong(au_fd, au_size);
}
}
if (au_fd != 1)
close(au_fd);
au_fd = -1;
}
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
if (linear_fd != 1)
close(linear_fd);
linear_fd = -1;
}
}
int
file_init(int argc, char **argv)
{
argc = getargs("File output", argc, argv,
"l", "", &linear_file, "Raw 16-bit linear pathname",
"o", "", &au_file, "Sun/Next audio file name",
NULL);
if (help_only)
return argc;
if (au_file)
{
if (strcmp(au_file, "-") == 0)
{
au_fd = 1; /* stdout */
}
else
{
au_fd = open(au_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (au_fd < 0)
perror(au_file);
}
if (au_fd >= 0)
{
if (samp_rate > 8000)
au_encoding = SUN_LIN_16;
else
au_encoding = SUN_ULAW;
au_header(au_fd, au_encoding, samp_rate, SUN_UNSPEC, "");
au_size = 0;
}
}
if (linear_file)
{
if (strcmp(linear_file, "-") == 0)
{
linear_fd = 1 /* stdout */ ;
}
else
{
linear_fd = open(linear_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (linear_fd < 0)
perror(linear_file);
}
}
if (au_fd >= 0 || linear_fd >= 0)
{
file_write = aufile_write;
file_term = aufile_term;
}
return argc;
}

View File

@ -0,0 +1,6 @@
extern int file_init(int argc,char *argv[]);
typedef void (*file_write_p)(int n, short *data);
typedef void (*file_term_p)(void);
extern file_write_p file_write;
extern file_term_p file_term;

View File

@ -0,0 +1,272 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include "charset.h"
void
init_locale(void)
{
char *s = setlocale(LC_ALL, "");
if (s)
{
s = setlocale(LC_CTYPE, NULL);
if (s && !strcmp(s, "C"))
{
s = setlocale(LC_CTYPE, "iso_8859_1");
if (!s)
s = setlocale(LC_CTYPE, "C");
}
}
}
int
deaccent(int ch)
{
/* Cast to char (type of litterals) as signedness may differ */
switch ((char)ch)
{
case 'à':
case 'á':
case 'â':
case 'ã':
case 'ä':
case 'å':
return 'a';
case 'ç':
return 'c';
break;
case 'è':
case 'é':
case 'ê':
case 'ë':
return 'e';
case 'ì':
case 'í':
case 'î':
case 'ï':
return 'i';
case 'ñ':
return 'n';
case 'ò':
case 'ó':
case 'ô':
case 'õ':
case 'ö':
return 'o';
case 'ù':
case 'ú':
case 'û':
case 'ü':
return 'u';
case 'ý':
case 'ÿ':
return 'y';
case 'À':
case 'Á':
case 'Â':
case 'Ã':
case 'Ä':
case 'Å':
return 'A';
case 'Ç':
return 'C';
case 'È':
case 'É':
case 'Ê':
case 'Ë':
return 'E';
case 'Ì':
case 'Í':
case 'Î':
case 'Ï':
return 'I';
case 'Ñ':
return 'N';
case 'Ò':
case 'Ó':
case 'Ô':
case 'Õ':
case 'Ö':
return 'O';
case 'Ù':
case 'Ú':
case 'Û':
case 'Ü':
return 'U';
case 'Ý':
return 'Y';
}
if ((ch & 0xFF) > 0x7F)
abort();
return ch;
}
int
accent(int a, int c)
{
if (a && c)
{
switch (a)
{
case '<':
case ',':
switch (c)
{
case 'c':
return 'ç';
case 'C':
return 'Ç';
default:
return c;
}
case '~':
switch (c)
{
case 'n':
return 'ñ';
case 'a':
return 'ã';
case 'o':
return 'õ';
case 'N':
return 'Ñ';
case 'A':
return 'Ã';
case 'O':
return 'Õ';
default:
return c;
}
case '\'':
switch (c)
{
case 'a':
return 'á';
case 'e':
return 'é';
case 'i':
return 'í';
case 'o':
return 'ó';
case 'u':
return 'ú';
case 'y':
return 'ý';
case 'A':
return 'Á';
case 'E':
return 'É';
case 'I':
return 'Í';
case 'O':
return 'Ó';
case 'U':
return 'Ú';
case 'Y':
return 'Ý';
default:
return c;
}
case '`':
switch (c)
{
case 'a':
return 'à';
case 'e':
return 'è';
case 'i':
return 'ì';
case 'o':
return 'ò';
case 'u':
return 'ù';
case 'A':
return 'À';
case 'E':
return 'È';
case 'I':
return 'Ì';
case 'O':
return 'Ò';
case 'U':
return 'Ù';
default:
return c;
}
case '^':
switch (c)
{
case 'a':
return 'â';
case 'e':
return 'ê';
case 'i':
return 'î';
case 'o':
return 'ô';
case 'u':
return 'û';
case 'A':
return 'Â';
case 'E':
return 'Ê';
case 'I':
return 'Î';
case 'O':
return 'Ô';
case 'U':
return 'Û';
default:
return c;
}
case '"':
switch (c)
{
case 'a':
return 'ä';
case 'e':
return 'ë';
case 'i':
return 'ï';
case 'o':
return 'ö';
case 'u':
return 'ü';
case 'y':
return 'ÿ';
case 'A':
return 'Ä';
case 'E':
return 'Ë';
case 'I':
return 'Ï';
case 'O':
return 'Ö';
case 'U':
return 'Ü';
default:
return c;
}
}
}
return c;
}

View File

@ -0,0 +1,18 @@
#ifndef CHARSET_H
#define CHARSET_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAS_NL_LANGINFO
#include <langinfo.h>
#endif
extern void init_locale(void);
extern int deaccent(int ch);
extern int accent(int a, int c);
#ifdef __cplusplus
}
#endif
#endif /* CHARSET_H */

1453
stella/src/emucore/rsynth/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,170 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Old ALSA API without pointers */
/* #undef ALSA_PCM_OLD_HW_PARAMS_API */
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
#define HAVE_ALSA_ASOUNDLIB_H 1
/* Define to 1 if you have the <audio/audiolib.h> header file. */
/* #undef HAVE_AUDIO_AUDIOLIB_H */
/* Define to 1 if you have the `chsize' function. */
/* #undef HAVE_CHSIZE */
/* Define to 1 if you have the <db.h> header file. */
#define HAVE_DB_H 1
/* Found /dev/audio */
/* #undef HAVE_DEV_AUDIO */
/* Found /dev/dsp */
/* #undef HAVE_DEV_DSP */
/* Found /dev/dspW */
/* #undef HAVE_DEV_DSPW */
/* Found /dev/sbdsp */
/* #undef HAVE_DEV_SBDSP */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the <gdbm.h> header file. */
#define HAVE_GDBM_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `asound' library (-lasound). */
#define HAVE_LIBASOUND 1
/* Define to 1 if you have the `audio' library (-laudio). */
/* #undef HAVE_LIBAUDIO */
/* Define to 1 if you have the <libc.h> header file. */
/* #undef HAVE_LIBC_H */
/* Define to 1 if you have the `db' library (-ldb). */
#define HAVE_LIBDB 1
/* Define to 1 if you have the `gdbm' library (-lgdbm). */
#define HAVE_LIBGDBM 1
/* Define to 1 if you have the `m' library (-lm). */
#define HAVE_LIBM 1
/* Found -lX11 */
#define HAVE_LIBX11 1
/* Found -lXt */
#define HAVE_LIBXT 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the `memcpy' function. */
/* #undef HAVE_MEMCPY */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Found NAS -laudio */
/* #undef HAVE_NAS */
/* Sun hack */
/* #undef HAVE_NONSTDARITH */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
/* #undef HAVE_STRCHR */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sun/audioio.h> header file. */
/* #undef HAVE_SUN_AUDIOIO_H */
/* Define to 1 if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/ioccom.h> header file. */
/* #undef HAVE_SYS_IOCCOM_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/soundcard.h> header file. */
/* #undef HAVE_SYS_SOUNDCARD_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `truncate' function. */
#define HAVE_TRUNCATE 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* No float prototype */
/* #undef NOPROTOFLOAT */
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* New ALSA API passes pointers to parms */
#define RSYNTH_ALSA_PCM_POINTER_PARAMS_API 1
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef off_t */

View File

@ -0,0 +1,169 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Old ALSA API without pointers */
#undef ALSA_PCM_OLD_HW_PARAMS_API
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
#undef HAVE_ALSA_ASOUNDLIB_H
/* Define to 1 if you have the <audio/audiolib.h> header file. */
#undef HAVE_AUDIO_AUDIOLIB_H
/* Define to 1 if you have the `chsize' function. */
#undef HAVE_CHSIZE
/* Define to 1 if you have the <db.h> header file. */
#undef HAVE_DB_H
/* Found /dev/audio */
#undef HAVE_DEV_AUDIO
/* Found /dev/dsp */
#undef HAVE_DEV_DSP
/* Found /dev/dspW */
#undef HAVE_DEV_DSPW
/* Found /dev/sbdsp */
#undef HAVE_DEV_SBDSP
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
/* Define to 1 if you have the <gdbm.h> header file. */
#undef HAVE_GDBM_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `asound' library (-lasound). */
#undef HAVE_LIBASOUND
/* Define to 1 if you have the `audio' library (-laudio). */
#undef HAVE_LIBAUDIO
/* Define to 1 if you have the <libc.h> header file. */
#undef HAVE_LIBC_H
/* Define to 1 if you have the `db' library (-ldb). */
#undef HAVE_LIBDB
/* Define to 1 if you have the `gdbm' library (-lgdbm). */
#undef HAVE_LIBGDBM
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Found -lX11 */
#undef HAVE_LIBX11
/* Found -lXt */
#undef HAVE_LIBXT
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <machine/soundcard.h> header file. */
#undef HAVE_MACHINE_SOUNDCARD_H
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Found NAS -laudio */
#undef HAVE_NAS
/* Sun hack */
#undef HAVE_NONSTDARITH
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sun/audioio.h> header file. */
#undef HAVE_SUN_AUDIOIO_H
/* Define to 1 if you have the <sys/audioio.h> header file. */
#undef HAVE_SYS_AUDIOIO_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/ioccom.h> header file. */
#undef HAVE_SYS_IOCCOM_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the `truncate' function. */
#undef HAVE_TRUNCATE
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* No float prototype */
#undef NOPROTOFLOAT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* New ALSA API passes pointers to parms */
#undef RSYNTH_ALSA_PCM_POINTER_PARAMS_API
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1566
stella/src/emucore/rsynth/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
/*****************************************************************/
/*****************************************************************/
/*** ***/
/*** ***/
/*** Play out a file on the NeXT ***/
/*** ***/
/*** ***/
/*** B. Stuyts 21-feb-94 ***/
/*** ***/
/*** ***/
/*****************************************************************/
/*****************************************************************/
#include <sound/sound.h>
#include <stdio.h>
#include <libc.h>
#include "getargs.h"
#include "hplay.h"
#undef DEBUG
#define SAMP_RATE SND_RATE_CODEC
long samp_rate = SAMP_RATE;
SNDSoundStruct *sound = NULL;
int
audio_init(int argc, char *argv[])
{
int err;
int rate_set = 0;
#ifdef DEBUG
int i;
printf("audio_init: %d\n", argc);
for (i = 0; i < argc; i++)
printf("audio_init arg %d = %s\n", i, argv[i]);
#endif
argc = getargs("NeXT audio",argc, argv,
"r", "%d", &rate_set, "Sample rate",
NULL);
if (help_only)
return argc;
if (rate_set)
samp_rate = rate_set;
err = SNDAlloc(&sound, 1000000, SND_FORMAT_LINEAR_16, samp_rate, 1, 0);
if (err)
{
fprintf(stderr, "audio_init: %s\n", SNDSoundError(err));
exit(1);
}
return argc;
}
void
audio_play(int n, short *data)
{
int err;
#ifdef DEBUG
printf("audio_play: %d words\n", n);
#if 0
printf("audio_play: sound = %ld\n", sound);
printf("audio_play: dataLocation = %ld\n", sound->dataLocation);
printf("audio_play: sum = %ld\n", (char *) sound + sound->dataLocation);
#endif
#endif
if (n > 0)
{
/* Wait for previous sound to finish before changing
fields in sound
*/
err = SNDWait(0);
if (err)
{
fprintf(stderr, "SNDWait: %s\n", SNDSoundError(err));
exit(1);
}
sound->dataSize = n * sizeof(short);
/* Patch from benstn@olivetti.nl (Ben Stuyts)
Thanks to ugubser@avalon.unizh.ch for finding out why the NEXTSTEP
version of rsynth didn't work on Intel systems. As suspected, it was a
byte-order problem.
*/
#if i386
swab((char *) data, (char *) sound + sound->dataLocation, n * sizeof(short));
#else /* i386 */
bcopy(data, (char *) sound + sound->dataLocation, n * sizeof(short));
#endif
err = SNDStartPlaying(sound, 1, 5, 0, 0, 0);
if (err)
{
fprintf(stderr, "audio_play: %s\n", SNDSoundError(err));
exit(1);
}
}
}
void
audio_term()
{
int err;
#ifdef DEBUG
printf("audio_term\n");
#endif
if(!sound)
return;
err = SNDWait(0);
if (err)
{
fprintf(stderr, "audio_play: %s\n", SNDSoundError(err));
exit(1);
}
err = SNDFree(sound);
if (err)
{
fprintf(stderr, "audio_term: %s\n", SNDSoundError(err));
exit(1);
}
}

View File

@ -0,0 +1,209 @@
/*
Copyright (c) 2003 Nick Ing-Simmons.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include "useconfig.h"
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <unistd.h>
// #define ALSA_PCM_OLD_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "l2u.h"
char *pcm_name = "default";
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 11025
long samp_rate = SAMP_RATE;
/* Audio Parameters */
static int linear_fd = -1;
char *prog = "hplay";
static snd_pcm_t *pcm;
static snd_pcm_hw_params_t *hwparams;
static snd_pcm_uframes_t chunk;
static int
audio_open(void)
{
int err;
if ((err = snd_pcm_open(&pcm,pcm_name,SND_PCM_STREAM_PLAYBACK,0)) < 0)
{
fprintf(stderr,"Cannot open %s:%s",pcm_name,snd_strerror(err));
return 0;
}
else
{
unsigned int want = samp_rate;
int dir = 0;
snd_pcm_hw_params_malloc(&hwparams);
snd_pcm_hw_params_any(pcm,hwparams);
/* Check capabilities */
if ((err = snd_pcm_hw_params_set_access(pcm, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{
fprintf(stderr,"Cannot set access %s:%s",pcm_name,snd_strerror(err));
return 0;
}
/* Set sample format */
if ((err=snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S16)) < 0)
{
fprintf(stderr,"Error setting format %s:%s",pcm_name,snd_strerror(err));
return(0);
}
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
want = snd_pcm_hw_params_set_rate_near(pcm, hwparams, want, &dir);
#else
err = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &want, &dir);
#endif
if (dir != 0 || want != samp_rate)
{
fprintf(stderr,"Wanted %ldHz, got %uHz (%d)",samp_rate,want,dir);
samp_rate = want;
}
if ((err=snd_pcm_hw_params_set_channels(pcm, hwparams, 1)) < 0)
{
fprintf(stderr,"Error setting channels %s:%s",pcm_name,snd_strerror(err));
return(0);
}
/* Apply HW parameter settings to */
/* PCM device and prepare device */
if ((err=snd_pcm_hw_params(pcm, hwparams)) < 0)
{
fprintf(stderr,"Error setting parameters %s:%s",pcm_name,snd_strerror(err));
return(0);
}
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
chunk = snd_pcm_hw_params_get_buffer_size (hwparams);
#else
snd_pcm_hw_params_get_buffer_size (hwparams,&chunk);
#endif
return 1;
}
}
int
audio_init(int argc, char *argv[])
{
int rate_set = 0;
int use_audio = 1;
prog = argv[0];
argc = getargs("ALSA Sound driver",argc, argv,
"r", "%d", &rate_set, "Sample rate",
"A", "default", &pcm_name, "Device",
"a", NULL, &use_audio, "Audio enable",
NULL);
if (help_only)
return argc;
if (rate_set)
samp_rate = rate_set;
if (use_audio)
audio_open();
return argc;
}
void
audio_term(void)
{
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
close(linear_fd);
linear_fd = -1;
}
/* Close audio system */
if (pcm)
{
int err = snd_pcm_drain(pcm);
if (err < 0)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err));
}
if ((err = snd_pcm_close(pcm)) < 0)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err));
}
pcm = 0;
}
if (hwparams)
{
snd_pcm_hw_params_free(hwparams);
hwparams = 0;
}
}
void
audio_play(int n, short *data)
{
if (n > 0)
{
if (linear_fd >= 0)
{
if (write(linear_fd, data, n) != n)
perror("write");
}
if (pcm)
{
snd_pcm_sframes_t ret;
while (n > 0)
{
size_t amount = ((size_t) n > chunk) ? chunk : (size_t) n;
while ((ret = snd_pcm_writei(pcm, data, amount)) < 0)
{
/* Pipe may well drain - but harmless as we write
whole words to the pipe
*/
if (ret != -EPIPE)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(ret));
}
snd_pcm_prepare(pcm);
}
n -= ret;
data += ret;
}
}
}
}

View File

@ -0,0 +1,103 @@
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define if you need to in order for stat and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if prototype cannot use a type of float if followed by K&R defn. */
#define NOPROTOFLOAT 1
/* turn off strict IEEE compliance in favour of speed */
/* #undef HAVE_NONSTDARITH */
/* Define if we can find -lX11 */
#define HAVE_LIBX11 1
/* Define if we can find nas -laudio */
/* #define HAVE_NAS 1 */
/* Define if we can find /dev/dsp - linux/FreeBSD */
/* #undef HAVE_DEV_DSP */
/* Define if we can find /dev/sbdsp - linux (older drivers) */
/* #undef HAVE_DEV_SBDSP */
/* Define if you have the memcpy function. */
/* #undef HAVE_MEMCPY */
/* Define if you have the strchr function. */
/* #undef HAVE_STRCHR */
/* Define if you have the <audio/audiolib.h> header file. */
/* #define HAVE_AUDIO_AUDIOLIB_H 1 */
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <libc.h> header file. */
/* #undef HAVE_LIBC_H */
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define if you have the <sun/audioio.h> header file. */
/* #undef HAVE_SUN_AUDIOIO_H */
/* Define if you have the <sys/audioio.h> header file. */
/* #define HAVE_SYS_AUDIOIO_H 1 */
/* Define if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define if you have the <sys/ioccom.h> header file. */
#define HAVE_SYS_IOCCOM_H 1
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/soundcard.h> header file. */
/* #undef HAVE_SYS_SOUNDCARD_H */
/* Define if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <unistd.h> header file. */
/* #define HAVE_UNISTD_H 1 */
/* Define if you have the M library (-lM). */
#define HAVE_LIBM 1
/* Define if you have the audio library (-laudio). */
/* #undef HAVE_LIBAUDIO */
/* Define if you have the gdbm library (-lgdbm). */
/* #define HAVE_LIBGDBM 1 */
/* Define if you have the m library (-lm). */
#define HAVE_LIBM 1

View File

@ -0,0 +1,22 @@
#include <config.h>
#include <stdio.h>
#include "getargs.h"
#include "hplay.h"
long samp_rate = 8000;
int
audio_init(int argc, char **argv)
{
return (0);
}
void
audio_term(void)
{
}
void
audio_play(int n, short *data)
{
}

View File

@ -0,0 +1,144 @@
#include <config.h>
/*****************************************************************/
/*** ***/
/*** Play out a file on Linux ***/
/*** ***/
/*** H.F. Silverman 1/4/91 ***/
/*** Modified: H.F. Silverman 1/16/91 for amax parameter ***/
/*** Modified: A. Smith 2/14/91 for 8kHz for klatt synth ***/
/*** Modified: Rob W. W. Hooft (hooft@EMBL-Heidelberg.DE) ***/
/*** adapted for linux soundpackage Version 2.0 ***/
/*** ***/
/*****************************************************************/
#include <useconfig.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/ioctl.h>
#include <machine/soundcard.h>
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 8000
long samp_rate = SAMP_RATE;
/* Audio Parameters */
static int dev_fd = -1;
/* file descriptor for audio device */
char *dev_file = "/dev/dsp";
static int linear_fd = -1;
static char *linear_file = NULL;
char *prog = "hplay";
static int
audio_open(void)
{
dev_fd = open(dev_file, O_WRONLY | O_NDELAY);
if (dev_fd < 0)
{
perror(dev_file);
return 0;
}
return 1;
}
int
audio_init(int argc, char *argv[])
{
int rate_set = 0;
int use_audio = 1;
prog = argv[0];
argc = getargs("FreeBSD Audio",argc, argv,
"r", "%d", &rate_set, "Sample rate",
"a", NULL, &use_audio, "Audio enable",
NULL);
if (help_only)
return argc;
if (use_audio)
audio_open();
if (rate_set)
samp_rate = rate_set;
if (dev_fd > 0)
{
ioctl(dev_fd, SNDCTL_DSP_SPEED, &samp_rate);
printf("Actual sound rate: %ld\n", samp_rate);
}
return argc;
}
void
audio_term()
{
int dummy;
/* Close audio system */
if (dev_fd >= 0)
{
ioctl(dev_fd, SNDCTL_DSP_SYNC, &dummy);
close(dev_fd);
dev_fd = -1;
}
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
close(linear_fd);
linear_fd = -1;
}
}
void
audio_play(int n, short *data)
{
if (n > 0)
{
unsigned char *converted = (unsigned char *) malloc(n);
int i;
if (converted == NULL)
{
fprintf(stderr, "Could not allocate memory for conversion\n");
exit(3);
}
for (i = 0; i < n; i++)
converted[i] = (data[i] - 32768) / 256;
if (linear_fd >= 0)
{
if (write(linear_fd, converted, n) != n)
perror("write");
}
if (dev_fd >= 0)
{
if (write(dev_fd, converted, n) != n)
perror("write");
}
free(converted);
}
}

View File

@ -0,0 +1,187 @@
#include <config.h>
/*****************************************************************/
/*** ***/
/*** Play out a file on an HP ***/
/*** ***/
/*** accesses audio device directly, ***/
/*** should use Aserver & Alib instead ***/
/*** ***/
/*** Markus.Gyger@itr.ch 23 Jul 94 ***/
/*** ***/
/*****************************************************************/
#include <useconfig.h>
#include <stdio.h>
#include <fcntl.h>
/* Force this on as otherwise <sys/ioctl.h> may not
expand enough for <sys/audio.h> to work as expected,
and that is after all the *whole* point of this file.
*/
#define _INCLUDE_HPUX_SOURCE
#include <sys/ioctl.h>
#include <sys/audio.h>
#include <errno.h>
#include <limits.h>
#include "getargs.h"
#include "hplay.h"
#include "getargs.h"
#define AUDIO_DEVICE "/dev/audio"
#define SAMP_RATE 10000 /* desired, will be 11025 or 8000 */
long samp_rate = SAMP_RATE;
static int audioDescriptor = -1;
int
audio_init(argc, argv)
int argc;
char *argv[];
{
int i,
sr,
headphone = 2,
speaker = 2,
waitidle = 0;
struct audio_describe audioInfo;
struct audio_gain audioGain;
audioGain.cgain[0].transmit_gain = INT_MIN; /* never used value */
/* options g/h/s aren't needed if AudioCP or acontrol is used */
argc = getargs("HP-UX Audio",argc, argv,
"r", "%ld", &samp_rate, "Sample rate",
"g", "%d", &audioGain.cgain[0].transmit_gain, "Gain -128..127",
"h", NULL, &headphone, "Headphones",
"s", NULL, &speaker, "Speaker",
"W", NULL, &waitidle, "Wait until idle (not implemented)",
NULL);
if (help_only)
return argc;
/* open audio device */
audioDescriptor = open(AUDIO_DEVICE, O_WRONLY);
if (audioDescriptor == -1)
{
perror("open");
exit(1);
}
/* get list of available sample rates */
if (ioctl(audioDescriptor, AUDIO_DESCRIBE, &audioInfo) == -1)
{
perror("AUDIO_DESCRIBE");
exit(1);
}
/* set output gain */
if (audioGain.cgain[0].transmit_gain != INT_MIN)
{
if (audioGain.cgain[0].transmit_gain < AUDIO_OFF_GAIN)
audioGain.cgain[0].transmit_gain = AUDIO_OFF_GAIN;
if (audioGain.cgain[0].transmit_gain > AUDIO_MAX_GAIN)
audioGain.cgain[0].transmit_gain = AUDIO_MAX_GAIN;
audioGain.channel_mask = AUDIO_CHANNEL_0;
audioGain.cgain[0].receive_gain = AUDIO_OFF_GAIN;
audioGain.cgain[0].monitor_gain = AUDIO_OFF_GAIN;
if (ioctl(audioDescriptor, AUDIO_SET_GAINS, &audioGain) == -1)
{
perror("AUDIO_SET_GAINS");
exit(1);
}
}
/* select output */
if (headphone != 2 || speaker != 2)
{
int outSel;
if (ioctl(audioDescriptor, AUDIO_GET_OUTPUT, &outSel) == -1)
{
perror("AUDIO_GET_OUTPUT");
exit(1);
}
if (headphone != 2)
if (headphone)
outSel |= AUDIO_OUT_EXTERNAL;
else
outSel &= ~AUDIO_OUT_EXTERNAL;
if (speaker != 2) /* internal and external speakers */
if (speaker)
outSel |= (AUDIO_OUT_INTERNAL | AUDIO_OUT_LINE);
else
outSel &= ~(AUDIO_OUT_INTERNAL | AUDIO_OUT_LINE);
if (ioctl(audioDescriptor, AUDIO_SET_OUTPUT, outSel) == -1)
{
perror("AUDIO_SET_OUTPUT");
exit(1);
}
}
/* switch to 16 bit samples (710 converts to u-law) */
if (ioctl(audioDescriptor, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_LINEAR16BIT) == -1)
{
perror("AUDIO_SET_DATA_FORMAT");
exit(1);
}
/* choose nearest available sample rate (710 has 8 kHz only) */
sr = audioInfo.sample_rate[0];
for (i = 1; i < audioInfo.nrates; i++)
if (abs(audioInfo.sample_rate[i] - samp_rate) < abs(sr - samp_rate))
sr = audioInfo.sample_rate[i];
samp_rate = sr;
/* set sampling rate */
if (ioctl(audioDescriptor, AUDIO_SET_SAMPLE_RATE, (int) samp_rate) == -1)
{
perror("AUDIO_SET_SAMPLE_RATE");
exit(1);
}
/* switch to mono */
if (ioctl(audioDescriptor, AUDIO_SET_CHANNELS, 1) == -1)
{
perror("AUDIO_SET_CHANNELS");
exit(1);
}
return argc;
}
void
audio_term()
{
if (audioDescriptor >= 0)
{
if (ioctl(audioDescriptor, AUDIO_DRAIN) == -1)
{
perror("AUDIO_DRAIN");
exit(1);
}
if (close(audioDescriptor) == -1)
{
perror("close");
exit(1);
}
audioDescriptor = -1;
}
}
void
audio_play(n, data)
int n;
short *data;
{
if (n > 0)
{
unsigned size = n * sizeof(*data);
if (write(audioDescriptor, data, size) != size)
perror("write");
}
}

View File

@ -0,0 +1,21 @@
# This bit of Makefile only works if GNU make is available
# The classic make version would have `$(SRCDIR)/getrev $(SRCDIR)`
# which does not work as it gets evaluated by 'sh' once we have cd'ed
# elsewhere. GNU make scheme uses := and $(shell...) to evaluate
# REVISION once at Makefile parse time
# It is really only needed by developer
REVISION := $(shell $(SRCDIR)/getrev $(SRCDIR))
distribution:
rm -rf /tmp/rsynth-$(REVISION)
mkdir /tmp/rsynth-$(REVISION)
(cd $(SRCDIR); tar cf - `cat MANIFEST` ) | (cd /tmp/rsynth-$(REVISION); tar xf - )
(cd /tmp; tar cvf - rsynth-$(REVISION) ) | gzip -c > $(SRCDIR)/../rsynth-$(REVISION).tar.gz
disttest :
rm -rf /tmp/rsynth-$(REVISION)
mkdir /tmp/rsynth-$(REVISION)
(cd $(SRCDIR); tar cf - `cat MANIFEST` ) | (cd /tmp/rsynth-$(REVISION); tar xf - )
(cd /tmp/rsynth-$(REVISION); CC=$(CC) configure ; make CC=$(CC) -k check)

View File

@ -0,0 +1,210 @@
#ifndef _INC_MMSYSTEM
#define _INC_MMSYSTEM
typedef UINT MMRESULT;
typedef UINT MMVERSION; /* major (high byte), minor (low byte) */
typedef UINT *LPUINT;
#define MAXPNAMELEN 32 /* max product name length (including NULL) */
DECLARE_HANDLE(HWAVE);
DECLARE_HANDLE(HWAVEIN);
DECLARE_HANDLE(HWAVEOUT);
#ifndef _WIN32_VXD
typedef HWAVEIN *LPHWAVEIN;
typedef HWAVEOUT *LPHWAVEOUT;
#endif
typedef struct wavehdr_tag {
LPSTR lpData; /* pointer to locked data buffer */
DWORD dwBufferLength; /* length of data buffer */
DWORD dwBytesRecorded; /* used for input only */
DWORD dwUser; /* for client's use */
DWORD dwFlags; /* assorted flags (see defines) */
DWORD dwLoops; /* loop control counter */
struct wavehdr_tag FAR *lpNext; /* reserved for driver */
DWORD reserved; /* reserved for driver */
} PACKED WAVEHDR, *LPWAVEHDR;
#define MM_WOM_OPEN 0x3BB /* waveform output */
#define MM_WOM_CLOSE 0x3BC
#define MM_WOM_DONE 0x3BD
#define MM_WIM_OPEN 0x3BE /* waveform input */
#define MM_WIM_CLOSE 0x3BF
#define MM_WIM_DATA 0x3C0
/* wave callback messages */
#define WOM_OPEN MM_WOM_OPEN
#define WOM_CLOSE MM_WOM_CLOSE
#define WOM_DONE MM_WOM_DONE
#define WIM_OPEN MM_WIM_OPEN
#define WIM_CLOSE MM_WIM_CLOSE
#define WIM_DATA MM_WIM_DATA
/* flags for dwFlags parameter in waveOutOpen() and waveInOpen() */
#define WAVE_FORMAT_QUERY 0x0001
#define WAVE_ALLOWSYNC 0x0002
#if(WINVER >= 0x0400)
#define WAVE_MAPPED 0x0004
#define WAVE_FORMAT_DIRECT 0x0008
#define WAVE_FORMAT_DIRECT_QUERY (WAVE_FORMAT_QUERY | WAVE_FORMAT_DIRECT)
#endif /* WINVER >= 0x0400 */
#define CALLBACK_TYPEMASK 0x00070000l /* callback type mask */
#define CALLBACK_NULL 0x00000000l /* no callback */
#define CALLBACK_WINDOW 0x00010000l /* dwCallback is a HWND */
#define CALLBACK_TASK 0x00020000l /* dwCallback is a HTASK */
#define CALLBACK_FUNCTION 0x00030000l /* dwCallback is a FARPROC */
#ifdef _WIN32
#define CALLBACK_THREAD (CALLBACK_TASK)/* thread ID replaces 16 bit task */
#define CALLBACK_EVENT 0x00050000l /* dwCallback is an EVENT Handle */
#endif
/* flags for wFormatTag field of WAVEFORMAT */
#define WAVE_FORMAT_PCM 1
/* OLD general waveform format structure (information common to all formats) */
typedef struct waveformat_tag {
WORD wFormatTag; /* format type */
WORD nChannels; /* number of channels (i.e. mono, stereo, etc.) */
DWORD nSamplesPerSec; /* sample rate */
DWORD nAvgBytesPerSec; /* for buffer estimation */
WORD nBlockAlign; /* block size of data */
} PACKED WAVEFORMAT, *LPWAVEFORMAT;
/* specific waveform format structure for PCM data */
typedef struct pcmwaveformat_tag {
WAVEFORMAT wf;
WORD wBitsPerSample;
} PACKED PCMWAVEFORMAT, *LPPCMWAVEFORMAT;
#ifndef UNICODE_ONLY
typedef struct tagWAVEOUTCAPSA {
WORD wMid; /* manufacturer ID */
WORD wPid; /* product ID */
MMVERSION vDriverVersion; /* version of the driver */
CHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
DWORD dwFormats; /* formats supported */
WORD wChannels; /* number of sources supported */
WORD wReserved1; /* packing */
DWORD dwSupport; /* functionality supported by driver */
} PACKED WAVEOUTCAPSA, *PWAVEOUTCAPSA, *NPWAVEOUTCAPSA, *LPWAVEOUTCAPSA;
#endif /*!UNICODE_ONLY */
#ifndef ANSI_ONLY
typedef struct tagWAVEOUTCAPSW {
WORD wMid; /* manufacturer ID */
WORD wPid; /* product ID */
MMVERSION vDriverVersion; /* version of the driver */
WCHAR szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
DWORD dwFormats; /* formats supported */
WORD wChannels; /* number of sources supported */
WORD wReserved1; /* packing */
DWORD dwSupport; /* functionality supported by driver */
} PACKED WAVEOUTCAPSW, *PWAVEOUTCAPSW, *NPWAVEOUTCAPSW, *LPWAVEOUTCAPSW;
#endif /*!ANSI_ONLY */
#ifdef UNICODE
typedef WAVEOUTCAPSW WAVEOUTCAPS;
typedef PWAVEOUTCAPSW PWAVEOUTCAPS;
typedef NPWAVEOUTCAPSW NPWAVEOUTCAPS;
typedef LPWAVEOUTCAPSW LPWAVEOUTCAPS;
#else
typedef WAVEOUTCAPSA WAVEOUTCAPS;
typedef PWAVEOUTCAPSA PWAVEOUTCAPS;
typedef NPWAVEOUTCAPSA NPWAVEOUTCAPS;
typedef LPWAVEOUTCAPSA LPWAVEOUTCAPS;
#endif /* UNICODE */
/*
* extended waveform format structure used for all non-PCM formats. this
* structure is common to all non-PCM formats.
*/
typedef struct tWAVEFORMATEX
{
WORD wFormatTag; /* format type */
WORD nChannels; /* number of channels (i.e. mono, stereo...) */
DWORD nSamplesPerSec; /* sample rate */
DWORD nAvgBytesPerSec; /* for buffer estimation */
WORD nBlockAlign; /* block size of data */
WORD wBitsPerSample; /* number of bits per sample of mono data */
WORD cbSize; /* the count in bytes of the size of */
/* extra information (after cbSize) */
} PACKED WAVEFORMATEX, *LPWAVEFORMATEX;
typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
/* MMTIME data structure */
typedef struct mmtime_tag
{
UINT wType; /* indicates the contents of the union */
union
{
DWORD ms; /* milliseconds */
DWORD sample; /* samples */
DWORD cb; /* byte count */
DWORD ticks; /* ticks in MIDI stream */
/* SMPTE */
struct
{
BYTE hour; /* hours */
BYTE min; /* minutes */
BYTE sec; /* seconds */
BYTE frame; /* frames */
BYTE fps; /* frames per second */
BYTE dummy; /* pad */
BYTE pad[2];
} smpte;
/* MIDI */
struct
{
DWORD songptrpos; /* song pointer position */
} midi;
} u;
} PACKED MMTIME, *LPMMTIME;
#define WINMMAPI extern
/* waveform audio function prototypes */
WINMMAPI UINT WINAPI waveOutGetNumDevs(void);
#ifndef UNICODE_ONLY
WINMMAPI MMRESULT WINAPI waveOutGetDevCapsA(UINT uDeviceID, LPWAVEOUTCAPSA pwoc, UINT cbwoc);
#endif /*!UNICODE_ONLY */
#ifndef ANSI_ONLY
WINMMAPI MMRESULT WINAPI waveOutGetDevCapsW(UINT uDeviceID, LPWAVEOUTCAPSW pwoc, UINT cbwoc);
#endif /*!ANSI_ONLY */
#ifdef UNICODE
#define waveOutGetDevCaps waveOutGetDevCapsW
#else
#define waveOutGetDevCaps waveOutGetDevCapsA
#endif /* !UNICODE */
#ifndef UNICODE_ONLY
WINMMAPI MMRESULT WINAPI waveOutGetErrorTextA(MMRESULT mmrError, LPSTR pszText, UINT cchText);
#endif //!UNICODE_ONLY
#ifndef ANSI_ONLY
WINMMAPI MMRESULT WINAPI waveOutGetErrorTextW(MMRESULT mmrError, LPWSTR pszText, UINT cchText);
#endif //!ANSI_ONLY
#ifdef UNICODE
#define waveOutGetErrorText waveOutGetErrorTextW
#else
#define waveOutGetErrorText waveOutGetErrorTextA
#endif // !UNICODE
WINMMAPI MMRESULT WINAPI waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
LPCWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen);
WINMMAPI MMRESULT WINAPI waveOutClose(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutPrepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
WINMMAPI MMRESULT WINAPI waveOutUnprepareHeader(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
WINMMAPI MMRESULT WINAPI waveOutWrite(HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
WINMMAPI MMRESULT WINAPI waveOutPause(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutRestart(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutReset(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutBreakLoop(HWAVEOUT hwo);
WINMMAPI MMRESULT WINAPI waveOutGetPosition(HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
WINMMAPI MMRESULT WINAPI waveOutGetPitch(HWAVEOUT hwo, LPDWORD pdwPitch);
WINMMAPI MMRESULT WINAPI waveOutSetPitch(HWAVEOUT hwo, DWORD dwPitch);
WINMMAPI MMRESULT WINAPI waveOutGetPlaybackRate(HWAVEOUT hwo, LPDWORD pdwRate);
WINMMAPI MMRESULT WINAPI waveOutSetPlaybackRate(HWAVEOUT hwo, DWORD dwRate);
WINMMAPI MMRESULT WINAPI waveOutGetID(HWAVEOUT hwo, LPUINT puDeviceID);
#endif /* _INC_MMSYSTEM */

View File

@ -0,0 +1,150 @@
/*
Copyright (c) 1998,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include "useconfig.h"
#include <sys/time.h>
#include <sys/stat.h>
#ifdef __GNUC__
#define NeedFunctionPrototypes 1
#define NeedNestedPrototypes 1
#endif
#include <audio/audiolib.h>
#include <audio/soundlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include "getargs.h"
#include "hplay.h"
long samp_rate = 8000;
static int volume = 100;
static char *audioserver = NULL;
static AuServer *aud;
static void done(AuServer * aud, AuEventHandlerRec * handler, AuEvent * ev, AuPointer data)
{
switch (ev->auany.type)
{
case AuEventTypeElementNotify:
{
int *d = (int *) data;
*d = (ev->auelementnotify.cur_state == AuStateStop);
if (!*d || ev->auelementnotify.reason != AuReasonEOF)
{
fprintf(stderr, "curr_state=%d reason=%d\n",
ev->auelementnotify.cur_state,
ev->auelementnotify.reason);
}
}
break;
case AuEventTypeMonitorNotify:
break;
default:
fprintf(stderr, "type=%d serial=%ld time=%ld id=%ld\n",
ev->auany.type, ev->auany.serial, ev->auany.time, ev->auany.id);
break;
}
}
void
audio_play(int n,short *data)
{
int endian = 1;
#define little_endian ((*((char *)&endian) == 1))
int priv = 0;
AuEvent ev;
Sound s = SoundCreate(SoundFileFormatNone, little_endian ?
AuFormatLinearSigned16LSB : AuFormatLinearSigned16MSB,
1, samp_rate, n, "Chit chat");
if (aud)
{
#ifdef USE_ALL_ARGS
AuStatus ret_status;
AuFlowID flow = 0;
int monitor = 0;
int multiplier = 0;
if (!AuSoundPlayFromData(aud, s, data, AuNone,
AuFixedPointFromFraction(volume, 100),
done, &priv,
&flow, &multiplier,
&monitor, &ret_status))
#else
if (!AuSoundPlayFromData(aud, s, data, AuNone,
AuFixedPointFromFraction(volume, 100),
done, &priv,
NULL, NULL, NULL, NULL))
#endif
perror("problems playing data");
else
{
while (1)
{
AuNextEvent(aud, AuTrue, &ev);
AuDispatchEvent(aud, &ev);
if (priv)
break;
}
}
}
SoundDestroy(s);
}
void
audio_term(void)
{
if (aud)
{
AuFlush(aud);
AuCloseServer(aud);
}
}
int
audio_init(int argc,char *argv[])
{
int rate_set = samp_rate;
int vol = 0;
argc = getargs("Nas",argc, argv,
"r", "%d", &rate_set, "Sample rate Hz",
"V", "%d", &vol, "Volume 0 .. 1.0",
"a", "", &audioserver,"Name of server",
NULL);
if (help_only)
return argc;
if ((aud = AuOpenServer(audioserver, 0, NULL, 0, NULL, NULL)) == (AuServer *) 0)
perror(audioserver);
if (rate_set && rate_set != samp_rate)
samp_rate = rate_set;
if (vol)
volume = vol;
return argc;
}

View File

@ -0,0 +1,316 @@
/*
Copyright (c) 1991, H.F. Silverman, A. Smith, Rob W. W. Hooft.
Copyright (c) 1994,1999,2001-2002 Nick Ing-Simmons.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
/******************************************************************
***
*** Play out a file on Linux
***
*** H.F. Silverman 1/4/91
*** Modified: H.F. Silverman 1/16/91 for amax parameter
*** Modified: A. Smith 2/14/91 for 8kHz for klatt synth
*** Modified: Rob W. W. Hooft (hooft@EMBL-Heidelberg.DE)
*** adapted for linux soundpackage Version 2.0
*** Merged FreeBSD version - 11/11/94 NIS
*** Re-worked for OSS now I have one myself - NIS Sept. 1999
*** Re-worked again to use linear if we can figure out that
*** device supports it. Also turn off O_NONBLOCK and O_NDELAY
*** after open
***
*******************************************************************/
#include "useconfig.h"
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <unistd.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_SOUNDCARD_H /* linux style */
#include <sys/soundcard.h>
#endif
#ifdef HAVE_MACHINE_SOUNDCARD_H /* FreeBSD style */
#include <machine/soundcard.h>
#endif
#ifndef AFMT_S16_LE
#define AFMT_S16_LE 16
#endif
#ifndef AFMT_U8
#define AFMT_U8 8
#endif
#ifndef AFMT_MU_LAW
#define AFMT_MU_LAW 1
#endif
/* file descriptor for audio device */
#include "l2u.h"
#if defined(HAVE_DEV_DSP)
char *dev_file = "/dev/dsp";
static int dev_fmt = AFMT_U8;
#else /* DSP */
#if defined(HAVE_DEV_AUDIO)
char *dev_file = "/dev/audio";
static int dev_fmt = AFMT_MU_LAW;
#else
#if defined(HAVE_DEV_DSPW) || !defined(HAVE_DEV_SBDSP)
char *dev_file = "/dev/dspW";
static int dev_fmt = AFMT_S16_LE;
#else
#if defined(HAVE_DEV_SBDSP)
char *dev_file = "/dev/sbdsp";
static int dev_fmt = AFMT_U8;
#endif /* SBDSP */
#endif /* DSPW */
#endif /* AUDIO */
#endif /* DSP */
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 11025
long samp_rate = SAMP_RATE;
/* Audio Parameters */
static int dev_fd = -1;
static int linear_fd = -1;
char *prog = "hplay";
static const short endian = 0x1234;
static int
audio_open(void)
{
int attempt;
for (attempt = 0; attempt < 50; attempt++)
{
dev_fd = open(dev_file, O_WRONLY | O_NDELAY | O_EXCL);
if (dev_fd >= 0 || errno != EBUSY)
break;
usleep(10000);
}
if (dev_fd >= 0)
{
/* Modern /dev/dsp honours O_NONBLOCK and O_NDELAY for write which
leads to data being dropped if we try and write and device isn't ready
we would either have to retry or we can just turn it off ...
*/
int fl = fcntl(dev_fd,F_GETFL,0);
if (fl != -1)
{
if (fcntl(dev_fd,F_SETFL,fl & ~(O_NONBLOCK|O_NDELAY)) == 0)
{
#ifdef SNDCTL_DSP_GETFMTS
int fmts;
if (ioctl(dev_fd,SNDCTL_DSP_GETFMTS,&fl) == 0)
{
fmts = fl;
if (*((const char *)(&endian)) == 0x34)
{
if ((fl = fmts & AFMT_S16_LE) && ioctl(dev_fd,SNDCTL_DSP_SETFMT,&fl) == 0)
{
dev_fmt = fl;
return 1;
}
}
else
{
if ((fl = fmts & AFMT_S16_BE) && ioctl(dev_fd,SNDCTL_DSP_SETFMT,&fl) == 0)
{
dev_fmt = fl;
return 1;
}
}
if ((fl = fmts & AFMT_MU_LAW) && ioctl(dev_fd,SNDCTL_DSP_SETFMT,&fl) == 0)
{
dev_fmt = fl;
return 1;
}
}
#endif
fprintf(stderr,"Using %s on %d fl=%X\n",dev_file,dev_fd,fl);
return 1;
}
}
}
perror(dev_file);
return 0;
}
int
audio_init(int argc, char *argv[])
{
int rate_set = 0;
int use_audio = 1;
prog = argv[0];
argc = getargs("Sound driver",argc, argv,
"r", "%d", &rate_set, "Sample rate",
"a", NULL, &use_audio, "Audio enable",
NULL);
if (help_only)
return argc;
if (use_audio)
audio_open();
if (rate_set)
samp_rate = rate_set;
if (dev_fd > 0)
{
int want = samp_rate;
ioctl(dev_fd, SNDCTL_DSP_SPEED, &samp_rate);
if (samp_rate != want)
printf("Actual sample rate: %ld\n", samp_rate);
}
return argc;
}
void
audio_term(void)
{
int dummy;
/* Close audio system */
if (dev_fd >= 0)
{
ioctl(dev_fd, SNDCTL_DSP_SYNC, &dummy);
close(dev_fd);
dev_fd = -1;
}
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
close(linear_fd);
linear_fd = -1;
}
}
void
audio_play(int n, short *data)
{
if (n > 0)
{
if (dev_fmt == AFMT_S16_LE || dev_fmt == AFMT_S16_BE)
{
n *= 2;
if (dev_fd >= 0)
{
if (write(dev_fd, data, n) != n)
perror("write");
}
if (linear_fd >= 0)
{
if (write(linear_fd, data, n) != n)
perror("write");
}
}
else if (dev_fmt == AFMT_U8)
{
unsigned char *converted = (unsigned char *) malloc(n);
int i;
if (converted == NULL)
{
fprintf(stderr, "Could not allocate memory for conversion\n");
exit(3);
}
for (i = 0; i < n; i++)
converted[i] = (data[i] - 32767) / 256;
if (linear_fd >= 0)
{
if (write(linear_fd, converted, n) != n)
perror("write");
}
if (dev_fd >= 0)
{
if (write(dev_fd, converted, n) != n)
perror("write");
}
free(converted);
}
else if (dev_fmt == AFMT_MU_LAW)
{
unsigned char *plabuf = (unsigned char *) malloc(n);
if (plabuf)
{
int w;
unsigned char *p = plabuf;
unsigned char *e = p + n;
while (p < e)
{
*p++ = short2ulaw(*data++);
}
p = plabuf;
while ((w = write(dev_fd, p, n)) != n)
{
if (w == -1 && errno != EINTR)
{
fprintf(stderr, "%d,%s:%d\n", errno, __FILE__, __LINE__);
perror("audio");
abort();
}
else
{
fprintf(stderr, "Writing %u, only wrote %u\n", n, w);
p += w;
n -= w;
}
}
free(plabuf);
}
else
{
fprintf(stderr, "%s : No memory for ulaw data\n", program);
}
}
else
{
fprintf(stderr, "%s : unknown audio format\n", program);
}
}
}

View File

@ -0,0 +1,29 @@
#include <config.h>
#include <useconfig.h>
#include <stdio.h>
#include "getargs.h"
#include "hplay.h"
#include <fcntl.h>
static FILE *dev_fd;
long samp_rate = 8000;
int
audio_init(int argc, char **argv)
{
dev_fd = popen("/usr/audio/bin/send_sound -l16", "w");
return (0);
}
void
audio_term(void)
{
pclose(dev_fd);
}
void
audio_play(int n, short *data)
{
fwrite(data, 2, n, dev_fd);
fflush(dev_fd);
}

View File

@ -0,0 +1,92 @@
#include <config.h>
#include <useconfig.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <stropts.h>
#include <sys/ioctl.h>
#define TRUE 1
#define FALSE 0
#include <audio.h>
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 11025
long samp_rate = SAMP_RATE;
/* Audio Parameters */
int Verbose = FALSE; /* verbose messages */
int Immediate = FALSE; /* Should we hang waiting for device ? */
static int async = TRUE;
char *Ifile; /* current filename */
static ALconfig alconf;
static ALport alprt;
/* sgi system doesn't need to be opened */
static int audio_open
(void)
{
long pvbuf[2];
long buflen;
pvbuf[0] = AL_OUTPUT_RATE;
pvbuf[1] = samp_rate;
buflen = 2;
ALsetparams(AL_DEFAULT_DEVICE, pvbuf, buflen);
alconf = ALnewconfig();
ALsetwidth(alconf, AL_SAMPLE_16);
ALsetchannels(alconf, AL_MONO);
alprt = ALopenport("say", "w", alconf);
if (alprt == NULL)
{
fprintf(stderr, "cannot open audio port\n");
ALfreeconfig(alconf);
return 1;
}
return 0;
}
/* sgi system */
int
audio_init(int argc, char **argv)
{
argc = getargs("Sun Audio",argc, argv,
/* Really should support sample rate ... */
NULL);
if (help_only)
return argc;
audio_open();
return argc;
}
void
audio_term(void)
{
/* on sgi systems, wait for port to complete */
while (ALgetfilled(alprt) != 0)
{
sleep(1);
}
ALcloseport(alprt);
}
void
audio_play(int n, short *data)
{
ALwritesamps(alprt, (void *) data, (long) n);
}

View File

@ -0,0 +1,311 @@
/*
Copyright (c) 1994, 2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include <config.h>
#include <useconfig.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/filio.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <signal.h>
#include <stropts.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#ifdef HAVE_SYS_AUDIOIO_H
#include <sys/audioio.h>
#endif
#ifdef HAVE_SUN_AUDIOIO_H
#include <sun/audioio.h>
#endif
#include "l2u.h"
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 8000
long samp_rate = SAMP_RATE;
/* Audio Parameters */
int Verbose = 0; /* verbose messages */
int Wait = 1; /* Should we hang waiting for device ? */
static int async = 1;
static audio_info_t dev_info; /* audio header for device */
#ifdef AUDIO_DEV_AMD
static int dev_kind = AUDIO_DEV_AMD;
#endif
static int dev_fd = -1; /* file descriptor for audio device */
char *dev_file = "/dev/audio";
char *Ifile; /* current filename */
static RETSIGTYPE audio_catch(int);
static RETSIGTYPE
audio_catch(sig)
int sig;
{
fprintf(stderr, "signal\n");
}
static int audio_open
(void)
{
/* Try it quickly, first */
dev_fd = open(dev_file, O_WRONLY | O_NDELAY);
if ((dev_fd < 0) && (errno == EBUSY))
{
if (!Wait)
{
if (Verbose)
fprintf(stderr, "%s: %s is busy\n", program, dev_file);
exit(1);
}
if (Verbose)
{
fprintf(stderr, "%s: waiting for %s...", program, dev_file);
(void) fflush(stderr);
}
/* Now hang until it's open */
dev_fd = open(dev_file, O_WRONLY);
if (Verbose)
fprintf(stderr, "%s\n", (dev_fd < 0) ? "" : "open");
}
else if (dev_fd >= 0)
{
int flags = fcntl(dev_fd, F_GETFL, NULL);
if (flags >= 0)
fcntl(dev_fd, F_SETFL, flags & ~O_NDELAY);
else
perror("fcntl - F_GETFL");
}
if (dev_fd < 0)
{
fprintf(stderr, "%s: error opening ", program);
perror(dev_file);
return 0;
}
else
{
#ifdef AUDIO_DEV_AMD
/* Get the device output encoding configuration */
if (ioctl(dev_fd, AUDIO_GETDEV, &dev_kind))
{
/* Old releases of SunOs don't support the ioctl,
but can only be run on old machines which have AMD device...
*/
dev_kind = AUDIO_DEV_AMD;
}
#endif
if (ioctl(dev_fd, AUDIO_GETINFO, &dev_info) != 0)
{
perror(dev_file);
return 0;
}
}
return 1;
}
int
audio_init(argc, argv)
int argc;
char *argv[];
{
int rate_set = 0;
int use_linear = 0;
int use_audio = 1;
double gain = -1.0;
int headphone = 2;
int speaker = 2;
argc = getargs("Sun Audio",argc, argv,
"g", "%lg", &gain, "Gain 0 .. 0.1",
"r", "%d", &rate_set, "Sample rate",
"h", NULL, &headphone, "Headphones",
"s", NULL, &speaker, "Speaker",
"W", NULL, &Wait, "Wait till idle",
"a", NULL, &use_audio, "Use audio",
"L", NULL, &use_linear,"Force linear",
NULL);
if (help_only)
return argc;
if (rate_set)
{
samp_rate = rate_set;
}
if (use_audio && audio_open())
{
if (!rate_set)
samp_rate = dev_info.play.sample_rate;
if (rate_set || use_linear)
{
dev_info.play.sample_rate = samp_rate;
#ifdef AUDIO_ENCODING_LINEAR
if (samp_rate > 8000 || use_linear)
{
dev_info.play.encoding = AUDIO_ENCODING_LINEAR;
dev_info.play.precision = 16;
}
#endif
if (ioctl(dev_fd, AUDIO_SETINFO, &dev_info) != 0)
{
perror(dev_file);
close(dev_fd);
dev_fd = -1;
}
}
}
if (dev_fd >= 0)
{
if (gain >= 0.0)
{
dev_info.play.gain = (unsigned) (AUDIO_MAX_GAIN * gain);
if (ioctl(dev_fd, AUDIO_SETINFO, &dev_info) != 0)
perror("gain");
}
if (speaker != 2 || headphone != 2)
{
if (headphone != 2)
{
if (headphone)
dev_info.play.port |= AUDIO_HEADPHONE;
else
dev_info.play.port &= ~AUDIO_HEADPHONE;
}
if (speaker != 2)
{
if (speaker)
dev_info.play.port |= AUDIO_SPEAKER;
else
dev_info.play.port &= ~AUDIO_SPEAKER;
}
if (ioctl(dev_fd, AUDIO_SETINFO, &dev_info) != 0)
perror("port");
}
if (async)
{
int flag = 1;
/* May need to use streams calls to send a SIGPOLL when write
buffer is no longer full and use non-blocking writes, and
manipluate our own buffer of unwritten data.
However, at present just use FIOASYNC which means write
returns as soon as it can queue the data (I think).
*/
signal(SIGIO, audio_catch);
ioctl(dev_fd, FIOASYNC, &flag);
}
}
return argc;
}
void
audio_term()
{
/* Close audio system */
if (dev_fd >= 0)
{
ioctl(dev_fd, AUDIO_DRAIN, 0);
close(dev_fd);
dev_fd = -1;
if (async)
signal(SIGPOLL, SIG_DFL);
}
}
void
audio_play(n, data)
int n;
short *data;
{
if (n > 0 && dev_fd >= 0)
{
#ifdef AUDIO_ENCODING_LINEAR
if (dev_info.play.encoding == AUDIO_ENCODING_LINEAR)
{
unsigned size = n * sizeof(short);
if (write(dev_fd, data, n * sizeof(short)) != size)
perror("write");
}
else
#endif
if (dev_info.play.encoding == AUDIO_ENCODING_ULAW)
{
unsigned char *plabuf = (unsigned char *) malloc(n);
if (plabuf)
{
int w;
unsigned char *p = plabuf;
unsigned char *e = p + n;
while (p < e)
{
*p++ = short2ulaw(*data++);
}
p = plabuf;
while ((w = write(dev_fd, p, n)) != n)
{
if (w == -1)
{
fprintf(stderr, "%d,%s:%d\n", errno, __FILE__, __LINE__);
perror("audio");
abort();
}
else
{
fprintf(stderr, "Writing %u, only wrote %u\n", n, w);
p += w;
n -= w;
}
}
free(plabuf);
}
else
{
fprintf(stderr, "%s : No memory for ulaw data\n", program);
}
}
}
}

View File

@ -0,0 +1,425 @@
#include <config.h>
/*****************************************************************/
/*****************************************************************/
/*** ***/
/*** ***/
/*** Play out a 20kHz file on the SPARC ***/
/*** ***/
/*** ***/
/*** H.F. Silverman 1/4/91 ***/
/*** Modified: H.F. Silverman 1/16/91 for amax parameter ***/
/*** Modified: A. Smith 2/14/91 for 8kHz for klatt synth ***/
/*** ***/
/*** Called: hplay(n,volume,amax,a) ***/
/*** ***/
/*** int n -- No. of 8kHz pts. ***/
/*** int device -- 0 -> speaker, 1 -> Jack ***/
/*** ***/
/*** ***/
/*****************************************************************/
/*****************************************************************/
#include <useconfig.h>
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/filio.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <signal.h>
#include <stropts.h>
#include <sys/ioctl.h>
#include <multimedia/libaudio.h>
#include <multimedia/audio_device.h>
#ifndef __svr4__
#include <multimedia/ulaw2linear.h>
#endif
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 8000
long samp_rate = SAMP_RATE;
/* Audio Parameters */
int Verbose = FALSE;
/* verbose messages */
int Immediate = FALSE;
/* Should we hang waiting for device ? */
static int async = TRUE;
static Audio_hdr dev_header;
/* audio header for device */
static int dev_fd = -1;
/* file descriptor for audio device */
char *dev_file = "/dev/audio";
static Audio_hdr ulaw_header;
/* audio header for file */
static int ulaw_fd = -1;
/* file descriptor for .au ulaw file */
static char *ulaw_file = NULL;
static int linear_fd = -1;
#ifdef AUDIO_DEV_AMD
static int dev_kind = AUDIO_DEV_AMD;
#endif
/* file descriptor for 16 bit linear file */
static char *linear_file = NULL;
char *prog = "hplay";
char *Ifile; /* current filename */
static RETSIGTYPE audio_catch(int);
static RETSIGTYPE
audio_catch(sig)
int sig;
{
fprintf(stderr, "signal\n");
}
static int audio_open
(void)
{
/* Try it quickly, first */
dev_fd = open(dev_file, O_WRONLY | O_NDELAY);
if ((dev_fd < 0) && (errno == EBUSY))
{
if (Immediate)
{
fprintf(stderr, "%s: %s is busy\n", prog, dev_file);
return 0;
}
if (Verbose)
{
fprintf(stderr, "%s: waiting for %s...", prog, dev_file);
(void) fflush(stderr);
}
/* Now hang until it's open */
dev_fd = open(dev_file, O_WRONLY);
if (Verbose)
fprintf(stderr, "%s\n", (dev_fd < 0) ? "" : "open");
}
else
{
int flags = fcntl(dev_fd, F_GETFL, NULL);
if (flags >= 0)
fcntl(dev_fd, F_SETFL, flags & ~O_NDELAY);
}
if (dev_fd < 0)
{
fprintf(stderr, "%s: error opening ", prog);
perror(dev_file);
return 0;
}
else
{
#ifdef AUDIO_DEV_AMD
/* Get the device output encoding configuration */
if (ioctl(dev_fd, AUDIO_GETDEV, &dev_kind))
{
/* Old releases of SunOs don't support the ioctl,
but can only be run on old machines which have AMD device...
*/
dev_kind = AUDIO_DEV_AMD;
}
#endif
if (audio_get_play_config(dev_fd, &dev_header) != AUDIO_SUCCESS)
{
fprintf(stderr, "%s: %s is not an audio device\n", prog, dev_file);
close(dev_fd);
dev_fd = -1;
return 0;
}
}
return 1;
}
int
audio_init(argc, argv)
int argc;
char *argv[];
{
int rate_set = 0;
int use_linear = 0;
int use_audio = 1;
double gain = -1.0;
int headphone = 2;
int speaker = 2;
prog = argv[0];
argc = getargs("Old Sun (demo/SOUND)",argc, argv,
"g", "%lg", &gain, "Gain 0 .. 1.0",
"r", "%d", &rate_set, "Sample rate",
"h", NULL, &headphone, "Headphones",
"s", NULL, &speaker, "Speaker",
"a", NULL, &use_audio, "Audio enable",
"L", NULL, &use_linear, "Force linear",
"u", "", &ulaw_file, "Sun .au file",
"l", "", &linear_file, "Raw linear file",
NULL);
if (help_only)
return argc;
if (ulaw_file)
{
if (strcmp(ulaw_file, "-") == 0)
{
ulaw_fd = 1; /* stdout */
}
else
{
ulaw_fd = open(ulaw_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (ulaw_fd < 0)
perror(ulaw_file);
}
}
if (linear_file)
{
if (strcmp(linear_file, "-") == 0)
{
linear_fd = 1 /* stdout */ ;
}
else
{
linear_fd = open(linear_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (linear_fd < 0)
perror(linear_file);
}
}
if (rate_set)
{
samp_rate = rate_set;
}
if (use_audio && audio_open())
{
if (!rate_set)
samp_rate = dev_header.sample_rate;
if (rate_set || use_linear)
{
dev_header.sample_rate = samp_rate;
if (samp_rate > 8000 || use_linear)
{
dev_header.encoding = AUDIO_ENCODING_LINEAR;
dev_header.bytes_per_unit = 2;
}
if (audio_set_play_config(dev_fd, &dev_header) != AUDIO_SUCCESS)
{
fprintf(stderr, "%s : %s cannot accept sample rate of %ldHz\n",
prog, dev_file, samp_rate);
close(dev_fd);
dev_fd = -1;
}
}
}
if (dev_fd >= 0)
{
int myport = 0;
if (gain >= 0.0)
{
int err = audio_set_play_gain(dev_fd, &gain);
if (err != AUDIO_SUCCESS)
{
fprintf(stderr, "%s: could not set output volume for %s\n", prog, dev_file);
}
}
if (headphone != 2)
{
if (headphone)
myport |= AUDIO_HEADPHONE;
else
myport &= ~AUDIO_HEADPHONE;
}
if (speaker != 2)
{
if (speaker)
myport |= AUDIO_SPEAKER;
else
myport &= ~AUDIO_SPEAKER;
}
if (myport != 0)
audio_set_play_port(dev_fd, &myport);
if (async)
{
int flag = 1;
/* May need to use streams calls to send a SIGPOLL when write
buffer is no longer full and use non-blocking writes, and
manipluate our own buffer of unwritten data.
However, at present just use FIOASYNC which means write
returns as soon as it can queue the data (I think).
*/
signal(SIGIO, audio_catch);
ioctl(dev_fd, FIOASYNC, &flag);
}
}
if (ulaw_fd >= 0)
{
ulaw_header.sample_rate = samp_rate;
if (samp_rate > 8000)
{
ulaw_header.encoding = AUDIO_ENCODING_LINEAR;
ulaw_header.bytes_per_unit = 2;
}
else
{
ulaw_header.encoding = AUDIO_ENCODING_ULAW;
ulaw_header.bytes_per_unit = 1;
}
ulaw_header.samples_per_unit = 1;
ulaw_header.channels = 1;
ulaw_header.data_size = AUDIO_UNKNOWN_SIZE;
/* Write header - note that data_size is unknown at this stage,
so we set it to AUDIO_UNKNOWN_SIZE (AFEB);
if all goes well we will lseek back and do this again
in audio_term()
*/
audio_write_filehdr(ulaw_fd, &ulaw_header, NULL, 0);
/* reset the header info, so we can simply add to it */
ulaw_header.data_size = 0;
}
return argc;
}
void
audio_term()
{
/* Close audio system */
if (dev_fd >= 0)
{
audio_drain(dev_fd, FALSE);
close(dev_fd);
dev_fd = -1;
if (async)
signal(SIGPOLL, SIG_DFL);
}
/* Finish ulaw file */
if (ulaw_fd >= 0)
{
off_t here = lseek(ulaw_fd, 0L, SEEK_CUR);
if (here >= 0)
{
/* can seek this file - truncate it */
ftruncate(ulaw_fd, here);
/* Now go back and overwite header with actual size */
if (lseek(ulaw_fd, 0L, SEEK_SET) == 0)
{
audio_write_filehdr(ulaw_fd, &ulaw_header, NULL, 0);
}
}
close(ulaw_fd);
ulaw_fd = -1;
}
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
close(linear_fd);
linear_fd = -1;
}
}
void
audio_play(n, data)
int n;
short *data;
{
if (n > 0)
{
if (linear_fd >= 0)
{
unsigned size = n * sizeof(short);
if (write(linear_fd, data, n * sizeof(short)) != size)
perror("write");
}
if (dev_fd >= 0 && dev_header.encoding == AUDIO_ENCODING_LINEAR)
{
unsigned size = n * sizeof(short);
if (write(dev_fd, data, n * sizeof(short)) != size)
perror("write");
}
if (ulaw_fd >= 0 && ulaw_header.encoding == AUDIO_ENCODING_LINEAR)
{
unsigned size = n * sizeof(short);
if (write(ulaw_fd, data, n * sizeof(short)) != size)
perror("write");
else
ulaw_header.data_size += size;
}
if ((dev_fd >= 0 && dev_header.encoding == AUDIO_ENCODING_ULAW) ||
(ulaw_fd >= 0 && ulaw_header.encoding == AUDIO_ENCODING_ULAW))
{
unsigned char *plabuf = (unsigned char *) malloc(n);
if (plabuf)
{
int w;
unsigned char *p = plabuf;
unsigned char *e = p + n;
while (p < e)
{
*p++ = audio_s2u(*data++);
}
if (dev_fd >= 0 && dev_header.encoding == AUDIO_ENCODING_ULAW)
{
p = plabuf;
while ((w = write(dev_fd, p, n)) != n)
{
if (w == -1)
{
fprintf(stderr, "%d,%s:%d\n", errno, __FILE__, __LINE__);
perror("audio");
abort();
}
else
{
fprintf(stderr, "Writing %u, only wrote %u\n", n, w);
p += w;
n -= w;
}
}
}
if (ulaw_fd >= 0 && ulaw_header.encoding == AUDIO_ENCODING_ULAW)
{
if (write(ulaw_fd, plabuf, n) != n)
perror(ulaw_file);
else
ulaw_header.data_size += n;
}
free(plabuf);
}
else
{
fprintf(stderr, "%s : No memory for ulaw data\n", prog);
}
}
}
}

View File

@ -0,0 +1,317 @@
/*
TiMidity -- Experimental MIDI to WAVE converter
Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
win_audio.c
Functions to play sound on the Win32 audio driver (Win 95 or Win NT).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#ifdef __MINGW32__
#include "config/mmsystem.h"
#endif
#include "config.h"
#include "hplay.h"
#include "getargs.h"
typedef long int32;
static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
static void close_output(void);
static void output_data(int32 *buf, int32 count);
static void flush_output(void);
static void purge_output(void);
/* export the playback mode */
#define dpm win32_play_mode
#define PE_MONO 1
#define PE_SIGNED 2
#define PE_16BIT 4
#define PE_ULAW 8
#define PE_BYTESWAP 16
#define DEFAULT_RATE 8000
typedef struct
{
int32 rate;
int32 encoding;
int32 extra_param[1];
} PlayMode;
long samp_rate = DEFAULT_RATE;
int
ftruncate(int fd,long size)
{
return 0;
}
PlayMode dpm = {
DEFAULT_RATE, PE_16BIT|PE_SIGNED|PE_MONO,
{16},
};
/* Max audio blocks waiting to be played */
static LPHWAVEOUT dev;
static int nBlocks;
CRITICAL_SECTION critSect;
static void wait (void)
{
while (nBlocks)
Sleep (0);
}
static int play (void *mem, int len)
{
HGLOBAL hg;
LPWAVEHDR wh;
MMRESULT res;
while (nBlocks >= dpm.extra_param[0])
Sleep (0);
hg = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof (WAVEHDR));
if (!hg)
{
fprintf(stderr, "GlobalAlloc failed!");
return FALSE;
}
wh = GlobalLock (hg);
wh->dwBufferLength = len;
wh->lpData = mem;
res = waveOutPrepareHeader (dev, wh, sizeof (WAVEHDR));
if (res)
{
fprintf(stderr, "waveOutPrepareHeader: %d", res);
GlobalUnlock (hg);
GlobalFree (hg);
return TRUE;
}
res = waveOutWrite (dev, wh, sizeof (WAVEHDR));
if (res)
{
fprintf(stderr, "waveOutWrite: %d", res);
GlobalUnlock (hg);
GlobalFree (hg);
return TRUE;
}
EnterCriticalSection (&critSect);
nBlocks++;
LeaveCriticalSection (&critSect);
return FALSE;
}
#pragma argsused
static void CALLBACK wave_callback (HWAVE hWave, UINT uMsg,
DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
WAVEHDR *wh;
HGLOBAL hg;
if (uMsg == WOM_DONE)
{
EnterCriticalSection (&critSect);
wh = (WAVEHDR *)dwParam1;
waveOutUnprepareHeader (dev, wh, sizeof (WAVEHDR));
hg = GlobalHandle (wh->lpData);
GlobalUnlock (hg);
GlobalFree (hg);
hg = GlobalHandle (wh);
GlobalUnlock (hg);
GlobalFree (hg);
nBlocks--;
LeaveCriticalSection (&critSect);
}
}
static int open_output (void)
{
int i, j, mono, eight_bit, warnings = 0;
PCMWAVEFORMAT pcm;
MMRESULT res;
/* Check if there is at least one audio device */
if (!waveOutGetNumDevs ())
{
fprintf(stderr, "No audio devices present!");
return -1;
}
/* They can't mean these */
dpm.encoding &= ~(PE_ULAW|PE_BYTESWAP);
if (dpm.encoding & PE_16BIT)
dpm.encoding |= PE_SIGNED;
else
dpm.encoding &= ~PE_SIGNED;
mono = (dpm.encoding & PE_MONO);
eight_bit = !(dpm.encoding & PE_16BIT);
pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
pcm.wf.nChannels = mono ? 1 : 2;
pcm.wf.nSamplesPerSec = i = dpm.rate;
j = 1;
if (!mono)
{
i *= 2;
j *= 2;
}
if (!eight_bit)
{
i *= 2;
j *= 2;
}
pcm.wf.nAvgBytesPerSec = i;
pcm.wf.nBlockAlign = j;
pcm.wBitsPerSample = eight_bit ? 8 : 16;
res = waveOutOpen (NULL, 0, (LPWAVEFORMAT)&pcm, NULL, 0, WAVE_FORMAT_QUERY);
if (res)
{
fprintf(stderr, "Format not supported!\n");
return -1;
}
res = waveOutOpen (&dev, 0, (LPWAVEFORMAT)&pcm, (DWORD)wave_callback, 0, CALLBACK_FUNCTION);
if (res)
{
fprintf(stderr, "Can't open audio device");
return -1;
}
nBlocks = 0;
return warnings;
}
void
conv8bit(short *lp, int c)
{
unsigned char *cp = (unsigned char *) lp;
short l;
while (c--)
{
short l = (*lp++) >> (16-8);
if (l > 127) l = 127;
else if (l < -128) l = -128;
*cp++ = 0x80 ^ ((unsigned char) l);
}
}
void
audio_play(int count, short *buf)
{
int len = count;
HGLOBAL hg;
void *b;
if (!(dpm.encoding & PE_MONO)) /* Stereo sample */
{
count *= 2;
len *= 2;
}
if (dpm.encoding & PE_16BIT)
len *= 2;
hg = GlobalAlloc (GMEM_MOVEABLE, len);
if (!hg)
{
fprintf(stderr, "GlobalAlloc failed!");
return;
}
b = GlobalLock (hg);
if (!(dpm.encoding & PE_16BIT))
/* Convert to 8-bit unsigned. */
conv8bit(buf, count);
#ifdef __MINGW32__
memcpy(b, buf, len);
#else
CopyMemory(b, buf, len);
#endif
if (play (b, len))
{
GlobalUnlock (hg);
GlobalFree (hg);
}
}
static void close_output (void)
{
wait ();
waveOutClose (dev);
}
static void flush_output (void)
{
wait ();
}
static void purge_output (void)
{
waveOutReset (dev);
wait ();
}
int use_audio = 1;
int
audio_init(argc, argv)
int argc;
char *argv[];
{
InitializeCriticalSection(&critSect);
argc = getargs("Win32 waveOut",argc, argv,
"a", NULL, &use_audio, "Use audio",
#if 0
"g", "%lg", &gain, "Gain 0 .. 0.1",
"r", "%d", &rate_set, "Sample rate",
"h", NULL, &headphone, "Headphones",
"s", NULL, &speaker, "Speaker",
"W", NULL, &Wait, "Wait till idle",
"L", NULL, &use_linear,"Force linear",
#endif
NULL);
if (help_only)
return argc;
open_output();
return argc;
}
void
audio_term()
{
close_output();
DeleteCriticalSection(&critSect);
}

8958
stella/src/emucore/rsynth/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,322 @@
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
dnl Process this file with autoconf to produce a configure script.
AC_REVISION($Revision: 1.1 $)
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR([say.c])
AC_CANONICAL_HOST
AC_CONFIG_HEADER(config.h)
PROGS="say"
dnl Set up link to the native play program
hplay=dummy
dbm=none
make_dist=/dev/null
prefix=/usr/local
dnl AC_PREFIX_PROGRAM(gcc)
if test -z "$CC" && test -n "$GCC" ; then
CC=$GCC
fi
dnl Checks for programs.
AC_PROG_CC
if test "$GCC" != yes; then
CFLAGS="-O"
fi
AC_ISC_POSIX
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h sys/types.h sys/file.h sys/ioctl.h sys/time.h unistd.h)
if test "$ac_cv_header_stdc" != yes; then
AC_CHECK_FUNCS(strchr memcpy)
AC_CHECK_HEADERS(memory.h malloc.h)
fi
AC_CHECK_FUNCS(ftruncate chsize truncate)
case "$host" in
*-sun-*) hplay=sun; AC_CHECK_HEADERS(sys/ioccom.h sys/audioio.h sun/audioio.h);;
*-sgi-*) hplay=sgi ;;
*-next-*) hplay=NeXT; AC_CHECK_HEADERS(libc.h) ;;
*-*-freebsd*) hplay=linux ;;
*-*-linux*) hplay=linux ;;
*-*-hpux*) hplay=hpux ;;
*-*-*) echo "Unknown host type $host" ;;
esac
AC_MSG_WARN(prefix is $prefix)
if test "$hplay" = linux; then
AC_CHECK_HEADERS(alsa/asoundlib.h,hplay=alsa,hplay=oss)
fi
if test "$hplay" = alsa; then
AC_MSG_CHECKING(Checking for new ALSA API)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <alsa/asoundlib.h>
]], [[
static snd_pcm_hw_params_t *hwparams;
static snd_pcm_uframes_t chunk;
snd_pcm_hw_params_get_buffer_size (hwparams,&chunk);
]])],[
new_alsa=yes
AC_MSG_RESULT(yes),
AC_DEFINE(RSYNTH_ALSA_PCM_POINTER_PARAMS_API,1,[New ALSA API passes pointers to parms])
],[
new_alsa=no
AC_MSG_RESULT(no)
])
if test $new_alsa = no; then
AC_MSG_CHECKING(Checking for old ALSA API)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define ALSA_PCM_OLD_HW_PARAMS_API
#include <alsa/asoundlib.h>
]], [[
static snd_pcm_hw_params_t *hwparams;
static snd_pcm_uframes_t chunk;
chunk = snd_pcm_hw_params_get_buffer_size (hwparams);
]])],[
AC_MSG_RESULT(yes),
AC_DEFINE(ALSA_PCM_OLD_HW_PARAMS_API,1,[Old ALSA API without pointers])
],[
AC_MSG_RESULT(no)
])
fi
AC_CHECK_LIB(asound,snd_pcm_open)
fi
if test "$hplay" = oss; then
AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h,break,hplay=dummy)
if test -c /dev/dspW ; then
AC_DEFINE(HAVE_DEV_DSPW,1,[Found /dev/dspW])
fi
if test -c /dev/audio ; then
AC_DEFINE(HAVE_DEV_AUDIO,1,[Found /dev/audio])
fi
if test -c /dev/dsp ; then
AC_DEFINE(HAVE_DEV_DSP,1,[Found /dev/dsp])
fi
if test -c /dev/sbdsp ; then
AC_DEFINE(HAVE_DEV_SBDSP,1,[Found /dev/sbdsp])
fi
fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
dnl See if float can be used in protos followed by K&R definition
AC_MSG_CHECKING(if we can use float in prototypes)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
} int func (float a);
int func(a) float a; { ]])],[AC_MSG_RESULT(yes)],[
AC_DEFINE(NOPROTOFLOAT,1,[No float prototype])
AC_MSG_RESULT(no)
])
if test -d $prefix/include; then
CPPFLAGS="$CPPFLAGS -I$prefix/include"
AC_MSG_WARN(Using -I$prefix/include)
fi
if test -d $prefix/lib; then
LIBS="-L$prefix/lib $LIBS"
AC_MSG_WARN(Using -L$prefix/lib)
fi
AC_ARG_WITH(aDict,[ --with-aDict[=<path>] American Dictionary],[
if test "$withval" != "" && test -r "$withval" ; then
AC_MSG_NOTICE(Using $withval as American Dictionary)
ADICT="$withval"
BUILD="$BUILD aDict.db"
DICTS="$DICTS aDict.db"
else
AC_MSG_WARN(Cannot read $withval for American Dictionary)
fi])
AC_ARG_WITH(bDict,[ --with-bDict[=<path>] British Dictionary],[
if test "$withval" != "" && test -r "$withval" ; then
AC_MSG_NOTICE(Using $withval as British Dictionary)
BDICT="$withval"
BUILD="$BUILD bDict.db"
DICTS="$DICTS bDict.db"
else
AC_MSG_WARN(Cannot read $withval for British Dictionary)
fi])
AS_MESSAGE([checking for database libraries...])
AC_ARG_WITH(db,[ -with-db[=<path] Try and use Berkeley DB],[
if test "$withval" != "" && test -d "$withval" ; then
CPPFLAGS="-I$withval $CPPFLAGS"
LIBS="-L$withval $LIBS"
fi])
if test "$with_db" != "no" ; then
AC_CHECK_LIB(db,db_create)
if test "$ac_cv_lib_db_db_create" = yes ; then
AC_CHECK_HEADERS(db.h,db_h=yes)
fi
if test "$db_h" = yes ; then
PROGS="$PROGS mkdictdb dlookup"
AC_MSG_WARN(Using db)
fi
fi
AC_ARG_WITH(gdbm,[ --with-gdbm[=<path>] Try and use GNU gdbm (given source directory)],[
if test "$withval" != "" && test -d "$withval" ; then
CPPFLAGS="-I$withval $CPPFLAGS"
LIBS="-L$withval $LIBS"
else
echo "--with-gdbm=$withval"
fi])
if test "$with_gdbm" != "no" ; then
AC_CHECK_HEADERS(gdbm.h,gdbm_h=yes)
if test "$gdbm_h" = yes; then
AC_CHECK_LIB(gdbm,gdbm_open)
if test "$ac_cv_lib_gdbm_gdbm_open" = yes ; then
AC_MSG_WARN(Using gdbm)
PROGS="$PROGS mkdictdb dlookup"
fi
fi
fi
if test "$db_h$gdbm_h" = ""; then
AC_MSG_WARN(No db.h and no gdbm.h)
BUILD=""
fi
AC_PATH_PROG(PERL,perl)
if test "perl" != ""; then
BUILD="$BUILD perlstuff"
EXTRA_INST="$EXTRA install_perl"
fi
AC_ARG_WITH(festival,[ --with-festival[=<path>] Festival Directory],[
if test "$withval" != "" && test -d "$withval/lib/voices" ; then
FESTIVAL="$withval"
BUILD="$BUILD festival"
EXTRA_INST="$EXTRA_INST install_festival"
else
AC_MSG_WARN(Cannot find $withval/lib/voices directory)
fi])
DEFAULT_DICT=b
AC_ARG_WITH(defDict,[ --with-defDict[=<a|b>] Default Dictionary, American (a) or British (b)],[
if test "$withval" != "" ; then
DEFAULT_DICT="$withval"
else
echo "Cannot read $withval"
fi])
CPPFLAGS="-I. -I$srcdir $CPPFLAGS"
AC_CHECK_LIB(M,atan)
AC_CHECK_LIB(m,atan)
if test "$hplay" = sgi; then
AC_CHECK_LIB(audio,ALopenport)
fi
dnl Checking for X11
AC_PATH_XTRA
if test -n "$x_includes" ; then
CPPFLAGS="$CPPFLAGS -I$x_includes"
fi
AC_CHECK_LIB(socket,socket,XLIBS="-lsocket $XLIBS")
AC_CHECK_LIB(nsl,inet_addr,XLIBS="-lnsl $XLIBS")
AC_CHECK_LIB(X11,XauReadAuth,[
XLIBS="$X_LIBS -lX11 $XLIBS"
AC_DEFINE(HAVE_LIBX11,1,[Found -lX11])
],,$X_LIBS $XLIBS $LIBS)
AC_CHECK_LIB(Xt,XtAppAddInput,[
XLIBS="$X_LIBS -lXt $XLIBS"
AC_DEFINE(HAVE_LIBXT,1,[Found -lXt])
],,$X_LIBS $XLIBS $LIBS)
dnl See if we can find nas audio library
AC_CHECK_HEADERS(audio/audiolib.h)
if test "$ac_cv_header_audio_audiolib_h" = yes ; then
AC_CHECK_LIB(audio,AuOpenServer,[
XLIBS="$XLIBS -laudio"
AC_DEFINE(HAVE_NAS,1,[Found NAS -laudio])
],,$XLIBS $LIBS)
if test "$ac_cv_lib_audio_AuOpenServer" = yes; then
if test "$hplay" = dummy; then
hplay="na"
LIBS="$XLIBS $LIBS"
XLIBS=""
else
PROGS="$PROGS nasay"
fi
fi
fi
dnl Check for obscure but speed-enhancing sun hack
if test "$hplay" = sun; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nonstandard_arithmetic();]])],[AC_DEFINE(HAVE_NONSTDARITH,1,[Sun hack])],[])
fi
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_MSG_CHECKING(for GNU make)
if make -v 2>/dev/null | grep -i 'GNU *Make' > /dev/null ; then
make_dist=$srcdir/config/make_dist
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(CC)
AC_SUBST(RANLIB)
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_PROGRAM)
AC_SUBST(INSTALL_DATA)
AC_SUBST(BUILD)
AC_SUBST(EXTRA_INST)
AC_SUBST(PERL)
AC_SUBST(FESTIVAL)
AC_SUBST(ADICT)
AC_SUBST(BDICT)
AC_SUBST(DICTS)
AC_SUBST(DEFAULT_DICT)
AC_SUBST(XLIBS)
AC_SUBST(PROGS)
AC_SUBST(NOPROTOFLOAT)
AC_SUBST(HAVE_NONSTDARITH)
AC_SUBST_FILE(make_dist)
ac_sources="config/${hplay}play.c"
ac_dests="hplay.c"
while test -n "$ac_sources"; do
set $ac_dests; ac_dest=$1; shift; ac_dests=$*
set $ac_sources; ac_source=$1; shift; ac_sources=$*
ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
done
AC_CONFIG_LINKS([$ac_config_links_1])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -0,0 +1,138 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
/* $Id: darray.c,v 1.1 2006-06-11 07:13:23 urchlay Exp $
*/
char *darray_id = "$Id: darray.c,v 1.1 2006-06-11 07:13:23 urchlay Exp $";
#include "useconfig.h"
#include "darray.h"
void
darray_free(darray_t * a)
{
if (a->data) {
free(a->data);
a->data = NULL;
}
a->items = a->alloc = 0;
}
void *
Darray_find(darray_t * a, unsigned int n)
{
if (n >= a->alloc || n >= a->items) {
unsigned osize = a->items * a->esize;
unsigned nsize;
if (!a->esize)
abort();
if (n >= a->alloc) {
unsigned add = (a->get) ? a->get : 1;
char *ndata = (char *) malloc(nsize = (n + add) * a->esize);
if (ndata) {
if (osize)
memcpy(ndata, a->data, osize);
if (a->data)
free(a->data);
a->data = ndata;
a->alloc = n + add;
}
else
return NULL;
}
else
nsize = (n + 1) * a->esize;
if (n >= a->items) {
memset(a->data + osize, 0, nsize - osize);
a->items = n + 1;
}
}
return (void *) (a->data + n * a->esize);
}
int
darray_delete(darray_t * a, unsigned int n)
{
char *p = (char *) darray_find(a, n);
if (p) {
if (a->items) {
a->items--;
while (n++ < a->items) {
memcpy(p, p + a->esize, a->esize);
p += a->esize;
}
memset(p, 0, a->esize);
return 1;
}
else
abort();
}
else
return 0;
}
int
darray_append(darray_ptr p, int ch)
{
char *s = (char *) darray_find(p, p->items);
*s = ch;
return ch;
}
void
darray_cat(void *arg, char *s)
{
darray_ptr p = (darray_ptr) arg;
char ch;
while ((ch = *s++))
darray_append(p, ch);
}
int
darray_fget(FILE * f, darray_ptr p)
{
int ch;
while ((ch = fgetc(f)) != EOF) {
darray_append(p, ch);
if (ch == '\n')
break;
}
darray_append(p, '\0');
return p->items - 1;
}
#if !defined(__GNUC__)
float
darray_float(darray_ptr f0, float f)
{
float *fp = (float *) darray_find(f0, f0->items);
*fp = f;
return f;
}
short
darray_short(darray_ptr f0, short f)
{
short *fp = (short *) darray_find(f0, f0->items);
*fp = f;
return f;
}
#endif

View File

@ -0,0 +1,103 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
/* $Id: darray.h,v 1.1 2006-06-11 07:13:23 urchlay Exp $
*/
#if !defined(DARRAY_H)
#define DARRAY_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{char *data; /* the items */
unsigned items; /* number of slots used */
unsigned alloc; /* number of slots allocated */
unsigned short esize; /* size of items */
unsigned short get; /* number to get */
} darray_t, *darray_ptr;
/* return pointer to nth item */
extern void *Darray_find(darray_t *a,unsigned n);
/* delete nth item */
extern int darray_delete(darray_t *a,unsigned n);
extern void darray_free(darray_t *a);
extern int darray_append(darray_t *p, int ch);
extern void darray_cat(void *da, char *s);
#if defined(__GNUC__)
static __inline__ void darray_init(darray_t *a,unsigned size,unsigned get)
{
a->esize = size;
a->get = get;
a->items = a->alloc = 0;
a->data = NULL;
}
static __inline__ void *darray_find(darray_t *a,unsigned n)
{
if (n < a->alloc && n < a->items)
return (void *) (a->data + n * a->esize);
return Darray_find(a,n);
}
static inline float
darray_float(darray_ptr f0, float f)
{
float *fp = (float *) darray_find(f0, f0->items);
*fp = f;
return f;
}
static inline short
darray_short(darray_ptr f0, short f)
{
short *fp = (short *) darray_find(f0, f0->items);
*fp = f;
return f;
}
#else
extern float darray_float(darray_ptr f0, float f);
extern short darray_short(darray_ptr f0, short f);
#define darray_init(a,sz,gt) \
((a)->esize = (sz), (a)->get = (gt), (a)->items = (a)->alloc = 0, (a)->data = NULL)
#define darray_find(a,n) \
(((n) < (a)->alloc && (n) < (a)->items) \
? (void *) ((a)->data + (n) * (a)->esize) \
: Darray_find(a,n))
#endif
extern int darray_fget(FILE * f, darray_ptr p);
#ifdef __cplusplus
}
#endif
#endif /* DARRAY_H */

View File

@ -0,0 +1,55 @@
#!/usr/local/bin/perl -w
use Audio::Data;
use Audio::Play;
my $f = shift;
my $n = shift(@ARGV) + 0;
my @data;
while (<>)
{
s/#.*$//;
next if /^\s*$/;
s/^\s+//;
my @f = split(/\s+/,$_);
my $v = 0+$f[$n];
push(@data,$v);
}
my $au = Audio::Data->new(rate => 11025);
$au->data(@data);
$au /= 32768;
my ($max,$min) = $au->bounds;
my $dur = $au->duration;
warn "Original $max - $min ${dur}s\n";
if ($max > 1 || $min < -1)
{
my $dc = ($max+$min)/2;
$au -= $dc;
my $size = ($max-$min)/2;
$au /= $size;
($max,$min) = $au->bounds;
$dur = $au->duration;
warn "Normaized $max - $min ${dur}s\n";
}
open(my $fh,">$f") || die "Cannot open $f:$!";
$au->Save($fh,"");
close($fh);
# Audio::Play->new->play($au);
open($fh,"$f") || die "Cannot open $f:$!";
my $rb = Audio::Data->new(Load => $fh);
close($fh);
($max,$min) = $rb->bounds;
$dur = $rb->duration;
warn "Duration $max - $min ${dur}s\n";

View File

@ -0,0 +1,75 @@
#ifdef HAVE_DB_H
#include <fcntl.h>
#include <db.h>
#define DB_HANDLE DB *
#define DATUM DBT
#define DATUM_SIZE(d) d.size
#define DATUM_DATA(d) d.data
#define DATUM_SET(d,val,len) \
do { memset(&d,0,sizeof(d)); \
d.data = (val); \
d.size = (len); \
} while (0)
#define DB_OPEN_WRITE(db, path) \
do { \
int status = db_create(&db,NULL,0); \
if (!status) \
status = (db->open)(db, NULL, path, NULL, DB_HASH, DB_CREATE, 0644); \
if (status) \
db = NULL; \
} while (0)
#define DB_OPEN_READ(db, path) \
do { \
int status = db_create(&db,NULL,0); \
if (!status) \
status = (db->open)(db, NULL, path, NULL, DB_HASH, DB_RDONLY, 0644); \
if (status) \
db = NULL; \
} while (0)
#define DB_STORE(db, key, data) \
db->put(db, NULL, &key, &data, 0)
#define DB_FETCH(db, key, data) \
do { \
data.flags = DB_DBT_MALLOC; \
data.data = NULL; \
db->get(db, NULL, &key, &data, 0); \
} while (0)
#define DB_CLOSE(db) db->close(db,0)
#else /* LIBDB */
#ifdef HAVE_LIBGDBM
#include <gdbm.h>
/* Don't force block size let gdbm/os decide */
#define BLOCK_SIZE 0
#ifndef GDBM_FAST
/* Tolerate older versions of gdbm ... */
#define GDBM_FAST 0
#endif
#define DB_HANDLE GDBM_FILE
#define DATUM datum
#define DATUM_SIZE(d) d.dsize
#define DATUM_DATA(d) d.dptr
#define DATUM_SET(d,val,len) do { d.dptr = (val); d.dsize = (len); } while (0)
#define DB_STORE(db, key, data) gdbm_store(db, key, data, GDBM_INSERT)
#define DB_OPEN_WRITE(db, path) db = gdbm_open(path, BLOCK_SIZE, GDBM_WRCREAT | GDBM_FAST, 0644, NULL)
#define DB_OPEN_READ(db, path) db = gdbm_open(path, BLOCK_SIZE, GDBM_READER, 0644, NULL)
#define DB_CLOSE(db) gdbm_close(db)
#define DB_FETCH(db,key,data) \
data = gdbm_fetch(db, key)
#endif /* LIBGDBM */
#endif /* LIBDB */

View File

@ -0,0 +1,749 @@
/*
Contributed to rsynth by a forgotten author (based on english.c)
Changes Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include "darray.h"
#include "lang.h"
#include "say.h"
#include "deutsch.h"
/* $Id: deutsch.c,v 1.1 2006-06-11 07:13:24 urchlay Exp $
*/
char *deutsch_id = "$Id: deutsch.c,v 1.1 2006-06-11 07:13:24 urchlay Exp $";
static unsigned cardinal(long int value, darray_ptr phone);
static unsigned ordinal(long int value, darray_ptr phone);
static int vowel(int chr, int maybe);
static int consonant(int chr);
static Rule *rules(int ch);
/*
deutsche phoneme
**
**
**
** The Phoneme codes:
**
** <blank>, %, p, t, k, b, d, g, m, n, N, f, T, h, v, D,
** j, tS, dZ, S, x, Z, s, z,
** l, r, rr R, w, u, U, i, I,
** A, &, V, @, o, O, 0, e, 3,
** eI aI oI aU @U I@ e@ U@ O@ oU
**
**
** Rules are made up of four parts:
**
** The left context.
** The text to match.
** The right context.
** The phonemes to substitute for the matched text.
**
** Procedure:
**
** Seperate each block of letters (apostrophes included)
** and add a space on each side. For each unmatched
** letter in the word, look through the rules where the
** text to match starts with the letter in the word. If
** the text to match is found and the right and left
** context patterns also match, output the phonemes for
** that rule and skip to the next unmatched letter.
**
**
** Special Context Symbols:
**
** # One or more vowels
** : Zero or more consonants
** ^ One consonant.
** $ duplicate consonant
** . One of B, D, V, G, J, L, M, N, R, W or Z (voiced
** consonants)
** % One of ER, E, ES, ED, ING, ELY (a suffix)
** (Found in right context only)
** + One of E, I or Y (a "front" vowel)
**
*/
/* Context definitions */
static char Anything[] = "";
/* No context requirement */
static char Nothing[] = " ";
/* Context is beginning or end of word */
static char Silent[] = "";
/* No phonemes */
#define LEFT_PART 0
#define MATCH_PART 1
#define RIGHT_PART 2
#define OUT_PART 3
/*0 = Punctuation */
/*
** LEFT_PART MATCH_PART RIGHT_PART OUT_PART
*/
static Rule punct_rules[] =
{
{Anything, " ", Anything, " "},
{Anything, "-", Anything, ""},
{".", "'S", Anything, "z"},
{"#:.E", "'S", Anything, "z"},
{"#", "'S", Anything, "z"},
{Anything, "'", Anything, ""},
{Anything, ",", Anything, " "},
{Anything, ".", Anything, " "},
{Anything, "?", Anything, " "},
{Anything, "!", Anything, " "},
{Anything, 0, Anything, Silent},
};
static Rule A_rules[] =
{
/* {Anything, "A", Nothing, "@"}, */
{Nothing, "A", Nothing, "A"},
{Anything, "A", Nothing, "V"},
/* {Anything, "A", "^+:#", "&"}, */
/* {Anything, "A", "^%", "a"}, */
{Anything, "AU", Anything, "aU"},
/* {Anything, "A", Anything, "a"}, */
{Anything, "AE", Anything, "ee"}, /* Ä */
{Anything, "AR", Anything, "V@"}, /* narkose */
{Nothing, "AB", "B", "Vb "}, /* abbilden */
{Nothing, "AN", "N", "Vn "}, /* annehmen */
/* {Anything, "A", "^^", "V"}, geht nicht! koennen auch verschiedene sein */
{Anything, "A", "$", "V"},
/* {Anything, "A", "ß", "A"}, *//* das */
/* {Anything, "A", "S", "A"}, *//* das */
{Anything, "A", "H", "VV"},
/* {Anything, "A", Anything, "V"}, */
{Anything, "A", Anything, "A"},
{Anything, 0, Anything, Silent},
};
static Rule B_rules[] =
{
{"#", "BB", "#", "b"},
{Anything, "B", Anything, "b"},
{Anything, 0, Anything, Silent},
};
static Rule C_rules[] =
{
/* {Nothing, "CH", "^", "k"}, */
/* {Anything, "CH", "I", "x"}, //chinese */
/* {Anything, "CH", Nothing, "x"}, //charakter */
{Nothing, "CH", Anything, "k"}, /* charakter */
{Anything, "CH", Anything, "x"},
{Anything, "CI", "EN", "S"},
{Anything, "CK", Anything, "k"},
{Anything, "COM", "%", "kVm"},
{Anything, "C", Anything, "k"},
{Anything, 0, Anything, Silent},
};
static Rule D_rules[] =
{
{"#:", "DED", Nothing, "dId"},
{".E", "D", Nothing, "d"},
{"#:^E", "D", Nothing, "t"},
{"#", "DD", "#", "d"},
{"#", "DD", Nothing, "d"},
{Anything, "D", Anything, "d"},
{Anything, 0, Anything, Silent},
};
static Rule E_rules[] =
{
/* {Nothing, "E", Nothing, "ee"}, */
/* {Nothing, Anything, "E", "ee"}, */
{":", "E", Nothing, "@"},
{Anything, "ER", Nothing, "3"},
{Anything, "EV", "ER", "ev"},
/* {"#:", "ER", "#", "3"}, */
{Anything, "ER", "#", "er"},
{Anything, "EW", Anything, "ev"},
{Anything, "EI", Anything, "aI"},
{Anything, "EU", Anything, "oI"},
{Anything, "EH", Anything, "eee"}, /* ??? ge-habt <-> geh-abt */
{Anything, "EE", Anything, "eee"},
{Anything, "E", "^^", "e"},
{Anything, "E", "$", "e"},
{Anything, "EN", Nothing, "@n"},
{Anything, "E", Anything, "ee"},
/* {Anything, "E", Anything, "e"}, */
{Anything, 0, Anything, Silent},
};
static Rule F_rules[] =
{
{"F", "F", "F", "f f"},
/* {Anything, "F", "F", ""}, */
{"#", "FF", "#", "f"},
{"#", "FF", Nothing, "f"},
{Anything, "F", Anything, "f"},
{Anything, 0, Anything, Silent},
};
static Rule G_rules[] =
{
{Nothing, "GE", "E", "g@ "}, /* geehrte */
{Nothing, "GIN", Nothing, "dZin"},
{Anything, "GREAT", Anything, "greIt"},
{"#", "GG", "#", "g"},
{Anything, "G", Anything, "g"},
{Anything, 0, Anything, Silent},
};
static Rule H_rules[] =
{
{Anything, "H", "#", "h"},
{Anything, "H", Anything, ""},
{Anything, 0, Anything, Silent},
};
static Rule I_rules[] =
{
{Anything, "IE", Anything, "i"},
{Anything, "IER", Anything, "i3"},
{Anything, "IQUE", Anything, "ik"},
{Anything, "I", "ß", "i"},
{Anything, "I", "H", "i"},
{Anything, "I", "$", "I"},
{Anything, "I", Anything, "i"},
{Anything, 0, Anything, Silent},
};
static Rule J_rules[] =
{
{Anything, "J", Anything, "j"},
{Anything, 0, Anything, Silent},
};
static Rule K_rules[] =
{
{Nothing, "K", "N", ""},
{Anything, "K", Anything, "k"},
{Anything, 0, Anything, Silent},
};
static Rule L_rules[] =
{
{"#", "LL", "#", "l"},
{"#", "LL", Nothing, "l"},
{Anything, "L", Anything, "l"},
{Anything, 0, Anything, Silent},
};
static Rule M_rules[] =
{
{"#", "MM", "#", "m"},
{"#", "MM", Nothing, "m"},
{Anything, "M", Anything, "m"},
{Anything, 0, Anything, Silent},
};
static Rule N_rules[] =
{
{"#", "NN", "#", "n"},
{"#", "NN", Nothing, "n"},
{Anything, "N", Anything, "n"},
{Anything, 0, Anything, Silent},
};
static Rule O_rules[] =
{
{Anything, "OE", Anything, "@@"},
{Nothing, "OK", Nothing, "okei"},
{Anything, "OY", Anything, "oI"},
{Anything, "OI", Anything, "oI"},
{"C", "O", "N", "0"},
{Anything, "O", "$", "0"},
{Anything, "O", "ß", "oo"},
{Anything, "O", "H", "oo"},
{Anything, "O", Anything, "o"},
{Anything, 0, Anything, Silent},
};
static Rule P_rules[] =
{
{"#", "PP", "#", "p"},
{"#", "PP", Nothing, "p"},
{Anything, "PH", Anything, "f"},
{Anything, "PEOP", Anything, "pip"},
{Anything, "POW", Anything, "paU"},
{Anything, "PUT", Nothing, "pUt"},
{Anything, "P", Anything, "p"},
{Anything, 0, Anything, Silent},
};
static Rule Q_rules[] =
{
{Anything, "QUAR", Anything, "kwar"},
{Anything, "QU", Anything, "kw"},
{Anything, "Q", Anything, "k"},
{Anything, 0, Anything, Silent},
};
static Rule R_rules[] =
{
{Nothing, "RE", "^#", "re"},
{"#", "RR", "#", "r"},
{"#", "RR", Nothing, "r"},
{Anything, "R", Anything, "r"},
{Anything, 0, Anything, Silent},
};
static Rule S_rules[] =
{
{Anything, "SH", Anything, "S"},
{"#", "SS", "#", "s"},
{"#", "SS", Nothing, "s"},
/* {Anything, "S", "S", ""}, */
{".", "S", Nothing, "z"},
{"#:.E", "S", Nothing, "z"},
{"#:^##", "S", Nothing, "z"},
{"#:^#", "S", Nothing, "s"},
{"U", "S", Nothing, "s"},
{" :#", "S", Nothing, "z"},
{Anything, "SCH", Anything, "S"},
{Anything, "S", Anything, "s"},
{Anything, 0, Anything, Silent},
};
static Rule T_rules[] =
{
{"#", "TT", "#", "t"},
{"#", "TT", Nothing, "t"},
{Nothing, "TWO", Anything, "tu"},
{Anything, "TION", Nothing, "tsion"},
{Anything, "T", Anything, "t"},
{Anything, 0, Anything, Silent},
};
static Rule U_rules[] =
{
{Nothing, "UN", "N", "un "}, /* un-nötig */
{Anything, "U", "$", "U"},
{Anything, "U", "H", "uu"},
{Anything, "UE", Anything, "I"},
{Anything, "U", Anything, "u"},
{Anything, 0, Anything, Silent},
};
static Rule V_rules[] =
{
{Anything, "VIEW", Anything, "vju"},
{Nothing, "V", Anything, "f"},
{Anything, "V", Anything, "v"},
{Anything, 0, Anything, Silent},
};
static Rule W_rules[] =
{
{Anything, "WHERE", Anything, "hwer"},
{Anything, "WHAT", Anything, "hw0t"},
{Anything, "WHO", Anything, "hu"},
{Anything, "W", Anything, "v"},
{Anything, "W", Nothing, "f"}, /* kiew */
{Anything, 0, Anything, Silent},
};
static Rule X_rules[] =
{
{Anything, "X", Anything, "ks"},
{Anything, 0, Anything, Silent},
};
static Rule Y_rules[] =
{
{Nothing, "YES", Anything, "jes"},
{Nothing, "Y", Anything, "I"},
{Anything, "Y", Anything, "I"},
{Anything, 0, Anything, Silent},
};
static Rule Z_rules[] =
{
{Anything, "Z", Anything, "ts"},
{Anything, 0, Anything, Silent},
};
static Rule Uml_rules[] = /* jms */
{
{Anything, "ÄU", Anything, "oI"},
{Anything, "ß", Anything, "s"},
{Anything, "Ä", Anything, "ee"},
{Anything, "Ö", Anything, "@@"},
{Anything, "Ü", Anything, "I"},
{Anything, 0, Anything, Silent},
};
static Rule *Rules[] =
{
punct_rules,
A_rules, B_rules, C_rules, D_rules, E_rules, F_rules, G_rules,
H_rules, I_rules, J_rules, K_rules, L_rules, M_rules, N_rules,
O_rules, P_rules, Q_rules, R_rules, S_rules, T_rules, U_rules,
V_rules, W_rules, X_rules, Y_rules, Z_rules, Uml_rules
};
static int
vowel(int chr, int maybe)
{
if (!isalpha(chr))
return 0;
switch (chr)
{
case 'A':
case 'E':
case 'I':
case 'Ä':
case 'Ö':
case 'Ü':
case 'O':
case 'U':
case 'Y':
case 'a':
case 'e':
case 'i':
case 'ä':
case 'ö':
case 'ü':
case 'o':
case 'u':
case 'y':
return 1;
}
return 0;
}
static int
consonant(int chr)
{
return (isalpha(chr) && !vowel(chr,0));
}
static char *ASCII[] =
{
"null", "", "", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",
"blenk", "ausrufezeichen", "double quote", "hash",
"dollar", "prozent", "ampersand", "quote",
"klammer auf", "klammer zu", /*"asterisk" */ "mal", "plus",
"comma", "minus", "punkt", "slash",
"null", "eins", "zwei", "drei",
"vier", "fünf", "sechs", "sieben",
"acht", "neun", "doppelpunkt", "semicolon",
"kleiner als", "gleich", "grösser als", "fragezeichen",
#ifndef ALPHA_IN_DICT
"at",
"a", "bee", "zee",
"dee", "ee", "eff", "ge",
"ha", "i", "jott", "ka",
"ell", "em", "en", "oo",
"pee", "kuh", "err", "es",
"tee", "uh", "vau", "we",
"iks", "ypsilon", "zed", "klammer auf",
#else /* ALPHA_IN_DICT */
"at", "A", "B", "C",
"D", "E", "F", "G",
"H", "I", "J", "K",
"L", "M", "N", "O",
"P", "Q", "R", "S",
"T", "U", "V", "W",
"X", "Y", "Z", "klammer auf",
#endif /* ALPHA_IN_DICT */
"back slash", "klammer zu", "zirkumflex", "unterstrich",
#ifndef ALPHA_IN_DICT
"back quote",
"a", "bee", "zee",
"dee", "ee", "eff", "ge",
"ha", "ii", "jott", "ka",
"ell", "em", "en", "oo",
"pee", "kuh", "err", "es",
"tee", "uh", "vau", "we",
"iks", "ypsilon", "zed", "klammer auf",
#else /* ALPHA_IN_DICT */
"back quote", "A", "B", "C",
"D", "E", "F", "G",
"H", "I", "J", "K",
"L", "M", "N", "O",
"P", "Q", "R", "S",
"T", "U", "V", "W",
"X", "Y", "Z", "open brace",
#endif /* ALPHA_IN_DICT */
"senkrechter strich", "klammer zu", "tilde", "löschen",
NULL
};
/*
** Integer to Readable ASCII Conversion Routine.
**
** Synopsis:
**
** say_cardinal(value)
** long int value; -- The number to output
**
** The number is translated into a string of words
**
*/
static char *Cardinals[] =
{
"null", "eins", "zwei", "drei",
"vier", "fünf", "sechs", "sieben",
"acht", "neun",
"zehn", "elf", "zwölf", "dreizehn",
"vierzehn", "fünfzehn", "sechszehn", "siebzehn",
"achtzehn", "neunzehn"
};
static char *Twenties[] =
{
"zwanzig", "dreissig", "vierzig", "fünfzig",
"sechzig", "siebzig", "achtzig", "neunzig"
};
static char *Ordinals[] =
{
"nullter", "erster", "zweiter", "dritter",
"vierter", "fünfter", "sechster", "siebter",
"achter", "neunter",
"zehnter", "elfter", "zwölfter", "dreizehnter",
"vierzehnter", "fünfzehnter", "sechszehnter", "siebzehnter",
"achtzehnter", "neunzehnter"
};
static char *Ord_twenties[] =
{
"zwanzigster", "dreissigster", "vierzigster", "fünfzigster",
"sechzigster", "siebzigster", "achtzigster", "neunzigster"
};
/*
** Translate a number to phonemes. This version is for CARDINAL numbers.
** Note: this is recursive.
*/
static unsigned
cardinal(long int value, darray_ptr phone)
{
unsigned nph = 0;
if (value < 0)
{
nph += xlate_string("minus", phone);
value = (-value);
if (value < 0) /* Overflow! -32768 */
{
nph += xlate_string("zu viele", phone);
return nph;
}
}
if (value >= 1000000000L)
/* Billions */
{
nph += cardinal(value / 1000000000L, phone);
nph += xlate_string("milliarde", phone); /* this is different !! jms */
value = value % 1000000000;
if (value == 0)
return nph; /* Even billion */
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE BILLION AND FIVE */
}
if (value >= 1000000L)
/* Millions */
{
nph += cardinal(value / 1000000L, phone);
nph += xlate_string("million", phone);
value = value % 1000000L;
if (value == 0)
return nph; /* Even million */
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE MILLION AND FIVE */
}
/* Thousands 1000..1099 2000..99999 */
/* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */
if ((value >= 1000L && value <= 1099L) || value >= 2000L)
{
nph += cardinal(value / 1000L, phone);
nph += xlate_string("tausend", phone);
value = value % 1000L;
if (value == 0)
return nph; /* Even thousand */
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE THOUSAND AND FIVE */
}
if (value >= 100L)
{
nph += xlate_string(Cardinals[value / 100], phone);
nph += xlate_string("hundert", phone);
value = value % 100;
if (value == 0)
return nph; /* Even hundred */
}
if ((value % 10) > 0 && value > 20)
nph += xlate_string(Cardinals[value % 10], phone); /* jms */
if ((value % 10) > 0 && value > 20)
nph += xlate_string("und", phone); /* jms */
if (value >= 20)
{
nph += xlate_string(Twenties[(value - 20) / 10], phone);
/* value = value % 10; weg jms */
/* if (value == 0) weg jms */
/* return nph; weg jms *//* Even ten */
}
if (value < 20)
nph += xlate_string(Cardinals[value], phone); /* jms */
return nph;
}
/*
** Translate a number to phonemes. This version is for ORDINAL numbers.
** Note: this is recursive.
*/
static unsigned
ordinal(long int value, darray_ptr phone)
{
unsigned nph = 0;
if (value < 0)
{
nph += xlate_string("minus", phone);
value = (-value);
if (value < 0) /* Overflow! -32768 */
{
nph += xlate_string("zu viele", phone);
return nph;
}
}
if (value >= 1000000000L)
/* Billions */
{
nph += cardinal(value / 1000000000L, phone);
value = value % 1000000000;
if (value == 0)
{
nph += xlate_string("milliardste", phone);
return nph; /* Even billion */
}
nph += xlate_string("milliarde", phone);
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE BILLION AND FIVE */
}
if (value >= 1000000L)
/* Millions */
{
nph += cardinal(value / 1000000L, phone);
value = value % 1000000L;
if (value == 0)
{
nph += xlate_string("millionster", phone);
return nph; /* Even million */
}
nph += xlate_string("million", phone);
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE MILLION AND FIVE */
}
/* Thousands 1000..1099 2000..99999 */
/* 1100 to 1999 is eleven-hunderd to ninteen-hunderd */
if ((value >= 1000L && value <= 1099L) || value >= 2000L)
{
nph += cardinal(value / 1000L, phone);
value = value % 1000L;
if (value == 0)
{
nph += xlate_string("tausendster", phone);
return nph; /* Even thousand */
}
nph += xlate_string("tausend", phone);
if (value < 100)
nph += xlate_string("und", phone);
/* as in THREE THOUSAND AND FIVE */
}
if (value >= 100L)
{
nph += xlate_string(Cardinals[value / 100], phone);
value = value % 100;
if (value == 0)
{
nph += xlate_string("hundertster", phone);
return nph; /* Even hundred */
}
nph += xlate_string("hundert", phone);
}
if (value >= 20)
{
if ((value % 10) == 0)
{
nph += xlate_string(Ord_twenties[(value - 20) / 10], phone);
return nph; /* Even ten */
}
nph += xlate_string(Twenties[(value - 20) / 10], phone);
value = value % 10;
}
nph += xlate_string(Ordinals[value], phone);
return nph;
}
static Rule *
rules(int ch)
{
int type = 0;
if (isupper(ch) || ch == 'ß')
type = ch - 'A' + 1;
if (type > 'Z' - 'A' + 2)
type = 'Z' - 'A' + 2; /* umlaute , jms */
return Rules[type];
}
lang_t Deutsch =
{
ASCII,
"punkt",
vowel,
consonant,
ordinal,
cardinal,
rules
};

View File

@ -0,0 +1,2 @@
extern lang_t Deutsch;

View File

@ -0,0 +1,152 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
/* jms: changed default for dict_path to "g" */
#include "config.h"
#ifdef HAVE_IO_H
#include <io.h>
#endif /* HAVE_IO_H */
#include <stdio.h>
#include <ctype.h>
#include "charset.h"
#include "phones.h"
#include "useconfig.h"
#include "dbif.h"
#ifndef DEFAULT_DICT
#define DEFAULT_DICT "b"
#endif
char *dict_path = DEFAULT_DICT;
#ifdef DB_HANDLE
DB_HANDLE dict;
#include "lang.h"
#include "dict.h"
#ifndef DICT_DIR
#define DICT_DIR "/usr/local/lib/dict"
#endif
unsigned char *
dict_lookup(const char *s, unsigned int n)
{
if (!n)
n = strlen(s);
if (dict) {
unsigned char *p = (unsigned char *) s;
DATUM key;
DATUM data;
unsigned int i;
char *buf = (char *) malloc(n);
DATUM_SET(key, buf, n);
for (i = 0; i < n; i++) {
buf[i] = (isupper(p[i])) ? tolower(p[i]) : p[i];
}
DB_FETCH(dict, key, data);
free(buf);
if (DATUM_DATA(data)) {
unsigned char *w = (unsigned char *) realloc(DATUM_DATA(data),
DATUM_SIZE(data) +
1);
w[DATUM_SIZE(data)] = '\0';
return w;
}
}
return NULL;
}
static void choose_dialect(void);
static void
choose_dialect(void)
{
unsigned char *word = dict_find("wash", 0);
if (word && word[0] == W) {
if (word[1] == OH)
dialect = ph_br;
else if (word[1] == AA1)
dialect = ph_am;
free(word);
}
}
int
dict_init(const char *dictname)
{
char *buf = NULL;
#ifdef OS2
char *dictdir = getenv("ETC");
if (dictdir == NULL)
dictdir = DICT_DIR; /* jms: if ETC is not set */
#else
char *dictdir = DICT_DIR;
#endif
buf =
(char *) malloc(strlen(dictdir) + strlen("Dict.db") +
strlen(dict_path) + 2);
sprintf(buf, "%sDict.db", dictname);
DB_OPEN_READ(dict, buf);
if (!dict) {
sprintf(buf, "%s/%sDict.db", dictdir, dictname);
DB_OPEN_READ(dict, buf);
}
if (dict) {
dict_path = (char *) realloc(buf, strlen(buf) + 1);
lang->lookup = dict_lookup;
choose_dialect();
}
return have_dict;
}
void
dict_term(void)
{
if (dict) {
DB_CLOSE(dict);
free(dict_path);
lang->lookup = 0;
dict = 0;
}
}
#else
unsigned char *
dict_find(char *s, unsigned n)
{
return NULL;
}
int
dict_init(int argc, char *argv[])
{
return argc;
}
void
dict_term(void)
{
}
#endif

View File

@ -0,0 +1,21 @@
/* $Id: dict.h,v 1.1 2006-06-11 07:13:24 urchlay Exp $
*/
#ifndef DICT_H
#define DICT_H
#include "lang.h"
#ifdef __cplusplus
extern "C" {
#endif
extern char *dict_path;
extern int dict_init(const char *dictname);
extern void dict_term(void);
#ifdef __cplusplus
}
#endif
#endif /* DICT_H */

View File

@ -0,0 +1,77 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include "useconfig.h"
#include "dict.h"
#include "phones.h"
#include "getargs.h"
#include "english.h"
lang_t *lang = &English;
static void show(char *s);
static void
show(char *s)
{
unsigned char *p = dict_find(s, strlen(s));
printf("%s", s);
if (p) {
int l = strlen((char *) p);
int i;
for (i = 0; i < l; i++)
printf(" %s", ph_name[(unsigned) (p[i])]);
printf(" [");
for (i = 0; i < l; i++)
printf("%s", dialect[(unsigned) (p[i])]);
printf("]\n");
free(p);
}
else
printf(" ???\n");
}
int
main(int argc, char **argv, char **envp)
{
argc = getargs("Dictionary", argc, argv,
"d", "", &dict_path, "Which dictionary [b|a|g]", NULL);
if (help_only) {
fprintf(stderr, "Usage: %s [options as above] words to lookup\n",
argv[0]);
}
else {
if (dict_path && *dict_path)
dict_init(dict_path);
if (have_dict) {
int i;
for (i = 1; i < argc; i++) {
show(argv[i]);
}
dict_term();
}
}
return 0;
}

83
stella/src/emucore/rsynth/efix Executable file
View File

@ -0,0 +1,83 @@
#!/tools/local/perl -w
use strict;
use Rsynth::Elements;
read_elements();
my $vv;
my $nv = 0;
my $tv = 0;
foreach my $e (@eNames)
{
if ($elem{$e}{features}{vwl})
{
$nv++;
my $av = $elem{$e}{'av'}[0];
$vv = $av unless defined $vv;
$tv = $tv+$av;
if ($vv != $av)
{
warn "$e has av=$av not $vv\n";
}
}
}
$vv = int($tv/$nv+0.5);
warn "Vowels are av=$vv\n";
foreach my $e (@eNames)
{
my $f = $elem{$e}{features};
if ($elem{$e}{'f2'}[0] - $elem{$e}{'f1'}[0] < 200)
{
warn sprintf("$e : f2 %d too close to f1 %d\n", $elem{$e}{'f2'}[0], $elem{$e}{'f1'}[0]);
set($elem{$e}{'f2'},$elem{$e}{'f1'}[0]+200);
}
if ($elem{$e}{'f3'}[0] - $elem{$e}{'f2'}[0] < 200)
{
warn sprintf("$e : f3 %d too close to f2 %d\n", $elem{$e}{'f3'}[0], $elem{$e}{'f2'}[0]);
}
if (!$f->{vwl})
{
my $av = $elem{$e}{'av'}[0];
if ($av >= $vv)
{
warn "$e ".join(',',keys %{$elem{$e}{features}})." has av=$av\n";
if ($f->{apr} || $f->{nas} || $f->{lat})
{
set($elem{$e}{'av'},$vv-10);
}
elsif ($f->{frc} || $f->{stp})
{
set($elem{$e}{'av'},$vv-13);
}
}
if ($av > 0)
{
my $av = $elem{$e}{'avc'}[0];
if ($av >= $vv)
{
warn "$e ".join(',',keys %{$elem{$e}{features}})." has avc=$av\n";
if ($f->{apr} || $f->{nas} || $f->{lat})
{
set($elem{$e}{'avc'},$vv-10);
}
elsif ($f->{frc} || $f->{stp})
{
set($elem{$e}{'avc'},$vv-13);
}
}
}
}
}
write_elements("Elements.def");
sub set
{
my ($a,$v) = @_;
warn "Setting to $v\n";
my $p = $a->[2]/100;
$a->[0] = $v;
$a->[1] = $v * (1-$p);
}

View File

@ -0,0 +1,73 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include <config.h>
/* $Id: elements.c,v 1.1 2006-06-11 07:13:24 urchlay Exp $
*/
char *elements_id = "$Id: elements.c,v 1.1 2006-06-11 07:13:24 urchlay Exp $";
#include <stdio.h>
#include <math.h>
#include "rsynth.h"
#include "phfeat.h"
Elm_t Elements[] = {
#include "Elements.def"
};
unsigned num_Elements = (sizeof(Elements) / sizeof(Elm_t));
char *Ep_name[nEparm] = {
"fn", "f1", "f2", "f3",
"b1", "b2", "b3", "pn",
"a2", "a3", "a4",
"a5", "a6", "ab", "av",
"avc", "asp", "af"
};
speaker_t *
rsynth_speaker(float F0Hz, float gain, Elm_t * e)
{
static speaker_t pars;
// memset(&pars,-1,sizeof(pars));
pars.F0Hz = F0Hz;
/* Quasi fixed parameters */
pars.Gain0 = gain;
pars.F4hz = 3900;
pars.B4hz = 400;
pars.F5hz = 4700;
pars.B5hz = 150;
pars.F6hz = 4900;
pars.B6hz = 150;
pars.B4phz = 500;
pars.B5phz = 600;
pars.B6phz = 800;
pars.BNhz = 500;
/* Set the _fixed_ nasal pole to nasal zero frequency of the 0th element
(which should NOT be a nasal!) as a typical example of the zero
we wish to cancel
*/
pars.FNPhz = (long) e->p[fn].stdy;
return &pars;
}

254
stella/src/emucore/rsynth/elmdgm Executable file
View File

@ -0,0 +1,254 @@
#!/usr/local/bin/perl -w
use strict;
use Tk;
use Tk::Font;
use Rsynth::Elements;
use Audio::Play;
use blib './Rsynth';
use Rsynth::Audio;
my $au = Audio::Data->new(rate => 11025);
my $synth = Rsynth::Audio->new($au);
my $mw = MainWindow->new;
$mw->menu;
my $IPA = $mw->Font(family => 'Gentium',
point => 180, slant => 'r',
weight => 'medium');
my $t = $mw->Scrolled(Text => -width => 25,-background => 'black')
->pack(-side => 'right', -expand => 1, -fill => 'both');
#
# Vowel diagram to screen:
# Y axis is F1 - higher values near bottom, so just scaled
sub F1BASE () { 190 } # Lowest F1 and origin for Y axis
sub F1MAX () { 900 } # Highest F1
sub F1SCALE () { 3 }
# X axis is F2-F1 with higher values on the left
#
sub F2MIN () { 700 } # Lowest F2
sub F2MAX () { 2500 } # Highest F2
sub F2BASE () { 2400 } # Screen X offset to ensure +ve x.
sub F2SCALE () { 6 }
# F3 is a 3rd dimension which is a pain.
# F3 is lowest for /r/ sounds - low F3 is their characteristic.
# F3 is highest for unrounded vowels and lower for rounded vowels
# (F2 is lower for rounded vowels too)
# Note that /i/ and /j/ and possibly /&/ F3 isn't
# from usual "cavity".
sub F3MIN () { 1600 }
sub F3MAX () { 3200 }
sub F3SCALE () { 6 }
sub MINSPACE () { 200 }
sub f1f2toscreen
{
my ($f1,$f2) = @_;
my $x = (F2BASE - $f2 + $f1)/F2SCALE;
my $y = ($f1 - F1BASE)/F1SCALE;
return ($x,$y);
}
sub f1f2fromscreen
{
my ($x,$y) = @_;
my $f1 = F1BASE + F1SCALE*$y;
my $f2 = F2BASE - F2SCALE*$x+$f1;
if ($f2 < $f1 + MINSPACE)
{
$f2 = $f1 + MINSPACE;
}
return ($f1,$f2);
}
sub f2f3toscreen
{
my ($f2,$f3) = @_;
my $x = (F2BASE - $f2)/F2SCALE;
my $y = ($f3 - F3MIN)/F3SCALE;
return ($x,$y);
}
sub f2f3fromscreen
{
my ($x,$y) = @_;
my $f2 = F2BASE - $x *F2SCALE;
my $f3 = F3MIN + $y *F3SCALE;
if ($f3 < $f2 + MINSPACE)
{
$f3 = $f2 + MINSPACE;
}
return ($f2,$f3);
}
my ($width,$height) = f1f2toscreen(F1MAX, F2MIN);
my $left = $mw->Frame->pack(-side => 'left', -fill => 'y', -expand => 0);
my $f1f2 = $left->Canvas(-background => 'black',
-height => $height,
-width => $width)
->pack(-side => 'top', -expand => 0);
($width,$height) = f2f3toscreen(F2MIN, F3MAX);
my $f2f3 = $left->Canvas(-background => 'black',
-height => $height,
-width => $width)
->pack(-side => 'top', -expand => 0);
my $d = $mw->Text(-width => 15, -font => $IPA)
->pack(-side => 'left',-fill => 'y');
my $cur12 = $f1f2->create(oval => [0,0,0,0],-outline => 'yellow');
my $cur23 = $f2f3->create(oval => [0,0,0,0],-outline => 'yellow');
my @colours = qw(white red green blue magenta cyan orange brown pink violet);
my %colour;
my $i = 0;
read_elements();
my $ve;
foreach my $e (sort { height($a) <=> height($b) ||
front($a) <=> front($b) ||
round($a) <=> round($b) }
grep { $_->{features}{vwl} } values %elem)
{
my $ch = $e->{unicode};
utf8::decode($ch);
if ($e->{features}{vwl} || $e->{features}{gld})
{
next if ($e->{features}{nas} || $e->{features}{dip});
my @feat = features($e);
my $key = join(' ',@feat);
my $colour = $colour{$key};
unless (exists $colour{$key})
{
$colour = $colours[$i++ % @colours] ;
$t->tagConfigure($colour,-foreground => $colour, -font => $IPA);
$colour{$key} = $colour;
}
my $sm = $e->{sampa};
$t->insert('end',"$sm [$ch] - @feat\n",[$colour,$e->{name}]);
my ($x,$y) = f1f2toscreen($e->{f1}[0],$e->{f2}[0]);
my $id12 = $f1f2->createText($x, $y,
-font => $IPA,
-fill => $colour, -text => $ch);
($x,$y) = f2f3toscreen($e->{f2}[0],$e->{f3}[0]);
my $id23 = $f2f3->createText($x, $y,
-font => $IPA,
-fill => $colour, -text => $ch);
if ($e->{sampa} eq '#')
{
$ve = $e;
$f1f2->Tk::bind('<3>',[\&Click12,$ve,$id12,$id23,Ev('x'),Ev('y'),Ev('s')]);
$f2f3->Tk::bind('<3>',[\&Click23,$ve,$id12,$id23,Ev('x'),Ev('y'),Ev('s')]);
}
$f1f2->bind($id12,'<1>',[\&display,$e,$id12,$id23]);
$f1f2->bind($id12,'<2>',[\&change,$e,$id12,$id23]);
$f2f3->bind($id23,'<1>',[\&display,$e,$id12,$id23]);
$f2f3->bind($id23,'<2>',[\&change,$e,$id12,$id23]);
$t->tagBind($e->{name},'<1>',[\&display,$e,$id12,$id23]);
$t->tagBind($e->{name},'<2>',[\&change,$e,$id12,$id23]);
}
}
sub Click12
{
my ($w,$e,$id12,$id23,$wx,$wy,$s) = @_;
my $x = $w->canvasx($wx);
my $y = $w->canvasy($wy);
my ($f1,$f2) = f1f2fromscreen($x,$y);
$e->{f1}[0] = $f1;
$e->{f2}[0] = $f2;
display($w,$e,$id12,$id23);
}
sub Click23
{
my ($w,$e,$id12,$id23,$wx,$wy,$s) = @_;
my $x = $w->canvasx($wx);
my $y = $w->canvasy($wy);
my ($f2,$f3) = f2f3fromscreen($x,$y);
$e->{f2}[0] = $f2;
$e->{f3}[0] = $f3;
display($w,$e,$id12,$id23);
}
sub change
{
my ($w,$e,$id12,$id23) = @_;
foreach my $key (qw(f1 f2 f3))
{
$e->{$key}[0] = $ve->{$key}[0];
}
display($w,$e,$id12,$id23);
}
sub display
{
my ($w,$e,$id12,$id23) = @_;
my ($bx,$by) = f1f2toscreen($e->{f1}[0],$e->{f2}[0]);
$f1f2->coords($id12,[$bx,$by]);
my @coord = $f1f2->bbox($id12);
$f1f2->coords($cur12,\@coord);
($bx,$by) = f2f3toscreen($e->{f2}[0],$e->{f3}[0]);
$f2f3->coords($id23,[$bx,$by]);
@coord = $f2f3->bbox($id23);
$f2f3->coords($cur23,\@coord);
$e->update;
$d->delete('1.0','end');
my $ch = $e->{unicode};
utf8::decode($ch);
$d->insert('end',$e->{name}.' '.$e->{sampa}." [$ch]\n");
$d->insert('end',join(' ',features($e))."\n");
foreach my $sym (@pNames)
{
$d->insert('end',sprintf("$sym:%4d\n",$e->{$sym}[0]));
}
# Clear audio buffer
$au->length(0);
# An empty element/dur "string".
my $elm = '';
my $pre = '.';
my $post = '.';
my $idx = $e->{idx};
foreach my $ename (@{$Rsynth::Phones::phtoelm{$pre}},$e->{name},
@{$Rsynth::Phones::phtoelm{$post}})
{
my $t = $elem{$ename};
$elm .= chr($t->{idx});
$elm .= ($t->{idx} == $idx) ? chr(10) : chr($t->{du});
$d->insert('end',$ename);
}
$synth->interpolate($elm);
my $svr = Audio::Play->new;
$d->insert(end => "\n");
$svr->play($au) if $svr;
}
$f1f2->configure(-scrollregion => [$f1f2->bbox('all')]);
MainLoop;
write_elements("Elements.edt");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,2 @@
#include "lang.h"
extern lang_t English;

View File

@ -0,0 +1,121 @@
; Mbrola demo file for en1.
; Copyright (c) 1997 Faculte Polytechnique de Mons
;
; "It would be a considerable invention indeed, that of
; a machine able to mimic our speech, with its sounds
; and articulations. I think it is not impossible."
;
; - Leonhard Euler, 1761
_ 70
I 80 0 115 50 142 99 142
t 90
w 100
U 50 50 205
d 40 25 195 87 181
b 80
i: 140 0 132 99 108
@ 30 50 107
k 90
@ 40 0 145 100 121
n 40 50 117
s 110
I 80 50 218
d 40
r 50
@ 60 75 160
b 90 100 109
@ 30
5 90
I 60 75 109
n 80
v 40
e 90 0 109 50 153 75 177
n 30 25 195
S 80
@ 70
n 30
I 70 75 112
n 130 100 98
d 60 75 108
i: 270 30 177 60 100 100 156
d 120 100 177
_ 300
D 130 50 114
{ 100 45 142
t 110
V 30 25 119
v 60
@ 70
m 100
@ 30 100 100
S 230
i: 180 0 186 35 200 50 190 95 133
n 160 6 140 85 145
_ 300
eI 150 54 150 77 160
b 60
@ 10
l 70 20 137 70 135
t 100
@ 80 10 105
m 78
I 60 60 160
m 50 50 173
I 50 50 140
k 120
aU 120 5 120 75 97
s 140
p 100
i: 120 15 161 35 148 75 186
t 30
S 280
_ 300
w 100 90 115
I 30
D 60 15 117 60 123
I 70 75 205
t 60
s 60
s 100
aU 220 5 145 15 126 60 106 95 121
n 30
d 30 33 140
z 70
{ 70 0 110 85 119
n 30 33 115
d 40
A: 90 25 101 65 111
t 110
I 30 50 170
k 50
j 50 20 225 70 237
@ 30 35 235
l 50
eI 110 5 135 75 108
S 140
@ 40 35 95
n 80 95 99
z 230
_ 640
aI 210 90 105
T 140
I 30 35 216
N 180 85 250
k 110
I 30 50 222
t 70
s 80
_ 70
n 60 25 184 65 177
Q 130 5 181 80 222
t 120
I 30 15 221
m 60 85 173
p 80
Q 100 10 126 85 109
s 120
@ 50
b 60
@ 10 15 98
5 190 100 103
_ 50

View File

@ -0,0 +1,3 @@
It would be a considerable invention indeed, that of
a machine able to mimic our speech, with its sounds
and articulations. I think it is not impossible.

View File

@ -0,0 +1,103 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;
;;; Nicholas Ing-Simmons ;;
;;; Copyright (c) 2002 ;;
;;; All Rights Reserved. ;;
;;; ;;
;;; Permission is hereby granted, free of charge, to use and distribute ;;
;;; this software and its documentation without restriction, including ;;
;;; without limitation the rights to use, copy, modify, merge, publish, ;;
;;; distribute, sublicense, and/or sell copies of this work, and to ;;
;;; permit persons to whom this work is furnished to do so, subject to ;;
;;; the following conditions: ;;
;;; 1. The code must retain the above copyright notice, this list of ;;
;;; conditions and the following disclaimer. ;;
;;; 2. Any modifications must be clearly marked as such. ;;
;;; 3. Original authors' names are not deleted. ;;
;;; 4. The authors' names are not used to endorse or promote products ;;
;;; derived from this software without specific prior written ;;
;;; permission. ;;
;;; ;;
;;; THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK ;;
;;; DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ;;
;;; ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT ;;
;;; SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE ;;
;;; FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;;
;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ;;
;;; AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ;;
;;; ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ;;
;;; THIS SOFTWARE. ;;
;;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Support for rsynth as an external module.
;;; Derived from the handler for mbrola by Nick Ing-Simmons
;;;
;;; You might want to set this in your sitevars.scm
(defvar rsynth_progname "/usr/local/bin/say"
"rsynth_progname
The program name for rsynth.")
(defvar rsynth_options "-E -v -a"
"rsynth_options
Command line options to be passed during rsynth Synthesis.")
(define (rsynth_Synth utt)
"(rsynth_Synth UTT)
Synthesize using rsynth as external module. Basically dump the info
from this utterance. Call rsynth and reload the waveform into utt.
[see rsynth]"
(let ((filename (make_tmp_filename)))
(save_segments_rsynth utt filename)
(system (string-append rsynth_progname " "
rsynth_options
" -o " filename ".au"
" -f " filename
))
(utt.import.wave utt (string-append filename ".au"))
(apply_hooks after_synth_hooks utt)
(delete-file filename)
(delete-file (string-append filename ".au"))
utt))
(define (save_segments_rsynth utt filename)
"(save_segments_rsynth UTT FILENAME)
Save segment information in rsynth format in filename. The format is
phone duration (ms) [% position F0 target]*. [see rsynth]"
(let ((fd (fopen filename "w")))
(mapcar
(lambda (segment)
(save_seg_rsynth_entry
(item.feat segment 'name)
(item.feat segment 'segment_start)
(item.feat segment 'segment_duration)
(mapcar
(lambda (targ_item)
(list
(item.feat targ_item "pos")
(item.feat targ_item "f0")))
(item.relation.daughters segment 'Target)) ;; list of targets
fd))
(utt.relation.items utt 'Segment))
(fclose fd)))
(define (save_seg_rsynth_entry name start dur targs fd)
"(save_seg_rsynth_entry ENTRY NAME START DUR TARGS FD)
Entry contains, (name duration num_targs start 1st_targ_pos 1st_targ_val)."
(format fd "%s %d " name (nint (* dur 1000)))
(if targs ;; if there are any targets
(mapcar
(lambda (targ) ;; targ_pos and targ_val
(let ((targ_pos (car targ))
(targ_val (car (cdr targ))))
(format fd "%d %d "
(nint (* 100 (/ (- targ_pos start) dur))) ;; % pos of target
(nint (parse-number targ_val))) ;; target value
))
targs))
(terpri fd)
(terpri fd)
)
(provide 'rsynth)

View File

@ -0,0 +1,46 @@
uh V
e e
a {
o Q
i I
u U
ii i
uu u
oo O
aa A
@@ 3
ai aI
ei eI
oi OI
au aU
ou @U
e@ e@
i@ I@
u@ U@
@ @
p b
t t
k k
b b
d d
g g
s s
z z
sh S
zh Z
f f
v v
th T
dh D
ch tS
jh dZ
h h
m m
n n
ng N
l l
ll 5
y j
r r
w w
# _

View File

@ -0,0 +1,46 @@
uh V
e e
a {
o Q
i I
u U
ii i
uu u
oo O
aa A
@@ 3
ai aI
ei eI
oi OI
au aU
ou @U
e@ e@
i@ I@
u@ U@
@ @
p b
t t
k k
b b
d d
g g
s s
z z
sh S
zh Z
f f
v v
th T
dh D
ch tS
jh dZ
h h
m m
n n
ng N
l l
ll 5
y j
r r
w w
# _

View File

@ -0,0 +1,5 @@
#!/usr/local/bin/perl -w
use strict;
use Rsynth::Elements;
read_elements();
write_elements(\*STDOUT);

View File

@ -0,0 +1,5 @@
#!/usr/local/bin/perl -w
use strict;
use Rsynth::Elements;
read_elements();
write_features(\*STDOUT);

2
stella/src/emucore/rsynth/fsay Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
/home/nick/speech/festival/bin/festival --tts "$@"

View File

@ -0,0 +1,214 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include <config.h>
/* $Id: getarg.c,v 1.1 2006-06-11 07:13:25 urchlay Exp $
*/
char *getarg_id = "$Id: getarg.c,v 1.1 2006-06-11 07:13:25 urchlay Exp $";
#if defined(USE_PROTOTYPES) ? USE_PROTOTYPES : defined(__STDC__)
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <ctype.h>
#include <useconfig.h>
#include "getargs.h"
int help_only = 0;
/*
Usage is like :
argc = getargs("Module",argc,argv,
"r", "%d", &rate, "Integer",
"u", "", &ufile_name, "String",
"g", "%d", &gain, "Double",
"a", NULL, &use_audio, "Boolean -a toggles, +a sets",
"s", "" , &speaker, "Boolean -s clears, +s sets",
NULL);
*/
#if defined(USE_PROTOTYPES) ? USE_PROTOTYPES : defined(__STDC__)
int
getargs(char *module,int argc, char *argv[],...)
#else
int
getargs(module, argc, argv, va_alist)
char *module;
int argc;
char *argv[];
va_dcl
#endif
{
va_list ap;
int i = 0;
int done_module = 0;
while (i < argc)
{
char *s = argv[i];
int flag = *s++;
if (*s && (flag == '-' || flag == '+'))
{
int off = 1;
while (*s)
{
char *a;
int count = 0;
#if defined(USE_PROTOTYPES) ? USE_PROTOTYPES : defined(__STDC__)
va_start(ap, argv);
#else
va_start(ap);
#endif
while ((a = va_arg(ap, char *)))
{
int l = strlen(a);
char *fmt = va_arg(ap, char *);
void *var = va_arg(ap, void *);
char *desc = va_arg(ap, char *);
if (!strcmp(s,"-help"))
{
help_only = 1;
if (!done_module++)
fprintf(stderr,"%s:\n",module);
if (fmt)
{char *x = strchr(fmt,'%');
if (x)
{
fprintf(stderr," -%s <%s> [",a,x+1);
switch(*(x+strlen(x)-1))
{
case 'e':
case 'f':
case 'g':
fprintf(stderr,fmt,*((double *) var));
break;
case 'u':
case 'd':
if (x[1] == 'l')
fprintf(stderr,fmt,*((long *) var));
else
fprintf(stderr,fmt,*((int *) var));
break;
}
fprintf(stderr,"]\t%s\n",desc);
}
else
fprintf(stderr," -%s <string> [%s]\t%s\n",a,
*((char **) var) ? *((char **) var) : "", desc);
}
else
{
fprintf(stderr," [+|-]%s [%s]\t%s\n",a,
*((int *) var) ? "yes" : "no",desc);
}
}
else if (l > 1)
{
if (!count && !strcmp(s, a))
{
if (fmt)
{
if (i + off < argc)
{
char *x = argv[i + off++];
if (strchr(fmt, '%'))
{
if (sscanf(x, fmt, var) != 1)
fprintf(stderr, "%s : %s invalid after -%s\n", argv[0], x, a);
}
else
*((char **) var) = x;
}
else
fprintf(stderr, "%s : no argument after -%s\n", argv[0], a);
}
else
{
if (flag == '+')
*((int *) var) = !0;
else
*((int *) var) = !*((int *) var);
}
/* skip to end of string */
count++;
s += l;
break; /* out of va_arg loop */
}
}
else
{
if (*s == *a)
{
if (fmt)
{
if (i + off < argc)
{
char *x = argv[i + off++];
if (strchr(fmt, '%'))
{
if (sscanf(x, fmt, var) != 1)
fprintf(stderr, "%s : %s invalid after -%s\n", argv[0], x, a);
}
else
*((char **) var) = x;
}
else
fprintf(stderr, "%s : no argument after -%s\n", argv[0], a);
}
else
{
if (fmt || flag == '+')
*((int *) var) = (flag == '+');
else
*((int *) var) = !*((int *) var);
}
count++;
s++;
break; /* out of va_arg loop */
}
}
}
va_end(ap);
if (!count)
{
off = 0;
break; /* Out of s loop */
}
}
if (off != 0)
{
int j;
argc -= off;
for (j = i; j <= argc; j++)
argv[j] = argv[j + off];
}
else
i++;
}
else
i++;
}
if (help_only && done_module)
fprintf(stderr,"\n");
return argc;
}

View File

@ -0,0 +1,17 @@
/* $Id: getargs.h,v 1.1 2006-06-11 07:13:25 urchlay Exp $
*/
#ifndef GETARGS_H
#define GETARGS_H
#ifdef __cplusplus
extern "C" {
#endif
extern int getargs(char *module,int argc,char *argv[],...);
extern int help_only;
#ifdef __cplusplus
}
#endif
#endif /* GETARGS_H */

View File

@ -0,0 +1,8 @@
#!/bin/sh
if test $# -gt 0; then
dir=$1;
else
dir=.
fi
grep 'Revision:' ${dir}/Revision.c | sed 's/^.*Revision: *\([0-9.]*\).*$/\1/'

View File

@ -0,0 +1,109 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "darray.h"
#include "charset.h"
#include "text.h"
#include "phones.h"
#include "lang.h"
#include "english.h"
#include "say.h"
lang_t *lang = &English;
unsigned
xlate_string(char *string, darray_ptr phone)
{
abort(); /* just a stub */
}
int main(int argc,char *argv[])
{
darray_t phone;
darray_init(&phone, sizeof(char), 128);
init_locale();
if (argc > 1)
{
rule_debug = 1;
while (--argc)
{
char *s = *++argv;
NRL(s,strlen(s),&phone);
darray_append(&phone,0);
printf("%s [%s]\n",s,(char *) darray_find(&phone,0));
phone.items = 0;
}
}
else
{
char buf[1024];
unsigned char *s;
unsigned total = 0;
unsigned right = 0;
while ((s = (unsigned char *) fgets(buf,sizeof(buf),stdin)))
{
while (*s && isspace(*s)) s++;
if (*s)
{
unsigned char *e = s;
unsigned char *p;
while (*e && !isspace(*e)) e++;
NRL(s,(e-s),&phone);
darray_append(&phone,0);
p = e;
while (*p && isspace(*p)) p++;
if (*p)
{
char *q = p;
total++;
while (*q && !isspace(*q)) q++;
*q++ = ' ';
*q = '\0';
if (strcmp(p,darray_find(&phone,0)) != 0)
{
printf("%.*s",(e-s),s);
printf(" expected /%s/, got /%s/\n",p,(char *) darray_find(&phone,0));
}
else
{
right++;
}
}
else
{
printf("%.*s",(e-s),s);
printf(" got /%s/\n",(char *) darray_find(&phone,0));
fflush(stdout);
}
phone.items = 0;
}
}
if (total)
{
fprintf(stderr,"%.3g%% correct\n",right*100.0/total);
}
}
return 0;
}

View File

@ -0,0 +1,335 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
/* $Id: holmes.c,v 1.1 2006-06-11 07:13:25 urchlay Exp $
*/
char *holmes_id = "$Id: holmes.c,v 1.1 2006-06-11 07:13:25 urchlay Exp $";
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include "useconfig.h"
#include <math.h>
#include "rsynth.h"
#include "darray.h"
#include "getargs.h"
#include "plotparm.h"
#include "hplay.h"
typedef struct {
float v; /* boundary value */
long t; /* transition time */
} slope_t;
typedef struct {
float a;
float b;
float v;
} filter_t, *filter_ptr;
static float
filter(filter_ptr p, float v)
{
return p->v = (p->a * v + p->b * p->v);
}
/* 'a' is dominant element, 'b' is dominated
ext is flag to say to use external times from 'a' rather
than internal i.e. ext != 0 if 'a' is NOT current element.
*/
static void
set_trans(slope_t * t, int i, Elm_ptr a, Elm_ptr b, int ext, int e,
float speed)
{
t[i].t = (long) (((ext) ? a->p[i].ed : a->p[i].id) * speed);
if (t[i].t) {
float afrac = a->p[i].prop * 0.01F;
t[i].v = a->p[i].stdy * (1.0F - afrac) + (afrac * b->p[i].stdy);
}
else
t[i].v = b->p[i].stdy;
}
/*
______________ b
/
/
/
a____________/
0 d
---------------t---------------
*/
float
linear(float a, float b, long t, long d)
{
if (t <= 0)
return a;
else if (t >= d)
return b;
else {
float f = (float) t / (float) d;
return a + (b - a) * f;
}
}
float
interpolate(char *w, char *p, slope_t * s, slope_t * e, float mid, long t,
long d)
{
float steady = d - (s->t + e->t);
#ifdef DEBUG
fprintf(stdout, "%4s %s s=%g,%d e=%g,%d m=%g,%g\n",
w, p, s->v, s->t, e->v, e->t, mid, steady);
#endif
if (steady >= 0) {
/* Value reaches stready state somewhere ... */
if (t < s->t)
return linear(s->v, mid, t, s->t); /* initial transition */
else {
t -= s->t;
if (t <= steady)
return mid; /* steady state */
else
return linear(mid, e->v, (int) (t - steady), e->t);
/* final transition */
}
}
else {
float f = (float) 1.0 - ((float) t / (float) d);
float sp = linear(s->v, mid, t, s->t);
float ep = linear(e->v, mid, d - t, e->t);
return f * sp + ((float) 1.0 - f) * ep;
}
}
#define CHECK_SPACING(a,b) \
do { \
if (a < b + 200) \
fprintf(stdout,"%s=%g < %s=%g+200\n",#a,a,#b,b); \
} while (0)
unsigned
rsynth_interpolate(rsynth_t * rsynth,
unsigned char *elm, unsigned nelm,
float *f0, unsigned nf0)
{
filter_t flt[nEparm];
float ep[nEparm];
Elm_ptr le = &Elements[0];
unsigned i = 0;
unsigned tf0 = 0;
unsigned ntf0 = 0;
unsigned samp = 0;
float contour[3];
float f0s = rsynth->speaker->F0Hz;
float f0e = f0s;
int j;
float speed = rsynth->speed;
float F0Hz;
if (nf0 < 3 || !f0 || (rsynth->flags & RSYNTH_MONOTONE)) {
unsigned i;
f0 = contour;
nf0 = 3;
for (i = 0; i < nelm; i += 2) {
f0[1] += elm[i + 1];
}
if ((rsynth->flags & RSYNTH_MONOTONE)) {
f0[0] = rsynth->speaker->F0Hz; /* top */
f0[2] = f0[0]; /* bottom */
}
else {
f0[0] = 1.1 * rsynth->speaker->F0Hz; /* top */
f0[2] = 0.6 * f0[0]; /* bottom */
}
}
#if 0
fprintf(stderr, "f0 (%g) %5.1f %gs %5.1f\n", rsynth->F0hz,
f0[0], 1.0 * f0[1] * rsynth->samples_frame / rsynth->samp_rate,
f0[2]);
#endif
f0e = f0s = *f0++;
/* flag new utterance */
/* Experimental feature:
frac is the proporion of the new value that is fed into lowpass
filter. This is added to (1-frac) of old value.
So a value of 1.0 means no smoothing. A value of 0.5 seems ok
and tracks look smoother. Smoothing is insurance against
interpollation bugs and mis-features changing parameters too fast.
Revisit this with some theory...
*/
for (j = 0; j < nEparm; j++) {
flt[j].v = le->p[j].stdy;
flt[j].a = rsynth->smooth;
flt[j].b = 1.0F - rsynth->smooth;
}
while (i < nelm) {
Elm_ptr ce = &Elements[elm[i++]];
unsigned dur = elm[i++];
if (rsynth->flags & RSYNTH_ETRACE) {
printf("%s.%ld ", ce->name,
1000 * dur * rsynth->samples_frame / rsynth->sr);
}
/* Skip zero length elements which are only there to affect
boundary values of adjacent elements.
Note this mainly refers to "QQ" element in fricatives
as stops have a non-zero length central element.
*/
if (dur > 0) {
Elm_ptr ne = (i < nelm) ? &Elements[elm[i]] : &Elements[0];
slope_t start[nEparm];
slope_t end[nEparm];
unsigned t;
int i;
for (i = 0; i < nEparm; i++) {
if (ce->p[i].rk > le->p[i].rk) {
if (rsynth->parm_file)
fprintf(rsynth->parm_file,
"# %3s %2s(%2d) < %2s(%2d)\n", Ep_name[i],
le->name, le->p[i].rk, ce->name,
ce->p[i].rk);
set_trans(start, i, ce, le, 0, 's', speed);
/* we dominate last */
}
else {
if (rsynth->parm_file)
fprintf(rsynth->parm_file,
"# %3s %2s(%2d) >= %2s(%2d)\n", Ep_name[i],
le->name, le->p[i].rk, ce->name,
ce->p[i].rk);
set_trans(start, i, le, ce, 1, 's', speed);
/* last dominates us */
}
if (ne->p[i].rk > ce->p[i].rk) {
if (rsynth->parm_file)
fprintf(rsynth->parm_file,
"# %3s %2s(%2d) < %2s(%2d)\n", Ep_name[i],
ce->name, ce->p[i].rk, ne->name,
ne->p[i].rk);
set_trans(end, i, ne, ce, 1, 'e', speed);
/* next dominates us */
}
else {
if (rsynth->parm_file)
fprintf(rsynth->parm_file,
"# %3s %2s(%2d) >= %2s(%2d)\n", Ep_name[i],
ce->name, ce->p[i].rk, ne->name,
ne->p[i].rk);
set_trans(end, i, ce, ne, 0, 'e', speed);
/* we dominate next */
}
}
if (rsynth->parm_file) {
int j;
fprintf(rsynth->parm_file, "# %s\n", ce->name);
fprintf(rsynth->parm_file, "%c%6s %6s", '#', "f0", "ao");
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, "%c%6s", ' ', Ep_name[j]);
fprintf(rsynth->parm_file, "\n#%6s %6s", "", "");
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, "%c%6.4g", ' ', start[j].v);
fprintf(rsynth->parm_file, "\n#%6s %6s", "", "");
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, "%c%6ld", ' ', start[j].t);
fprintf(rsynth->parm_file, "\n");
}
for (t = 0; t < dur; t++, tf0++) {
int j;
float peak = 0.25;
for (j = 0; j < nEparm; j++) {
ep[j] =
filter(flt + j,
interpolate(ce->name, Ep_name[j], &start[j],
&end[j], (float) ce->p[j].stdy,
t, dur));
}
while (tf0 == ntf0) {
tf0 = 0;
f0s = f0e;
ntf0 = (unsigned) *f0++;
f0e = *f0++;
#if 0
fprintf(stderr, "f0 %5.1f %gs %5.1f\n", f0s,
1.0 * ntf0 * samples_frame / samp_rate, f0e);
#endif
}
/* interpolate the f0 value */
F0Hz = linear(f0s, f0e, tf0, ntf0);
if (rsynth->flags & RSYNTH_F0TRACE) {
printf(" %5.1fHz", F0Hz);
}
/* Now call the synth for each frame */
CHECK_SPACING(ep[f2], ep[f1]);
CHECK_SPACING(ep[f3], ep[f2]);
CHECK_SPACING(rsynth->speaker->F4hz, ep[f3]);
samp += rsynth_frame(rsynth, F0Hz, ep, ce->name);
if (rsynth->parm_file) {
fprintf(rsynth->parm_file, " %6.4g %6.4g",
F0Hz, 10 * log10(peak));
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, " %6.4g", ep[j]);
fprintf(rsynth->parm_file, "\n");
}
}
if (rsynth->parm_file) {
int j;
fprintf(rsynth->parm_file, "#%6s %6s", "", "");
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, " %6.4g", end[j].v);
fprintf(rsynth->parm_file, "\n");
fprintf(rsynth->parm_file, "#%6s %6s", "", "");
for (j = 0; j < nEparm; j++)
fprintf(rsynth->parm_file, " %6ld", end[j].t);
fprintf(rsynth->parm_file, "\n");
}
}
le = ce;
}
if (rsynth->flags & (RSYNTH_ETRACE | RSYNTH_F0TRACE)) {
printf("\n");
}
return samp;
}

View File

@ -0,0 +1,209 @@
/*
Copyright (c) 2003 Nick Ing-Simmons.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include "useconfig.h"
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <unistd.h>
// #define ALSA_PCM_OLD_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "l2u.h"
char *pcm_name = "default";
#include "getargs.h"
#include "hplay.h"
#define SAMP_RATE 11025
long samp_rate = SAMP_RATE;
/* Audio Parameters */
static int linear_fd = -1;
char *prog = "hplay";
static snd_pcm_t *pcm;
static snd_pcm_hw_params_t *hwparams;
static snd_pcm_uframes_t chunk;
static int
audio_open(void)
{
int err;
if ((err = snd_pcm_open(&pcm,pcm_name,SND_PCM_STREAM_PLAYBACK,0)) < 0)
{
fprintf(stderr,"Cannot open %s:%s",pcm_name,snd_strerror(err));
return 0;
}
else
{
unsigned int want = samp_rate;
int dir = 0;
snd_pcm_hw_params_malloc(&hwparams);
snd_pcm_hw_params_any(pcm,hwparams);
/* Check capabilities */
if ((err = snd_pcm_hw_params_set_access(pcm, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{
fprintf(stderr,"Cannot set access %s:%s",pcm_name,snd_strerror(err));
return 0;
}
/* Set sample format */
if ((err=snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S16)) < 0)
{
fprintf(stderr,"Error setting format %s:%s",pcm_name,snd_strerror(err));
return(0);
}
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
want = snd_pcm_hw_params_set_rate_near(pcm, hwparams, want, &dir);
#else
err = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &want, &dir);
#endif
if (dir != 0 || want != samp_rate)
{
fprintf(stderr,"Wanted %ldHz, got %uHz (%d)",samp_rate,want,dir);
samp_rate = want;
}
if ((err=snd_pcm_hw_params_set_channels(pcm, hwparams, 1)) < 0)
{
fprintf(stderr,"Error setting channels %s:%s",pcm_name,snd_strerror(err));
return(0);
}
/* Apply HW parameter settings to */
/* PCM device and prepare device */
if ((err=snd_pcm_hw_params(pcm, hwparams)) < 0)
{
fprintf(stderr,"Error setting parameters %s:%s",pcm_name,snd_strerror(err));
return(0);
}
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
chunk = snd_pcm_hw_params_get_buffer_size (hwparams);
#else
snd_pcm_hw_params_get_buffer_size (hwparams,&chunk);
#endif
return 1;
}
}
int
audio_init(int argc, char *argv[])
{
int rate_set = 0;
int use_audio = 1;
prog = argv[0];
argc = getargs("ALSA Sound driver",argc, argv,
"r", "%d", &rate_set, "Sample rate",
"A", "default", &pcm_name, "Device",
"a", NULL, &use_audio, "Audio enable",
NULL);
if (help_only)
return argc;
if (rate_set)
samp_rate = rate_set;
if (use_audio)
audio_open();
return argc;
}
void
audio_term(void)
{
/* Finish linear file */
if (linear_fd >= 0)
{
ftruncate(linear_fd, lseek(linear_fd, 0L, SEEK_CUR));
close(linear_fd);
linear_fd = -1;
}
/* Close audio system */
if (pcm)
{
int err = snd_pcm_drain(pcm);
if (err < 0)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err));
}
if ((err = snd_pcm_close(pcm)) < 0)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(err));
}
pcm = 0;
}
if (hwparams)
{
snd_pcm_hw_params_free(hwparams);
hwparams = 0;
}
}
void
audio_play(int n, short *data)
{
if (n > 0)
{
if (linear_fd >= 0)
{
if (write(linear_fd, data, n) != n)
perror("write");
}
if (pcm)
{
snd_pcm_sframes_t ret;
while (n > 0)
{
size_t amount = ((size_t) n > chunk) ? chunk : (size_t) n;
while ((ret = snd_pcm_writei(pcm, data, amount)) < 0)
{
/* Pipe may well drain - but harmless as we write
whole words to the pipe
*/
if (ret != -EPIPE)
{
fprintf(stderr,"%s:%s\n",pcm_name,snd_strerror(ret));
}
snd_pcm_prepare(pcm);
}
n -= ret;
data += ret;
}
}
}
}

View File

@ -0,0 +1,27 @@
/*
Copyright (c) 1994,2001-2003 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
/* $Id: hplay.h,v 1.1 2006-06-11 07:13:25 urchlay Exp $
*/
extern char *program;
extern long samp_rate;
extern int audio_init(int argc, char *argv[]);
extern void audio_term(void);
extern void audio_play(int n, short *data);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
This is R-synth - a formant synthesizer.
R-synth takes a list of phonemes
described in John Well's SAMPA encoding of the IPA,
and generates speech using a digital model of the vocal tract.
The festival speech synthesis system, can use r-synth to generate a
voice to read conventional english text.
Prosodic information is generated by festival and fed to r-synth.

View File

@ -0,0 +1,233 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5; it is not part of GNU.
#
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View File

@ -0,0 +1,71 @@
# Klatt symbol mappings to CMU's and our SAMPA via dlookup of example word(s) shown.
#
# Vowels
AA bob AA1 [A]
AX about AX [@]
EXR bear A [e@R]
IY beet IY [i]
UW boot UW [u]
AE bat AE [{]
AXR bar AA [A]
EY bait EY [eI]
OW boat OW [@U]
UXR poor UA [U@R]
AH but AH [V]
AY bite AY [aI]
IH bit IH [I]
OXR boar AO [OR]
YU beauty Y UW1 [ju]
AO bought AO [O]
EH bet EH [e]
IX impunity IH [I]
OY boy AO IY [Oi]
AW bout AW [aU]
ER bird ER [3`]
IXR beer IA [I@R]
UH book UH [U]
# Sonorants
RR rent R [r]
RX fire AX [@`] # Rhotic
HH hat HH [h]
HX hurrah HH [h] # Allophone ?
WW wet W [w]
WH which W [W] # [hw] sound ?
LL let L [l] # Allophone before vowel
LX bill L [5] # Allophone after vowel
EL bottle L [l=] # Syllabic l
YY yet Y [j]
# Nasals
EM 'em M [m=] # syllabic m
EN button N [n=] # syllabic n
MM met M [m]
NN net N [n]
NG sing NG [N]
# Fricatives
DH that DH [D]
VV vat V [v]
FF fin F [f]
ZZ zoo Z [z]
SS sat S [s]
ZH azure ZH [Z]
SH shin SH [S]
TH thin TH [T]
# Plosives
BB bet B [b]
KK core K [k] # allophone before back vowel?
KP keen K [k] # allophone before front vowel?
GG gore G [g] # allophone before back vowel?
GP give G [g] # allophone before front vowel?
DD debt D [d]
PP pet P [p]
TT ten T [t] #
DX butter T [4] # allophone beween vowels
TQ at Alan T [t] # allophone before stressed vowel?
# Affricates
CH chin CH [tS]
JJ gin G [g]
# Plosive release
AXP ship P [p] # artifact of terminal plosive?

View File

@ -0,0 +1,571 @@
/*
Copyright (c) 1994 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
short _u2l[] =
{
-32256, -31228, -30200, -29172, -28143, -27115, -26087, -25059,
-24031, -23002, -21974, -20946, -19918, -18889, -17861, -16833,
-16062, -15548, -15033, -14519, -14005, -13491, -12977, -12463,
-11949, -11435, -10920, -10406, -9892, -9378, -8864, -8350,
-7964, -7707, -7450, -7193, -6936, -6679, -6422, -6165,
-5908, -5651, -5394, -5137, -4880, -4623, -4365, -4108,
-3916, -3787, -3659, -3530, -3402, -3273, -3144, -3016,
-2887, -2759, -2630, -2502, -2373, -2245, -2116, -1988,
-1891, -1827, -1763, -1698, -1634, -1570, -1506, -1441,
-1377, -1313, -1249, -1184, -1120, -1056, -992, -927,
-879, -847, -815, -783, -751, -718, -686, -654,
-622, -590, -558, -526, -494, -461, -429, -397,
-373, -357, -341, -325, -309, -293, -277, -261,
-245, -228, -212, -196, -180, -164, -148, -132,
-120, -112, -104, -96, -88, -80, -72, -64,
-56, -48, -40, -32, -24, -16, -8, 0,
32256, 31228, 30200, 29172, 28143, 27115, 26087, 25059,
24031, 23002, 21974, 20946, 19918, 18889, 17861, 16833,
16062, 15548, 15033, 14519, 14005, 13491, 12977, 12463,
11949, 11435, 10920, 10406, 9892, 9378, 8864, 8350,
7964, 7707, 7450, 7193, 6936, 6679, 6422, 6165,
5908, 5651, 5394, 5137, 4880, 4623, 4365, 4108,
3916, 3787, 3659, 3530, 3402, 3273, 3144, 3016,
2887, 2759, 2630, 2502, 2373, 2245, 2116, 1988,
1891, 1827, 1763, 1698, 1634, 1570, 1506, 1441,
1377, 1313, 1249, 1184, 1120, 1056, 992, 927,
879, 847, 815, 783, 751, 718, 686, 654,
622, 590, 558, 526, 494, 461, 429, 397,
373, 357, 341, 325, 309, 293, 277, 261,
245, 228, 212, 196, 180, 164, 148, 132,
120, 112, 104, 96, 88, 80, 72, 64,
56, 48, 40, 32, 24, 16, 8, 0
};
static unsigned char _l2u_[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,
0x09, 0x09, 0x09, 0x09, 0x09, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A,
0x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0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13,
0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,
0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15,
0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16,
0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0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, 0x21,
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23, 0x23, 0x23,
0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x24, 0x24, 0x24,
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25,
0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26, 0x26,
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27,
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x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x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x2E, 0x2E,
0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,
0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2F, 0x2F,
0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F,
0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x2F, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31,
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x32,
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x33,
0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x34,
0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x35,
0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x36,
0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x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 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
0x4A, 0x4A, 0x4A, 0x4A, 0x4A, 0x4A, 0x4A, 0x4A, 0x4B, 0x4B, 0x4B, 0x4B, 0x4B, 0x4B, 0x4B, 0x4B,
0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4C, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D, 0x4D,
0x4E, 0x4E, 0x4E, 0x4E, 0x4E, 0x4E, 0x4E, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F,
0x50, 0x50, 0x50, 0x50, 0x51, 0x51, 0x51, 0x51, 0x52, 0x52, 0x52, 0x52, 0x53, 0x53, 0x53, 0x53,
0x54, 0x54, 0x54, 0x54, 0x55, 0x55, 0x55, 0x55, 0x56, 0x56, 0x56, 0x56, 0x57, 0x57, 0x57, 0x57,
0x58, 0x58, 0x58, 0x58, 0x59, 0x59, 0x59, 0x59, 0x5A, 0x5A, 0x5A, 0x5A, 0x5B, 0x5B, 0x5B, 0x5B,
0x5C, 0x5C, 0x5C, 0x5C, 0x5D, 0x5D, 0x5D, 0x5D, 0x5E, 0x5E, 0x5E, 0x5E, 0x5F, 0x5F, 0x5F, 0x5F,
0x60, 0x60, 0x61, 0x61, 0x62, 0x62, 0x63, 0x63, 0x64, 0x64, 0x65, 0x65, 0x66, 0x66, 0x67, 0x67,
0x68, 0x68, 0x68, 0x69, 0x69, 0x6A, 0x6A, 0x6B, 0x6B, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F,
0x6F, 0x70, 0x71, 0x72,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, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A,
0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A,
0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x9A,
0x9A, 0x9A, 0x9A, 0x9A, 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98,
0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x97,
0x97, 0x97, 0x97, 0x97, 0x97, 0x97, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x96,
0x96, 0x96, 0x96, 0x96, 0x96, 0x96, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95,
0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94,
0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x94, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93,
0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92,
0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91,
0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91, 0x91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89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89,
0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88,
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87,
0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86,
0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84,
0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83,
0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
};
unsigned char *_l2u = _l2u_ + 4096;

View File

@ -0,0 +1,5 @@
extern short _u2l[]; /* 8-bit u-law to 16-bit PCM */
extern unsigned char *_l2u; /* 13-bit PCM to 8-bit u-law */
#define ulaw2short(X) (_u2l[(unsigned char) (X)])
#define short2ulaw(X) (_l2u[((short)(X)) >> 3])

View File

@ -0,0 +1,39 @@
#ifndef LANG_H
#define LANG_H
#include "darray.h"
extern char **dialect;
/* Rule is an array of 4 character pointers */
typedef struct rule_s
{
char *left;
char *match;
char *right;
char *output;
} Rule;
typedef struct lang_s
{
char **char_name;
char *point;
int (*vowel)(int chr,int maybe);
int (*consonant)(int chr);
unsigned (*ordinal)(long int value,darray_ptr phone);
unsigned (*cardinal)(long int value,darray_ptr phone);
Rule *(*rules)(int ch);
unsigned char *(*lookup)(const char *s, unsigned n);
} lang_t;
extern unsigned char *dict_find(const char *s, unsigned n);
extern lang_t *lang;
#define isvowel(c,m) (*lang->vowel)(c,m)
#define isconsonant(c) (*lang->consonant)(c)
#define xlate_ordinal(v,p) (*lang->ordinal)(v,p)
#define xlate_cardinal(v,p) (*lang->cardinal)(v,p)
#define dict_find(s,n) ((lang->lookup) ? (*lang->lookup)(s,n) : 0)
#define have_dict (lang->lookup != 0)
#endif /* LANG_H */

View File

@ -0,0 +1,24 @@
#!/usr/local/bin/new/perl -w
use DB_File;
use Fcntl;
use strict;
my $dict = shift;
die "No $dict" unless -r $dict;
my %dict;
my $h = tie %dict, 'DB_File', $dict, O_RDONLY, 0644, $DB_BTREE;
$h = tie %dict, 'DB_File', $dict, O_RDONLY, 0644, $DB_HASH unless $h;
die "Cannot tie $dict:$!" unless $h;
while (my ($key,$val) = each %dict)
{
print "$key\n";
}
untie %dict;

14
stella/src/emucore/rsynth/ldict Executable file
View File

@ -0,0 +1,14 @@
#!/usr/local/bin/perl -w
use GDBM_File;
$dict = shift;
tie( %dict, 'GDBM_File', $dict, &GDBM_READER, 0644) || die "Cannot tie $dict:$!";
while (($key,$val) = each %dict)
{
print "$key\n";
}
untie %dict;

View File

@ -0,0 +1,5 @@
Mbrola was developed by Thierry Dutoit.
It is a speech synthesizer based on the concatenation of diphones.
It takes a list of phonemes as input, together with prosodic
information, and produces speech at the sampling frequency of the
diphone database.

View File

@ -0,0 +1,174 @@
/*
Copyright (c) 1994,2001-2002 Nick Ing-Simmons. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <ctype.h>
#include "useconfig.h"
#include "trie.h"
#include "darray.h"
#include "phones.h"
#include "charset.h" /* national differences ,jms */
#include "dbif.h"
trie_ptr phones;
static void enter_phones(void);
static void
enter_phones(void)
{
int i;
char *s;
for (i = 1; (s = ph_name[i]); i++)
trie_insert(&phones, s, (void *) i);
}
static inline int
Delete(unsigned char *p)
{
int ch = *p;
while (*p)
{
*p = p[1];
p++;
}
return ch;
}
static void enter_words(DB_HANDLE db, FILE * f)
{
char buf[4096];
unsigned words = 0;
while (fgets(buf, sizeof(buf), f))
{
char *s = buf;
char *h = strchr(s, '#');
if (h)
*h = '\0';
while (isspace((unsigned char)*s))
s++;
if (*s)
{
unsigned char *p = (unsigned char *) s;
while (!isspace(*p))
{
if (*p == '"' || *p == '~' || *p == '<')
{
unsigned char *x = p;
*x = accent(x[0], x[1]);
x++;
strcpy((char *)x,(char *)x+1);
}
else if (*p == '\\')
{
unsigned char *x = p;
*x = accent(x[1], x[2]);
x++;
strcpy((char *) x,(char *)x+2);
}
if (isupper(*p))
*p = tolower(*p);
else if (!isalpha(*p) && *p != '\'' && *p != '-' && *p != '_' && *p != '.')
break;
p++;
}
if (isspace(*p))
{
char codes[4096];
char *d = codes;
int ok = 1;
int stress = 0;
DATUM key;
DATUM_SET(key, s, (char *) p - s);
if (++words % 10000 == 0)
{
printf("%d %.*s\n",words, (int) DATUM_SIZE(key), (char *) DATUM_DATA(key));
}
while (*p && ok)
{
unsigned code;
while (isspace(*p))
p++;
if (*p)
{
unsigned char *e = p;
while (isalpha(*e) || *e == '1' || *e == '2')
{
if (*e == '1' || *e == '2')
stress = 1;
else if (islower(*e))
*e = toupper(*e);
e++;
}
if (*e == '0')
*e++ = ' ';
if (e > p && (code = (unsigned) trie_lookup(&phones, (char **) &p)))
*d++ = code;
else
{
fprintf(stderr, "Bad code %.*s>%s", (int)((char *) p - s), s, p);
ok = 0;
break;
}
}
}
if (ok)
{
DATUM data;
DATUM_SET(data, codes, d - codes);
DB_STORE(db, key, data);
}
}
else
{
if (*p != '(')
fprintf(stderr, "Ignore (%c) %s", *p, s);
}
}
}
}
int main(int argc, char *argv[], char *env[]);
int
main(int argc, char **argv, char **envp)
{
init_locale();
if (argc == 3)
{
FILE *f = fopen(argv[1], "r");
if (f)
{
DB_HANDLE db;
DB_OPEN_WRITE(db,argv[2]);
if (db)
{
enter_phones();
enter_words(db, f);
DB_CLOSE(db);
}
else
perror(argv[2]);
fclose(f);
}
else
perror(argv[1]);
}
return 0;
}

View File

@ -0,0 +1,150 @@
/*
Copyright (c) 1998,2001-2002 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include "config.h"
#include "useconfig.h"
#include <sys/time.h>
#include <sys/stat.h>
#ifdef __GNUC__
#define NeedFunctionPrototypes 1
#define NeedNestedPrototypes 1
#endif
#include <audio/audiolib.h>
#include <audio/soundlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include "getargs.h"
#include "hplay.h"
long samp_rate = 8000;
static int volume = 100;
static char *audioserver = NULL;
static AuServer *aud;
static void done(AuServer * aud, AuEventHandlerRec * handler, AuEvent * ev, AuPointer data)
{
switch (ev->auany.type)
{
case AuEventTypeElementNotify:
{
int *d = (int *) data;
*d = (ev->auelementnotify.cur_state == AuStateStop);
if (!*d || ev->auelementnotify.reason != AuReasonEOF)
{
fprintf(stderr, "curr_state=%d reason=%d\n",
ev->auelementnotify.cur_state,
ev->auelementnotify.reason);
}
}
break;
case AuEventTypeMonitorNotify:
break;
default:
fprintf(stderr, "type=%d serial=%ld time=%ld id=%ld\n",
ev->auany.type, ev->auany.serial, ev->auany.time, ev->auany.id);
break;
}
}
void
audio_play(int n,short *data)
{
int endian = 1;
#define little_endian ((*((char *)&endian) == 1))
int priv = 0;
AuEvent ev;
Sound s = SoundCreate(SoundFileFormatNone, little_endian ?
AuFormatLinearSigned16LSB : AuFormatLinearSigned16MSB,
1, samp_rate, n, "Chit chat");
if (aud)
{
#ifdef USE_ALL_ARGS
AuStatus ret_status;
AuFlowID flow = 0;
int monitor = 0;
int multiplier = 0;
if (!AuSoundPlayFromData(aud, s, data, AuNone,
AuFixedPointFromFraction(volume, 100),
done, &priv,
&flow, &multiplier,
&monitor, &ret_status))
#else
if (!AuSoundPlayFromData(aud, s, data, AuNone,
AuFixedPointFromFraction(volume, 100),
done, &priv,
NULL, NULL, NULL, NULL))
#endif
perror("problems playing data");
else
{
while (1)
{
AuNextEvent(aud, AuTrue, &ev);
AuDispatchEvent(aud, &ev);
if (priv)
break;
}
}
}
SoundDestroy(s);
}
void
audio_term(void)
{
if (aud)
{
AuFlush(aud);
AuCloseServer(aud);
}
}
int
audio_init(int argc,char *argv[])
{
int rate_set = samp_rate;
int vol = 0;
argc = getargs("Nas",argc, argv,
"r", "%d", &rate_set, "Sample rate Hz",
"V", "%d", &vol, "Volume 0 .. 1.0",
"a", "", &audioserver,"Name of server",
NULL);
if (help_only)
return argc;
if ((aud = AuOpenServer(audioserver, 0, NULL, 0, NULL, NULL)) == (AuServer *) 0)
perror(audioserver);
if (rate_set && rate_set != samp_rate)
samp_rate = rate_set;
if (vol)
volume = vol;
return argc;
}

View File

@ -0,0 +1,602 @@
/*
Copyright (c) 2002-2004 Nick Ing-Simmons. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
#include <config.h>
#include <useconfig.h>
#include <stdio.h>
#define __USE_ISOC99 1 /* For fpclassify() etc. */
#include <math.h>
#ifndef PI
#define PI 3.1415927
#endif
#include "rsynth.h"
#include "plotparm.h"
#define SYNC_CASCADE
#define PVT(x) rsynth->pvt->x
#define RES(x) &PVT(x),#x
#if defined(__linux__)
#define FPCHECK(x) do { \
if (fpclassify(x) < FP_ZERO) \
{ \
fprintf(stderr, #x "=%g (%s:%d)\n",x,__FILE__,__LINE__); \
abort(); \
} \
} while (0)
#else
#define FPCHECK(x)
#endif
#ifdef DO_RANGE_CHECKS
static float range_max = 0.0; /* largest value seen */
static int range_ln = 0; /* Line number it occurred */
#define RGCHECK(x) do { \
FPCHECK(x); \
if (abs(x) > range_max) \
{ \
range_max = abs(x); \
if (range_max > 32767) \
fprintf(stdout, #x "=%g (%s:%d)\n",range_max,__FILE__,__LINE__); \
range_ln = __LINE__; \
} \
} while (0)
#else
#define RGCHECK(x)
#endif
typedef struct {
float a;
float b;
float c;
float p1;
float p2;
} resonator_t, *resonator_ptr;
typedef struct {
float a;
float b;
float p1;
} lowpass_t, *lowpass_ptr;
struct rsynth_private {
/* Voicing source */
long nper; /* Current loc in voicing period 4*sample_rate */
long T0; /* Fundamental period in output samples times 4 */
long nopen; /* Number of samples in open phase of period */
float F0Hz;
float amp_av; /* ep[av] converted to linear gain */
float amp_bypass; /* ep[ab] converted to linear gain */
float amp_asp; /* ep[asp] converted to linear gain */
float amp_af; /* ep[af] converted to linear gain */
float amp_avc; /* AVC converted to linear gain */
float amp_turb; /* Turbuleance in voicing */
unsigned long seed;
unsigned long ns;
long clip_max;
unsigned usrsamp;
resonator_t rgl;
resonator_t rnz;
resonator_t rnpc;
resonator_t r5c;
resonator_t rsc;
resonator_t r4c;
resonator_t r3c;
resonator_t r2c;
resonator_t r1c;
resonator_t r6p;
resonator_t r5p;
resonator_t r4p;
resonator_t r3p;
resonator_t r2p;
resonator_t rout;
};
/* Convert formant freqencies and bandwidth into
resonator difference equation coefficents
*/
static void
set_pole_fbw(long sr, float f, float bw, resonator_ptr rp, char *name,
int casc)
{
float minus_pi_t = -PI / sr;
float two_pi_t = -2.0 * minus_pi_t;
/* Attempt to be clever and automatically adjust resonator presence based
on sample rate -it does not work very well.
So cascade path has its own conditional to skip r5c
*/
if (2 * f - bw <= sr) {
double arg;
float r;
if (2 * (f + bw) > sr) {
/* This is a little dubious - keep lower skirt in place and
move centre frequency so upper skirt hits Nyquist freq
*/
float low = f - bw;
#if 0
fprintf(stderr, "Adj %s %ld/%ld @ %ld", name, f, bw, sr);
#endif
f = (sr / 2 + low) / 2;
bw = f - low;
#if 0
fprintf(stderr, "=> %ld/%ld\n", f, bw);
#endif
}
arg = minus_pi_t * bw;
r = exp(arg); /* Let r = exp(-pi bw t) */
rp->c = -(r * r); /* Let c = -r**2 */
arg = two_pi_t * f;
rp->b = r * cos(arg) * 2.0; /* Let b = r * 2*cos(2 pi f t) */
rp->a = 1.0 - rp->b - rp->c; /* Let a = 1.0 - b - c */
}
else {
/* lower skirt of resonator exceeds Nyquist limit - make it a no-op,
i.e. pass if cascade, zero if parallel
*/
#if 0
fprintf(stderr, "Skip %s %ld/%ld @ %ld\n", name, f, bw, sr);
#endif
rp->a = casc;
rp->b = 0.0;
rp->c = 0.0;
}
}
/* Convienience function for setting parallel resonators with gain */
static void
set_pole_fbwg(long sr, float f, float bw, resonator_ptr rp, char *name,
float gain, int casc)
{
set_pole_fbw(sr, f, bw, rp, name, casc);
rp->a *= gain;
}
/* Convert formant freqencies and bandwidth into
* anti-resonator difference equation constants
*/
static void
set_zero_fbw(long sr, float f, float bw, resonator_ptr rp, char *name)
{
/* First compute ordinary resonator coefficients */
set_pole_fbw(sr, f, bw, rp, name, 1);
/* Now convert to antiresonator coefficients */
rp->a = 1.0 / rp->a; /* a'= 1/a */
rp->b *= -rp->a; /* b'= -b/a */
rp->c *= -rp->a; /* c'= -c/a */
}
/* Generic resonator function */
static float
resonator(resonator_ptr r, char *name, float input)
{
register float x = r->a * input + r->b * r->p1 + r->c * r->p2;
FPCHECK(input);
FPCHECK(r->a);
FPCHECK(r->b);
FPCHECK(r->c);
r->p2 = r->p1;
r->p1 = x;
return x;
}
/* Generic anti-resonator function
Same as resonator except that a,b,c need to be set with set_zero_fbw()
and we save inputs in p1/p2 rather than outputs.
There is currently only one of these - "rnz"
*/
/* Output = (rnz.a * input) + (rnz.b * oldin1) + (rnz.c * oldin2) */
static float
antiresonator(resonator_ptr r, char *name, float input)
{
register float x = r->a * input + r->b * r->p1 + r->c * r->p2;
FPCHECK(input);
FPCHECK(r->a);
FPCHECK(r->b);
FPCHECK(r->c);
r->p2 = r->p1;
r->p1 = input;
return x;
}
/* Convert from decibels to a linear scale factor */
static float
DBtoLIN(float dB)
{
if (dB > 0) {
float val = 32768 * pow(10.0, (dB - 87) / 20 - 3);
FPCHECK(val);
return val;
}
return 0.0;
}
static void
set_cascade(rsynth_t * rsynth)
{
long sr = rsynth->sr;
/* Set coeficients of nasal resonator and zero antiresonator */
set_pole_fbw(sr, rsynth->speaker->FNPhz, rsynth->speaker->BNhz,
RES(rnpc), 1);
set_zero_fbw(sr, rsynth->ep[fn], rsynth->speaker->BNhz, RES(rnz));
/* Rest of cascade path */
set_pole_fbw(sr, 3500, 1800, RES(rsc), 1);
set_pole_fbw(sr, rsynth->speaker->F5hz, rsynth->speaker->B5hz,
RES(r5c), 1);
set_pole_fbw(sr, rsynth->speaker->F4hz, rsynth->speaker->B4hz,
RES(r4c), 1);
set_pole_fbw(sr, rsynth->ep[f3], rsynth->ep[b3], RES(r3c), 1);
set_pole_fbw(sr, rsynth->ep[f2], rsynth->ep[b2], RES(r2c), 1);
set_pole_fbw(sr, rsynth->ep[f1], rsynth->ep[b1], RES(r1c), 1);
}
static void
pitch_sync(rsynth_t * rsynth)
{
float F0Hz = PVT(F0Hz);
if (rsynth->ep[av] > 0 || rsynth->ep[avc] > 0) {
PVT(T0) = (long) ((4 * rsynth->sr) / F0Hz); /* Period in samp*4 */
PVT(amp_av) = DBtoLIN(rsynth->ep[av]); /* Voice amplitude */
PVT(amp_avc) = DBtoLIN(rsynth->ep[avc]); /* Voice-bar amplitude */
PVT(amp_turb) = PVT(amp_avc) * 0.1; /* Breathiness of voicing waveform */
/* Duration of period before amplitude modulation */
/* if voiced then nopen is 1/3rd the period */
PVT(nopen) = PVT(T0) / 3;
/* Klatt's original has code to jitter T0 by a skew */
}
else {
PVT(T0) = 4; /* Default for f0 undefined */
PVT(nopen) = PVT(T0);
PVT(amp_av) = 0.0;
PVT(amp_avc) = 0.0;
}
/* Reset these pars pitch synchronously or at update rate if f0=0 */
if ((PVT(T0) != 4) || (PVT(ns) == 0)) {
if (rsynth->voice_file) {
fprintf(rsynth->voice_file, "# pitch sync T0=%ld\n", PVT(T0));
}
/* rgl is used to smooth voice to feed cascade during voice-bars
of plosives etc. - high frequencies are much reduced
but try and keep some 2nd harmonic by setting cuttoff to twice f0.
*/
set_pole_fbw(rsynth->sr, 0L, (long) (2 * F0Hz), RES(rgl), 1);
/* Holmes also says that when glotis is open BW of formants
is wider due to damping of sub-glottal airway
We are not modelling this yet.
*/
#ifdef SYNC_CASCADE
/* One theory was that some of noises were due to setting parameters
and that doing cascade (voice) part sync would help - it didn't
*/
set_cascade(rsynth);
#endif
}
}
static float
gen_voice(rsynth_t * rsynth, float noise)
{
int i;
float voice;
/* Generate voice waveform at sr*4 to give better resolution
of T0 and hence period of f0
The sr*4 was for 10kHz system - using impulse train
as voicing source.
With interpolated voice scheme, and without the
lowpass filter used to cancel output 1st difference
this loop seems to be pointless.
*/
for (i = 0; i < 4; i++) {
float alpha;
const float amp = 4096.0;
if (PVT(nper) >= PVT(T0)) {
PVT(nper) = 0;
pitch_sync(rsynth);
}
/* Voice source shape is linear ramp up for 1/3 of
period, then instant drop to baseline and
a parabolic loop below baseline for 2nd 2/3rds
of period. Shape developed by doing LPC analysis
of sample vowels and inverse filtering raw (un differenced)
sample data to approximate excitation of LPC filter.
May still be too "spiky" to be natural, and cosine arch
might be better than parabola.
*/
alpha = (float) PVT(nper) / PVT(T0);
if (alpha <= 1.0 / 3) {
voice = 3 * amp * alpha;
}
else {
voice = amp * ((9 * alpha - 12) * alpha + 3);
}
/* The Klatt model had a low-passed voice term
which needs further analysis
*/
PVT(nper)++;
}
FPCHECK(voice);
return voice;
}
float
gen_noise(rsynth_t * rsynth)
{
float noise = 0.0;
/* pseudo-ramdom is uniformly distributed so average 16 randoms
to get approximatly Gaussian distribution
*/
int i;
for (i = 0; i < 16; i++) {
/* Our own code like rand(), but portable.
Whole upper 31 bits of seed random
assumes 32-bit unsigned arithmetic
with untested code to handle larger.
*/
long nrand;
PVT(seed) = PVT(seed) * 1664525 + 1;
if (8 * sizeof(unsigned long) > 32)
PVT(seed) &= 0xFFFFFFFFL;
/* Low have 31bits of random we want 14 MS bits as a signed value */
/* Shift top bits of seed up to top of long then back down to LS 14 bits */
/* Assumes 8 bits per sizeof unit i.e. a "byte" */
nrand =
(((long) PVT(seed)) << (8 * sizeof(long) -
32)) >> (8 * sizeof(long) - 14);
noise += nrand;
}
/* now divide by 2 - just to balance amplitide of noise with voice source */
return noise / 2;
}
static void
setup_frame(rsynth_t * rsynth)
{
long sr = rsynth->sr;
float Gain0 = rsynth->speaker->Gain0 - 3;
#ifndef SYNC_CASCADE
set_cascade(sr, frame);
#endif
/* Set coefficients of parallel resonators, and amplitude of outputs */
/* dB adjustment is to make 60db "full-on" for all parameters */
set_pole_fbwg(sr, rsynth->ep[f2], rsynth->ep[b2], RES(r2p),
DBtoLIN(rsynth->ep[a2]), 0);
set_pole_fbwg(sr, rsynth->ep[f3], rsynth->ep[b3], RES(r3p),
DBtoLIN(rsynth->ep[a3]), 0);
set_pole_fbwg(sr, rsynth->speaker->F4hz, rsynth->speaker->B4phz,
RES(r4p), DBtoLIN(rsynth->ep[a4]), 0);
set_pole_fbwg(sr, rsynth->speaker->F5hz, rsynth->speaker->B5phz,
RES(r5p), DBtoLIN(rsynth->ep[a5]), 0);
set_pole_fbwg(sr, rsynth->speaker->F6hz, rsynth->speaker->B6phz,
RES(r6p), DBtoLIN(rsynth->ep[a6]), 0);
PVT(amp_bypass) = DBtoLIN(rsynth->ep[ab]);
PVT(amp_asp) = DBtoLIN(rsynth->ep[asp]);
PVT(amp_af) = DBtoLIN(rsynth->ep[af]);
/* fold overall gain into output resonator */
if (Gain0 <= 0)
Gain0 = 57;
/* output low-pass filter - resonator with freq 0 and BW = samrate
*/
set_pole_fbwg(sr, 0L, sr / 2, RES(rout), DBtoLIN(Gain0), 1);
}
float
rsynth_filter(rsynth_t * rsynth, float voice, float noise)
{
RGCHECK(noise);
RGCHECK(voice);
/* Glottal source down cascade chain via nasal zero/pole and f1..f5 */
voice = resonator(RES(rnpc), voice);
RGCHECK(voice);
voice = antiresonator(RES(rnz), voice);
RGCHECK(voice);
voice = resonator(RES(r1c), voice);
RGCHECK(voice);
voice = resonator(RES(r2c), voice);
RGCHECK(voice);
voice = resonator(RES(r3c), voice);
RGCHECK(voice);
voice = resonator(RES(r4c), voice);
RGCHECK(voice);
voice = resonator(RES(rsc), voice);
RGCHECK(voice);
if (rsynth->sr > 8000) {
voice = resonator(RES(r5c), voice);
RGCHECK(voice);
}
/* Now add the parallel parts - excited by frication, alternating in phase.
The phase alternation is to mimimize "zeros" in spectrum by making use
of the fact that phase skirts of two formants F(N) and F(N+1) will
be opposite sign - so for trick to work we must do this in formant
order
*/
/* No f1 on parallel side */
voice = resonator(RES(r2p), noise) - voice;
RGCHECK(voice);
voice = resonator(RES(r3p), noise) - voice;
RGCHECK(voice);
voice = resonator(RES(r4p), noise) - voice;
RGCHECK(voice);
voice = resonator(RES(r5p), noise) - voice;
RGCHECK(voice);
voice = resonator(RES(r6p), noise) - voice;
RGCHECK(voice);
voice = PVT(amp_bypass) * noise - voice;
RGCHECK(voice);
/* Final low-pass filter and gain */
voice = resonator(RES(rout), voice);
RGCHECK(voice);
return voice;
}
long
rsynth_frame(rsynth_t * rsynth, float F0Hz, float *frame, const char *name)
{
unsigned long es;
rsynth->ep = frame;
setup_frame(rsynth);
if (rsynth->voice_file) {
fprintf(rsynth->voice_file, "# voice lpvoc noise out");
fprintf(rsynth->voice_file, "\n");
if (name) {
fprintf(rsynth->voice_file, "# %s\n", name);
}
}
PVT(F0Hz) = F0Hz;
/*
fprintf(stderr,"F0=%g T0=%ld @ %ld\n",0.1*F0hz10,T0,ns);
*/
for (es = PVT(ns) + rsynth->samples_frame; PVT(ns) < es; PVT(ns)++) {
float noise = gen_noise(rsynth);
float voice = gen_voice(rsynth, noise);
float lpvoice = resonator(RES(rgl), voice);
if (PVT(nper) < PVT(nopen)) {
/* Add breathiness during glottal open phase - using noise
Note that amp_avc is further modified by amp_av below.
*/
voice += PVT(amp_turb) * noise;
}
RGCHECK(noise);
/* Original Klatt derived code had a 1st difference
which needed a compsenating soft low-pass filter.
*/
if (PVT(nper) < PVT(nopen)) {
/* less noise in 2nd half of glottal (open phase) */
/* Should that apply to frictation ? */
noise *= 0.5;
}
voice *= PVT(amp_av);
/* Add in aspiration noise to glottal source */
voice += (PVT(amp_asp) * noise);
#if 1
/* Add in sinusoidal voice-bar element */
voice += (PVT(amp_avc) * lpvoice);
#endif
/* From now on noise is frictation source */
noise *= PVT(amp_af);
if (rsynth->voice_file) {
fprintf(rsynth->voice_file, "%6g %6g %6g", voice, lpvoice,
noise);
}
voice = rsynth_filter(rsynth, voice, noise);
if (rsynth->voice_file) {
fprintf(rsynth->voice_file, " %6g\n", voice);
}
/* Original Klatt code did 1st difference of output - which
boosts high frequency. Idea was based on the "lip radiation"
(terminating impedance) of the vocal-tract-as-tubes model.
As waveform is normally slowly varying
it also reduced amplitude considerably which meant earlier
stages needed a lot of dynamic range.
This synth attempts to get same overall response by folding
this high-pass element of transfer function into the excitation.
This not only keeps values more bounded but is computationally
simpler as high-pass is achieved by removing low-pass elements.
The 1st difference also exaggerated problems of an impulse
train as a voicing source and made sampling rate much more important.
*/
if (rsynth->sample_p)
rsynth->user_data =
(*rsynth->sample_p) (rsynth->user_data, voice,
PVT(usrsamp)++, rsynth);
}
return PVT(usrsamp) + rsynth->samples_frame;
}
void
rsynth_flush(rsynth_t * rsynth, unsigned nsamp)
{
if (!nsamp)
nsamp = PVT(usrsamp);
if (rsynth->flush_p)
rsynth->user_data =
(*rsynth->flush_p) (rsynth->user_data, nsamp, rsynth);
PVT(usrsamp) = 0;
}
/* This is here so we can keep rsynth_private private to this file */
rsynth_t *
rsynth_init(long sr, float ms_per_frame, speaker_t * speaker,
rsynth_sample_p * sample_p,
rsynth_flush_p * flush_p, void *user_data)
{
rsynth_t *rsynth = (rsynth_t *) malloc(sizeof(rsynth_t));
struct rsynth_private *pvt = (struct rsynth_private *)
malloc(sizeof(struct rsynth_private));
if (rsynth && pvt) {
memset(rsynth, 0, sizeof(*rsynth));
memset(pvt, 0, sizeof(*pvt));
rsynth->pvt = pvt;
PVT(seed) = 5; /* Fixed staring value */
rsynth->sr = sr;
rsynth->samples_frame = (long) ((sr * ms_per_frame) / 1000);
rsynth->speaker = speaker;
rsynth->sample_p = sample_p;
rsynth->flush_p = flush_p;
rsynth->user_data = user_data;
rsynth->smooth = 0.5F;
rsynth->speed = 1.0F;
}
return rsynth;
}

View File

@ -0,0 +1,33 @@
#define unr 0x00000000
#define rnd 0x00000001
#define low 0x00000002
#define lmd 0x00000004
#define mdl 0x00000008
#define smh 0x00000010
#define lax 0x00000020
#define hgh 0x00000040
#define bck 0x00000080
#define cnt 0x00000100
#define fnt 0x00000200
#define vwl 0x00000400
#define dip 0x00000800
#define blb 0x00001000
#define stl 0x00002000
#define vls 0x00004000
#define stp 0x00008000
#define vcd 0x00010000
#define alv 0x00020000
#define vel 0x00040000
#define glt 0x00080000
#define nas 0x00100000
#define tap 0x00200000
#define apr 0x00400000
#define rzd 0x00800000
#define frc 0x01000000
#define lbd 0x02000000
#define dnt 0x04000000
#define pla 0x08000000
#define lat 0x10000000
#define gld 0x20000000
#define lbv 0x40000000
#define pal 0x80000000

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