Skip to content
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
8 changes: 4 additions & 4 deletions doc/classes/SignalSmith.xml → doc/classes/SoundSmith.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SignalSmith" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<class name="SoundSmith" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
Performs time-stretching and pitch-shifting on raw audio buffers using Signalsmith.
Performs time-stretching and pitch-shifting on raw audio buffers using Soundsmith.
</brief_description>
<description>
SignalSmith is a low-level audio processing utility which wraps the Signalsmith time-stretching library. It operates on raw interleaved floating-point PCM audio buffers and allows independent control of playback tempo and pitch.
SoundSmith is a low-level audio processing utility which wraps the Soundsmith time-stretching library. It operates on raw interleaved floating-point PCM audio buffers and allows independent control of playback tempo and pitch.
</description>
<tutorials>
</tutorials>
Expand All @@ -15,7 +15,7 @@
<param index="1" name="tempo" type="float" />
<param index="2" name="pitch" type="float" default="1.0" />
<description>
Loads an MP3 file, applies time-stretching and pitch-shifting using the Signalsmith engine, and returns a streamable AudioStreamWAV.
Loads an MP3 file, applies time-stretching and pitch-shifting using the Soundsmith engine, and returns a streamable AudioStreamWAV.
The `tempo` parameter controls playback speed without affecting pitch. A value of `1.0` preserves the original speed.
The `pitch` parameter is a transpose factor. A value of `1.0` preserves pitch, `2.0` raises pitch by one octave,
and `0.5` lowers pitch by one octave.
Expand Down
14 changes: 7 additions & 7 deletions modules/signalsmith/SCsub → modules/soundsmith/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ from misc.utility.scons_hints import *

Import("env")

signalsmith_env = env.Clone()
soundsmith_env = env.Clone()

signalsmith_env.Append(
soundsmith_env.Append(
CPPPATH=[
"#thirdparty",
"#thirdparty/minimp3",
Expand All @@ -18,12 +18,12 @@ is_gcc = ("gcc" in cxx or "g++" in cxx) and not is_clang
is_msvc = ("cl" in cxx) and not is_clang

if is_gcc:
signalsmith_env.Append(CCFLAGS=["-Wno-class-memaccess"])
signalsmith_env.Append(CCFLAGS=["-Wno-shadow"])
soundsmith_env.Append(CCFLAGS=["-Wno-class-memaccess"])
soundsmith_env.Append(CCFLAGS=["-Wno-shadow"])

# silence "hides previous declaration/member" warnings
if is_msvc:
signalsmith_env.Append(
soundsmith_env.Append(
CCFLAGS=[
"/wd4456", # hides previous local declaration
"/wd4458", # hides class member
Expand All @@ -32,7 +32,7 @@ if is_msvc:

module_sources = [
"register_types.cpp",
"signalsmith_module.cpp",
"soundsmith_module.cpp",
]

signalsmith_env.add_source_files(env.modules_sources, module_sources)
soundsmith_env.add_source_files(env.modules_sources, module_sources)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@

#include "register_types.h"
#include "core/object/class_db.h"
#include "signalsmith_module.h"
#include "soundsmith_module.h"

void initialize_signalsmith_module(ModuleInitializationLevel p_level) {
void initialize_soundsmith_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}

ClassDB::register_class<SignalSmith>();
ClassDB::register_class<SoundSmith>();
}

void uninitialize_signalsmith_module(ModuleInitializationLevel p_level) {
void uninitialize_soundsmith_module(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@

#include "modules/register_module_types.h"

void initialize_signalsmith_module(ModuleInitializationLevel p_level);
void uninitialize_signalsmith_module(ModuleInitializationLevel p_level);
void initialize_soundsmith_module(ModuleInitializationLevel p_level);
void uninitialize_soundsmith_module(ModuleInitializationLevel p_level);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**************************************************************************/
/* signalsmith_module.cpp */
/* soundsmith_module.cpp */
/**************************************************************************/
/* This file is part of: */
/* REDOT ENGINE */
Expand Down Expand Up @@ -30,7 +30,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#include "signalsmith_module.h"
#include "soundsmith_module.h"

#include "core/io/file_access.h"
#include "core/os/memory.h"
Expand All @@ -43,25 +43,25 @@
#include <cmath>
#include <vector>

void SignalSmith::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sample_rate", "rate"), &SignalSmith::set_sample_rate);
ClassDB::bind_method(D_METHOD("set_channels", "channels"), &SignalSmith::set_channels);
ClassDB::bind_method(D_METHOD("set_pitch", "pitch"), &SignalSmith::set_pitch);
ClassDB::bind_method(D_METHOD("set_tempo", "tempo"), &SignalSmith::set_tempo);
ClassDB::bind_method(D_METHOD("get_last_sample_rate"), &SignalSmith::get_last_sample_rate);
ClassDB::bind_method(D_METHOD("get_last_channels"), &SignalSmith::get_last_channels);
ClassDB::bind_method(D_METHOD("reset"), &SignalSmith::reset);
ClassDB::bind_method(D_METHOD("process", "input"), &SignalSmith::process);
ClassDB::bind_method(D_METHOD("change_tempo", "path", "tempo", "pitch"), &SignalSmith::change_tempo, DEFVAL(1.0f));
void SoundSmith::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_sample_rate", "rate"), &SoundSmith::set_sample_rate);
ClassDB::bind_method(D_METHOD("set_channels", "channels"), &SoundSmith::set_channels);
ClassDB::bind_method(D_METHOD("set_pitch", "pitch"), &SoundSmith::set_pitch);
ClassDB::bind_method(D_METHOD("set_tempo", "tempo"), &SoundSmith::set_tempo);
ClassDB::bind_method(D_METHOD("get_last_sample_rate"), &SoundSmith::get_last_sample_rate);
ClassDB::bind_method(D_METHOD("get_last_channels"), &SoundSmith::get_last_channels);
ClassDB::bind_method(D_METHOD("reset"), &SoundSmith::reset);
ClassDB::bind_method(D_METHOD("process", "input"), &SoundSmith::process);
ClassDB::bind_method(D_METHOD("change_tempo", "path", "tempo", "pitch"), &SoundSmith::change_tempo, DEFVAL(1.0f));
}

SignalSmith::SignalSmith() {
SoundSmith::SoundSmith() {
stretch.presetDefault(channels, sample_rate);
}

SignalSmith::~SignalSmith() {}
SoundSmith::~SoundSmith() {}

void SignalSmith::set_sample_rate(int p_rate) {
void SoundSmith::set_sample_rate(int p_rate) {
if (p_rate < 1) {
return;
}
Expand All @@ -70,7 +70,7 @@ void SignalSmith::set_sample_rate(int p_rate) {
stretch.presetDefault(channels, sample_rate);
}

void SignalSmith::set_channels(int p_channels) {
void SoundSmith::set_channels(int p_channels) {
if (p_channels < 1) {
return;
}
Expand All @@ -79,35 +79,35 @@ void SignalSmith::set_channels(int p_channels) {
stretch.presetDefault(channels, sample_rate);
}

void SignalSmith::set_pitch(float p_pitch) {
void SoundSmith::set_pitch(float p_pitch) {
if (!(p_pitch > 0.0f)) {
return;
}

stretch.setTransposeFactor(p_pitch);
}

void SignalSmith::set_tempo(float p_tempo) {
void SoundSmith::set_tempo(float p_tempo) {
if (!(p_tempo > 0.0f)) {
return;
}

tempo = p_tempo;
}

int SignalSmith::get_last_sample_rate() const {
int SoundSmith::get_last_sample_rate() const {
return sample_rate;
}

int SignalSmith::get_last_channels() const {
int SoundSmith::get_last_channels() const {
return channels;
}

void SignalSmith::reset() {
void SoundSmith::reset() {
stretch.reset();
}

PackedFloat32Array SignalSmith::process(const PackedFloat32Array &input) {
PackedFloat32Array SoundSmith::process(const PackedFloat32Array &input) {
PackedFloat32Array output;

if (channels < 1) {
Expand Down Expand Up @@ -189,7 +189,7 @@ PackedFloat32Array SignalSmith::process(const PackedFloat32Array &input) {
return output;
}

Ref<AudioStreamWAV> SignalSmith::change_tempo(const String &path, float p_tempo, float p_pitch) {
Ref<AudioStreamWAV> SoundSmith::change_tempo(const String &path, float p_tempo, float p_pitch) {
Ref<AudioStreamWAV> out;

Ref<AudioStreamMP3> mp3 = AudioStreamMP3::load_from_file(path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**************************************************************************/
/* signalsmith_module.h */
/* soundsmith_module.h */
/**************************************************************************/
/* This file is part of: */
/* REDOT ENGINE */
Expand Down Expand Up @@ -38,8 +38,8 @@
#include "signalsmith-stretch/signalsmith-stretch.h"
#include <random>

class SignalSmith : public RefCounted {
GDCLASS(SignalSmith, RefCounted);
class SoundSmith : public RefCounted {
GDCLASS(SoundSmith, RefCounted);

private:
signalsmith::stretch::SignalsmithStretch<float, std::mt19937> stretch;
Expand All @@ -51,8 +51,8 @@ class SignalSmith : public RefCounted {
static void _bind_methods();

public:
SignalSmith();
~SignalSmith();
SoundSmith();
~SoundSmith();

void set_sample_rate(int p_rate);
void set_channels(int p_channels);
Expand Down
Loading