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

Aug 6, 2008 at 6:17pm

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

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

#39174
Aug 6, 2008 at 6:33pm

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.

#137551
Aug 6, 2008 at 6:51pm

– Pasted Max Patch, click to expand. –
#137552
Aug 6, 2008 at 6:53pm

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

#137553
Aug 6, 2008 at 7:16pm

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

#137554
Aug 6, 2008 at 8:35pm

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

#137555
Aug 6, 2008 at 9:28pm

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

#137556
Aug 6, 2008 at 9:36pm

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

#137557
Aug 6, 2008 at 9:49pm

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

#137558
Aug 6, 2008 at 10:55pm

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

#137559
Aug 7, 2008 at 12:59am

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

#137560
Aug 7, 2008 at 7:22am

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

#137561
Aug 7, 2008 at 8:21am

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

#137562
Aug 7, 2008 at 8:42am

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

#137563
Aug 7, 2008 at 8:45am

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.

#137564
Aug 7, 2008 at 5:12pm

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

#137565
Aug 7, 2008 at 5:39pm

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

#137566

You must be logged in to reply to this topic.