Getting a phasor locked to transport to step through an audio file of any length

christiancurtis's icon

Hi guys,

This is part of a much larger patch. I'm using a phasor locked to the transport using phasor~ 1n @lock 1 to play audio using wave~. Obviously this means that when I play audio that is not exactly 1 bar in length the phasor needs to be scaled. I initially used the rate~ object, which worked perfectly for what I wanted the patch to do at the time, but I've decided to try going about it in a different way because it would simplify other parts of the patch.

For instance, if the audio is 4 bars long, I'm multiplying the master phasor buy .25 to slow it down by the correct amount, then stepping through the bars by using +~, so bar one = +~ 0.,bar two = +~ .25, bar three = +~ .5, bar four = +~ .75.

My problem is that I can't get it to step through smoothly, as you can see from the scope in the patch, which causes little glitches in the audio.

Anyone know the best way to get around this?

As always any help would be greatly appreciated!

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

Best,
Christian

christiancurtis's icon

I've also tried using the signal to trigger the steps, but sometimes it triggers too early, and sometimes too late...

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

Is it possible to trigger sample accurately from a phasor?

mudang's icon

Have you enabled "Scheduler in Audio Interrupt" and set Audio Vector Size to a small value ?
This is essential for having an accurate message timing !

mudang's icon

BTW, a bit more precise method to get a bang on phasor's turnaround could be:

[phasor~]
|
[delta~]
|
[
|
[edge~]
|

christiancurtis's icon

Ah. Yes. The Signal Vector Size was too large...

Thanks!

christiancurtis's icon

I'm thinking this may be a better way to go about this, but I still can't get rid of the little clicks. Does anyone know of a better way to go about it. I'm having a bit of a nightmare with it. It's part of a much bigger and more complex patch, and for the sequencer to function properly I need to be able to use a phasor scaled to 1 bar to step through audio files seamlessly. The rate object that comes after the phasor is used to change playback position reverse etc within my larger patch.

Is this possible?

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

Any advice is much appreciated.

christiancurtis's icon

and if it's not possible, is there another/better way of going about it?

I basically need to have multiple sound files of various bar lengths playing simultaneously, they have to be synced, I have to be able to change which bar within the loop is playing back, and I have to be able to press a button which will reverse playback from the current position and when released will snap back into sync. I have all of this and more working at the moment, but I can't get rid of the clicks between bars, so I'm thinking I may need to rethink how I'm going about it...

roger.carruthers's icon

First of all, if you're on Max 5 you might want to have a look at this post: https://cycling74.com/forums/phasor-lock-bug-was-wait-transport-lock-1 with regards transport locked phasors~ - you can ignore it if you're on 6.

For the clicking, perhaps you could use a windowed pair of wave~s, like in the /examples/sampling folder?

Finally, you might want to have a look at 2dwave~ for changing the playback position within the buffer,
cheers
Roger

christiancurtis's icon

Hi Roger. Thanks for the reply. I am indeed still on Max 5, so it's good to know about the timing issue with the locked phasor.

Using a windowed pair of waves won't work in this instance as it doesn't work unless the 2 samples are playing in sync, and I need to be able to jump around to different bars within the sample.

I've just had to rethink how I was going about it. I thought this would be something fairly simple to do, but unless you can be sample accurate when stepping through the bars it doesn't work. It's fine when looping segments as you can use a hanning window etc and it's not noticeable, but when stepping through the bars it is noticeable with most audio...