Woblay
Woblay is a stereo vibrato effect. It contains a left and a right section, with a link toggle which makes the right follow the left controls. Each section contains 3 sets of two controls (being frequency (F) and frequency-multiplier (oX)), with each set having different values. In the middle is a feedback slider (fbk). This feedbacks the right output to the left input and vice versa. It adds some kind of phasing.
Each section also contains a time (T) slider which will smoothly evolve the change of parameters.
There are no presets yet, but what i do is :
- enable link
- choose some values left (right will follow)
- slightly change the right values (a bit more or less)
- turn up the feedback
Its sounds range from mild boards-of-canada-like vibrato (on synths e.g.) -> total mashup of beats.
To use it just copy the controls and the [pd woblay] subpatch into your own and connect input at top, output at the bottom.
Have fun,
Domien
This is a slightly improved (i guess) version with the following changes :
- graphical : it's now visually indicated which slider (freq / oscX) has been last selected.
- functional : added a random slider to the right section. When link is on, the right counterpart will be randomized according to the selected amount
- functional : time sliders are now also linked
- functional : added some patch initialization
There's a serious amount of overhead now in the patch and people might ask why i have not implemented some parts using abstractions. That is because i like patches to be self-containing and therefore easily reusable by just copy/pasting a sub-patch/GUI from one patch to another, without worrying about missing abstractions.
Have fun,
Domien
Woblay
Woblay is a stereo vibrato effect. It contains a left and a right section, with a link toggle which makes the right follow the left controls. Each section contains 3 sets of two controls (being frequency (F) and frequency-multiplier (oX)), with each set having different values. In the middle is a feedback slider (fbk). This feedbacks the right output to the left input and vice versa. It adds some kind of phasing.
Each section also contains a time (T) slider which will smoothly evolve the change of parameters.
There are no presets yet, but what i do is :
- enable link
- choose some values left (right will follow)
- slightly change the right values (a bit more or less)
- turn up the feedback
Its sounds range from mild boards-of-canada-like vibrato (on synths e.g.) -> total mashup of beats.
To use it just copy the controls and the [pd woblay] subpatch into your own and connect input at top, output at the bottom.
Have fun,
Domien
This is a slightly improved (i guess) version with the following changes :
- graphical : it's now visually indicated which slider (freq / oscX) has been last selected.
- functional : added a random slider to the right section. When link is on, the right counterpart will be randomized according to the selected amount
- functional : time sliders are now also linked
- functional : added some patch initialization
There's a serious amount of overhead now in the patch and people might ask why i have not implemented some parts using abstractions. That is because i like patches to be self-containing and therefore easily reusable by just copy/pasting a sub-patch/GUI from one patch to another, without worrying about missing abstractions.
Have fun,
Domien
Set to zero if no incoming data
I have a stream of data coming in through a gate. For each gate output, I want to be able to set the value to zero when there is no data at the gate. I think a metronome will be required to periodically 'check' if there is data coming, and if there isnt set it to zero.
This 'zero' would then control a spigot to control data flow from another source.
I have tried a combination of spigots, gates, logical tests, bangs and metronomes, and I just cant get it to work.
Pseudo code:
var control (user can control)
var dataStream1 (constant data streams on all accounts)
var dataStream2 "
var dataStream3 "
var dataStream4 "
var collector (i want the data streams to end up here)
if 1 >= control <= 4 then
send dataStreamcontrol to collector
endif
I can get as far as a gate and the controler, however, since all data streams are dumping data, even if the date is switched to say, 2, the collector gets filled simultaneously with all the data streams.
Here is an analogy which can also describe what I want incase its unclear:
Where [gate] might be compared to filling for example four buckets full of water from a hosepipe - that is one data stream and several collectors. In this scenario, if you switch from filling bucket 1 to bucket 2, there will still be some water in bucket 1 from where you filled it earlier. Here I might have 4 buckets on the floor and I move the hosepipe.
I have four hosepipes, each with different coloured water. By selecting 1, 2, 3 or 4, I want to fill ONE bucket with that coloured water, but if I change to a different hosepipe, I want to empty the bucket first, then start filling it with the new coloured water. Here I might have 4 hosepipes suspended and I'm moving the bucket underneath them (tipping out unwanted water).
Meh!
Checking data stream
This one is a bit complicated, I can just about picture what I want in my head; I will do my best to describe it here. Please don't get scared off by the long post! I've put detail as I need this to work for a project I'm working on for my degree. All help appreciated
I have a stream of values (floats) coming from an external source (via OSC). I want to be able to tell when this stream is interrupted, eg no more floats are arriving, so that I can switch off shape rendering in Gem.
A little about the patch:
Wii Remote detecting IR LEDs.
IR data captured with OSCulator.
OSC data sent to PD over localhost.
OSC streams routed to x and y values of IR points.
x and y values draw small circles in gem, showing position of IR points in real time.
Now, the problem is, if the IR beam is interrupted (no more OSC data coming in), the circle shapes stay on screen and don't move. When the beam is restored, the circles ping over to their new position. I want there to be NO circles if the beam is interrupted (no data flow).
I want to be able to say (in pseudo code)
If data stream
render circle on
send data stream to [translateXYZ]
else
send stop rendering to [circle]
end if
I have read all the PD help patches and can't find anything that would really do the trick. I have a suspicion there might be something to do with checking if a value existed over time? Or maybe 'bang' something to 'remind' it theres no more data.
Any help appreciated.
I would attach the patch, but since its so hardware dependent, there wouldn't be much point. I hope I have described it as best above.
Probleme with \[pix\_blob\]
Hi, I'm working on a color tracking interface but I got some problem (in fact, my patch work, but don't properly I think)
First I show you the patch :
in fact, as you can see , there is a red dot on the left side of the gem window (i'm shooting a white sheet with a red dot drew on it with my webcam, and with pix_alpha, I mask every colors except red) but [pix_blob] allways calculate red barycenter around x=0.5 / y=0.5 (on the center) and don't change values when the red dot isn't on the center (same for blue and green blob). I don't know why (maybe pix_blob detect red pixels in the black area, i don't really know what is happening) but I really want to track properly red area (like in this case barycenter should be more like x=0.2 / y=0.5.
so if anyone as an idea to make it track colors area properly, please tell me : )
Problem compiling external on Windows
Hey,
thanks to everyone who responded to my posts both here and in the mailing list. Since then, I've figured out how to compile externals written in C using Microsoft Visual C++ 2005. There's more to document, however, such as how to compile externals using some of the other Windows compilers (Borland, djgpp, etc.), and also how to compile externals written in C++ in Windows. But one thing at a time.
one little thing to note... steps 4 and 7 may seem a little roundabout, but they account for the fact that MSVC sometimes has trouble with spaces in directory names (eg. C://Program Files/). If anyone knows how to override this behavior, post a reply, and I'll try to simplify the steps accordingly.
Updated June 29, 2007:
use [b]C://Progra~1/[/b] instead of [b]C://Program Files/[/b],
use [b]C://Docume~1/[/b] instead of [b]C://Documents and Settings/[/b], etc.
So, without further ado...
How to compile a pd external written in C using Microsoft Visual C++ 2005:
Compared to Windows, linux offers a much more user-friendly environment for compiling pd externals. However, with a little patience, a usable environment can be set up in Windows, and the good news is that everything you need is available for free. There are several reputable Windows-compatible C/C++ compilers out there, but here I'll discuss compiling externals with Microsoft Visual C++ 2005 (MSVC for short).
1. Download and Install Microsoft Visual C++ 2005 Express Edition.
a. Click the link above, then click Go! in the Visual C++ box.
b. Run vcsetup.exe to install the program
(the setup wizard should guide you through the process).
2. Download [url=http://download.microsoft.com/download/7/7/3/7737290f-98e8-45bf-9075-85cc6ae34bf1/VS80sp1-KB9267
]Visual C++ 2005 Express Service Pack 1.
a. Click the link above to download the Service Pack.
b. Run VS80sp1-KB926748-X86-INTL.exe to install the program.
3. Create a new project:
a. Open Visual C++.
b. Open the New Project window (Ctrl+Shift+N).
c. In the Project Types pane, select Visual C++.
d. In the Templates pane, select emptyproj.
e. Enter object name (helloworld).
f. Leave Create directory for solution unchecked, and click OK.
4. Import the pd header file:
a. Get m_pd.h here, or, using pd-vanilla (not pd-extended):
1. Open Windows Explorer or My Computer.
2. Navigate to the pd/src/ directory on your system.
3. Open m_pd.h in a text editor (file type is: C/C++ header).
b. Select all (Ctrl+A).
c. Copy selection to the clipboard (Ctrl+C).
d. Back in Visual C++, open the New File window (Ctrl+N).
e. In the Categories pane, select General.
f. In the Templates pane, select Text File, and click Open.
g. Copy the contents of m_pd.h into the editor window (Ctrl+V).
h. Open the Save File As Window (Ctrl+S).
i. Save as m_pd.h.
j. From the File Menu, select Move m_pd.h into; select helloworld.
5. Write the source code for the external in C.
a. Open the New File window (Ctrl+N).
b. In the Categories pane, select General.
c. In the Templates pane, select Text File, and click Open.
d. Write your source code in the editor window.
The following example is taken from the tutorial by Johannes M. Zmoelnig.
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
6. Save and import the source code into the project:
a. Open the Save File As Window (Ctrl+S).
b. Save as helloworld.c.
c. From the File Menu, select Move helloworld.c into; select helloworld.
7. Access the pd library file:
a. Open Windows Explorer or My Computer.
b. Navigate to the pd/bin/ directory on your system.
c. Right-click on pd.lib (file type is: Object File Library) and select Copy.
d. Navigate to the C://TEMP/ directory on your system.
e. Paste the copy of pd.lib in the C://TEMP/ directory (right-click or Ctrl-V).
8. Set configuration properties:
a. Set configuration type to .dll:
1. Back in Visual C++, open the helloworld Property Pages window (Alt+F7).
2. In the left pane, select Configuration Properties >> General.
3. In the right pane, under Project Defaults, click on
Configuration Type, and select Dynamic Library (.dll)
(using the arrow on the right).
b. Add MSW to preprocessor definitions:
1. In the left pane, select
Configuration Properties >> C/C++ >> Preprocessor.
2. In the right pane, type MSW in the Preprocessor Definitions field.
c. Tell compiler which language to use:
1. In the left pane, select
Configuration Properties >> C/C++ >> Advanced.
2. In the right pane, select Compile As.
3. Select Compile as C Code (/TC) by clicking the arrow on the right.
d. Tell linker where to find pd.lib:
1. In the left pane, select Configuration Properties >> Linker >> Input.
2. In the right pane, select Additional Dependencies and enter
C://TEMP/pd.lib.
e. Tell linker to export the setup function:
1. In the left pane, select
Configuration Properties >> Linker >> Command Line.
2. In the right pane, type
/export:helloworld_setup in the Additional options field.
3. Click OK.
9. Compile and link:
a. Use the Build Solution command (F7).
10. Copy the new helloworld.dll file into pd.
a. Open Windows Explorer or My Computer.
b. Navigate to the
My Documents/Visual Studio 2005/Projects/helloworld/Debug/
directory on your system.
c. Right-click on helloworld.dll (file type is: Application Extension)
and select Copy.
d. Navigate to the pd/extra directory on your system.
e. Paste the copy of helloworld.dll in the pd/extra directory
(right-click or Ctrl-V).
11. Test the external in pd.
a. the external should now be a useable object in pd.
b. open a new pd patch and try to create a helloworld object.
c. add a bang to the left inlet and test it out.
d. if the main pd console window displays "Hello world !!",
the external has succeeded.
Hope this helps!
-- middlepedal
Framenumber to timecode conversion
Hello,
please excuse my stupidity both in programming and generally in understanding PD. i've been trying to figure a way to convert a frame number (received with OSC) to a timecode but the code i tried to adapt from a matlab script by Malcolm A. MacIver that i found here http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=1116&objectType=File
involves some for...loop and i dont know how to do the same in PD... can anyone explain, please?
i guess the field part of the smpte timcode (and other bits of information) are usually not needed, for most people HH:MM:SS:FF Information will be ok... maybe with an adjustable framerate between 30 (ntsc) and 25 (pal)
greetings,
till
function smpte = dec2smpte(init, framecount, field)
% convert the smpte time from the total elapsed frames and field as an integer
% to the new smpte time
first_field=init(9);
weight=[1080000 108000 18000 1800 300 30 10 1];
ns=[];
remain=framecount;
for i=1:8
ns(i)=floor(remain/weight(i));
remain=remain- (ns(i)*weight(i));
end
if strcmp(first_field,':')
second_field='.';
else
second_field=':';
end
if field==1
field_flag=first_field;
else
field_flag=second_field;
end
smpte=[ ...
num2str(ns(1)) num2str(ns(2)) ':' ...
num2str(ns(3)) num2str(ns(4)) ':' ...
num2str(ns(5)) num2str(ns(6)) field_flag ...
num2str(ns(7)) num2str(ns(8))];
different approach here
function itc (int "framecount", float "rate", bool "ms")
{
rate=default(rate,25)
ms = default(ms, false)
drop = (rate==29.97)? true : false
rate2 = (drop==true)? 30 : rate
hours=floor((framecount/rate)/3600)%60
mins=floor((framecount/rate)/60.0)%60
secs=floor(framecount/rate)%60
milli=floor(1000*framecount/rate)%6000%1000
fmilli=framecount/rate - floor(framecount/rate)
#frames=floor(fmilli*rate2)
frames=framecount%int(rate)
dframes = (drop==false)? frames : (secs==0)&&(mins%10!=0)? floor(fmilli*rate2) + 2 : frames
return (ms==false)? (string(hours,"%02.0f")+":"+string(mins,"%02.0f")+":"+string(secs,"%02.0f")+":"+string(frames,"%02.0f")) :
\ (string(hours,"%02.0f")+":"+string(mins,"%02.0f")+":"+string(secs,"%02.0f")+":"+string(milli,"%03.0f"))
}
PureData's patchfile format
@from said:
Color: Some graphical elements have color attributes. Per color only one signed integer value is stored that contains the three 8-bit color // components (RGB). Formula to calculate color attribute values:
color = ( * -65536) + ( [green] * -256) + ( [blue] * -1)
Where [red], [green], [blue] obviously represent the three color components, their values range from 0 to 255. They apply to the attributes [background color], [front color], [label color] of various elements.
my notes on the matter:
I discovered that this formula did not produce the same values that were being in produced in the file. After a frustrating investigation into the discrepency, I realized that Pd color component values are not stored as 8-bit values. For some reason Pd scales these values down to 6-bit values. I am not sure why 6-bit values instead of 8-bit; it does not make much sense to me. The following formula produces accurate results to +/- 1 tolerance:
color = (([red]/-4 * 2^12) +([green]/-4 * 2^6) +([blue]*-1)
I am not sure why the result of this ends up one number off. I think it has to do with integer numbers being rounded when divided by four.
If you convert the decimal representation of the the RGB triplet to hexadecimal, and take the 5 least significant nibbles of that hexadecimal number, and convert each of those nibbles to binary, you can extract the 6-bit values. A binary representation looks like this:
xxrr rrrr gggg ggbb bbbb,
where each letter represents one bit. The six r's, six g's, and six b's obviously refer to the 6-bit red, green and blue values.[/blue][/green][/red][/blue][/green][/red][/blue][/green]
Play a sample
there seems to be something called [table16] that can read large soundfiles, but it still seems to be the in development stage.
for the moment, the only thing i can suggest is to cut your 20 minute file into 20 x 60 second segments,
and then use something like this:
#N canvas 0 22 751 443 10;
#X obj 114 16 table 0-Right;
#X obj 15 16 table 0-Left;
#X obj 114 36 table 1-Right;
#X obj 15 36 table 1-Left;
#X obj 114 56 table 2-Right;
#X obj 15 56 table 2-Left;
#X obj 114 76 table 3-Right;
#X obj 15 76 table 3-Left;
#X obj 114 96 table 4-Right;
#X obj 15 96 table 4-Left;
#X obj 114 116 table 5-Right;
#X obj 15 116 table 5-Left;
#X obj 114 136 table 6-Right;
#X obj 15 136 table 6-Left;
#X obj 114 156 table 7-Right;
#X obj 15 156 table 7-Left;
#X obj 114 176 table 8-Right;
#X obj 15 176 table 8-Left;
#X obj 114 196 table 9-Right;
#X obj 15 196 table 9-Left;
#X obj 114 216 table 10-Right;
#X obj 15 216 table 10-Left;
#X obj 114 236 table 11-Right;
#X obj 15 236 table 11-Left;
#X obj 114 256 table 12-Right;
#X obj 15 256 table 12-Left;
#X obj 114 276 table 13-Right;
#X obj 15 276 table 13-Left;
#X obj 114 296 table 14-Right;
#X obj 15 296 table 14-Left;
#X obj 114 316 table 15-Right;
#X obj 15 316 table 15-Left;
#X obj 114 336 table 16-Right;
#X obj 15 336 table 16-Left;
#X obj 114 356 table 17-Right;
#X obj 15 356 table 17-Left;
#X obj 114 376 table 18-Right;
#X obj 15 376 table 18-Left;
#X obj 114 396 table 19-Right;
#X obj 15 396 table 19-Left;
#X obj 296 179 soundfiler;
#X msg 296 155 read -resize /AUDIO/$1.wav \$1-Left \$1-Right;
#X obj 296 99 until;
#X obj 296 126 f;
#X obj 322 126 + 1;
#X obj 300 57 t b b;
#X msg 298 80 20;
#X msg 341 99 0;
#X msg 300 34 load audio files;
#X floatatom 298 255 5 0 0 0 - - -;
#X obj 315 278 / 60;
#X obj 316 308 int;
#X floatatom 317 339 5 0 0 0 - - -;
#X msg 314 359 set \$1-Left;
#X obj 296 391 tabread4~;
#X text 340 255 Playing position (seconds);
#X connect 41 0 40 0;
#X connect 42 0 43 0;
#X connect 43 0 44 0;
#X connect 43 0 41 0;
#X connect 44 0 43 1;
#X connect 45 0 46 0;
#X connect 45 1 47 0;
#X connect 46 0 42 0;
#X connect 47 0 43 1;
#X connect 48 0 45 0;
#X connect 49 0 50 0;
#X connect 50 0 51 0;
#X connect 51 0 52 0;
#X connect 52 0 53 0;
#X connect 53 0 54 0;
How do you bring in a wav file?
hello liz
first of all you have to create a table (an array)
table sound-file-array 256 for example
next you have to load a file in that table . to do that you have to use the soundfiler object.
you could do that to choose the file you want to load.:
bang (message type)
'
openpanel (object type)
'
-read -resize $1 sound-file-array (message type)
'
soundfiler
that's all. soundfiler 's outlet outputs the filesize.
if you want to use stereo samples , you have to create two arrays and change the message sent to the soundfiler in that way:
-read -resize $1 sound-file-array.L sound-file-array.R (message type)
(it could also be -read -resize $1 table1 table2 )
at least using that way you 'll be limited to 4mb files . if you want to load huge samples , you should rather send this:
-read -maxsize 1e07 $1 sound-file-array (message type)
that 's the way to do that.
but if you want to apply some fx in realtime you could stream a file directly from the harddisk , using sfplay from zexylib.
to output the file you'll have to use sfrecord , i don't recommend tabwrite for such a function . in my opinion it's easier to bounce the file directly to the hdd. else you have to take care of the filesize and to do a mechanism to record sound in a table and after to export it to the hdd.
let me know if it does the job the way you want.
see ya