Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThinkDSP.jl

An idiomatic Julia toolkit for signals, waves, spectra, filtering, and audio, inspired by Allen Downey's Think DSP.

ThinkDSP.jl targets Julia 1.12+ and is currently prepared for its first public release.

Features

  • Signal families: sinusoids, periodic waves, chirps, impulses, and colored noise.
  • Time-domain processing: sampled Wave values, arithmetic, windows, segmentation, convolution, differentiation, and integration.
  • Frequency-domain analysis: FFT spectra, DCTs, filters, spectral calculus, and reusable FFTW workspaces.
  • Time-frequency analysis: STFT spectrograms with normalized overlap-add reconstruction.
  • Audio and music helpers: WAV I/O, PCM quantization, MIDI notes, chords, and rests.
  • Plotting recipes for signals, waves, spectra, DCTs, integrated spectra, and spectrograms through RecipesBase.

Installation

ThinkDSP.jl has not yet been registered. Install it from a local checkout:

using Pkg
Pkg.develop(path="/path/to/think_dsp_julia_build")

After registration, installation will be:

using Pkg
Pkg.add("ThinkDSP")

Quick Start

using ThinkDSP

signal = Sinusoid(440.0)
wave = make_wave(signal; duration=1.0, framerate=44100)
spec = spectrum(wave)
println("Peak frequency: ", spec.fs[argmax(magnitude(spec))], " Hz")

Plotting

ThinkDSP uses RecipesBase. Load Plots separately:

using Plots
gr()
plot(wave)
plot(spec; representation=:magnitude)
plot(spectrogram(wave))

Documentation

The source documentation is in docs/src. Build the site locally with:

julia --project=docs docs/make.jl

The generated site is written to docs/build/ and is not committed.

Examples

The examples/ directory contains small executable programs as well as end-to-end workflows:

Example Demonstrates
basic_fft.jl FFT spectrum and inverse-transform round trip
signal_pipeline.jl Two-tone analysis, low-pass filtering, differentiation, and convolution
reusable_workspaces.jl Reusing FFT, DCT, and spectrogram workspaces
audio_midi_roundtrip.jl MIDI chord construction and 16-bit WAV round trip
plotting.jl RecipesBase integration with Plots.jl

Run a non-plotting example from the repository root:

julia --project=. examples/signal_pipeline.jl

The plotting example requires the contributor environment:

julia --project=dev examples/plotting.jl

Development

Clone the repository, then instantiate the root workspace once:

using Pkg
Pkg.activate(".")
Pkg.instantiate()
Pkg.test()

ThinkDSP uses Julia 1.12+ workspaces. Package users receive only the runtime dependencies in the root Project.toml; contributor tools are scoped to dedicated projects that share the root Manifest.toml.

Workspace Purpose
dev Daemon workflow, Revise, plotting, validation, and local tooling
test Functional tests plus Aqua and JET quality checks
benchmark BenchmarkTools and the checked-in benchmark baseline
docs Documenter-based site build

Start the optional development daemon with:

julia --project=dev --startup-file=no -t auto -e 'using Revise, DaemonMode; serve(async=true)'

Run a command through the daemon with the same environment:

julia --project=dev --startup-file=no -e 'using DaemonMode; runargs()' validation/run_daemon.jl

Testing and Quality

julia --project=. -e 'using Pkg; Pkg.test()'
julia --project=test test/qa.jl

Benchmarks

julia --project=benchmark benchmark/benchmarks.jl --check-baseline

Numerical Validation

julia --project=dev --startup-file=no -e 'using DaemonMode; runargs()' validation/run_daemon.jl
python3 validation/python_reference.py validation/artifacts/latest
julia --project=dev validation/check.jl validation/artifacts/latest

Validation artifacts are local-only and ignored by Git. Run validation and benchmark commands serially when using DaemonMode because its redirected output is process-global.

License and Attribution

ThinkDSP.jl is released under the MIT License. It is a Julia port inspired by Allen Downey's Think DSP and the associated thinkdsp.py implementation. See docs/PORTING.md for intentional behavioral differences.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages