daily_automated
This commit is contained in:
36
trunk/workspace/SharpTools/scripts.linux/Makefile
Normal file
36
trunk/workspace/SharpTools/scripts.linux/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
INSTALL = install
|
||||
RM = rm
|
||||
PREFIX = /usr/local
|
||||
VERSION = 0.1
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
$(MAKE) -C ../Sources
|
||||
|
||||
installdirs:
|
||||
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) -d $(DESTDIR)/etc
|
||||
|
||||
install: build installdirs
|
||||
$(INSTALL) ../Sources/bas2img $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) ../Sources/bin2wav $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) ../Sources/wav2bin $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) cload $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) csave $(DESTDIR)$(PREFIX)/bin/
|
||||
$(INSTALL) -m 644 sharppc.cfg $(DESTDIR)/etc/
|
||||
|
||||
uninstall:
|
||||
$(RM) $(DESTDIR)$(PREFIX)/bin/bas2img
|
||||
$(RM) $(DESTDIR)$(PREFIX)/bin/bin2wav
|
||||
$(RM) $(DESTDIR)$(PREFIX)/bin/wav2bin
|
||||
$(RM) $(DESTDIR)$(PREFIX)/bin/csave
|
||||
$(RM) $(DESTDIR)$(PREFIX)/bin/cload
|
||||
$(RM) $(DESTDIR)/etc/sharppc.cfg
|
||||
|
||||
clean:
|
||||
$(RM) ../Sources/bas2img
|
||||
$(RM) ../Sources/bin2wav
|
||||
$(RM) ../Sources/wav2bin
|
||||
|
||||
|
||||
124
trunk/workspace/SharpTools/scripts.linux/README
Normal file
124
trunk/workspace/SharpTools/scripts.linux/README
Normal file
@@ -0,0 +1,124 @@
|
||||
SHARP Pocket Computer Tools - Linux scripts
|
||||
===========================================
|
||||
|
||||
|
||||
1. Introduction
|
||||
---------------
|
||||
|
||||
These scripts provides easy to use command line tools to load and save Basic-programms on SHARP Pocket Computers.
|
||||
|
||||
At the moment there are 2 scipts for Linux: One to load a program (cload) and one to save a program from the Pocket Computer (csave).
|
||||
|
||||
The whole process of interfacing the Pocket computer and converting files is automated. After the successful configuration of the tool, saving or loading a program from/to the SHARP Pocket Computer is a ONE-STEP process.
|
||||
|
||||
The backend of these scripts are the binaries by Torsten Mücker's PocketTools (http://www.peil-partner.de/ifhe.de/sharp/)
|
||||
|
||||
|
||||
|
||||
2. Loading and saving programs to the SHARP Pocket Computer
|
||||
-----------------------------------------------------------
|
||||
|
||||
+----------+-----------+ +-----------+ +-----------------+
|
||||
| | Audio- |_________| CE-124 |_________| SHARP |
|
||||
| Linux-PC | Interface | | converter | | Pocket Computer |
|
||||
+----------+-----------+ +-----------+ +-----------------+
|
||||
|
||||
|
||||
|
||||
2.1. Saving a program from the SHARP Pocket Computer
|
||||
----------------------------------------------------
|
||||
|
||||
1. Start the program "csave <filename.bas>" on your PC. The program will wait until it receives an audio signal from the Pocket Computer.
|
||||
2. Start CSAVE on your SHARP Pocket Computer.
|
||||
3. Conversion to ASCII Basic text will start automatically once transfer from the SHARP has finished.
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
csave [-vh] [-x|k] [-p sharp-model-#] [-c audio-card-#] [-d audio-dev-#] [-m mic-ctrl-name] [-l mic-rec-level] <filename.bas>
|
||||
|
||||
OPTIONS:
|
||||
|
||||
-h Print help screen
|
||||
-v Print version information
|
||||
-p <number> Set model number of Sharp (without "PC-")
|
||||
-c <number> Set audio card number (as reported by 'arecord -l')
|
||||
-d <number> Set audio device number (as reported by 'arecord -l')
|
||||
-m <name> Set control-name of the microphone of the audiointerface (as reported by 'amixer -c <device-#> scontrols')
|
||||
-l <number> Set microphone level (in %)
|
||||
-x Don't keep interim files (delete temporary generated img and wav file after uploading)
|
||||
-k Keep all interim files
|
||||
|
||||
Options can be used to override the configuration file settings.
|
||||
|
||||
|
||||
|
||||
2.2. Loading a program to the SHARP Pocket Computer
|
||||
---------------------------------------------------
|
||||
|
||||
1. Start CLOAD on your SHARP Pocket Computer. Alternatively CLOAD can also be started on your SHARP after starting the PC script.
|
||||
2. Start the program "cload <filename.bas>" on your PC.
|
||||
3. The program will transfer the BASIC program via it's audio interface and the SHARP cassette interface to the SHARP Pocket Computer.
|
||||
|
||||
SYNOPSIS:
|
||||
|
||||
cload [-vh] [-x|k] [-p sharp-model-#] [-c audio-card-#] [-d audio-dev-#] <filename.bas>
|
||||
|
||||
OPTIONS:
|
||||
|
||||
-h Print help screen
|
||||
-v Print version information
|
||||
-p <number> Set model number of Sharp (without "PC-")
|
||||
-s Skip autosensing of CLOAD (start transfer immediately)
|
||||
-c <number> Set audio card number (as reported by 'arecord -l')
|
||||
-d <number> Set audio device number (as reported by 'arecord -l')
|
||||
-x Don't keep interim files (delete temporary generated img and wav file after uploading)
|
||||
-k Keep all interim files
|
||||
|
||||
Options can be used to override the configuration file settings.
|
||||
|
||||
|
||||
|
||||
3. Installation
|
||||
---------------
|
||||
|
||||
3.1. Hardware requirements:
|
||||
---------------------------
|
||||
|
||||
To connect the SHARP Pocket Computer with the PC, the SHARP CE-126P, CE-124 or a compatible cassette interface and any ALSA compatible audio interface for the PC is required.
|
||||
|
||||
|
||||
3.2. Software requirements:
|
||||
---------------------------
|
||||
|
||||
The communication of the SHARP Pocket Computer with the PC is through the PC's audio interface. To record and playback the SHARP's cassette signal, a comprehensive command line tool for audio manipulation is utilized:
|
||||
|
||||
SoX - Sound eXchange, the Swiss Army knife of audio manipulation
|
||||
|
||||
To install SoX on an Ubuntu based Linux system run:
|
||||
|
||||
sudo apt-get install sox
|
||||
|
||||
Another tool needed is "amixer" which comes in the alsa-utils package. Very likely this package is already installed on your Linux distribution. In case it's not, install with:
|
||||
|
||||
sudo apt-get install alsa-utils
|
||||
|
||||
|
||||
3.3. Installing SHARP Pocket Computer Tools + Linux scripts:
|
||||
------------------------------------------------------------
|
||||
|
||||
Change to the directory "scripts.linux" inside the PocketTool installation package and run:
|
||||
|
||||
make
|
||||
sudo make install
|
||||
|
||||
This compiles the PocketTool binaries, and installs all scripts into the system directories.
|
||||
|
||||
|
||||
3.4. Configuring the Linux scripts:
|
||||
-----------------------------------
|
||||
|
||||
Custom configuration is mandatory for the scripts to work as expected. All configuration is done in "/etc/sharppc.cfg"
|
||||
|
||||
Follow the comments inside the configuration file, which will provide you with all information required for a successful configuration.
|
||||
|
||||
|
||||
224
trunk/workspace/SharpTools/scripts.linux/cload
Normal file
224
trunk/workspace/SharpTools/scripts.linux/cload
Normal file
@@ -0,0 +1,224 @@
|
||||
#!/bin/bash
|
||||
#================================================================================
|
||||
# HEADER
|
||||
#================================================================================
|
||||
#
|
||||
# Sharp Pocket Computer Program Uploader
|
||||
# --------------------------------------
|
||||
#
|
||||
# by B.Lex, 2017-11-22
|
||||
#
|
||||
#================================================================================
|
||||
#% SYNOPSIS
|
||||
#+ ${SCRIPT_NAME} [-vh] [-x|k] [-p sharp-model-#] [-c audio-card-#] [-d audio-dev-#] <filename.bas>
|
||||
#%
|
||||
#% DESCRIPTION
|
||||
#% Uploading a SHARP Pocket Computer BASIC program from a PC to the SHARP Pocket Computer.
|
||||
#%
|
||||
#% This script uses Torsten Mücker's Pocket Tools (http://www.peil-partner.de/ifhe.de/sharp/)
|
||||
#% to upload BASIC programs from many SHARP Pocket Computers.
|
||||
#%
|
||||
#% The program will convert the ASCII Basic program to a audiofile (wav) and play it to
|
||||
#% the SHARP cassette interface.
|
||||
#%
|
||||
#% Program upload procedure:
|
||||
#% 1. Start CLOAD on your SHARP Pocket Computer.
|
||||
#% Alternatively CLOAD can also be started on your SHARP after starting the PC script.
|
||||
#% 2. Start the program ${SCRIPT_NAME} on your PC.
|
||||
#% 3. The program will transfer the BASIC program via it's audio interface and the
|
||||
#% SHARP cassette interface to the SHARP Pocket Computer.
|
||||
#%
|
||||
#% REQUIREMENTS
|
||||
#% Hardware: SHARP CE-126P, CE-124 or a compatible cassette interface.
|
||||
#% Software: sox (Sound eXchange); amixer (command-line ALSA mixer)
|
||||
#%
|
||||
#% OPTIONS
|
||||
#% -h print this help
|
||||
#% -v print version information
|
||||
#% -p set model number of Sharp (without "PC-")
|
||||
#% -s skip autosensing of CLOAD (start transfer immediately)
|
||||
#% -c set audio card number (as reported by 'arecord -l')
|
||||
#% -d set audio device number (as reported by 'arecord -l')
|
||||
#% -x don't keep interim files (delete generated img and wav file after uploading)
|
||||
#% -k keep all interim files
|
||||
#%
|
||||
#% Options can be used to override the settings in the configuration file settings.
|
||||
#%
|
||||
#================================================================================
|
||||
#- IMPLEMENTATION
|
||||
## version 0.1
|
||||
#- author Bernhard Lex
|
||||
#- copyright 2017
|
||||
#- license GNU General Public License
|
||||
#-
|
||||
#================================================================================
|
||||
# END_OF_HEADER
|
||||
#================================================================================
|
||||
|
||||
|
||||
# --- general variables
|
||||
|
||||
# program is installed or local
|
||||
INSTALLED=1
|
||||
|
||||
# name of configuration file
|
||||
CONFIGFILE="sharppc.cfg"
|
||||
|
||||
# system's standard configuration directory (applies only when program is installed)
|
||||
CONFIGDIR="/etc"
|
||||
|
||||
# interim files are kept (this setting can be overruled by config file)
|
||||
KEEPFILES=1
|
||||
|
||||
# interim files are saved in /tmp folder; applies only when deletion of interim files is enabled
|
||||
USE_TMPDIR=1
|
||||
|
||||
|
||||
# --- display help functions
|
||||
|
||||
SCRIPT_HEADSIZE=$(head -200 ${0} |grep -n "^# END_OF_HEADER" | cut -f1 -d:)
|
||||
SCRIPT_NAME="$(basename ${0})" # scriptname without path
|
||||
|
||||
usage() { printf "Usage: "; head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#+" | sed -e "s/^#+[ ]*//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" ; }
|
||||
usagefull() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#[%#+-]" | sed -e "s/^#[%#+-][ ]\?//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" -e "s/\${APPEND}/${APPEND}/g" ; }
|
||||
version() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^##" | sed -e "s/^##[ ]*//g" -e "s/[ ]\+/ /g" ; }
|
||||
|
||||
|
||||
|
||||
# if program is installed, config file is found in /etc
|
||||
if [ $INSTALLED -eq 1 ]
|
||||
then
|
||||
CONFIGFILE="$CONFIGDIR/$CONFIGFILE"
|
||||
PROGDIR=""
|
||||
else
|
||||
PROGDIR="./"
|
||||
fi
|
||||
|
||||
# load config file
|
||||
if [ -f $CONFIGFILE ]
|
||||
then
|
||||
source $CONFIGFILE
|
||||
else
|
||||
echo "Configuration file $CONFIGFILE not found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if delete-interim-files is set in config
|
||||
# convert DEL_INTERFILES to lower case
|
||||
DEL_INTERFILES=$(echo "$DEL_INTERFILES" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $DEL_INTERFILES == "yes" ]]
|
||||
then
|
||||
KEEPFILES=0
|
||||
else
|
||||
KEEPFILES=1
|
||||
fi
|
||||
|
||||
# set TMPDIR parameter for mktemp
|
||||
if [ $USE_TMPDIR -eq 1 ]
|
||||
then
|
||||
USE_TMPDIR="--tmpdir"
|
||||
else
|
||||
USE_TMPDIR=""
|
||||
fi
|
||||
|
||||
# check if CLOAD autosensing is set in config, then convert CLOAD_AUTOSENSE to lower case
|
||||
CLOAD_AUTOSENSE=$(echo "$CLOAD_AUTOSENSE" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# set flag-arguments
|
||||
while getopts :c:d:p:sxkvh option
|
||||
do
|
||||
case "${option}"
|
||||
in
|
||||
c) AUDIOCARD=${OPTARG};;
|
||||
d) AUDIODEVICE=${OPTARG};;
|
||||
p) SHARPPC=${OPTARG};;
|
||||
s) CLOAD_AUTOSENSE="no";;
|
||||
x) KEEPFILES=0;;
|
||||
k) KEEPFILES=1;;
|
||||
v)
|
||||
version
|
||||
exit 0
|
||||
;;
|
||||
h)
|
||||
usagefull
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# get the filename argument
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
FILENAME="$1"
|
||||
FILENAME_WO_EXT="${FILENAME%.*}"
|
||||
# check if file is existing
|
||||
if [ ! -e "$FILENAME" ]
|
||||
then
|
||||
echo "File $FILENAME does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
#echo "Please provide a filename!"
|
||||
usagefull
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prevent temporary files from overwriting existing files with same name
|
||||
if [ $KEEPFILES -eq 0 ]
|
||||
then
|
||||
# temporary files
|
||||
WAV_FILE=$(mktemp $USE_TMPDIR --suffix=.wav "${FILENAME_WO_EXT}_XXXX")
|
||||
IMG_FILE=$(mktemp $USE_TMPDIR --suffix=.img "${FILENAME_WO_EXT}_XXXX")
|
||||
else
|
||||
# permanent files
|
||||
WAV_FILE="${FILENAME_WO_EXT}.wav"
|
||||
IMG_FILE="${FILENAME_WO_EXT}.img"
|
||||
fi
|
||||
|
||||
# Set record-level if scontrol mic-name is defined
|
||||
# used only for detecting when CLOAD has been started on SHARP
|
||||
if [ ! -z $MICNAME ]
|
||||
then
|
||||
amixer -c $AUDIOCARD sset $MICNAME $MICLEVEL
|
||||
fi
|
||||
|
||||
# Set playback-level if scontrol headphone-name is defined
|
||||
if [ ! -z $PLAYNAME ]
|
||||
then
|
||||
amixer -c $AUDIOCARD sset $PLAYNAME $PLAYLEVEL
|
||||
fi
|
||||
|
||||
# convert ASCII Basic to IMG
|
||||
${PROGDIR}bas2img -t img -p $SHARPPC "$FILENAME" "$IMG_FILE"
|
||||
|
||||
# convert IMG to audio
|
||||
${PROGDIR}bin2wav -t img -p $SHARPPC "$IMG_FILE" "$WAV_FILE"
|
||||
|
||||
# check if CLOAD autosensing is set
|
||||
if [[ $CLOAD_AUTOSENSE == "yes" ]]
|
||||
then
|
||||
# waiting until CLOAD has been started on SHARP (no file being created)
|
||||
sox -c 1 -e s -t alsa hw:$AUDIOCARD,$AUDIODEVICE -n silence 1 0.1 5% trim 0 0.1
|
||||
fi
|
||||
|
||||
# upload file to Sharp
|
||||
sox "$WAV_FILE" -t alsa hw:$AUDIOCARD,$AUDIODEVICE
|
||||
|
||||
# delete interim files if requested
|
||||
if [ $KEEPFILES -eq 0 ]
|
||||
then
|
||||
rm "$IMG_FILE"
|
||||
rm "$WAV_FILE"
|
||||
fi
|
||||
|
||||
204
trunk/workspace/SharpTools/scripts.linux/csave
Normal file
204
trunk/workspace/SharpTools/scripts.linux/csave
Normal file
@@ -0,0 +1,204 @@
|
||||
#!/bin/bash
|
||||
#================================================================================
|
||||
# HEADER
|
||||
#================================================================================
|
||||
#
|
||||
# Sharp Pocket Computer Program Saver
|
||||
# -----------------------------------
|
||||
#
|
||||
# by B.Lex, 2017-11-22
|
||||
#
|
||||
#================================================================================
|
||||
#% SYNOPSIS
|
||||
#+ ${SCRIPT_NAME} [-vh] [-x|k] [-p sharp-model-#] [-c audio-card-#] [-d audio-dev-#] [-m mic-ctrl-name] [-l mic-rec-level] <filename.bas>
|
||||
#%
|
||||
#% DESCRIPTION
|
||||
#% Saving a program from a SHARP Pocket Computer as ASCII Basic on PC.
|
||||
#%
|
||||
#% This script uses Torsten Mücker's Pocket Tools (http://www.peil-partner.de/ifhe.de/sharp/)
|
||||
#% to download BASIC programs from many SHARP Pocket Computers.
|
||||
#%
|
||||
#% The program will record the signal from the SHARP cassette interface as audio file (wav)
|
||||
#% and convert it to a ASCII Basic text file.
|
||||
#%
|
||||
#% Program download procedure:
|
||||
#% 1. Start the program ${SCRIPT_NAME} on your PC. The program will wait
|
||||
#% until it receives an audio signal.
|
||||
#% 2. Start CSAVE on your SHARP Pocket Computer.
|
||||
#% 3. Conversion to ASCII Basic text will start automatically once transfer
|
||||
#% from the SHARP has finished.
|
||||
#%
|
||||
#% REQUIREMENTS
|
||||
#% Hardware: SHARP CE-126P, CE-124 or a compatible cassette interface.
|
||||
#% Software: sox (Sound eXchange); amixer (command-line ALSA mixer)
|
||||
#%
|
||||
#% OPTIONS
|
||||
#% -h print this help
|
||||
#% -v print version information
|
||||
#% -p set model number of sharp (without "PC-")
|
||||
#% -c set audio card number (as reported by 'arecord -l')
|
||||
#% -d set audio device number (as reported by 'arecord -l')
|
||||
#% -m set control-name of the microphone of the audiointerface
|
||||
#% (as reported by 'amixer -c <device-#> scontrols')
|
||||
#% -l set microphone level (in %)
|
||||
#% -x don't keep interim files (delete generated wav file after converting to ASCII)
|
||||
#% -k keep all interim files
|
||||
#%
|
||||
#% Options can be used to override the settings in the configuration file.
|
||||
#%
|
||||
#================================================================================
|
||||
#- IMPLEMENTATION
|
||||
## version 0.1
|
||||
#- author Bernhard Lex
|
||||
#- copyright 2017
|
||||
#- license GNU General Public License
|
||||
#-
|
||||
#================================================================================
|
||||
# END_OF_HEADER
|
||||
#================================================================================
|
||||
|
||||
|
||||
# --- general variables
|
||||
|
||||
# program is installed or local
|
||||
INSTALLED=1
|
||||
|
||||
# name of configuration file
|
||||
CONFIGFILE="sharppc.cfg"
|
||||
|
||||
# system's standard configuration directory (applies only when program is installed)
|
||||
CONFIGDIR="/etc"
|
||||
|
||||
# interim files are kept (this setting can be overruled by config file)
|
||||
KEEPFILES=1
|
||||
|
||||
# interim files are saved in /tmp folder; applies only when deletion of interim files is enabled
|
||||
USE_TMPDIR=1
|
||||
|
||||
|
||||
# --- display help functions
|
||||
|
||||
SCRIPT_HEADSIZE=$(head -200 ${0} |grep -n "^# END_OF_HEADER" | cut -f1 -d:)
|
||||
SCRIPT_NAME="$(basename ${0})" # scriptname without path
|
||||
|
||||
usage() { printf "Usage: "; head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#+" | sed -e "s/^#+[ ]*//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" ; }
|
||||
usagefull() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^#[%#+-]" | sed -e "s/^#[%#+-][ ]\?//g" -e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g" -e "s/\${APPEND}/${APPEND}/g" ; }
|
||||
version() { head -${SCRIPT_HEADSIZE:-99} ${0} | grep -e "^##" | sed -e "s/^##[ ]*//g" -e "s/[ ]\+/ /g" ; }
|
||||
|
||||
|
||||
|
||||
# if program is installed, config file is found in /etc
|
||||
if [ $INSTALLED -eq 1 ]
|
||||
then
|
||||
CONFIGFILE="$CONFIGDIR/$CONFIGFILE"
|
||||
PROGDIR=""
|
||||
else
|
||||
PROGDIR="./"
|
||||
fi
|
||||
|
||||
# load config file
|
||||
if [ -f $CONFIGFILE ]
|
||||
then
|
||||
source $CONFIGFILE
|
||||
else
|
||||
echo "Configuration file $CONFIGFILE not found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# check if delete-interim-files is set in config
|
||||
# convert DEL_INTERFILES to lower case
|
||||
DEL_INTERFILES=$(echo "$DEL_INTERFILES" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $DEL_INTERFILES == "yes" ]]
|
||||
then
|
||||
KEEPFILES=0
|
||||
else
|
||||
KEEPFILES=1
|
||||
fi
|
||||
|
||||
# set TMPDIR parameter for mktemp
|
||||
if [ $USE_TMPDIR -eq 1 ]
|
||||
then
|
||||
USE_TMPDIR="--tmpdir"
|
||||
else
|
||||
USE_TMPDIR=""
|
||||
fi
|
||||
|
||||
# set flag-arguments
|
||||
while getopts :c:d:p:m:l:xkvh option
|
||||
do
|
||||
case "${option}"
|
||||
in
|
||||
c) AUDIOCARD=${OPTARG};;
|
||||
d) AUDIODEVICE=${OPTARG};;
|
||||
p) SHARPPC=${OPTARG};;
|
||||
m) MICNAME=${OPTARG};;
|
||||
l) MICLEVEL="${OPTARG}%";;
|
||||
x) KEEPFILES=0;;
|
||||
k) KEEPFILES=1;;
|
||||
v)
|
||||
version
|
||||
exit 0
|
||||
;;
|
||||
h)
|
||||
usagefull
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# get the filename argument
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
FILENAME="$1"
|
||||
FILENAME_WO_EXT="${FILENAME%.*}"
|
||||
# check if filename has extension
|
||||
if [[ "$FILENAME" == "$FILENAME_WO_EXT" ]]
|
||||
then
|
||||
# no extension given, add extension
|
||||
FILENAME="$FILENAME.bas"
|
||||
fi
|
||||
else
|
||||
#echo "Please provide a filename!"
|
||||
usagefull
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# prevent temporary files from overwriting existing files with same name
|
||||
if [ $KEEPFILES -eq 0 ]
|
||||
then
|
||||
# temporary files
|
||||
WAV_FILE=$(mktemp $USE_TMPDIR --suffix=.wav "${FILENAME_WO_EXT}_XXXX")
|
||||
else
|
||||
# permanent files
|
||||
WAV_FILE="${FILENAME_WO_EXT}.wav"
|
||||
fi
|
||||
|
||||
# Set record-level if scontrol mic-name is defined
|
||||
if [ ! -z $MICNAME ]
|
||||
then
|
||||
amixer -c $AUDIOCARD sset $MICNAME $MICLEVEL
|
||||
fi
|
||||
|
||||
# record audio
|
||||
sox -r 22050 -b 16 -c 1 -e s -t alsa hw:$AUDIOCARD,$AUDIODEVICE "$WAV_FILE" silence 1 0.1 5% 1 0.5 5%
|
||||
|
||||
# convert to ASCII Basic
|
||||
${PROGDIR}wav2bin -t bas -p $SHARPPC "$WAV_FILE" "$FILENAME"
|
||||
|
||||
# delete interim files if requested
|
||||
if [ $KEEPFILES -eq 0 ]
|
||||
then
|
||||
rm "$WAV_FILE"
|
||||
fi
|
||||
|
||||
48
trunk/workspace/SharpTools/scripts.linux/sharppc.cfg
Normal file
48
trunk/workspace/SharpTools/scripts.linux/sharppc.cfg
Normal file
@@ -0,0 +1,48 @@
|
||||
#================================================================================
|
||||
# Configuration file for:
|
||||
# SHARP Pocket Computer Tools
|
||||
#
|
||||
#
|
||||
# Do all configurations and settings depending on your environment here
|
||||
# Note: No space is allowed on either side of the equal sign (=)!
|
||||
# A valid example: VARIABLE=value
|
||||
#================================================================================
|
||||
|
||||
|
||||
# Set the model type of your Pocket Computer (without "PC-")
|
||||
#SHARPPC=1211
|
||||
#SHARPPC=1251
|
||||
#SHARPPC=1260
|
||||
#SHARPPC=1350
|
||||
#SHARPPC=1360
|
||||
SHARPPC=1401
|
||||
#SHARPPC=1403
|
||||
#SHARPPC=1421
|
||||
#SHARPPC=1475
|
||||
#SHARPPC=1500
|
||||
#SHARPPC=1600
|
||||
#SHARPPC=E220
|
||||
#SHARPPC=E500
|
||||
#SHARPPC=G850
|
||||
|
||||
# Set the audio interface where the Sharp cassette interface (CE-124 or CE-126P) is connected
|
||||
# Using `aplay -l` or `arecord -l` will list all audio devices on your system. Enter the card number and the device number of your audio interface where your CE-124 compatible device is connected.
|
||||
AUDIOCARD=3
|
||||
AUDIODEVICE=0
|
||||
|
||||
# Setting the Mic level to a high level is required. For being able to apply this setting automatically the control-name of the microphone of the audio-interface to use is needed.
|
||||
# To get a complete list of simple mixer controls of your device use `amixer -c <card number> scontrol`. Default mic-name is "Mic" and default mic-level = "95%". Not setting MICNAME will leave default system device settings unchanged.
|
||||
MICNAME="Mic"
|
||||
MICLEVEL="95%"
|
||||
|
||||
# Setting the playback audio level (optional). To do this the control-name of the audio output-port of the audio-interface is needed.
|
||||
# Get a complete list of simple mixer controls of your device use `amixer -c <card number> scontrol`. Default playback-name is "Headphone" and a good value for playback-level = "90%". Not setting PLAYNAME will leave default device settings unchanged.
|
||||
#PLAYNAME="Headphone"
|
||||
PLAYLEVEL="90%"
|
||||
|
||||
# Enable autodetecting CLOAD sensing. With this setting CLOAD might be started on your SHARP after starting the PC script. The PC will wait with the transfer until CLOAD is detected on the SHARP Pocket Computer. Default setting = yes.
|
||||
CLOAD_AUTOSENSE=yes
|
||||
|
||||
# Delete interim files (WAV, IMG) after processing. Set to "yes" or "no". Not setting DEL_INTERFILES will keep all files)
|
||||
DEL_INTERFILES=yes
|
||||
|
||||
Reference in New Issue
Block a user