I think it would help me to think of the problem if you could say what you wanted the envelope itself to look/sound like. Is this a continuous glissando (in frequency? pitch?) from low to high? Does it go up then down then up again? Or any of these possibilities? Does it matter more what transpositions are involved or what the timing of the contour is? All of this matters.
For instance let's say you had a 1000ms sample, and you want the result of this process to start out an octave lower than the original for a period of time, and then you want it to jump suddenly to an octave higher than the original at some point, such that the total time of this event is 1000ms. Then your timing is determined for you -- you spend 666.667 ms for the octave lower (chewing up 1/3 of the original), and then 333.333 ms for the octave higher (chewing up the remaining 2/3 of the original).
But let's say you just want the sound to start some unspecified interval lower than original and then exactly halfway through the 1000ms you leap up to some interval higher than written -- this is a very different problem and it has multiple solutions (that is, it depends on the value of at least one of the intervals). You can start with an octave lower (0.5 playback speed) and then jump at 500ms to a perfect fifth higher (1.5 playback speed). Or you could start a just major third lower (0.8 playback speed) and then jump at 500ms to a just minor third higher (1.2 playback speed).
This is true but a little more complicated with glissandi -- it matters a lot whether you care more about the timing or more about the intervals of transposition, and if you care about the intervals it's important whether you're thinking of interval in terms of frequency difference or in terms of pitch (the base-2 log of frequency ratios, i.e. "fractions of an octave" or "semitones" or what have you). The "linearity" of the continuous change will have everything to do with whether you're thinking of frequency or the pitch measurement.
I haven't thought this through but I'm pretty sure that a linear envelope on frequency will have the same timing as the average of the endpoint playback speeds -- in the above example, going from 0.5x to 1.5x at 500ms would be the same as linearly changing from 0.5x to 1.5x over the whole 1000ms -- so long as the mean is 1.
Matt
Herm.. not sure,
What I mean is this. If I have a sample of 1000ms, and a breakpoint envelope of 1000ms duration, the two will stay the same length as long as I don't make any points on the graph (i.e. the transpose envelope stays at 0 all the way through).
With a transposing sampler, as soon as the transposition is increased the time of the sample playback is decreased, so the transposition envelope will not finish before the sample is played out. Similarly, if the transposition envelope is goes down, the transposition envelope will finish before the sample does.
What I am looking for is a mathematical way to calculate the length of a transposition envelope relative to its effect on a finite-length sample, and so to derive a length for the envelope that will allow the envelope and the sample to play out over the same duration.
The transposition will continuously change the length of the sample, and so from my limited knowledge of mathematics I reckon it will take some integration of the breakpoint envelope to calculate this number. I'm just not sure how to do this.
Best, Ed
Metastudio 4 for Pure Data - coming soon! Metastudio 3 still available at http://sharktracks.co.uk/puredata
As Matt points out, it's not trivial.
Your initial instinct was best IMHO, to use the integral (running accumulation) of normalised pitch.
If you have a samplewise integrator then a small increment value 1/samplerate , lets call it I, will cause the output, let's call that O, to reach a value of 1 in 1 second of time.
If your sample is S samples long (look at the output of [soundfiler] object) then divide by samplerate to get the time T
You want to reach a value of 1 in T seconds so divide to get your new increment I.
The envelope can be made by subtracting O from 1, so that the output fades away.
It's a good idea to add a [max 0] or [clip 0 1] to the envelope output because it will continue to get smaller and go negative otherwise.
If pitch varies up or down during playback then 1 - O should still hit zero at the end of the playback.
On Mon, 21 Feb 2011 19:49:45 -0500 Matt Barber brbrofsvl@gmail.com wrote:
I think it would help me to think of the problem if you could say what you wanted the envelope itself to look/sound like. Is this a continuous glissando (in frequency? pitch?) from low to high? Does it go up then down then up again? Or any of these possibilities? Does it matter more what transpositions are involved or what the timing of the contour is? All of this matters.
For instance let's say you had a 1000ms sample, and you want the result of this process to start out an octave lower than the original for a period of time, and then you want it to jump suddenly to an octave higher than the original at some point, such that the total time of this event is 1000ms. Then your timing is determined for you -- you spend 666.667 ms for the octave lower (chewing up 1/3 of the original), and then 333.333 ms for the octave higher (chewing up the remaining 2/3 of the original).
But let's say you just want the sound to start some unspecified interval lower than original and then exactly halfway through the 1000ms you leap up to some interval higher than written -- this is a very different problem and it has multiple solutions (that is, it depends on the value of at least one of the intervals). You can start with an octave lower (0.5 playback speed) and then jump at 500ms to a perfect fifth higher (1.5 playback speed). Or you could start a just major third lower (0.8 playback speed) and then jump at 500ms to a just minor third higher (1.2 playback speed).
This is true but a little more complicated with glissandi -- it matters a lot whether you care more about the timing or more about the intervals of transposition, and if you care about the intervals it's important whether you're thinking of interval in terms of frequency difference or in terms of pitch (the base-2 log of frequency ratios, i.e. "fractions of an octave" or "semitones" or what have you). The "linearity" of the continuous change will have everything to do with whether you're thinking of frequency or the pitch measurement.
I haven't thought this through but I'm pretty sure that a linear envelope on frequency will have the same timing as the average of the endpoint playback speeds -- in the above example, going from 0.5x to 1.5x at 500ms would be the same as linearly changing from 0.5x to 1.5x over the whole 1000ms -- so long as the mean is 1.
Matt
Herm.. not sure,
What I mean is this. If I have a sample of 1000ms, and a breakpoint envelope of 1000ms duration, the two will stay the same length as long as I don't make any points on the graph (i.e. the transpose envelope stays at 0 all the way through).
With a transposing sampler, as soon as the transposition is increased the time of the sample playback is decreased, so the transposition envelope will not finish before the sample is played out. Similarly, if the transposition envelope is goes down, the transposition envelope will finish before the sample does.
What I am looking for is a mathematical way to calculate the length of a transposition envelope relative to its effect on a finite-length sample, and so to derive a length for the envelope that will allow the envelope and the sample to play out over the same duration.
The transposition will continuously change the length of the sample, and so from my limited knowledge of mathematics I reckon it will take some integration of the breakpoint envelope to calculate this number. I'm just not sure how to do this.
Best, Ed
Metastudio 4 for Pure Data - coming soon! Metastudio 3 still available at http://sharktracks.co.uk/puredata
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Wed, 23 Feb 2011, Andy Farnell wrote:
If you have a samplewise integrator
That's called [rpole~] in pd.
then a small increment value 1/samplerate , lets call it I, will cause the output, let's call that O, to reach a value of 1 in 1 second of time.
Try this attachment. Press the bang many times and look at what happens.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC