Multitrack Analysis Module
hi
Matt Black of Coldcut here.
as a step towards achieving multitrack audio visualisers, ie video synths which are controlled by multiple simultaneous audio inputs, i am interested in getting the following bit of software built, and think it could be made in PD. Am posting it here to see if anyone is interested. I can offer a fee to get this built.
This is the initial spec. I call it a Multitrack Analysis Module , MAM.
-MAM works with multi input ASIO soundcards eg RME fireface, and supports up to 16 audio ins.
-MAM performs SEPARATE fft /spectrum analysis on EACH AUDIO INPUT , say 16 frequency bands per input . delivers amplitude for each frequency band.
-outputs results of fft analysis as midi data. use cc numbers 1-16, with value 1-127 for the 16 frequency bands amplitudes. use midi channel 1-16 to distinguish the 16 audio inputs. Midi data can be routed to available midi interfaces/ports on the host machine, including virtual midi ports such as Maple, MidiYoke.
-optionally, output could be via OSC/ethernet which would get round possible MIDI data rate problems. (Do people think MIDI could handle this amount of data? it could be thinned)
-the MAM should be a self contained module , a stand alone patch that doesnt require a PD framework to run. As i dont know anything about PD , i dont know how it works, but you probably know what i mean.
-ideally, MAM would also be able to run with Ableton LIVE so that one can route the analysis data off to another machine to do the visuals, and still manipulate the audio on the machine with the audio ins in LIVE. this is not essential but i would like to know if people think it would be possible.
Hope this makes sense. I am looking for a good PD coder who is interested in working on a cutting edge project. A payment to build this initial module can be negotiated...not a huge one, but something. Interested parties can post here initially.
Thanks.
Matt Black
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
Soundflower to Decrease CPU usage for those with Firewire interfaces
Hey Guys,
I've noticed, consistently, that if I select my MOTU 828mkII as both Audio In and Audio Out in PD .39extended (newest build from Hans in daily builds, RC4) my CPU usage jumps to almost double as compared to CPU usage with my Built In audio as Audio In and Audio Out. I have not seen this behaviour in any other Mac OS X application.
I've found a way around this.
If you're a Mac OS X user, go ahead and download Soundflower from Cycling74's website: http://www.cycling74.com/downloads/soundflower
Soundflower mirrors Jack in function, but is only available for OS X. It creates a virtual 2 channel and 16 channel interface in your OS so you can route audio between applications and out the soundcard.
To work around this CPU usage bug with firewire interfaces, select Soundflower 2ch or Soundflower 16ch as your default Audio Out / Audio In within Pd. Then within the Soundflowerbed menu, select your firewire interface as your soundflower output. I don't know why this works, but it does. You can now decrease your CPU usage up to about 2x when using a firewire interface. Screenshots follow.
Builtin audio OR soundflower as output while playing the 7. datastructure sequencer demo
Firewire as audio output while playing the 7. datastructure sequencer demo
Soundflower config
How To Start ...
Thanks for that - I managed to work out these things by random clicking. If I hadn't been so interested in Pd then I wouldn't have persued it because the interface/docs do not give an easy entry to making the first sound (which is easy, actually, but I couldn't have known that).
I think I came across Pd before, couldn't get a sound out of it and gave up. Maybe if the docs were improved then we'd have many, many more users!
Just a thought. Hopefully this forum post might help someone.
My attempt : This Is How To Start (Linux version : v0.1) :
1 At a command prompt type pd
2 From the top menu : File | New - will get a new window, called a patch
3 Put | Object then click anywhere in the new patch window and type osc~ into the box, then click anywhere outside the new osc "object"
3 Put | Object again and this time type dac~ into the box and click outside
4 Put | Number and then click outside
5 Click on the middle of an object to move it around if you like
6 At the bottom of the osc~ object is a short thick line. Move your mouse to this and the curser will change to a circle, then click and drag the resultant line to the short thick line on the top of the dac~ object.
7 Do the same with the Number (bottom short thick line) to the top of the osc~ box (the leftmost one).
8. Edit | Edit mode - select the toggle to be off - or cntrl-e
9 In the parent window (the first one that appeared when pd was run) click the "compute audio" button
10 In the patch window select the Number box and move the mouse upwards - this selects the frequency of the oscillator. You should hear a sinewave with the frequency controlled by the Number box.
Is this right??
Cheers!
Caesura
Scanned (video feedback creating audio)
I've been working on my Scanned patch, the basic core is the same, but I've been adding to it a great deal.
Click the link for my set from last night's [url=http://leplacard.org" target="_blank">Placard</a> in Brussels, I streamed live from my bedroom, and typically Pd crashed 3 minutes in when it had been running fine for hours before-hand.
<a href="http://www.archive.org/audio/audio-details-db.php?collectionid=ClaudiusMaximus_-_LePlacard_Live_2005-07-14&collection=opensource_audio
]http://www.archive.org/audio/audio-details-db.php?collectionid=Claudiu sMaximus_-_LePlacard_Live_2005-07-14&collection=opensource_audio
The patches I performed with are also on that page.