Forums > MaxMSP

prepend txt list items with number increments and ',' ?

August 6, 2008 | 6:17 pm

Hi

I have a list of fp numbers and I want to prepend the list with incremental numbers beginning with 1 and followed by a ‘,’ so i can then use the data for input to a midi player

can anyone please either: which ever is easiest/better

1. point me to or explain how to add an incremental number to an exsiting (long) list coming from a text file OR
2. is there a way I can use similar functions to output an altered text list with the incremental numbers prepending my fp numbers?

Thanks a lot

w


August 6, 2008 | 6:33 pm

Quote: wooly wrote on Wed, 06 August 2008 12:17
—————————————————-
> Hi
>
> I have a list of fp numbers and I want to prepend the list with incremental numbers beginning with 1 and followed by a ‘,’ so i can then use the data for input to a midi player
>
> can anyone please either: which ever is easiest/better
>
> 1. point me to or explain how to add an incremental number to an exsiting (long) list coming from a text file OR
> 2. is there a way I can use similar functions to output an altered text list with the incremental numbers prepending my fp numbers?
>
> Thanks a lot
>
> w
—————————————————-

I should mention I am using the coll object in the same way as the 18mDataCollecions tutorial in max.


August 6, 2008 | 6:51 pm

– Pasted Max Patch, click to expand. –

August 6, 2008 | 6:53 pm

for the previous patch, make sure you enter each float in a new line in the text object


August 6, 2008 | 7:16 pm

Hi Rob

thanks a lot for the patch..
I’ll have a look at it to see if I can understand how it works… Im a bit fresh with all of this :)

Cheers

W


August 6, 2008 | 8:35 pm

Quote: robtherich wrote on Wed, 06 August 2008 12:53
—————————————————-
> for the previous patch, make sure you enter each float in a new line in the text object
—————————————————-

Hi Rob

I tried the patch but Im not sure it can do what I need it to do or I have misunderstood it :(

I wanted to use an external text file as I have a lot of lines like

5439.04
5431.06
5342.13

etc

I wanted to add numbers like this

0, 5439.04
1, 5431.06
2, 5342.13
etc
so it could be read by a coll object

However, I now have tried the numbers output to a box with ‘prepend line’ and a ‘text file.txt’ objects, but they dont seem to create the same output as a ‘coll file.txt’

here is the tutorial patch I am trying to edit

– Pasted Max Patch, click to expand. –

I have added a comment with the issue in the patch
any ideas you have for a little tweak would be great

Thanks again for any help :)
w


August 6, 2008 | 9:28 pm

You might find it illuminating to hang a print object on the output of
your text object.

-C

Chris Muir
cbm@well.com

http://www.xfade.com


August 6, 2008 | 9:36 pm

Quote: Chris Muir wrote on Wed, 06 August 2008 15:28
—————————————————-
>
>
> You might find it illuminating to hang a print object on the output of
> your text object.

Hi Chris
thanks for the help

I can see that the output is prepended with set which is not being read by the rest of the patch.

I guess i will spend some time researching why :(

But if anyone can put me out of my misery and help remove the ‘set’ i’d be ecstatic ;)

W


August 6, 2008 | 9:49 pm

On Aug 6, 2008, Paul wrote:
> But if anyone can put me out of my misery and help remove the ‘set’
> i’d be ecstatic ;)
>

One way to do it is to insert a "route set" between the text object
and the number box.

I can think of a couple more.

-C

Chris Muir
cbm@well.com

http://www.xfade.com


August 6, 2008 | 10:55 pm

Quote: Chris Muir wrote on Wed, 06 August 2008 15:49
—————————————————-
>
> On Aug 6, 2008, Paul wrote:
> > But if anyone can put me out of my misery and help remove the ‘set’
> > i’d be ecstatic ;)
> >
>
>
> One way to do it is to insert a "route set" between the text object
> and the number box.
>
> I can think of a couple more.
>
> -C
>
> Chris Muir
> cbm@well.com
> http://www.xfade.com
>
>

Hi Chris,

thanks again for your reply

I now have a signal with the ‘route set’ object but i cant seem to divide it into audible notes as the input is a six digit number with 2 floating points i.e 5435.06 – i tried / or % but no joy

here is the patch

– Pasted Max Patch, click to expand. –

once again any help is much appreciated :)
w


August 7, 2008 | 12:59 am

On Aug 6, 2008, at 3:55 PM, Paul wrote:
> I now have a signal with the ‘route set’ object but i cant seem to
> divide it into audible notes as the input is a six digit number with
> 2 floating points i.e 5435.06 – i tried / or % but no joy

I’m not seeing that, but I’m using the eeg coll data set. I put in a
peak and trough that watches the numbers coming out of text. Perhaps
you have data that is > 1 in the data set?

– Pasted Max Patch, click to expand. –

Chris Muir
cbm@well.com

http://www.xfade.com


August 7, 2008 | 7:22 am

Hi Chris,

been asleep =)
Thanks again for your replies

Yes I do have number >1 or 5434.03 is an example
Have i missed something that should treat numbers this size?

Thanks
W


August 7, 2008 | 8:21 am

On Aug 7, 2008, at 12:22 AM, Paul wrote:
> Yes I do have number >1 or 5434.03 is an example
> Have i missed something that should treat numbers this size?

Well, if you have any number bigger than 1 in your data set, the *
127 before you hit your makenote is going to be problematic. There
are several ways to scale data, but which one would be the most
appropriate depends on the data. Perhaps you could upload your data set?

-C

Chris Muir
cbm@well.com

http://www.xfade.com


August 7, 2008 | 8:42 am

Quote: Chris Muir wrote on Thu, 07 August 2008 02:21
—————————————————-
>
> On Aug 7, 2008, at 12:22 AM, Paul wrote:
> > Yes I do have number >1 or 5434.03 is an example
> > Have i missed something that should treat numbers this size?
>
>
> Well, if you have any number bigger than 1 in your data set, the *
> 127 before you hit your makenote is going to be problematic. There
> are several ways to scale data, but which one would be the most
> appropriate depends on the data. Perhaps you could upload your data set?
>
> -C
>

hi chris
I ws just getting a dump of my data set to do jsut that :)
I dont know how to embed/reference an external text file yet so here is an example data set with 10 years of daily figures
thanks again for your very welcome help ;)
w


August 7, 2008 | 8:45 am

Quote: Chris Muir wrote on Thu, 07 August 2008 02:21
—————————————————-
>
> On Aug 7, 2008, at 12:22 AM, Paul wrote:
> > Yes I do have number >1 or 5434.03 is an example
> > Have i missed something that should treat numbers this size?
>
>
> Well, if you have any number bigger than 1 in your data set, the *
> 127 before you hit your makenote is going to be problematic. There
> are several ways to scale data, but which one would be the most
> appropriate depends on the data. Perhaps you could upload your data set?
>
> -C
>
> Chris Muir
> cbm@well.com
> http://www.xfade.com

I forgot to mention this will be one of a number of text file inputs. I intend to have many more iterations but with different numbers (these are stock index and share prices). All numbers will be >1 and < 20000 and will usually have 2 decimal places.


August 7, 2008 | 5:12 pm

Sorry if this shows up twice. It didn’t seem to make it the first
time. I removed the data set this time, to make the patch smaller.

On Aug 7, 2008, at 1:45 AM, Paul wrote:
> I forgot to mention this will be one of a number of text file
> inputs. I intend to have many more iterations but with different
> numbers (these are stock index and share prices). All numbers will
> be >1 and < 20000 and will usually have 2 decimal places.

Well, the number of decimal places is up to a specific floating point
representation, but that’s probably not too relevant here.

I pushed this patch around a little bit. I hope it’s along the lines
of what you were shooting for.

Drawing and playback are normalized to the min and max of a given data
set. This might not be quite what you want, but adjusting the
parameters of scale will probably get you where you want to be.

– Pasted Max Patch, click to expand. –

Chris Muir
cbm@well.com

http://www.xfade.com


August 7, 2008 | 5:39 pm

Hi Chris

whoah thanks very much for your help here. This is exactly the kind of thing I was looking for.

Im hoping to make a few more data sets input into the make note too get chords

If its ok I will examine what you ahve done and get back if I have any questions?

Thanks again for your help
W


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