minimodem 0.2.0

This commit is contained in:
Kamal Mostafa 2011-06-08 14:00:22 -07:00
parent 54f8efde20
commit 439b606a97
17 changed files with 249 additions and 37 deletions

22
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for minimodem 0.1.0.
# Generated by GNU Autoconf 2.67 for minimodem 0.2.0.
#
# Report bugs to <kamal@whence.com>.
#
@ -551,8 +551,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='minimodem'
PACKAGE_TARNAME='minimodem'
PACKAGE_VERSION='0.1.0'
PACKAGE_STRING='minimodem 0.1.0'
PACKAGE_VERSION='0.2.0'
PACKAGE_STRING='minimodem 0.2.0'
PACKAGE_BUGREPORT='kamal@whence.com'
PACKAGE_URL=''
@ -1203,7 +1203,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures minimodem 0.1.0 to adapt to many kinds of systems.
\`configure' configures minimodem 0.2.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1269,7 +1269,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of minimodem 0.1.0:";;
short | recursive ) echo "Configuration of minimodem 0.2.0:";;
esac
cat <<\_ACEOF
@ -1362,7 +1362,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
minimodem configure 0.1.0
minimodem configure 0.2.0
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1417,7 +1417,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by minimodem $as_me 0.1.0, which was
It was created by minimodem $as_me 0.2.0, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@ -1766,7 +1766,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
VERSION=0.1.0
VERSION=0.2.0
am__api_version='1.11'
@ -2236,7 +2236,7 @@ fi
# Define the identity of the package.
PACKAGE='minimodem'
VERSION='0.1.0'
VERSION='0.2.0'
cat >>confdefs.h <<_ACEOF
@ -4038,7 +4038,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by minimodem $as_me 0.1.0, which was
This file was extended by minimodem $as_me 0.2.0, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4104,7 +4104,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
minimodem config.status 0.1.0
minimodem config.status 0.2.0
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"

View File

@ -3,7 +3,7 @@ dnl configure.ac Generated by project-setup
dnl
AC_DEFUN([PKG_NAME], [minimodem])
AC_DEFUN([PKG_VERSION], [0.1.0])
AC_DEFUN([PKG_VERSION], [0.2.0])
AC_DEFUN([PKG_AUTHOR], [Kamal Mostafa <kamal@whence.com>])
AC_DEFUN([PKG_BUGS_TO], [kamal@whence.com])

45
src-baudot/baudot.h Normal file
View File

@ -0,0 +1,45 @@
static char
baudot[32][3] = {
// letter, U.S. figs, CCITT No.2 figs (Europe)
{ '*', '*', '*' }, // NUL
{ 'E', '3', '3' },
{ '\n', '\n', '\n' },
{ 'A', '-', '-' },
{ ' ', ' ', ' ' }, // SPACE
{ 'S', '*', '\'' }, // BELL or apostrophe
{ 'I', '8', '8' },
{ 'U', '7', '7' },
{ '\n', '\n', '\n' },
{ 'D', '$', '*' }, // '$' or ENQ
{ 'R', '4', '4' },
{ 'J', '\'', '*' }, // apostrophe or BELL
{ 'N', ',', ',' },
{ 'F', '!', '!' },
{ 'C', ':', ':' },
{ 'K', '(', '(' },
{ 'T', '5', '5' },
{ 'Z', '"', '+' },
{ 'L', ')', ')' },
{ 'W', '2', '2' },
{ 'H', '#', '*' }, // '#' or British pounds symbol // FIXME
{ 'Y', '6', '6' },
{ 'P', '0', '0' },
{ 'Q', '1', '1' },
{ 'O', '9', '9' },
{ 'B', '?', '?' },
{ 'G', '&', '&' },
{ '*', '*', '*' }, // FIGS
{ 'M', '.', '.' },
{ 'X', '/', '/' },
{ 'V', ';', '=' },
{ '*', '*', '*' }, // LTRS
};
#define BAUDOT_LTRS 0x1F
#define BAUDOT_FIGS 0x1B
#define BAUDOT_SPACE 0x04

View File

@ -1,17 +1,32 @@
#
# Makefile.am
#
# Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
#
# NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
#
#
AM_CFLAGS = -Wall -Werror
INCLUDES = $(DEPS_CFLAGS)
bin_PROGRAMS = minimodem tscope
bin_PROGRAMS = minimodem
SIMPLEAUDIO_SRC=\
EXTRA_DIST = run-test
SIMPLEAUDIO_SRC = \
simpleaudio.h \
simpleaudio_internal.h \
simpleaudio.c \
simpleaudio-pulse.c \
simpleaudio-sndfile.c
minimodem_LDADD = $(DEPS_LIBS)
minimodem_SOURCES = minimodem.c fsk.c $(SIMPLEAUDIO_SRC)
FSK_SRC = fsk.h fsk.c
minimodem_LDADD = $(DEPS_LIBS)
minimodem_SOURCES = minimodem.c $(FSK_SRC) $(SIMPLEAUDIO_SRC)
tscope_LDADD = $(DEPS_LIBS)
tscope_SOURCES = tscope.c tscope_print.c

View File

@ -15,6 +15,15 @@
@SET_MAKE@
#
# Makefile.am
#
# Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
#
# NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
#
#
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -32,7 +41,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = minimodem$(EXEEXT) tscope$(EXEEXT)
bin_PROGRAMS = minimodem$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -45,16 +54,14 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am__objects_1 = simpleaudio.$(OBJEXT) simpleaudio-pulse.$(OBJEXT) \
am__objects_1 = fsk.$(OBJEXT)
am__objects_2 = simpleaudio.$(OBJEXT) simpleaudio-pulse.$(OBJEXT) \
simpleaudio-sndfile.$(OBJEXT)
am_minimodem_OBJECTS = minimodem.$(OBJEXT) fsk.$(OBJEXT) \
$(am__objects_1)
am_minimodem_OBJECTS = minimodem.$(OBJEXT) $(am__objects_1) \
$(am__objects_2)
minimodem_OBJECTS = $(am_minimodem_OBJECTS)
am__DEPENDENCIES_1 =
minimodem_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_tscope_OBJECTS = tscope.$(OBJEXT) tscope_print.$(OBJEXT)
tscope_OBJECTS = $(am_tscope_OBJECTS)
tscope_DEPENDENCIES = $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@ -63,8 +70,8 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(minimodem_SOURCES) $(tscope_SOURCES)
DIST_SOURCES = $(minimodem_SOURCES) $(tscope_SOURCES)
SOURCES = $(minimodem_SOURCES)
DIST_SOURCES = $(minimodem_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -158,15 +165,17 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -Wall -Werror
INCLUDES = $(DEPS_CFLAGS)
EXTRA_DIST = run-test
SIMPLEAUDIO_SRC = \
simpleaudio.h \
simpleaudio_internal.h \
simpleaudio.c \
simpleaudio-pulse.c \
simpleaudio-sndfile.c
FSK_SRC = fsk.h fsk.c
minimodem_LDADD = $(DEPS_LIBS)
minimodem_SOURCES = minimodem.c fsk.c $(SIMPLEAUDIO_SRC)
tscope_LDADD = $(DEPS_LIBS)
tscope_SOURCES = tscope.c tscope_print.c
minimodem_SOURCES = minimodem.c $(FSK_SRC) $(SIMPLEAUDIO_SRC)
all: all-am
.SUFFIXES:
@ -241,9 +250,6 @@ clean-binPROGRAMS:
minimodem$(EXEEXT): $(minimodem_OBJECTS) $(minimodem_DEPENDENCIES)
@rm -f minimodem$(EXEEXT)
$(LINK) $(minimodem_OBJECTS) $(minimodem_LDADD) $(LIBS)
tscope$(EXEEXT): $(tscope_OBJECTS) $(tscope_DEPENDENCIES)
@rm -f tscope$(EXEEXT)
$(LINK) $(tscope_OBJECTS) $(tscope_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -256,8 +262,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio-pulse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio-sndfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tscope.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tscope_print.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<

View File

@ -1,3 +1,12 @@
/*
* fsk.c
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#include <malloc.h>
#include <string.h>

77
src/fsk.h Normal file
View File

@ -0,0 +1,77 @@
/*
* fsk.h
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#define USE_FFT // leave this enabled; its presently the only choice
#ifdef USE_FFT
#include <fftw3.h>
#endif
typedef struct fsk_plan fsk_plan;
struct fsk_plan {
float sample_rate;
float f_mark;
float f_space;
float filter_bw;
unsigned int n_data_bits;
unsigned int n_frame_bits;
#ifdef USE_FFT
int fftsize;
unsigned int nbands;
unsigned int band_width;
unsigned int b_mark;
unsigned int b_space;
fftwf_plan fftplan;
float *fftin;
fftwf_complex *fftout;
#endif
};
fsk_plan *
fsk_plan_new(
float sample_rate,
float f_mark,
float f_space,
float filter_bw,
unsigned int n_data_bits
);
void
fsk_plan_destroy( fsk_plan *fskp );
/* returns confidence value [0.0 to 1.0] */
float
fsk_find_frame( fsk_plan *fskp, float *samples, unsigned int frame_nsamples,
unsigned int try_max_nsamples,
unsigned int try_step_nsamples,
unsigned int *bits_outp,
unsigned int *frame_start_outp
);
int
fsk_detect_carrier(fsk_plan *fskp, float *samples, unsigned int nsamples,
float min_mag_threshold );
void
fsk_set_tones_by_bandshift( fsk_plan *fskp, unsigned int b_mark, int b_shift );
// FIXME move this?:
//#define FSK_DEBUG
#ifdef FSK_DEBUG
# define debug_log(format, args...) fprintf(stderr, format, ## args)
#else
# define debug_log(format, args...)
#endif

View File

@ -1,3 +1,12 @@
/*
* minimodem.c
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#include <stdio.h>
#include <stdlib.h>
@ -54,8 +63,7 @@ main( int argc, char*argv[] )
#ifdef CARRIER_AUTODETECT_THRESHOLD
unsigned int autodetect_shift = 200;
#endif
// band_width = 10;
band_width = 100; /* close enough */
band_width = 50; /* close enough */
/*
* Bell 202: baud=1200 mark=1200 space=2200

View File

@ -1,4 +1,13 @@
#!/bin/bash
#
# run-test
#
# Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
#
# NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
#
#
TMPDIR=/tmp/run-test-$$
mkdir "$TMPDIR" || exit

View File

@ -1,3 +1,12 @@
/*
* simpleaudio-pulse.c
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#include <stdio.h>
#include <malloc.h>

View File

@ -1,3 +1,12 @@
/*
* simpleaudio-sndfile.c
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#include <stdio.h>
#include <malloc.h>

View File

@ -1,3 +1,12 @@
/*
* simpleaudio.c
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#include "simpleaudio.h"
#include "simpleaudio_internal.h"
#include "malloc.h"

View File

@ -1,3 +1,12 @@
/*
* simpleaudio.h
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#ifndef SIMPLEAUDIO_H
#define SIMPLEAUDIO_H

View File

@ -1,3 +1,12 @@
/*
* simpleaudio_internal.h
*
* Copyright (C) 2011 Kamal Mostafa <kamal@whence.com>
*
* NO LICENSE HAS BEEN SPECIFIED OR GRANTED FOR THIS WORK.
*
*/
#ifndef SIMPLEAUDIO_INTERNAL_H
#define SIMPLEAUDIO_INTERNAL_H