[PD] change samplerate locally
Martin Peach
martin.peach at sympatico.ca
Sun Mar 15 17:36:30 CET 2009
hard off wrote:
> to re-create the sound of a dx7 i need to change samplerate from my
> default (44.1khz) to 28khz.
> globally changing pd's samplerate to 28khz has the intended effect, but
> i want to be able to run other patches at 44.1khz while running my dx7
> at 28khz.
>
I think that the sound card decides what sample rates you can use, you
probably can get 22.5 and 11.25 but not 28.
A clean resampling usually would mean sampling at a common multiple of
28kHz and 44.1kHz and then downsampling again, not really feasible with Pd.
> i naively tried adding this construct to the output, but the sound is
> completely wrong:
> (if it doesn't show, the phasor~ is connected to the right inlet of the
> [samplehold~])
>
> [inlet~] [phasor~ 28000]
> | |
> [samplehold~]
> |
> [outlet~]
>
> i thought about it for a bit, and i understand why that doesn't work,
> but i can't think of another solution.
>
> is there some way i can 'mimic' 28khz samplerate while running pd at
> 44.1? or even better, is there some way to locally set the samplerate
> for a patch? i tried messing round with [block~] but i can't make it do
> what i need.
>
Unless you're looking for aliasing artifacts, wouldn't it be easier to
use a multi-pole low-pass filter at around 14kHz?
> also, i need to mimic a 12bit DAC~ too.
For that you could multiply the samples by 2048 (for bipolar signal) and
then divide them modulo 2048, like this:
[*~ 2048]
|
[expr~ $v1%2048]
|
[/~ 2048]
|
[dac~]
Martin
More information about the Pd-list
mailing list