I'm trying to keep a simple random melody generator for myself - I had it working one way, but I would like to tweak it and employ arrays so I can more efficiently add more notes. On the right it's working, On the left is my array implementation that I can't figure out whats wrong - I have looked over many tutorials and examples of arrays in pd and how they work, but I guess my understanding is still flawed somewhere..
-
Helping a newbie with arrays ?
-
Can I reference or name an array without putting a number infront of it by the way ?
I've looked over the documentation for arrays but it just left me looking for more examples to try and understand..
-
@dvd01osclfo Create an array, then right click on it and select help. On that first help page there are examples without the $0- prefix. Next, click on [16.more.arrays.pd( which opens another help window. The first paragraph tells you how to set the start index and values in a message. If you look back at my other reply you can see how Pd interprets your first 440 as the start index.
-
I'll take a look i'm determined to figure this out
-
@dvd01osclfo I know you will!
-
okay I looked over those files, made some further changes with my birdbrain lol
Now, I've finally managed to make that number object fill that goes into the oscillator
but I only get values of -1 and 1 inside.
-
@dvd01osclfo I'll assume that array98 is somewhere off-screen. Your initialization message is still weird. First of all, you no longer need that [f $0] because you didn't want to use it anymore to prefix your array name. Next, you still are not initializing your array from the beginning, index 0, and I'm not sure what "pitches" does in that message. Look again more carefully at that help page. The format of that second line of the message should be <name of the array><start index><value 1><value 2>.....
You're almost there. I suggest you just create an array and work on sending it messages until you figure out what's going on. Signing off until tomorrow am.
-
@dvd01osclfo You can also use the [array] objects to interact with graphical arrays.
-
@jameslo Im still struggling,, I haven't had much time too look -- I'll try and take a look when I get a chance and hopefully fix it.
-
@dvd01osclfo Consider using @oid's method above, it's a little less arcane than that compound message idiom. Otherwise, here are some relevant sections of array help:
Also, an easy way to check what values are in an array is to right click on it, select properties, and then list view. -
@dvd01osclfo Using an [array] is probably not the best way to do it, but it does give you a graphical representation of the notes.
You will need to increase the height of the array window if you put notes over 1000.... it will still work but it will look strange with bars outside the window.
Try this..... huh-mod.zipYou get one extra index with a value of zero, but the message to [random] ensures that it is ignored.
That can be fixed of course..... but no more time right now......
David.