Pd's modularity?
As an eventual project I wanted to write a quick and dirty sequencer for live/recording use in Pd (with effects etc). A sort of virtual groovebox that can take MIDI and audio inputs controlled by a MIDI foot pedal.
I was just curious about how easy it is to do modular things in Pd. I was thinking of structuring the program so that everything was an object:
- MIDI tracks
- Audio tracks
- Effects
There'd be a lot of work to do with timing etc. since I'd be using it as a glorified looper. But each track should have a 'list' of effects that are applied to it..
So; can I have buttons to add (an unlimited number) MIDI/audio tracks and then add effects to each track as I see fit? I know how I would code this in an OOP language but since Pd has all the audio handling and such useful objects I'd like to do it there.
I've got a lot to learn though!
Dealing with data structures
Structs must be outside the abstraction. In the sequencer I'm building, my data windows are named [pd $1-window] within a [track] abstraction, which first argument is the number of the track :
[track 1], [track 2]...
Structures have to be declared only once, otherwise you get errors. So the unique shared templates and structs are in a subpatch, in the same patch as the [tracks].
This way you can handle separately the different data windows corresponding to different tracks, as whithin [track 1] the data window is called "pd-1-window".
Changing length of beats/steps/something......?
Sorry, I didn't know exactly how to word this in the subject.... but here goes:
I have a 64 step sequencer with 6 different "tracks" all running off the same metro. (when I say track, I'm referring to the 64 steps for one particular sample) I can change the number of steps for each track, so let's say I can have the track with the bass drum count up to 16 before looping, have the snare track count up to 20 before looping, have the hi-hat track count up to 9 before looping, and so on. They can all be set to the same number of steps or however you want, but they still all follow the same metro bangs. In other words, even if you set them to different odd lengths, they stay sounding in time with each other.
So my question is, can I make it so the overall length of time for each track stay the same and have them count through different amounts of steps? Like I could have the bass drum do a straight 8 count, and have the snare do a 13 count, but have them both begin and end at the same time. Like squeeze (or stretch) one or the other so that you would be offsetting them rhythmically, but the time it takes to count to 8 and the time it takes the other to count to 13 be the same length of time.... just a different number of steps.
Does that make any sense? Maybe not in a musical sense, but in a mathematical sense? I know it's not hard to create chaotic patterns with Pd (which I know would probably be the result of what I'm talking about) but I still want to try it.
How to populate 1 array with 4 incomming number streams
hhh, I was wrong about how I thought [poly] assigned voices - i misthought it would always try the lowest voice first, so you could do voice 1->pad, voice 2->perc, voice 3->bass etc to get what you want (which is: each blob gets one sound until it dies, with some sounds preferred when there aren't many blobs - as far as i understand - i might have misinterpreted though)"
this is exactly what I want!!!!!!!!!!!!!!!!
I am probably over complicating things. To trigger the tracks (and they are full studio tacks not notes) does requires a counter which convets bangs to numbers 1 2 3 etc in the order they were recieved
Which then tells [line] to activate a fader in Reason. Every ID can be a separate number
The problem is keeping track of which ID triggered which track, so when that ID sends its OFF message (pull the fader down), it only sends it to the track it triggered and doesnt cut of some other users sound.
so i think I need to do the following: set up 2 arrays
new array Tracks[ 12 ] ; // holds the ID values currently assigned to the track indexes and is written to each time an incomming ID appears -
Tracks [0] = 4 means ID4 has been assigned to the first track
new array IDs[12] ; //here the IDs are the index and the track number they are assigned to is the value
and then swap their values
for ( i = 0; i > IDs.length; i++) {
IDs [ i ] = Tracks _; or something .......................
}
but I cant even get [tabread] to get the correct information out of the first array. if you open the subpatch "assign machine IDs to on messages"
you can write ro the first array, but it doesnt output the correct values
thanks a million for your help man,
looking forward to checking out your patch
http://www.pdpatchrepo.info/hurleur/keeping_track_of_IDs.pd_
How to populate 1 array with 4 incomming number streams
Hi all,
This should be the easiest thing in the world, but I cant for the life of me figure it out.
I need to populate an array with input from four different number streams were the order of appearence of numbers in the stream puts them into an queue to bang messages from 0,1,2 etc.
A brief explanation
I presume is pretty
easy when you know how, but A brief explanation of the project might be in order
The idea is to back project onto a series of screens and give people
IR LED "paintbrushes" so they can paint with procedural graphics and
sound.
We're using "touchlib" blob tracking software (and webcams)to
differentiate between the blobs. the software assigns each blob a
numbered ID for the length of its lifetime, based on the order in
which they come into existence : so the first blob in existence is "ID
0" (until it dies, when it takes its pace in the queue), the second
is "ID 1" etc.
These IDs allow us to assign specific graphics to different blobs in
Processing, and also to give each an individual piece of audio.
Its easy with just one machine sending these messages as each ID
corresponds nicely to the order of tracks to be triggered in the
sequencer,
but we're using four separate modular machines each running touchlib
and we want the sound to be global.
We have networked the machines and each of the four graphics modules
can talk to the machine running the sound. The sound module is running
PD which receives messages from the other machines and then sends MIDI
messages to the sequencer. So PD is getting four streams of numbers -say from zero to three- which correspond to the order in which touchlib blob IDs pop into existence - (each stream local to its own machine)
these numbers trigger a fade in/out of a
mixer track in say for example Reason). Ideally the first person who enters the space will
trigger some pad sounds (fader 1 in reason say) regardless of which
screen they paint on.
that way it will work if there is only one person in the space. The
next person would trigger some percussion, and the full track would
build naturally. The alternative is to have every ID locked to a
sound, meaning it would really only work for four people in the space.
So to the question. There are 4 data streams coming into PD, literally
numbers 0 - 3 in each number box. as you can see in the
"four_machine_dilemma"patch attached.
what I need to do is fix it so that if (and only if) computer A has
sent a message triggering track 1 that computer B, or the next stream,
when it sends its own "ID number 1" is converted to ID number 2 , that
is, it occupies the next position in the global array, triggering
track two (because track 1 is occupied) even though it thinks it is
"ID number 1", and so on down the chain.
is there some way to store a boolean for the track's on state and use
it to reassign a value to the next incoming message?
Or just to fill positions in an array with the incoming messages in
the order they are received. It seems like it it should be
straight-forward but I'll be buggered blind if I can figure it out.
Hope this is not to long winded for a simple question.
Thanks in advance,
wadeorz
Click track with clicks based on an outside source...
I am working on synching up audio from a multiplayer game setup. I already have pd recording audio on three separate audio tracks (each player's speech, the radio speech, and the game audio). This is done for each player.
What I would like to do is add to this audio file a fourth track, which will have events triggered by the game. I would simply like to place a single sample with a maximum value when an OSC event arrives, and write 0's (or the minimum value) otherwise. This way, the fourth track does not act as an audio track, but instead the computer can use it to synch together all of the different players' audio tracks offline using it as a data source.
Unfortunately, I'm a little at a loss as to how to do this.
My biggest problem is that I don't understand quite how [writesf~] works. How is it synching up the audio tracks? Does it keep them all synched, writing 0s if one incoming track has no data, or are they each written separately? If anyone has any insight into this, I'd appreciate it!
-Zach
MS decoding
Surround sound is a specific array of playback devices (speakers and subs.) 5.1 surround sound is similar to M/S sound in that is is a multi-channel image encoded onto 1 stereo track. The encoding and decoding is done with simple addition and subtraction, which is why when you add (sum) the stereo result of an m/s encoded stereo track, the differential is the mid track alone.
So if 5.1 starts as a stereo stream: You have track A (right), and track B (left). But there are five speakers right? Well, AFAIK, it is only possible to do a 4-channel matrix with a 2 channel source, meaning the two 'sorround speakers' are the same. Can anyone correct me?
I believe it is decoded as follows:
A=A (duh)
B=B (hmmm)
C=A+B (surround)
D=A-B (center)
The '.1' I guess is a crossover fed bass 'kicker' that the kids love so much.
Of course, with all digital signal flow to the home theater amp of the future, and cheaper and cheaper D/A, we could do 16.4 surround, which would kick ass.