- Install Jupytext with pip install jupytext
- Add *.ipynb to your local .gitignore file
- When you've pulled the latest version of the .py notebook from Github, open the file as a notebook in Jupyer (right-click in Jupyter Lab)
- Once you're done editing the notebook, the updated SynthFuzz2.py file should be automatically updated to match the edits made to the .ipynb file.
- To add the notebook to version control, push the .ipynb file.
- Do not edit the .py notebook, instead think of it as a transpiled version of the .ipynb that's more friendly for us to send to version control.
- Before you commit, run sync command
jupytext --sync SynthFuzz2.ipynb
#How to build
The main() function in SynthFuzz2.py provides a flexible way to test different wave transformations on audio signals.
from SynthFuzz2 import main
import numpy as np
# Create a test signal
duration = 10
sample_rate = 44100
time = np.linspace(0, duration, duration * sample_rate)
test_signal = np.sin(2*np.pi*100*time) # Simple sine wave at 100 Hz
# Define transformations to apply
transformations = [
{
'type': 'iterative',
'function': square_wave_maker,
'iterations': 1
},
{
'type': 'combo',
'functions': [square_wave_maker, triangle_wave_maker]
}
]
# Run the transformations
main(test_signal, transformations=transformations)input_signal: Your input audio signal (numpy array)sample_rate: Sampling rate in Hz (default: 44100)window_size: Window size for transformations (default: 10000)plot_length: Number of samples to plot (default: 1000)plot_offset: Sample offset for plotting (default: 0)transformations: List of transformation configurations
Applies a single wave maker function multiple times:
{
'type': 'iterative',
'function': square_wave_maker, # or triangle_wave_maker
'iterations': 1 # number of times to apply
}Applies multiple wave maker functions in sequence:
{
'type': 'combo',
'functions': [square_wave_maker, triangle_wave_maker]
}The function produces two plots:
- Original signal vs. transformed signals
- Residuals (difference between original and transformed signals)
It also returns the time array and list of transformed signals for further analysis.