tomclegg.net


Diary
Examples
Hire Tom
Mostly Mozart
Patches
School
Scrapbook
Software
    allaboutme
    byteswap
    checksocks
    djbdns-ipv6
  >dsprec<
    fresnel
    fresnel
    logger
    mail-transport-agent
    maildirpop3d
    mp3cat
    qmail-bmf-wildcard
    rawrms
    stationbreak
Telephones




colocation
comments
davidireland
edsgranola
faq
funsites
goodlooking
goodmovies
google-earth-saucy-amd64
houserules
liberating
resume
resume2
scratch
shopping
snacks
todo
university
warisbogus

dsprec
Posted March 10, 2003

This is the dsprec home page. Download the current version: dsprec-0.2.tar.gz.

dsprec was written for FreeBSD. It also works with Linux. It might work with other UNIX systems too. If you make it work on another OS, please tell me so I can mention it here.

Copyright 2003 Tom Clegg.

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.

There is no warranty. If you need a warranty, you cannot use this software. Sorry!


Synopsis

dsprec [-f DEV] [rate R] [channels C] [bits B]

dsprec reads R B-bit signed samples per second, on each of C channels, from DEV (or /dev/dsp if DEV is not supplied) and outputs them to standard output. It stops when it receives a signal or it fails to read from DEV.

If B > 8 then the samples are little-endian.

Typical usage:

$ dsprec rate 44100 bits 16 channels 2 > outfile.raw

Sample rate, word size, and number of channels are untouched if they are not specified. You should always specify them.

Installation

cd /usr/local/src
fetch http://tomclegg.net/software/dsprec-0.2.tar.gz
tar xzf dsprec-0.2.tar.gz
cd dsprec-0.2
make
make install

You need sound support (device pcm) in your kernel in order to run dsprec.

Example

I wrote this to support MP3 streaming with mp3cat. For some reason, I couldn't find an existing program to do this simple job reliably.

dsprec channels 2 rate 44100 bits 16 | \
  lame -h -x -b 64 -a - - | \
  mp3cat --clean --size $((60 * 60 * 8192)) - mp3dir \
  2>&1

If you try dsprec, I'm interested to know whether you can make it work and what you're using it for.