Re: Fast (real-time) time stretch code
On May 29, 11:48*pm, R <R...@nospam.com> wrote:
> On Thu, 29 May 2008 14:35:49 -0700 (PDT), robert bristow-johnson
>
> <r...@audioimagination.com> wrote:
>
> >first of all, usually for a "real-time" process we mean that the same
> >amount of time going in is what comes out.
>
> I meant response time.
i think you meant the computation is efficient enough that if you can
play back the audio file either faster or slower from the disk, and
the algorithm output doesn't fall behind more than a known and bounded
delay.
>
> >as you're slowing it down, are your samples coming from disk (or
> >whatever source) repeating over some regions?
>
> Yes, samples coming from disk. Yes, an option to keep replaying the
> segment, if that's what you meant.
yeah, if you're slowing it down, you would have to repeat segments in
some manner. and if you were speeding it up, you would be omitting
some segments. (discounting any cross-fading in the splices.)
>
> >> I think that some softer (Transcribe! above) does this via Fourier
> >> transform. Is that the best way to achieve this without reentrant
> >> glitches?
>
> >it's about the only way to do it for broadbanded, full-mix audio. *if
> >the source was a monophonic instrument that plays single notes at a
> >time, then time-scaling can be accomplished by staying in the time-
> >domain and making judicious use of splicing.
>
> Yeah, I understand the splice problem. I've seen some older hardware
> "Harmonizers" that try to make intelligent decisions on splice points,
> but that's tough with more than one or two simultaneous pitches.
it depends on the relationship between pitches. playing a heavy power
chord (fifth and major third) should not sound so bad.
> And
> as you point out, overtones won't necessarily align even with
> monophonic sources.
did i say that?? (i have to check.) for *harmonic* monophonic
sources, you should nearly always be able to find a splice length that
makes all of the harmonic overtones happy. if they slightly detune at
the weaker very high harmonics, those splices won't be particularly
noticible.
> But even the old hardware was not that bad
> sometimes. Guitarists and keyboard players used those for playing
> root+5th or even full chords at times. You've probably heard the
> result on recordings.
yeah. actually i was in on the pitch-shifting algs on one of the
Eventide Harmonizer models. and my point above is even more true
(that some polyphonic input to a time-domain pitch shifter can come
out very good, depending on what the notes are) for chords that are
just fifths and no third. those pitch-shift fine. easy. (think of
the tonic and it's fifth as being the 2nd and 3rd harmonic of a common
fundamental that doesn't necessarily have any energy at the
fundamental. then it's a periodic function. sorta.)
> Still, if it can be done via FFT without having to crunch overnight,
> that would be preferable. The sound doesn't have to be hifi, but best
> that it's free of distracting pulsing or harsh artifacts.
there a bunch of products. SoundToys (or Wave Mechanics) SPEED,
Serato Pitch 'n Time.
> So...any code available for doing this? Pref in C/C++ so I could get
> it running on a Windows machine.
it's not too hard to write a simple phase vocoder. i'm not gonna send
you any code nor tell you any tricks that make it sound better than
what you might get from a published alg (like Laroche or Puckette).
that's not too hard. do you have your file and sound I/O worked out?
r b-j
|