Git Product home page Git Product logo

chirpsignal's Introduction

ChirpSignal

Chirp Swept-frequency sine generator.

Installation

Enter the REPL mode and add the module from the latest repository by :

]add https://github.com/sonosole/ChirpSignal.git

or from Julia's official registries by :

]add ChirpSignal

Two Public APIs

chirp(T, fs, fl, fh; method="linear", phase=0.0) -> Array{Float64,1}
chirp(T, fs, f::Function; phase=0.0) -> Array{Float64,1}

The first API is enough for most usages. Detials could be found via Julia's helping mode.

help?> chirp

Example

Examples' public code

using WAV
using ChirpSignal

fs = 16000.0; # sampling frequency
fl = 500.0;   # lower bound frequency
fh = 8000.0;  # upper bound frequency
T  = 5.0 ;    # total time of chirp signal

Linear chirp example

# f(t) = (fh-fl)/T * t + fl
wav = chirp(T, fs, fl, fh; method="linear");
wavwrite(wav, "./doc/chirpLinear.wav", Fs=fs, nbits=32)

chirpLinear_500_8000Hz

Quadratic chirp example

# f(t) = k * t^2 + fl, k = (fh-fl)/T^2
wav = chirp(T, fs, fl, fh; method="quadratic");
wavwrite(wav, "./doc/chirpQuadratic.wav", Fs=fs, nbits=32)

chirpQuadratic_500_8000Hz

Logarithmic chirp example

# f(t) = k*log(t+1) + fl, k = (fh-fl)/log(T+1)
wav = chirp(T, fs, fl, fh; method="logarithmic");
wavwrite(wav, "./doc/chirpLogarithmic.wav", Fs=fs, nbits=32)

chirpLogarithmic_500_8000Hz

Exponential chirp example

# f(t) = exp(k * t) + (fl-1), k = 1/T*log(fh-fl+1)
wav = chirp(T, fs, fl, fh; method="exponential");
wavwrite(wav, "./doc/chirpExponential.wav", Fs=fs, nbits=32)

chirpExponential_500_8000Hz

Customizable chirp example by user's own function

Customizable chirp by specifying fun(t) = 2000*t

fun(t) = 2000*t
wav = chirp(2.0, 16000.0, fun)
wavwrite(wav, "./doc/0_4000hz_linear.wav", Fs=fs, nbits=32)

0_4000Hz_linear

Customizable chirp example by user's anonymous function

Customizable chirp by specifying a anonymous function t -> 2000*t^2

wav = chirp(2.0, 16000.0, t -> 2000*t^2 )
wavwrite(wav, "./doc/0_8000Hz_quadratic.wav", Fs=fs, nbits=32)

0_8000hz_quadratic

PS

For method="linear" and method="quadratic" cases, the lower bound frequency fl could be set lager than the upper bound frequency fh, but not for the method="logarithmic" and method="exponential".

chirpsignal's People

Contributors

sonosole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mfkiwl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.