I want to make a program that can do two things really:
1) Detect the beat of a song
2) Output through a port, preferably the paralell port.

1) I was thinking the easiest way to do this, would be to use windows media players bars visualization, but then i need to get python to grab information from a certain area of the screen, detect changes visually.

2) I believe most programs can output through the parallel port.

Can python do this? if so, can anyone point me to some resources that can help me make a program to detect screen changes that are visual? I'll make that part first, then worry about the second part.

Thanks everyone,

-Matt

P.S. - this also goes with my isu post, I'm going to use this as my programming isu.

Start learning C++, I am sure it will make it easy to do the things you want to do! What will the parallel port go to? Our friends in the C++ forum will be a lot of help!

You can also look into PySonic and Fmod.

I am also taking grade 12 computer electronics which also needs an isu, I was going to make a cicuit to show (via leds) a sort of visualization of the music, and the easiest way to do that is with the parallel port.

There is a module called pyparallel. You need to google for it.
Hurry so, the parallel port might disappear in favor of the USB.

the computers in the computer lab at my school, which is where my class is, all have parallel ports. But is there a way to grab the graphical data from the visualization? For example, if i told my program to look in that area for screen changes, and then detect the changes in the "bars" visualization. If I can do that... plus the pyparallel module, I can make my isu.

This from the Win32 Programmer's Reference:

The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

COLORREF GetPixel(

HDC hdc, // handle of device context
int XPos, // x-coordinate of pixel
int nYPos // y-coordinate of pixel
);


Parameters

hdc

Identifies the device context.

nXPos

Specifies the logical x-coordinate of the pixel to be examined.

nYPos

Specifies the logical y-coordinate of the pixel to be examined.

Return Values

If the function succeeds, the return value is an RGB value. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.

Remarks

The pixel must be within the boundaries of the current clipping region.
Not all devices support GetPixel. An application should call GetDeviceCaps to determine whether a specified device supports this function.

A related function SetPixel() is used in one of the C code snippets about plotting. Vegaseat is probably right, for low level things like direct screen access C or C++ is best.

Read on another forum:

With Python you learn how to drive the car, with C++ you learn how to build the car.

Matt:

If your song is MIDI data, then it should be a trivial solution; I believe that MIDI files encode their tempo as metadata.

If your song is in MP3 or .wav format, then you are going to have to scan the data for amplitude peaks or patterns, which is non-trivial.

Google is your friend:
http://www.google.com/search?hs=gAq&hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=detecting+beats+in+.wav+files+algorithms&btnG=Search

Then you would need something like pyNumeric to implement an algorithm.

Jeff

Python comes with a module audioop, you may want to check that one out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.