Skip to content

Commit

Permalink
copyright update: 2021 -> 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
phip1611 committed Feb 28, 2023
1 parent 3eae87d commit ebc6bf5
Show file tree
Hide file tree
Showing 18 changed files with 47 additions and 49 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/bench.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/live-visualization.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/mp3-samples.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/fft/microfft_complex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/fft/microfft_real.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/fft/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/fft/rustfft_complex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 6 additions & 8 deletions src/frequency.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -28,16 +28,14 @@ use core::cmp::Ordering;
use core::fmt::{Display, Formatter, Result};
use core::ops::{Add, Div, Mul, Sub};

/// A frequency. A convenient wrapper type around `f32`.
/// A frequency in Hertz. A convenient wrapper type around `f32`.
pub type Frequency = OrderableF32;
/// The value of a frequency in a frequency spectrum. Convenient wrapper around `f32`.
/// Not necessarily the magnitude of the complex numbers because scaling/normalization
/// functions could have been applied.
/// The value of a [`Frequency`] in a frequency spectrum. Also called the
/// magnitude.
pub type FrequencyValue = OrderableF32;

/// Small convenient wrapper around `f32`.
/// Mainly required to make `f32` operable in a sorted tree map.
/// You should only use the type aliases `Frequency` and `FrequencyValue`.
/// Wrapper around [`f32`] that guarantees a valid number, hence, the number is
/// neither `NaN` or `infinite`. This makes the number orderable and sortable.
#[derive(Debug, Copy, Clone, Default)]
pub struct OrderableF32(f32);

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/limit.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
50 changes: 25 additions & 25 deletions src/scaling.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -84,27 +84,27 @@ pub type SpectrumScalingFunction = dyn Fn(f32, &SpectrumDataStats) -> f32;
/// ```
/// Function is of type [`SpectrumScalingFunction`].
#[must_use]
pub fn scale_20_times_log10(frequency_magnitude: f32, _stats: &SpectrumDataStats) -> f32 {
debug_assert!(!frequency_magnitude.is_infinite());
debug_assert!(!frequency_magnitude.is_nan());
debug_assert!(frequency_magnitude >= 0.0);
if frequency_magnitude == 0.0 {
pub fn scale_20_times_log10(fr_val: f32, _stats: &SpectrumDataStats) -> f32 {
debug_assert!(!fr_val.is_infinite());
debug_assert!(!fr_val.is_nan());
debug_assert!(fr_val >= 0.0);
if fr_val == 0.0 {
0.0
} else {
20.0 * libm::log10f(frequency_magnitude)
20.0 * libm::log10f(fr_val)
}
}

/// Scales each frequency value/amplitude in the spectrum to interval `[0.0; 1.0]`.
/// Function is of type [`SpectrumScalingFunction`]. Expects that [`SpectrumDataStats::min`] is
/// not negative.
#[must_use]
pub fn scale_to_zero_to_one(frequency_magnitude: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!frequency_magnitude.is_infinite());
debug_assert!(!frequency_magnitude.is_nan());
debug_assert!(frequency_magnitude >= 0.0);
pub fn scale_to_zero_to_one(fr_val: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!fr_val.is_infinite());
debug_assert!(!fr_val.is_nan());
debug_assert!(fr_val >= 0.0);
if stats.max != 0.0 {
frequency_magnitude / stats.max
fr_val / stats.max
} else {
0.0
}
Expand All @@ -114,14 +114,14 @@ pub fn scale_to_zero_to_one(frequency_magnitude: f32, stats: &SpectrumDataStats)
/// by the length of samples, so that values of different samples lengths are comparable.
#[allow(non_snake_case)]
#[must_use]
pub fn divide_by_N(frequency_magnitude: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!frequency_magnitude.is_infinite());
debug_assert!(!frequency_magnitude.is_nan());
debug_assert!(frequency_magnitude >= 0.0);
pub fn divide_by_N(fr_val: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!fr_val.is_infinite());
debug_assert!(!fr_val.is_nan());
debug_assert!(fr_val >= 0.0);
if stats.n == 0.0 {
frequency_magnitude
fr_val
} else {
frequency_magnitude / stats.n
fr_val / stats.n
}
}

Expand All @@ -130,15 +130,15 @@ pub fn divide_by_N(frequency_magnitude: f32, stats: &SpectrumDataStats) -> f32 {
/// See <https://docs.rs/rustfft/latest/rustfft/#normalization>
#[allow(non_snake_case)]
#[must_use]
pub fn divide_by_N_sqrt(frequency_magnitude: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!frequency_magnitude.is_infinite());
debug_assert!(!frequency_magnitude.is_nan());
debug_assert!(frequency_magnitude >= 0.0);
pub fn divide_by_N_sqrt(fr_val: f32, stats: &SpectrumDataStats) -> f32 {
debug_assert!(!fr_val.is_infinite());
debug_assert!(!fr_val.is_nan());
debug_assert!(fr_val >= 0.0);
if stats.n == 0.0 {
frequency_magnitude
fr_val
} else {
// https://docs.rs/rustfft/latest/rustfft/#normalization
frequency_magnitude / libm::sqrtf(stats.n)
fr_val / libm::sqrtf(stats.n)
}
}

Expand Down Expand Up @@ -195,7 +195,7 @@ mod tests {
let _combined_static = combined(&[&scale_20_times_log10, &divide_by_N, &divide_by_N_sqrt]);

// doesn't compile yet.. fix this once someone requests it
/*let closure_scaling_fnc = |frequency_magnitude: f32, _stats: &SpectrumDataStats| {
/*let closure_scaling_fnc = |fr_val: f32, _stats: &SpectrumDataStats| {
0.0
};
Expand Down
2 changes: 1 addition & 1 deletion src/spectrum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/tests/sine.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2021 Philipp Schuster
Copyright (c) 2023 Philipp Schuster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit ebc6bf5

Please sign in to comment.