band limited waveforms

Status
Not open for further replies.
I suggest testing the pull request branch and then feeback here and to the pull request comments. The changes are only on the teensy4 tree
anyway, I don't know what the procedure is for merging across multiple trees and I only have T4.0's for testing here.

And yes the design tool would need some changes too - again I've not looked into this.
 
Hello,

I have tried the bad limited waveforms and I can confirm this is a major improvement. Aliasing is dramatically reduced. I have implemented a simple 6 voices synth on a Teensy 6, everything is working so far. Thanks for your hard work.
I am not familiar with using Github and pull requests. I can't help on this side. But that would be certainly great if these wave generators were available as audio objects within the audio design tool.
Emmanuel
 
Is it a separate audio object?
Of what I can read from the changes
It more like additional waveforms added to the existing waveform objects.
If so then how do you use it?
You can always add new objects by edit the local index.html available in the audio library.
Or you can try a modified version of the tool
manicken.github.io there you can add a user object directly in the GUI (available at special category) when edit the name there are some fields you have to fill in
Subtype is the class name of the AudioObject
Include is the .h file that needs to be included
Name is the instancename like before.

Right now if I remember that custom object is only available when exporting as class.

/Jannik
 
They are just alternative waveforms you select. I'll look at index.html

The issues that hold me back are:
1) is it rock solid and tested
2) does it have too much overhead (memory) to go into standard waveform class (for smaller Teensy's this could be important
for backwards compativility)
3) what's the process for adding it to other teensy's than the 4?
 
I think it's best to release it now more like some "extensions" called AudioWaveformExt and AudioWaveformModulatedExt to make them more available to the public, and also make sure that the new names don't collide with current AudioObjects.
In this way you can get feedback to make it "better" before trying to merge it with current AudioObjects. It could maybe be merged with the new names, because there is always bugs/issues even in the official releases.
 
I looked at the source before, and you already have custom names, what I mean was to have them separated in different files, I have noticed that Paul also puts many classes in the same file, I think that's making it unclear where the actual classes are but maybe there is some limit in the c++ compiler, and I also know that separating stuff makes it harder to share static functions.
I also sometimes put many classes in the same file :p
 
Here is a description how you add a custom Object to the gui:

there are 3 things that needs to be copied for a complete node:

first at the NodeDefinitions:
Code:
<script  type="text/x-red" data-container-name="NodeDefinitions">
    {"nodes":[
        {"type":"NewObject","data":{"defaults":{"name":{"value":"new"},"comment":{"value":""}},"shortName":"label","inputs":0,"outputs":1,"category":"synth","color":"#E6E0F8","icon":"arrow-in.png"}},
    ]}
</script>

second help text (optional but good to have):
Code:
<script type="text/x-red" data-help-name="NewObject">
	<h3>Summary</h3>
	<div class=tooltipinfo>
	<p>summary description</p>
	</div>
	<h3>Audio Connections</h3>
	<table class=doc align=center cellpadding=3>
		<tr class=top><th>Port</th><th>Purpose</th></tr>
		<tr class=odd><td align=center>Out 0</td><td>Sine Wave Output</td></tr>
	</table>
	<h3>Functions</h3>
	<p class=func><span class=keyword>functionName</span>(function parameter(s));</p>
	<p class=desc>function description</p>
	
	<h3>Examples</h3>
	<p class=exam>File > Examples > Audio > MemoryAndCpuUsage</p>
	<h3>Notes</h3>
	<p></p>
</script>

third the edit node template (mandatory to make it possible to change the name in the GUI):
Code:
<script type="text/x-red" data-template-name="NewObject">
	<div class="form-row">
		<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
		<input type="text" id="node-input-name" placeholder="Name">
	</div>
</script>

at all these just replace the NewObject with your custom object name.
@ "shortName":"label"
this is the label shown in the left "toolbox" palette also this is the name used as default to the new node.


I have looked at your changes,
what you can do is to only create an instance of the BandLimitedWaveform i.e. using pointer when its needed (to avoid additional memory use when not used)
BandLimitedWaveform *band_limit_waveform;

then when at void begin(short t_type)

Code:
if (!band_limit_waveform) 
    band_limit_waveform = new BandLimitedWaveform ();

if (t_type == WAVEFORM_BANDLIMIT_SQUARE)
    band_limit_waveform.init_square (phase_increment) ;
else if (t_type == WAVEFORM_BANDLIMIT_PULSE)
    band_limit_waveform.init_pulse (phase_increment, pulse_width) ;
else if (t_type == WAVEFORM_BANDLIMIT_SAWTOOTH || t_type == WAVEFORM_BANDLIMIT_SAWTOOTH_REVERSE)
    band_limit_waveform.init_sawtooth (phase_increment) ;
 
Tested the PR on a Teensy 4.1. I can confirm that the bandlimited waveforms sound much better, thanks for this. The aliasing artifacts are quite audible when modulating non-bandlimited waveforms, but the artifacts disappear when modulating bandlimited waveforms.

Here is a test recording I made for comparison:

- (SINGLE NOTE) reverse sawtooth vs. bandlimited reverse sawtooth
- (SINGLE NOTE) sawtooth vs. reverse sawtooth
- (SINGLE NOTE) squarewave vs. bandlimited squarewave

- (SINGLE NOTE + modulation) reverse sawtooth vs. bandlimited reverse sawtooth
- (SINGLE NOTE + modulation) sawtooth vs. bandlimited sawtooth
- (SINGLE NOTE + modulation) squarewave vs. bandlimited squarewave

- (TWO NOTES + modulation) reverse sawtooth vs. bandlimited reverse sawtooth
- (TWO NOTES + modulation) sawtooth vs. bandlimited sawtooth
- (TWO NOTES + modulation) squarewave vs. bandlimited squarewave

Note:
1. The same test using the stock sine and triangle waveforms don't reveal any artifacts when modulating them, so I'm guessing they are already bandlimited in some way. Does that sound right?
2. My Teensy would occasionally get into an unstable state when switching between the different waveforms during playback. However, the problem is intermittent so maybe it is just a problem with my code. I'll keep poking at it and see if I can reproduce it.
 
Status
Not open for further replies.
Back
Top