Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next release #74

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install csh parallel valgrind
sudo apt-get install csh parallel valgrind libpcre3-dev

- name: Tool
run: cd tools; make check -j 4 PYTHON_VERSION=3
run: cd tools && make check -j 4 PYTHON_VERSION=3

- name: Make
run: make debug
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.1...3.5)

project(SPTK VERSION 4.2)
project(SPTK VERSION 4.3)

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Speech Signal Processing Toolkit (SPTK) is a software for speech signal proc
- PyTorch version: [diffsptk](https://github.com/sp-nitech/diffsptk)

[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://sp-nitech.github.io/sptk/latest/)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/sptk/4.2/)
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://sp-nitech.github.io/sptk/4.3/)
[![](https://img.shields.io/badge/license-Apache%202.0-green.svg)](https://github.com/sp-nitech/SPTK/blob/master/LICENSE)
[![](https://github.com/sp-nitech/SPTK/workflows/build/badge.svg)](https://github.com/sp-nitech/SPTK/actions)

Expand Down
2 changes: 1 addition & 1 deletion doc/main/pitch2sin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pitch2sin

:ref:`pitch` :ref:`excite`

.. doxygenclass:: sptk::SinusoidalGeneration
.. doxygenclass:: sptk::PeriodicWaveformGeneration
:members:
29 changes: 24 additions & 5 deletions include/SPTK/utils/int24_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#ifndef SPTK_UTILS_INT24_T_H_
#define SPTK_UTILS_INT24_T_H_

#include <cstdint> // uint8_t
#include <cstdint> // std::uint8_t
#include <limits> // std::numeric_limits

namespace sptk {

Expand All @@ -27,6 +28,7 @@ static const int INT24_MIN(-8388608);
class int24_t {
public:
int24_t() {
*this = 0;
}

template <typename T>
Expand Down Expand Up @@ -57,9 +59,9 @@ class int24_t {
}

int24_t& operator=(int input) {
value[0] = (reinterpret_cast<uint8_t*>(&input))[0];
value[1] = (reinterpret_cast<uint8_t*>(&input))[1];
value[2] = (reinterpret_cast<uint8_t*>(&input))[2];
value[0] = (reinterpret_cast<std::uint8_t*>(&input))[0];
value[1] = (reinterpret_cast<std::uint8_t*>(&input))[1];
value[2] = (reinterpret_cast<std::uint8_t*>(&input))[2];
return *this;
}

Expand Down Expand Up @@ -176,9 +178,26 @@ class int24_t {
}

protected:
uint8_t value[3];
std::uint8_t value[3];
};

} // namespace sptk

namespace std {

template <>
struct numeric_limits<sptk::int24_t> {
static const bool is_specialized = true;

static sptk::int24_t min() {
return sptk::int24_t(sptk::INT24_MIN);
}

static sptk::int24_t max() {
return sptk::int24_t(sptk::INT24_MAX);
}
};

} // namespace std

#endif // SPTK_UTILS_INT24_T_H_
2 changes: 1 addition & 1 deletion include/SPTK/utils/sptk_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
namespace sptk {

//! Version of SPTK.
static const char* const kVersion("4.2");
static const char* const kVersion("4.3");
//! @f$\pi@f$
static const double kPi(3.141592653589793);
//! @f$2\pi@f$
Expand Down
29 changes: 24 additions & 5 deletions include/SPTK/utils/uint24_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#ifndef SPTK_UTILS_UINT24_T_H_
#define SPTK_UTILS_UINT24_T_H_

#include <cstdint> // uint8_t
#include <cstdint> // std::uint8_t
#include <limits> // std::numeric_limits

namespace sptk {

Expand All @@ -26,6 +27,7 @@ static const int UINT24_MAX(16777215);
class uint24_t {
public:
uint24_t() {
*this = 0;
}

template <typename T>
Expand All @@ -52,9 +54,9 @@ class uint24_t {
}

uint24_t& operator=(int input) {
value[0] = (reinterpret_cast<uint8_t*>(&input))[0];
value[1] = (reinterpret_cast<uint8_t*>(&input))[1];
value[2] = (reinterpret_cast<uint8_t*>(&input))[2];
value[0] = (reinterpret_cast<std::uint8_t*>(&input))[0];
value[1] = (reinterpret_cast<std::uint8_t*>(&input))[1];
value[2] = (reinterpret_cast<std::uint8_t*>(&input))[2];
return *this;
}

Expand Down Expand Up @@ -171,9 +173,26 @@ class uint24_t {
}

protected:
uint8_t value[3];
std::uint8_t value[3];
};

} // namespace sptk

namespace std {

template <>
struct numeric_limits<sptk::uint24_t> {
static const bool is_specialized = true;

static sptk::uint24_t min() {
return sptk::uint24_t(0);
}

static sptk::uint24_t max() {
return sptk::uint24_t(sptk::UINT24_MAX);
}
};

} // namespace std

#endif // SPTK_UTILS_UINT24_T_H_
2 changes: 1 addition & 1 deletion src/analysis/mel_filter_bank_analysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "SPTK/analysis/mel_filter_bank_analysis.h"

#include <algorithm> // std::fill, std::max, std::min
#include <cmath> // std::expm1, std::log1p, std::sqrt
#include <cmath> // std::expm1, std::log, std::log1p, std::sqrt
#include <cstddef> // std::size_t
#include <numeric> // std::accumulate
#include <vector> // std::vector
Expand Down
3 changes: 2 additions & 1 deletion src/analysis/pitch_extraction_by_reaper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

#include "SPTK/analysis/pitch_extraction_by_reaper.h"

#include <stdint.h> // int16_t, int32_t

#include <algorithm> // std::copy, std::fill, std::transform
#include <cmath> // std::ceil
#include <cstdint> // int16_t
#include <vector> // std::vector

#include "REAPER/epoch_tracker/epoch_tracker.h"
Expand Down
2 changes: 1 addition & 1 deletion src/compression/a_law_expansion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "SPTK/compression/a_law_expansion.h"

#include <cmath> // std::exp, std::fabs, std::pow
#include <cmath> // std::exp, std::fabs, std::log

namespace sptk {

Expand Down
2 changes: 1 addition & 1 deletion src/compression/mu_law_compression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ MuLawCompression::MuLawCompression(double abs_max_value,
double compression_factor)
: abs_max_value_(abs_max_value),
compression_factor_(compression_factor),
constant_(abs_max_value_ / std::log(1.0 + compression_factor_)),
constant_(abs_max_value_ / std::log1p(compression_factor_)),
is_valid_(true) {
if (abs_max_value_ <= 0.0 || compression_factor_ <= 0.0) {
is_valid_ = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

namespace {

uint64_t CalculateBinomialCoefficient(int n, int k) {
std::uint64_t CalculateBinomialCoefficient(int n, int k) {
if (0 == k || n == k) {
return 1;
}

std::vector<uint64_t> buffer(n);
std::vector<std::uint64_t> buffer(n);
for (int i(0); i < n; ++i) {
buffer[i] = 1;
for (int j(i - 1); 0 < j; --j) {
Expand Down Expand Up @@ -114,7 +114,8 @@ bool AutocorrelationToCompositeSinusoidalModeling::Run(
for (int l(0); l < length; ++l) {
long double sum(0.0);
for (int k(0); k <= l; ++k) {
const uint64_t binomial_coefficient(CalculateBinomialCoefficient(l, k));
const std::uint64_t binomial_coefficient(
CalculateBinomialCoefficient(l, k));
const int index((l < 2 * k) ? (2 * k - l) : (l - 2 * k));
sum += (binomial_coefficient)*input[index];
}
Expand Down
3 changes: 2 additions & 1 deletion src/generation/normal_distributed_random_value_generation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#include "SPTK/generation/normal_distributed_random_value_generation.h"

#include <cmath> // std::log, std::sqrt
#include <cmath> // std::log, std::sqrt
#include <cstdint> // std::uint64_t

namespace {

Expand Down
18 changes: 9 additions & 9 deletions src/main/bcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// ------------------------------------------------------------------------ //

#include <algorithm> // std::max
#include <cstdint> // int8_t, int16_t, int32_t, int64_t, etc.
#include <cstdint> // std::int8_t, std::int16_t, std::int32_t, etc.
#include <cstring> // std::strncmp
#include <fstream> // std::ifstream
#include <iomanip> // std::setprecision, std::setw
Expand Down Expand Up @@ -189,43 +189,43 @@ class BlockCopyWrapper {
double pad_value)
: block_copy_(NULL) {
if ("c" == data_type) {
block_copy_ = new BlockCopy<int8_t>(
block_copy_ = new BlockCopy<std::int8_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("s" == data_type) {
block_copy_ = new BlockCopy<int16_t>(
block_copy_ = new BlockCopy<std::int16_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("h" == data_type) {
block_copy_ = new BlockCopy<sptk::int24_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, sptk::int24_t(pad_value));
} else if ("i" == data_type) {
block_copy_ = new BlockCopy<int32_t>(
block_copy_ = new BlockCopy<std::int32_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("l" == data_type) {
block_copy_ = new BlockCopy<int64_t>(
block_copy_ = new BlockCopy<std::int64_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("C" == data_type) {
block_copy_ = new BlockCopy<uint8_t>(
block_copy_ = new BlockCopy<std::uint8_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("S" == data_type) {
block_copy_ = new BlockCopy<uint16_t>(
block_copy_ = new BlockCopy<std::uint16_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("H" == data_type) {
block_copy_ = new BlockCopy<sptk::uint24_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, sptk::uint24_t(pad_value));
} else if ("I" == data_type) {
block_copy_ = new BlockCopy<uint32_t>(
block_copy_ = new BlockCopy<std::uint32_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("L" == data_type) {
block_copy_ = new BlockCopy<uint64_t>(
block_copy_ = new BlockCopy<std::uint64_t>(
input_start_number, input_end_number, input_block_length,
output_start_number, output_block_length, pad_value);
} else if ("f" == data_type) {
Expand Down
18 changes: 9 additions & 9 deletions src/main/bcut.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License. //
// ------------------------------------------------------------------------ //

#include <cstdint> // int8_t, int16_t, int32_t, int64_t, etc.
#include <cstdint> // std::int8_t, std::int16_t, std::int32_t, etc.
#include <cstring> // std::strncmp
#include <fstream> // std::ifstream
#include <iomanip> // std::setw
Expand Down Expand Up @@ -127,34 +127,34 @@ class BinaryCutWrapper {
: binary_cut_(NULL) {
if ("c" == data_type) {
binary_cut_ =
new BinaryCut<int8_t>(start_number, end_number, block_length);
new BinaryCut<std::int8_t>(start_number, end_number, block_length);
} else if ("s" == data_type) {
binary_cut_ =
new BinaryCut<int16_t>(start_number, end_number, block_length);
new BinaryCut<std::int16_t>(start_number, end_number, block_length);
} else if ("h" == data_type) {
binary_cut_ =
new BinaryCut<sptk::int24_t>(start_number, end_number, block_length);
} else if ("i" == data_type) {
binary_cut_ =
new BinaryCut<int32_t>(start_number, end_number, block_length);
new BinaryCut<std::int32_t>(start_number, end_number, block_length);
} else if ("l" == data_type) {
binary_cut_ =
new BinaryCut<int64_t>(start_number, end_number, block_length);
new BinaryCut<std::int64_t>(start_number, end_number, block_length);
} else if ("C" == data_type) {
binary_cut_ =
new BinaryCut<uint8_t>(start_number, end_number, block_length);
new BinaryCut<std::uint8_t>(start_number, end_number, block_length);
} else if ("S" == data_type) {
binary_cut_ =
new BinaryCut<uint16_t>(start_number, end_number, block_length);
new BinaryCut<std::uint16_t>(start_number, end_number, block_length);
} else if ("H" == data_type) {
binary_cut_ =
new BinaryCut<sptk::uint24_t>(start_number, end_number, block_length);
} else if ("I" == data_type) {
binary_cut_ =
new BinaryCut<uint32_t>(start_number, end_number, block_length);
new BinaryCut<std::uint32_t>(start_number, end_number, block_length);
} else if ("L" == data_type) {
binary_cut_ =
new BinaryCut<uint64_t>(start_number, end_number, block_length);
new BinaryCut<std::uint64_t>(start_number, end_number, block_length);
} else if ("f" == data_type) {
binary_cut_ =
new BinaryCut<float>(start_number, end_number, block_length);
Expand Down
Loading
Loading