sdr: A software defined radio library

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

Write software defined radio applications in Haskell.

Features:

See https://github.com/adamwalker/sdr for more features and screenshots.

A collection of simple apps that use this library can be found here. These include an FM radio receiver, an OpenGL waterfall plotter and an AM radio receiver.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.8, 0.1.0.9, 0.1.0.10, 0.1.0.11, 0.1.0.12, 0.1.0.12, 0.1.0.13, 0.1.0.14
Change log None available
Dependencies array (>=0.4 && <0.6), base (>=4.7 && <5), bytestring (>=0.10 && <0.11), cairo (>=0.13 && <0.14), cereal (>=0.4 && <0.6), Chart (>=1.3 && <1.10), Chart-cairo (>=1.3 && <1.10), colour (>=2.3 && <2.4), containers (>=0.5 && <0.7), Decimal (>=0.4 && <0.6), dynamic-graph (>=0.1.0.12), fftwRaw (>=0.1 && <0.2), GLFW-b (>=1.4.8 && <4), mwc-random, OpenGL (>=2.11 && <3.1), optparse-applicative (>=0.11 && <0.15), pango (>=0.13 && <0.14), pipes (>=4.1 && <4.4), pipes-bytestring (>=2.0 && <2.2), pipes-concurrency (>=2.0 && <2.1), primitive (>=0.5 && <0.7), pulse-simple (>=0.1 && <0.2), rtlsdr (>=0.1 && <0.2), storable-complex (>=0.2 && <0.3), time (>=1.4 && <1.9), transformers (>=0.5 && <0.6), tuple (>=0.2 && <0.4), vector (>=0.11 && <0.13) [details]
License BSD-3-Clause
Copyright 2018 Adam Walker
Author Adam Walker
Maintainer adamwalker10@gmail.com
Category Software Defined Radio
Home page https://github.com/adamwalker/sdr
Bug tracker https://github.com/adamwalker/sdr/issues
Source repo head: git clone https://github.com/adamwalker/sdr
Uploaded by adamwalker at 2019-07-21T06:10:00Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for sdr-0.1.0.12

[back to package description]

SDR

A Software Defined Radio library written in Haskell

See the blog post.

Features

See sdr-apps for a collection of simple apps built on the library, sdr-demo for a demo application and bladerf-sdr-apps to get started with the BladeRF.

Screenshot

A chunk of the FM broadcast spectrum. Captured with an RTLSDR device and drawn as a waterfall using the Plot module.

Screenshot

Getting Started

Installation

This library will only build and run on 64 bit x86 Linux systems.

You can install it from Hackage:

cabal install sdr

Or, you can build it with cabal sandboxes:

cabal sandbox init
git clone https://github.com/adamwalker/dynamic-graph
git clone https://github.com/adamwalker/haskell-fftw-simple
git clone https://github.com/adamwalker/sdr
cabal sandbox add-source dynamic-graph haskell-fftw-simple sdr
cabal install sdr

If you want to use the BladeRF, you will also need bladerf-pipes and hlibBladeRF.

Example Applications

A collection of simple apps can be found here. These include an FM radio receiver, an OpenGL waterfall plotter and an AM radio receiver that can be used to listen to Airband.

Clone and build:

git clone https://github.com/adamwalker/sdr-apps  
cabal sandbox add-source sdr-apps
cabal install sdr-apps

To run the FM receiver:

.cabal-sandbox/bin/fm -f <your favourite station, e.g. 90.2M>  

To run the waterfall plot:

.cabal-sandbox/bin/waterfall -f <center frequency, e.g. 90.2M> -r <sample rate, e.g. 1280M>

To run the AM receiver:

.cabal-sandbox/bin/am -f <center frequency, e.g. 124.4M> 

Usage

Documentation is available on Hackage.

An FM receiver:

import           Control.Monad.Trans.Either
import           Data.Vector.Generic        as VG 
import           Pipes
import qualified Pipes.Prelude              as P


import SDR.Filter 
import SDR.RTLSDRStream
import SDR.Util
import SDR.Demod
import SDR.Pulse
import SDR.CPUID

--The filter coefficients are stored in another module
import Coeffs

samples    = 8192
frequency  = 105700000

main = eitherT putStrLn return $ do

    info <- lift getCPUInfo

    str  <- sdrStream (defaultRTLSDRParams frequency 1280000) 1 (fromIntegral samples * 2)

    lift $ do

        sink <- pulseAudioSink

        deci <- fastDecimatorC info 8 coeffsRFDecim 
        resp <- fastResamplerR info 3 10 coeffsAudioResampler
        filt <- fastFilterSymR info coeffsAudioFilter

        runEffect $   str
                  >-> P.map (interleavedIQUnsignedByteToFloatFast info)
                  >-> firDecimator deci samples 
                  >-> fmDemod
                  >-> firResampler resp samples 
                  >-> firFilter filt samples
                  >-> P.map (VG.map (* 0.2)) 
                  >-> sink

Disclaimer

I started this project to learn about signal processing. I still have no idea what I'm doing.

Only tested on Arch Linux.

If you actually use this library for anything, let me know: adamwalker10@gmail.com