commit - a7dafd6f194e81639c91e50d75f205343d02eef2
commit + 4ff4e76f99c53a244e00f23c1ab69fe22f00b5aa
blob - 15febf1d5c3a83facadd5d06242337b6b3d1546e
blob + 7cdda88f80b9eff9e1a5150217bcac1e230f04d2
--- NOTES
+++ NOTES
- CW_DECAY env. variable to set decay time in ms [=attack]
- CW_ATTACK_SHAPE env. variable to set attack envelope [lin]
- CW_DECAY_SHAPE env. variable to set decay envelope [lin]
+ - CW_AMPLITUDE env. variable to set output amplitude in percent [80]
- morseteach.c - implements the Cunningham Morse Teacher
- terminal interactive UI
- sound output via external process: morse -s | morseplay
blob - 72f4382f3cc61e6e6751a586ae79ffa3cd60e431
blob + 32d3db82039f22d66de13c59bd13e50f1cb25cd7
--- cw.c
+++ cw.c
static int lowtime, hightime; /* (in)audible time included in ramps */
static int inbeep; /* did we last beep()? */
+static double amp = 0.8; /* sine wave amplitute [0.0, 1.0] */
/* possible values for the envelope functions */
struct shape { const char *name; rampfun_t *fun; } shapes[] = {
return *p;
}
+double
+getenvpct(const char *name, double *p)
+{
+ int n = *p * 100;
+
+ *p = getenvnum(name, "%", &n) / 100.0;
+
+ return *p;
+}
+
rampfun_t *
getenvshape(const char *name, rampfun_t **p)
{
int i, j;
for (i = 0; i < n; i++) {
- y = sample_max * sin(2 * M_PI * f * (x + i) / par.rate);
+ y = sample_max * amp * sin(2 * M_PI * f * (x + i) / par.rate);
/* write to all channels */
for (j = 0; j < par.pchan; j++)
void
cwstart()
{
+ getenvpct("CW_AMPLITUDE", &);
getenvnum("CW_ATTACK", "ms", &rise);
fall = rise; /* default */
getenvnum("CW_DECAY", "ms", &fall);
blob - 2d3d791bba1a28abbb2bbd1057c0f377f037a8f0
blob + 75927a85de175288c360be5e27058fdec27214e9
--- cw.h
+++ cw.h
/* getenv helpers */
int getenvnum(const char *, const char *, int *);
+double getenvpct(const char *, double *);
rampfun_t *getenvshape(const char *, rampfun_t **);
#endif /* CW_H_ */