Forums > MaxMSP

Convert signal output to milliseconds

December 5, 2006 | 3:46 pm

Hi guys,

I’ve got a buffer~ and then a groove~ object to play it.

Is there any way to convert the signal of the playtime that is produced from groove~ (0 to 1) as the playtime in milliseconds?

Thanks in advance!

Dave


December 5, 2006 | 4:00 pm

Multiply the phasor value by the buffer’s length.

hth,
Owen


December 5, 2006 | 4:04 pm

This should work:

#N vpatcher 391 201 527 403;
#N comlet (signal) loop end;
#P inlet 80 35 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 58 84 30 196617 abs~;
#P newex 58 62 32 196617 -~ 0.;
#P newex 25 131 31 196617 +~ 0.;
#P newex 25 110 35 196617 *~ 0.;
#N comlet (signal) current position (ms);
#P outlet 25 153 15 0;
#N comlet (signal) loop start;
#P inlet 46 35 15 0;
#N comlet (signal) groove position output (0..1);
#P inlet 25 35 15 0;
#P connect 0 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 2 0;
#P fasten 1 0 4 1 51 55 51 55;
#P fasten 6 0 3 1 63 102 55 102;
#P fasten 1 0 5 0 51 55 63 55;
#P connect 5 0 6 0;
#P connect 7 0 5 1;
#P pop;
#P newobj 147 259 72 196617 p getAudioPos;

- Mattijs


December 5, 2006 | 4:05 pm

Quote: Owen Green wrote on Tue, 05 December 2006 17:00
—————————————————-
> Multiply the phasor value by the buffer’s length.

This doesn’t work if you set the loop points other than at beginning and end.

Mattijs


December 5, 2006 | 4:10 pm

On Dec 5, 2006, at 3:46 PM, Dave Hardy wrote:
> Is there any way to convert the signal of the playtime that is
> produced from groove~ (0 to 1) as the playtime in milliseconds?

Get the duration of the [buffer~] from the [info~] object.
Multiply by the output from the sync outlet of [groove~].
Good for shorter files, but accuracy is a problem for longer ones.

If you are wondering why, search the archives for one of the many
postings to this list about the limitations of floating point
numbers. Most were authored by Peter Castine, so you might try
adding his name to the search. :)

—–
Nathan Wolek
nw@nathanwolek.com

http://www.nathanwolek.com


December 5, 2006 | 7:34 pm


Viewing 6 posts - 1 through 6 (of 6 total)