Page 2 of 5
Re: possible to make this plugin? ("auto draw wave")
Posted: Mon Mar 31, 2014 5:30 pm
by steve
I'm not sure that I understand your use case, but the requested modification is very simple.
Just change
(setq amp 0.5) to
(setq amp (snd-fetch s))
So then you have:
Code: Select all
(setq amp (snd-fetch s)) ; set amplitude = first sample
(setq offset 0.) ; DC offset
(setq phase -270) ; start phase in degrees
(setq cycles 1.0) ; number of cycles
(sum offset
(mult amp
(osc (hz-to-step (/ cycles (get-duration 1)))
1 *sine-table* phase)))
(Reminder for other readers: this is for short mono tracks only)
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 6:46 am
by N871
thank you Steve, very, very small request : )
Is it possible to do the same for the other basic waveforms? (triangular, square,..)
Thanks again for your nice work!
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 7:29 am
by N871
This is what I'm trying to do:
I have made some samples which need to be looped. Unfortunately for very complex reasons,
all my recordings need to have the exact same length. Therefor I had to stretch them a bit to
make them all end with a full cycle. Unfortunately the stretching messed up the first and last
wave. So now I have to draw them manually, I can't copy/paste because the length of the "glitch"
is not exactly the same as a cycle. Because some of the samples are very sine-like I get clicks and
pops very easily if the glitch isn't "filled in" correctly.
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 7:53 am
by Robert J. H.
There are two additional wave forms that can be integrated into Steve's code:
Just replace *sine-table* in the last line with either *tri-table* or *saw-table*.
I've still the impression that your procedure is unnecessarily complicated.
How do you accomplish this audio stretching?
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 11:36 am
by N871
The procedure is complicated because I'm trying to make virtual oscillators
out of a series of chromatic samples in the max msp language. The original
oscillators are too complex to mock starting from a digital oscillator. I ended
up using the 2d.wave object should you be familiar with it by any chance.
I used the flex speed stretch in logic X. It did a perfect job except for the fact
that my samples are not longer loopable. Well, most still are, but the sine-like
tones are giving pops.
All oscillators are round off a bit towards the top (filtered) so the higher notes are
the most troublesome.
Each of my recordings exists of exactly 300 cycles, 299 are ok, I just need to fix one
Unfortunately there are over 500 recordings...which is why I'm searching for a practical plugin.
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 11:45 am
by steve
There's probably/hopefully an easier way to do this. Could you post one of the problematic examples for us to have a look at?
Assuming that they are under 1 MB you should be able to upload one or two of them using the "upload attachment" feature below the message composing box.
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 12:13 pm
by N871
I'll upload some samples as soon as I get home. Thanks again for your help

This is by far the most enthousiastic forum I participated in so far!
Re: possible to make this plugin? ("auto draw wave")
Posted: Tue Apr 01, 2014 2:02 pm
by N871
the files are both around 1.5MB..but you can download them here:
http://we.tl/RNICGCPJps
http://we.tl/rujmHAeBPl
the first one is a kind of rectangular wave
the second one is a sine wave.
I have cut them so that the glitch is now in the middle and they can be looped correctly.
thanks again,
Nils
Re: possible to make this plugin? ("auto draw wave")
Posted: Wed Apr 02, 2014 3:09 pm
by steve
It would probably be have been easier if you'd made the samples a bit longer than necessary so that you could have just trimmed the ends to get the right length. However, why not just trim the deformed cycle off, then copy and paste a good one in its place? If you need to tweak the overall length but want to keep the same number of cycles, use the Sliding Time Scale / Pitch Shift effect and enter the same % for each of start/final for Pitch and Tempo.
Re: possible to make this plugin? ("auto draw wave")
Posted: Wed Apr 02, 2014 7:30 pm
by N871
Hi steve, thanks again for your reply,
Unfortunately your ideas won't work. I can't change the length of the recording, they all
need to have the same length up to the sample to work well in my max msp program. The
size of the glitch is not equal to the length of a cycle. The smallest imperfection results immediately in
clicks/pops. Your sine wave patch works well, I just need to change the parameters for each sample.