Project of the Computer Graphics Course in Fudan University, Fall 2021
The project is divided into 3 parts
- Music visualization
- Draw something with code
- make a Flash vedio
This repo contains the first 2 of them. For Project 01, you are recommended to use Binder (repo2docker) to run the code, means you won't bother to deal with those environment setting stuffs, and there is no instrutions for you to set up on your own devices. Try it yourself if you'd like to. For Project 02, you should run on your own device cuz there is no dependencies added for using turtle on Juypter Lab, If you want to do so, please modify the code on your own.
P.S. ./src/
folder is for README.md
, useless for the program
Music Visualization
- Click the
lunch Binder
Buttom and wait until the container is set - Pick Terminal in Jupyter Lab generated by Binder
- Use the commend
cd Project01_MusicVisualization/
to access project 01 dirctory - Use the commend
python AudioAnalyzer.py
to start processing music file and wait for the program to finish - Check the gif file you got in
./Image/
folder
You'll get .gif
files like this:
You can also modify the Music files and try with your own .wav
file. P.S. Only .wav
file is valid here!
- Use
matplotlib
in Python to draw the wave of a paticular interval of the music. (Here we use 1 Sec for a frame cuz this is the smallest interval for the data we got fromAudioSegment.from_file
) - Save those waves as
plt.plot
and add to the frames list namesims []
- Use
animation.ArtistAnimation
method to combine the frames and get the vedio - Save the vedio as
.gif
file
More details please refer to the code and I've written detailed comments for one to understand.
Draw Something
- Clone the code onto your device
- Switch to the folder of PJ 2
- Use the commend
python DrawSomething.py
to start drawing and wait for the program to finish (Turtle is needed for the code to run properly, so search the internet for this package) - You'll see PeppaPig as soon as it finishes
You'll get the tkinter window like this:
- Use
turtle
in Python to draw the picture on canvas - See the documentations here about
turtle
: https://docs.python.org/3/library/turtle.html - Follow the comments I made on the code, you can see the process of the drawing rather clearly