Let's say you have an 8 second clip at 44100Hz.
To acheive standard playback at the original sample rate you want to scan from zero to t * sr in t seconds, that's 0 to 352800 in 8000ms (line gens are specified in milliseconds)
You could say
[352800, 8000( | [line~]
But you want to be able to vary the rate, so fixing it in a message isn't so good.
A line generator is usually normalised, so whatever the rate/time we often make it scan from 0 to 1. You then multiply that by the total size, so
[1, 8000( [44100( sr in samps/second | | [line~] [* 8] time in seconds | / [*~ ] | [tabread~]
Substituting the time in the message
time -------
/ | [1, $1( rate | | | | [line~] [* ] time in seconds | / [*~ ] | [tabread~]
Now you can vary your rate and time.
I want to use tabread4~ in conjunction with other objects in one case to change the speed and keep the sample at the same pitch
You cannot do this with a simple tabread~, what you describe is timestretching and that's another story.
and in another case to just change the pitch and keep the sound length the same.
Sadly that's also not something you can do with simple playback/reading either, what you describe is pitchshifting, a whole new can of worms.
Is there a way to do this?
Yes indeed, there are several ways, but try and master the standard playback methods first because the pitchshift and timestretch methods are quite complicated and you will need to fully understand sample playback before moving forwards.
padawan12 wrote: ....
Substituting the time in the message
time -------
/ | [1, $1( rate | | | | [line~] [* ] time in seconds | / [*~ ] | [tabread~]
Now you can vary your rate and time.
One possible problem with this is that if you vary the rate, the position will jump. So you can't really use it to change the pitch of a sample while it's playing. I've often run into this problem (also with things other than sample playback) and had a desire for a line object that would take a target value and a *rate* (slope) at which to approach it, rather than a time. Perhaps even allowing a signal to control the rate. My susloop~ external can do this, but it's kind of a pain when all you want is a line~ with a rate/slope control. Does such an object exist?
Ben
There's [vline~] which will interpolate. But it is updated at krate and like [line~] you specify a time not a rate. What's missing afaics is a linear integrator.
this hideous hack works...
[sig~ 1] vslider -1 to +1 | | [*~ ] | [r~ inc] \ / \ / [+~ ] | [s~ inc]
but one should be able to say
[sig~ 0.001] | [integrate~]
or am I missing something dead obvious?
On Wed, 02 Aug 2006 18:30:31 -0800 Ben Saylor bensaylor@fastmail.fm wrote:
padawan12 wrote: ....
Substituting the time in the message
time -------
/ | [1, $1( rate | | | | [line~] [* ] time in seconds | / [*~ ] | [tabread~]
Now you can vary your rate and time.
One possible problem with this is that if you vary the rate, the position will jump. So you can't really use it to change the pitch of a sample while it's playing. I've often run into this problem (also with things other than sample playback) and had a desire for a line object that would take a target value and a *rate* (slope) at which to approach it, rather than a time. Perhaps even allowing a signal to control the rate. My susloop~ external can do this, but it's kind of a pain when all you want is a line~ with a rate/slope control. Does such an object exist?
Ben
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
padawan12 wrote:
There's [vline~] which will interpolate. But it is updated at krate and like [line~] you specify a time not a rate. What's missing afaics is a linear integrator.
this hideous hack works...
Err, not entirely - the s~/r~ pair will introduce a delay of BLOCKSIZE, which is usually not 1 sample.
[sig~ 1] vslider -1 to +1 | | [*~ ] | [r~ inc] \ / \ / [+~ ] | [s~ inc]
but one should be able to say
[sig~ 0.001] | [integrate~]
or am I missing something dead obvious?
[biquad~] would work, with the correct parameters, which I leave as an exercise to the reader ;)
Doh! Here's the evil biquad hack hooked to a sample player a.
padawan12 wrote:
There's [vline~] which will interpolate. But it is updated at krate and like [line~] you specify a time not a rate. What's missing afaics is a linear integrator.
this hideous hack works...
Err, not entirely - the s~/r~ pair will introduce a delay of BLOCKSIZE, which is usually not 1 sample.
[sig~ 1] vslider -1 to +1 | | [*~ ] | [r~ inc] \ / \ / [+~ ] | [s~ inc]
but one should be able to say
[sig~ 0.001] | [integrate~]
or am I missing something dead obvious?
[biquad~] would work, with the correct parameters, which I leave as an exercise to the reader ;)
Claude
Hallo, padawan12 hat gesagt: // padawan12 wrote:
Here's the evil biquad hack hooked to a sample player
Cool. And not so evil actually.
(Only [list2symbol] in this case is a bit evil, as [list] would have worked as well - it converts single words to symbols, too.)
Frank Barknecht _ ______footils.org_ __goto10.org__
Very clever! Thanks for this patch. It will definitely come in handy for me.
Ben
On Thursday 03 August 2006 10:31, padawan12 wrote:
Doh! Here's the evil biquad hack hooked to a sample player a.
padawan12 wrote:
There's [vline~] which will interpolate. But it is updated at krate and like [line~] you specify a time not a rate. What's missing afaics is a linear integrator.
this hideous hack works...
Err, not entirely - the s~/r~ pair will introduce a delay of BLOCKSIZE, which is usually not 1 sample.
[sig~ 1] vslider -1 to +1
[*~ ]
| [r~ inc] \ / \ / [+~ ] [s~ inc]
but one should be able to say
[sig~ 0.001]
[integrate~]
or am I missing something dead obvious?
[biquad~] would work, with the correct parameters, which I leave as an exercise to the reader ;)
Claude