openobject.org

Daniel's Pure Data Media Player - PROJECT 2

From Physical Programming

The idea for my patch was to try something that was completely different to anything I had learnt before, this led me to programming a media player.

I jumped on youtube and google, looking up Pure Data Tutorials into how to do this http://www.youtube.com/watch?v=CQpUVwSVUGg&feature=related http://www.youtube.com/watch?v=FkmMzqohsDo

It was here that I came across many of the different sound functions that Pure Data allows you to create from the ability to cross fade a certain note, to being able to create a basic music player.

This is my cross fading program that i was able to create through using the youtube tutorial

Image:Xfad1.jpg


The Start of a very basic music player

Image:Number1.jpg

As you can see there are alot of similarities in the help menu to my actual file, this is because the tutorial i followed wasn't working well and i had to try it a different way.

Through what i learnt in the tutorials and in class i added a seek bar which allowed the user to scroll through the song to the bit they wanted to listen to, or to listen to the song again. The term 'oggread~' is an object that allows the user to upload an .ogg audio file and play it through Pure Data

Image:Musicplayer1.jpg

After showing some friends my patch, i realised it was a bit simple and got the idea to add a video to accompany the song. This is where i looked up some more tutorials in how to add videos. I learnt that videos can be added in mp4 format but sound needs to be added separately.

http://en.flossmanuals.net/PureData/GEMIntroduction

http://puredata.hurleur.com/sujet-3155-problems-playing-audio-file

http://www.youtube.com/watch?v=H9Wy7eNpTkw

http://www.youtube.com/user/cheetomoskeeto#p/c/12DC9A161D8DC5DC/28/WgxwkAsNjYw

This was the beginning, creating a window, with a create and destroy function to a certain dimensioned screen

Image:Vdplayr1.jpg

The next step was to add an object called 'pix_film' which is much like 'oggread~' in the way that it allows you to play .mov and .mp4 movie files. I also added an open panel function to allow the user to select their own video.

Image:Vdplay2.jpg

The next step was to add a seek bar for the video in much the same way i did in the music player. I also added a play function with a 'toggle' so i could play and stop the video at will.

Image:Vdplay3.jpg

The next step was to add an object "unpack f f f" which would show the total number of frames in the video, as well as its pixel size such as 640 by 480etc. Aswell as this i added an obejct called "pic_texture" which allows you to create a window in a size of your liking to play this video in

Image:Vidplayr4.jpg

After this i wanted to add in the audio to accompany the video. I found out there was another way to add audio in a different format, this time in .aif format. This required the use of the object called "readsf~ 2" which again functioned alot like 'oggread~' just for different audio files.

Image:Vidplyr5.jpg

I then added the 'open panel' functions to allow the user to choose their own sound file to accompany the video. I downloaded a video and sampled its audio so i could essentially play the video with sound. The tricky bit was syncing them together. The ': pd dsp $1" was a trick a friend showed me to act as a button to turn the Audio On in Pure Data, without having to go through the menus.

Image:Vdplayr6.jpg

For the final bit, i tried to sync the audio and video together. I had manged to get the audio and the video to play independently so what i decided to do was connect the 'toggle' switch which plays the video and connect it to the start button on the music player. This way, once the user added his selected video and audio, he was able to play them in synchronisation .

Image:Vdplayr7.jpg

This is my finished program, a video/ music player which i used alot of online tutorials and the help menu inside puredata to help me create. I have run into some problems however with the video not playing at the correct frame rate and the music just not playing sometimes however im hoping these are just minor errors and are easy to fix.

12/8/10

After a week of work on the program I came up with a method to add keys to activate the opening of the video and the audio so you dont have to use the mouse. I assigned the numbers (1,2,3 and T) for the different functions

Image:Redcircles.jpg


I also realised that the problems i was having from the week before werent really problems with my program. There was a certain way to open the files so the video and sounds played in sync. Video first, then audio, then toggle to start. The frame rate was fixed by adding the "gemwin 30" object

Image:Final.jpg

Note, the audio plays at the same time as the video

    • Sorry about the lateness of the the zip file upload. I completely forgot to upload the zip, my mistake. It was basically the same program you saw the week before the due date minus a few minor changes.

Image:Pure Data Old Spice Video Player.zip