Speeding up an event with no pitch shift

phiol's icon

Hi,

This topic of ?playback speed control? is something that I have posted before but have had no luck with the results of what was suggested to try out. There is obviously something fundamental that I am not getting about how the sampling domain works.

Here is the topic again.

All I want to do is to have control on the speed of an event. i.e. a single piano key struck is an event which can rhythmically be sped up and slowed down without having it?s pitch altered. When done fast enough it becomes a single note again. Right.
But I am surprised the see that sample playback react more like a vinyl or tape deck player. Why is this, I assume that this is because the samples are entered and read in a linear fashion ?

Coming back to my piano key example, if this were to be compared to when I select a sample size to be read in the waveform display object, it is read and ?repeated?/looped at a certain speed. All I want is to know how to have control on that playback or repeated speed. (what decide on the playback speed of this object anyways? ) It should not pitch shift , but react like a piano which is, the faster you repeat the more your sound is morphing back into a single sound again , not pitch shift. (what decide on the playback speed of the waveform display object object anyways?)

Here is a list of things I was suggested to try out and that I have covered.

-I was told to search for externals that does this. I was unlucky with the ones that I found ,(maybe I?m just not using them correctly. The last one was residency~ from the FFTease library.

-I was also told to try out the gizmo~ , which worked with the fftin~ , so I needed to first learn Fast Fourier transform was.
So I spend a lot of time doing this by

1. Looking on wikipedia 2. The MSP tutorials and topics 3. Peter Elsea?s notes on fft.

What I got out of it is that FFT was a fast version of DFT which was cut up sound into slices the length of a period (a wave) , in order to analyse it?s spectral content (harmonics). And as for the fft~ object, well what come out is now frenquency domain.

At this point I start getting lost, and sort only got the grasp that this was somewhat like granular synthesis. Maybe?

-I was also told to have a look in c74 example and to check out the modsquadRedux patch.
Interesting patch but the it also demonstrated that, as the samples were sped up the sound quality would change. Of course it would not pitch shift, but the sound quality is altered.

I also had a look at the granular and phase vocoder sampler patch example , and the results are always an altered sound.

I don?t want to be annoying with this topicI keep posting, but this is essential for what I want to do musically. And this move sounds to simple to have anything to do with granular synthesis.or fft .

I accomplish this in ableton live simply by selecting a sample and bringing the BPM way up to 999.
But for now ableton is really not my concern, I want to build my playback speed shifting instrument with the waveform editor that which it?s speed will be controlled by the multi-slider.

Sorry for the long post
And thank you to everyone for your time and concern.

phil

Jean-Francois Charles's icon
Stefan Tiedje's icon

phil schrieb:
> All I want to do is to have control on the speed of an event. i.e. a
> single piano key struck is an event which can rhythmically be sped up
> and slowed down without having it?s pitch altered. When done fast
> enough it becomes a single note again. Right. But I am surprised the
> see that sample playback react more like a vinyl or tape deck player.

If you record some notes into a single buffer~, the buffer doesn't know
anything about events. If you really want to have the same effect as a
piano played faster, each single keystroke of the piano isn't playing
the piano sound faster, its only triggering faster. That's a fundamental
difference...

So better you look at a Midi/event kind of control. What you want is a
sequencer, not a tape recorder...

> At this point I start getting lost, and sort only got the grasp that
> this was somewhat like granular synthesis. Maybe?

It's different, but you could look at it that way as well... ;-)

> I accomplish this in ableton live simply by selecting a sample and
> bringing the BPM way up to 999.

Yes, you are playing repeatedly a sampler, with a single short sample as
opposed to playing a single long recorded piece of multiple sounds...

Hope that helps...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

seejayjames's icon

You can do a lot with gizmo~. To keep the pitch the "same" when changing speed, send the speed (sig~) float number through a !/ 1. object. This gives you the reciprocal, which gizmo~ then uses to transpose accordingly. So the pitch is shifted, but matches the speed changes to try and stay the same as the original. Yes there will be degradation, this is unavoidable (and there is degradation in any program that does this, though it varies). Here I'm assuming you are using a groove~ to play back, with the loop points set by the selection in the waveform~ display.

You can try various parameters in your pfft~ in the gizmo~ patch -- larger ones are more accurate pitch-wise, but incur more smoothing / slew and the timing is "smeared"... larger window size means more time smear. Smaller ones are more accurate time-wise (better for percussive sounds usually) but can get distorted.

Overall, small speed changes are usually fine. Large changes sound anything from crappy to wild and crazy (sometimes there's a fine line here ;) -- I have gotten some really cool sounds from combinations of speed and pitch, especially at very low or high values (drum beats sounding like violins, of all things). It's nice to be able to change both independently, or together -- a simple gate before the !/ 1. does this.

Probably there are many other options but this has worked well for me. Note that this is not the same as triggering events faster, as Stefan said. This is changing the access rate of your individual samples, and changing the speed of this access will change the pitch by definition.

--CJ

phiol's icon

Hi and thanks alot guys , this is clearing things up for me.

So I will try with the gizmo objet.
But I think what I want is more what stephane said;

''So better you look at a Midi/event kind of control. What you want is a
sequencer, not a tape recorder...''

But is this possible with the waveform display object. I mean, can I select a size or more specifically a section of a displayed sample and have trigger control on that specific selected sample?

Would one way to do this be, everytime I highlight sample section I have it activate a recording object, recording it in a buffer or wave form display and in turn ''trigger control'' that recorded sample.

Could this work? Or am I taking to many steps for something that be done way simpler manner. But basically my goal is still have trigger control on a sample section that I highlight in the waveform display.

Many thanks again

phil

seejayjames's icon

Ah, gotcha. No need to record into another buffer~, though this may provide other options. All you need is to have your triggering event (metro, counter, played note, mouse click, etc.) do a "startloop" message to the groove~ object. With loop off (loop 0) this will play the selected portion and then stop. Determining that the loop is over -- use the right outlet of groove~. When that's 1. the loop is done, so you can have it retrigger the startloop (or not -- have a gate there for control maybe, see below).

Note that this will not work with negative sig~ values, as the loop end in that case is 0. not 1. Need to compensate for this if you'll be playing backwards (if sig~ < 0 then set the sel to 0. instead of 1.) The signal value out the right outlet doesn't seem to act the way I'd imagine (going from 1. to 0.) when the signal is negative --- anyone confirm this? (XP, 4.6.2)

There may be timing issues with this arrangement, as the scheduler is slower than the signal rate. I'm sure there are better options out there, but this one works OK. As far as those pesky clicks, that's another thread... using a line~ or a trapezoid~ on the amplitude to quickly bring up and down the signal at the end points can do it, and can be set with a bpfunction graph.

Try this messiness for ideas ;)

--------------------------

Max Patch
Copy patch and select New From Clipboard in Max.

Stefan Tiedje's icon

phil schrieb:
> Would one way to do this be, everytime I highlight sample section I
> have it activate a recording object, recording it in a buffer or wave
> form display and in turn ''trigger control'' that recorded sample.

You could recreate something like recycle, but keep the sound in a
single buffer~, just store the start and end points, then there is no
need to rerecord anything...
Of course you would have to deal with gaps if you play it slower than
original. To just cut the rest if playing faster doesn't hurt....

You can tell groove~/play~/wave~ to start at a certain point within the
sound... Easiest probably with play~, send it a message [startpoint,
endpoint (endpoint-startpoint)]...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

phiol's icon

WOW ! Thank you so very much. I feel like it's christmas !

This is exactly what I've been wanting, dead on. I will have to study it a little and of course customize it, but the "mecanics" of your patch will be incoporated in all of my patches. It will from now on be standard procedure when building a new patch. Thanks again and again.

I just have a few basic, basic questions about your patch;

1. what is the difference between playtrough and retrigger ? Because the results are the same with what i've be doing with it.
2. why does loop need a $1? isn't loop 1 good enough ?
3. why does your groove~ have 2 channel (what is the use for this ?)
4. is your patch hard cpu, and moreover can I have many buffers being triggered like this, say 4-5 ? My computer is a Mac osx PPC 1.3GHz, 768 of RAM.

Many thanks again, Your time, attention and efforts are greatly appreciated. Since this forum is my max msp school.

phil

seejayjames's icon

This is exactly what I've been wanting, dead on. I will have to study it a little and of course customize it, but the "mecanics" of your patch will be incoporated in all of my patches. It will from now on be standard procedure when building a new patch. Thanks again and again.

Thanks! Do feel free to clean it up, it's a mess. ;)

1. what is the difference between playtrough and retrigger ? Because the results are the same with what i've be doing with it.
2. why does loop need a $1? isn't loop 1 good enough ?
3. why does your groove~ have 2 channel (what is the use for this ?)
4. is your patch hard cpu, and moreover can I have many buffers being triggered like this, say 4-5 ? My computer is a Mac osx PPC 1.3GHz, 768 of RAM.

I made it so that on playthrough it keeps playing past the loop point. This only works with the metro off, otherwise the metro retriggers the loop. Wanted to have two ways of doing this.

Loop $1 allows you to choose whether looping is on or off, with the toggle. This $1 "passing values" to objects is *absolutely fundamental* in all areas of Max so do read up on it, this will permit all kinds of further customization. If you always want it to loop, then loop 1 is fine (though this message needs to be passed to the groove~ at some point, like with a loadbang, as loop 0 is the default).

This groove~ has two channels for two channels of audio, usually L and R. Could have one, or more than 2 if the buffer~ has more (surround sound etc.)

The patch is OK on CPU, though as you add effects like filters and delays etc. it will eat up a lot more. This should be able to handle 4 buffers fine, though I haven't done extensive testing.

For your next step I'd look into filtergraph~ and tapin~ / tapout~ (delays). Why have one plain sound when you can have 8 adjustable-time echoes with crazy filtering??

Have fun and do poke around a lot in the manual, tutorials, and help files. Everything you read will likely give you new ideas and possibilities, but keep sight of your goals too (otherwise you may get caught up in experimentation for the sake of fiddling... which is great, up to a point...)

--CJ