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

[cm] Non-realtime wrapper #72

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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 examples/example_clipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch.nn as nn
from torch import Tensor

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.utils import save_neutone_model

logging.basicConfig()
Expand Down Expand Up @@ -59,9 +59,9 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter("min", "min clip threshold", default_value=0.15),
NeutoneParameter("max", "max clip threshold", default_value=0.15),
NeutoneParameter("gain", "scale clip threshold", default_value=1.0),
ContinuousNeutoneParameter("min", "min clip threshold", default_value=0.15),
ContinuousNeutoneParameter("max", "max clip threshold", default_value=0.15),
ContinuousNeutoneParameter("gain", "scale clip threshold", default_value=1.0),
]

@tr.jit.export
Expand Down
10 changes: 5 additions & 5 deletions examples/example_clipper_prefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import torch.nn as nn
from torch import Tensor

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.filters import FIRFilter, FilterType
from neutone_sdk.utils import save_neutone_model
from neutone_sdk.filters import FIRFilter, IIRFilter, FilterType

"""
Example wrapper script for prefilter + models with variable sample rate.
Expand Down Expand Up @@ -65,9 +65,9 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter("min", "min clip threshold", default_value=0.15),
NeutoneParameter("max", "max clip threshold", default_value=0.15),
NeutoneParameter("gain", "scale clip threshold", default_value=1.0),
ContinuousNeutoneParameter("min", "min clip threshold", default_value=0.15),
ContinuousNeutoneParameter("max", "max clip threshold", default_value=0.15),
ContinuousNeutoneParameter("gain", "scale clip threshold", default_value=1.0),
]

@tr.jit.export
Expand Down
8 changes: 4 additions & 4 deletions examples/example_overdrive-random.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import torch.nn as nn
from torch import Tensor

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.tcn_1d import FiLM
from neutone_sdk.utils import save_neutone_model

Expand Down Expand Up @@ -202,9 +202,9 @@ def get_citation(self) -> str:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter("depth", "Effect Depth", 0.0),
NeutoneParameter("P1", "Feature modulation 1", 0.0),
NeutoneParameter("P2", "Feature modulation 2", 0.0),
ContinuousNeutoneParameter("depth", "Effect Depth", 0.0),
ContinuousNeutoneParameter("P1", "Feature modulation 1", 0.0),
ContinuousNeutoneParameter("P2", "Feature modulation 2", 0.0),
]

@torch.jit.export
Expand Down
12 changes: 6 additions & 6 deletions examples/example_rave.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
from typing import Dict, List

import torch
from torch import Tensor
import torchaudio
from torch import Tensor

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.audio import (
AudioSample,
AudioSamplePair,
render_audio_sample,
)
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk.utils import save_neutone_model

logging.basicConfig()
Expand Down Expand Up @@ -60,20 +60,20 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter(
ContinuousNeutoneParameter(
name="Chaos", description="Magnitude of latent noise", default_value=0.0
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z edit index",
description="Index of latent dimension to edit",
default_value=0.0,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z scale",
description="Scale of latent variable",
default_value=0.5,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z offset",
description="Offset of latent variable",
default_value=0.5,
Expand Down
10 changes: 5 additions & 5 deletions examples/example_rave_prefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torchaudio
from torch import Tensor, nn

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.audio import (
AudioSample,
AudioSamplePair,
Expand Down Expand Up @@ -69,20 +69,20 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter(
ContinuousNeutoneParameter(
name="Chaos", description="Magnitude of latent noise", default_value=0.0
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z edit index",
description="Index of latent dimension to edit",
default_value=0.0,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z scale",
description="Scale of latent variable",
default_value=0.5,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z offset",
description="Offset of latent variable",
default_value=0.5,
Expand Down
10 changes: 5 additions & 5 deletions examples/example_rave_v1_prefilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torchaudio
from torch import Tensor, nn

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.audio import (
AudioSample,
AudioSamplePair,
Expand Down Expand Up @@ -67,22 +67,22 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter(
ContinuousNeutoneParameter(
name="Chaos",
description="Magnitude of latent noise",
default_value=0.0,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z edit index",
description="Index of latent dimension to edit",
default_value=0.0,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z scale",
description="Scale of latent variable",
default_value=0.5,
),
NeutoneParameter(
ContinuousNeutoneParameter(
name="Z offset",
description="Offset of latent variable",
default_value=0.5,
Expand Down
8 changes: 4 additions & 4 deletions examples/example_spectral_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch.nn as nn
from torch import Tensor

from neutone_sdk import WaveformToWaveformBase, NeutoneParameter
from neutone_sdk import WaveformToWaveformBase, NeutoneParameter, ContinuousNeutoneParameter
from neutone_sdk.realtime_stft import RealtimeSTFT
from neutone_sdk.utils import save_neutone_model

Expand Down Expand Up @@ -171,11 +171,11 @@ def is_experimental(self) -> bool:

def get_neutone_parameters(self) -> List[NeutoneParameter]:
return [
NeutoneParameter(
ContinuousNeutoneParameter(
"center", "center frequency of the filter", default_value=0.3
),
NeutoneParameter("width", "width of the filter", default_value=0.5),
NeutoneParameter(
ContinuousNeutoneParameter("width", "width of the filter", default_value=0.5),
ContinuousNeutoneParameter(
"amount", "spectral attenuation amount", default_value=0.9
),
]
Expand Down
5 changes: 5 additions & 0 deletions neutone_sdk/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
SDK_VERSION = "1.4.3"

MAX_N_PARAMS = 4
MAX_N_CATEGORICAL_VALUES = 20
MAX_N_CATEGORICAL_LABEL_CHARS = 20
MAX_N_AUDIO_SAMPLES = 3

DEFAULT_DAW_SR = 48000
DEFAULT_DAW_BS = 2048

NEUTONE_GEN_N_NUMERICAL_PARAMS = 4
NEUTONE_GEN_N_TEXT_PARAMS = 1
Loading