-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from HEnquist/develop
Develop
- Loading branch information
Showing
27 changed files
with
3,329 additions
and
1,074 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
Cargo.lock | ||
*.raw | ||
*.wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "camilladsp" | ||
version = "0.0.14" | ||
version = "0.2.2" | ||
authors = ["Henrik Enquist <[email protected]>"] | ||
description = "A flexible tool for processing audio" | ||
|
||
|
@@ -12,14 +12,21 @@ pulse-backend = ["libpulse-simple-binding", "libpulse-binding"] | |
socketserver = ["ws"] | ||
FFTW = ["fftw"] | ||
|
||
[lib] | ||
name = "camillalib" | ||
path = "src/lib.rs" | ||
|
||
[[bin]] | ||
name = "camilladsp" | ||
path = "src/bin.rs" | ||
|
||
[dependencies] | ||
alsa = { version = "0.4", optional = true } | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_yaml = "0.8" | ||
serde_with = "1.4.0" | ||
rustfft = "3.0.0" | ||
fftw = { version = "0.6.0", optional = true } | ||
num-traits = "0.2" | ||
realfft = "0.2.0" | ||
fftw = { version = "0.6.2", optional = true } | ||
num = "0.2" | ||
signal-hook = "0.1.13" | ||
rand = "0.7.3" | ||
|
@@ -30,4 +37,11 @@ env_logger = "0.7.1" | |
ws = { version = "0.9.1", optional = true } | ||
libpulse-binding = { version = "2.0", optional = true } | ||
libpulse-simple-binding = { version = "2.0", optional = true } | ||
rubato = "0.4.3" | ||
|
||
[dev-dependencies] | ||
criterion = "0.3" | ||
|
||
[[bench]] | ||
name = "filters" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
extern crate criterion; | ||
use criterion::{criterion_group, criterion_main, Bencher, BenchmarkId, Criterion}; | ||
extern crate camillalib; | ||
|
||
use camillalib::biquad::{Biquad, BiquadCoefficients}; | ||
use camillalib::diffeq::DiffEq; | ||
use camillalib::fftconv::FFTConv; | ||
use camillalib::filters::Filter; | ||
use camillalib::PrcFmt; | ||
|
||
/// Bench a single convolution | ||
fn run_conv(b: &mut Bencher, len: usize, chunksize: usize) { | ||
let filter = vec![0.0 as PrcFmt; len]; | ||
let mut conv = FFTConv::new("test".to_string(), chunksize, &filter); | ||
let mut waveform = vec![0.0 as PrcFmt; chunksize]; | ||
|
||
//let mut spectrum = signal.clone(); | ||
b.iter(|| conv.process_waveform(&mut waveform)); | ||
} | ||
|
||
/// Run all convolution benches | ||
fn bench_conv(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("Conv"); | ||
let chunksize = 1024; | ||
for filterlen in [chunksize, 4 * chunksize, 16 * chunksize].iter() { | ||
group.bench_with_input( | ||
BenchmarkId::new("FFTConv", filterlen), | ||
filterlen, | ||
|b, filterlen| run_conv(b, *filterlen, chunksize), | ||
); | ||
} | ||
group.finish(); | ||
} | ||
|
||
/// Bench biquad | ||
fn bench_biquad(c: &mut Criterion) { | ||
let chunksize = 1024; | ||
let coeffs = BiquadCoefficients::new( | ||
-0.1462978543780541, | ||
0.005350765548905586, | ||
0.21476322779271284, | ||
0.4295264555854257, | ||
0.21476322779271284, | ||
); | ||
let mut bq = Biquad::new("test".to_string(), chunksize, coeffs); | ||
let mut waveform = vec![0.0 as PrcFmt; chunksize]; | ||
|
||
c.bench_function("Biquad", |b| b.iter(|| bq.process_waveform(&mut waveform))); | ||
} | ||
|
||
/// Bench diffew | ||
fn bench_diffeq(c: &mut Criterion) { | ||
let chunksize = 1024; | ||
let mut de = DiffEq::new( | ||
"test".to_string(), | ||
vec![1.0, -0.1462978543780541, 0.005350765548905586], | ||
vec![0.21476322779271284, 0.4295264555854257, 0.21476322779271284], | ||
); | ||
let mut waveform = vec![0.0 as PrcFmt; chunksize]; | ||
|
||
c.bench_function("DiffEq", |b| b.iter(|| de.process_waveform(&mut waveform))); | ||
} | ||
|
||
criterion_group!(benches, bench_conv, bench_biquad, bench_diffeq); | ||
|
||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
devices: | ||
samplerate: 96000 | ||
chunksize: 1024 | ||
enable_resampling: true | ||
resampler_type: AccurateSync | ||
capture_samplerate: 44100 | ||
playback: | ||
type: File | ||
channels: 2 | ||
filename: "result_f64.raw" | ||
format: FLOAT64LE | ||
capture: | ||
type: File | ||
channels: 2 | ||
filename: "sine_120_44100_f64_2ch.raw" | ||
format: FLOAT64LE | ||
extra_samples: 0 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
devices: | ||
samplerate: 48000 | ||
chunksize: 1024 | ||
target_level: 1024 | ||
adjust_period: 3 | ||
enable_resampling: true | ||
resampler_type: BalancedAsync | ||
capture_samplerate: 44100 | ||
capture: | ||
type: Alsa | ||
channels: 2 | ||
device: "hw:Loopback,0,0" | ||
format: S16LE | ||
playback: | ||
type: Alsa | ||
channels: 2 | ||
device: "hw:Generic_1" | ||
format: S32LE | ||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.