This task is part of project08 which is due at 23:00 EDT on 2024-04-02.
You have the option to work with a partner on this task if you wish. Working with a partner requires more work to coordinate schedules, but if you work together and make sure that you are both understanding the code you write, you will make progress faster and learn more.
You can download the starter code for this task using this link.
You can submit this task using this link.
Put all of your work for this task into the file
tune2.py
(you will create this file from scratch)
For this task, we want you to review concepts covered in the first part
of the class, like loops, functions, and conditionals, giving you space
to design your own code that uses these constructs. Back at the start of
the class you did either a custom scene or a custom song a way of
learning about Python basics; now you will have a chance to make
something more complex, using what you've learned so far. This task
focuses on wavesynth
audio, while you could instead do the
turtleScene2
task which focuses on drawing with
turtle
and turtleBeads
.
The requirements are again simple, with no restrictions on what audio you produce: the only rules are that you must make use of certain Python statements.
To start, you need to create a new file, named tune2.py
. This file
must be in a folder where wavesynth.py
is also present. Download the
starter code, unzip it, and then create your tune2.py
file in that
folder.
Your tune2.py
file must satisfy the following criteria:
Your file must start with the usual docstring with authorship information. Here's a template you can copy and paste:
"""
Authors: Anon & Ymous
Consulted: T. A.
Date: 2023-10-31
Purpose: Wavesynth tune task version 2
"""
Your file will have to import
the wavesynth
module.
for
and/or while
loops as long as
they're directly inside each other. Inside the inner loop of this
nested loop, you must call a custom function called
addOne
.addOne
function must accept at least two
parameters.addOne
function must contain at least one if/else
statement.addOne
function must call at least one of the following
functions:addNote
addBeast
climbUp
, climbDown
,
halfStepUp
, halfStepDown
, climbUpFrom
, climbDownFrom
,
halfStepUpFrom
, or
halfStepDownFrom
to change the
current pitch between notes, or to compute a pitch based on another
pitch.setVolume
, quieter
, and/or
louder
functions to manipulate
the volume of one or more notes or beats.setTime
, rewind
, and/or
fastforward
functions to alter the
time at which some notes or beats are created.saveTack
function so that your program saves the music to a file. You may name
your saved file whatever you wish. As an extra goal, you may
also use the printTrack
function
to print out a record of the notes you created. Calling playTrack
is
not required, but if simpleaudio
can be installed on your system,
it's a faster way to hear the audio than opening up the saved file
each time.You are welcome to use other wavesynth
features in addition to the ones
listed above, but only the above features are required.
After completing this task, you must take the audio file that saveTrack
produces, name it correctly, and upload it to the shared google drive
folder as explained in the submission
instructions.
addOne
addOne
in at least one place.addOne(_, _, ___)
def
to define addOne(_, _, ___)
addOne(_, _, ___)
, use an if
statement (possibly accompanied by an elif
or else
block) in at least one place.addNote
addOne(_, _, ___)
, call addNote
or addBeat
in at least one place.climbUp
climbUp
, climbDown
, halfStepUp
, halfStepDown
, climbUpFrom
, climbDownFrom
, halfStepUpFrom
, or halfStepDownFrom
in at least one place.setVolume
setVolume
, quieter
, or louder
in at least one place.setTime
setTime
, rewind
, or fastforward
in at least one place.saveTrack
saveTrack
in at least one place.printTrack
printTrack
in at least one place.