Spring2018.CITA180Homework3 History

Show minor edits - Show changes to output

Changed line 31 from:
Your program should have a meaningful name, e.g., '''audioAllAround.py'''.
to:
Your program should have a meaningful name, e.g., '''birdsAndSeaguls.py''' or '''desertMoon.py''', or '''nightAlone.py''', etc.
Added lines 118-121:

Also, do realize that your sound material plays a major role in helping shape your aesthetic outcome. For example, for a more soothing effect, change the following to use these (you may have to adapt some parameters, i.e., pitch, duration, volume, and panning.):
* [[https://www.dropbox.com/s/0hv8j9sq8ubcgbr/nightingale.wav?dl=0 | nightingale.wav]], and
* [[https://www.dropbox.com/s/ei9641yq7hbd7ip/waterFlowing.wav?dl=0 | waterFlowing.wav]].
Added lines 14-15:

The piece should be somewhere between 1 to 3 minutes long approximately.
Changed lines 55-58 from:
!!Example

Here is a not-so-serious example that demonstrates how to play a regular score using audio files as instruments. (Also compare with [[https://jythonmusic.me/ch-3-organization-and-data/#Autumn-Leaves | this]].)
to:
!!Examples

Here are three examples that demonstrate the mechanics of this assignment (but not the inspiration - that's up to you).

!!!Example No. 1

The following demonstrates how to do polyphony with a single audio file.

It utilizes the following sonic material (download and save in your JythonMusic folder prior to running):
* [[https://www.dropbox.com/s/ep0golwapaic1op/sey.wav?dl=0 | sey.wav]] (a backwards "Yes", recorded during class)

(:source lang=Python tabwidth=3 -trim :)
from music import *

# load audio instruments
a1 = AudioSample("sey.wav")
a2 = AudioSample("sey.wav")
a3 = AudioSample("sey.wav")

# create musical data structure
score = Score()

part1 = Part(0, 0)
part2 = Part(0, 1)
part3 = Part(0, 2)

phr1 = Phrase()
phr2 = Phrase()
phr3 = Phrase()

# create musical data
pitches1 = [A4, B3, CS4]
pitches2 = [E4, GS4, A4]
#pitches3 = [CS4, E4, E4]
pitches3 = [CS2, E2, E3]

durations = [3.0, 4.8, 3.6] # durations are in seconds (assuming 60bpm)

phr1.addNoteList(pitches1, durations)
phr2.addNoteList(pitches2, durations)
phr3.addNoteList(pitches3, durations)

part1.addPhrase(phr1)
part2.addPhrase(phr2)
part3.addPhrase(phr3)

score.addPart(part1)
score.addPart(part2)
score.addPart(part3)

# play it!
Play.audio( score, [a1, a2, a3] )
(:sourcend:)

!!!Example No. 2

The following demonstrates how to work with two different audio files, and also control their volume.

It utilizes the following sonic material (download and save in your JythonMusic folder prior to running):
* [[https://www.dropbox.com/s/bnssb9fetgn5mrb/whatSouldISayIHaveNoIdea.wav?dl=0 | whatSouldISayIHaveNoIdea.wav]] (a recording made during class, which was reveresed, and echoed using Audacity)
* [[https://www.dropbox.com/s/sm41vz3i4c2s6tq/Ricochet%20Of%20A%20Bullet-SoundBible.com-377161548.wav?dl=0 | Ricochet Of A Bullet-SoundBible.com-377161548.wav]] - available [[http://soundbible.com/tags-ricochet.html | here]].

(:source lang=Python tabwidth=3 -trim :)
from music import *

# load audio instruments
a1 = AudioSample("whatSouldISayIHaveNoIdea.wav")
a2 = AudioSample("Ricochet Of A Bullet-SoundBible.com-377161548.wav")

# create musical data structure
score = Score() # 60bpm

part1 = Part(0, 0)
part2 = Part(0, 1)

phrase1 = Phrase()
phrase2 = Phrase()

# create musical data
pitches1 = [REST, A4]
durations1 = [1.6, 6.0]
dynamics1 = [0, 127]

pitches2 = [A4, REST, G2]
durations2 = [2.0, 1.8, 12.2]
dynamics2 = [20, 0, 60] # lower volume of ricochet

# assemble musical data
phrase1.addNoteList(pitches1, durations1, dynamics1)
phrase2.addNoteList(pitches2, durations2, dynamics2)

part1.addPhrase(phrase1)
part2.addPhrase(phrase2)

score.addPart(part1)
score.addPart(part2)

# now, play it!
Play.audio( score, [a1, a2] )
(:sourcend:)

!!!Example No. 3

Here is the Autumn Leaves example, with a not-so-serious choice of audio instruments. (Also compare with [[https://jythonmusic.me/ch-3-organization-and-data/#Autumn-Leaves | the original]].)
Changed line 11 from:
The piece should utilize up to seven different [[https://jythonmusic.me/api/audiosample/ | AudioSamples]]. Each file should be up to 10 seconds - no more.
to:
The piece should utilize up to seven different [[https://jythonmusic.me/api/audiosample/ | AudioSamples]]. Each file should be up to 12 seconds - no more.
Added lines 1-157:
'''Assigned Date''': Monday, Feb. 5, 2018\\
'''Due Date''': Monday, Feb. 12\\
'''Due Time''': 30 mins before class

Last modified on {$LastModified} (see [[http://www.cs.cofc.edu/~manaris/index.php/Spring2018.CITA180Homework3?action=diff&source=n&minor=n | updates]])

!!Assignment

Write a Jython program that generates an interesting piece of music using pre-recorded sound material.

The piece should utilize up to seven different [[https://jythonmusic.me/api/audiosample/ | AudioSamples]]. Each file should be up to 10 seconds - no more.

These samples will be used as instruments to [[https://jythonmusic.me/play/#audio | Play]] a particular score that you will put together (see example below).

'''Notes:'''

* For polyphony, it is OK to load multiple copies of the same audio file - these do not count as separate files (for the total of seven).
* Before spending too much time on your score, make sure your computer's CPU and memory can handle all the audio files you are planning to use.

!!Submissions

Do '''all four''':

# Draw a sketch of your score on paper (by hand or otherwise).
# Upload your program file '''and audio files''' on [[https://lms.cofc.edu/ | OAKS]].
# Hand in a printout of your Python program in class on the due date. '''Attach''' the sketch of your score.
# Be ready to perform it in class.

Your program should have a meaningful name, e.g., '''audioAllAround.py'''.

!!Program Documentation

Follow the documentation instructions from [[http://www.cs.cofc.edu/~manaris/?n=Spring2018.CITA180Homework1?action=print | Homework 1]].

In addition, your header documentation should describe the following [1]:

# ''Initial, high-level concept'' (i.e., what is this piece about, what is it trying to communicate / achieve, etc.).

# ''Sonic entities used'' and their ''symbolism'' (i.e., mention something about each recording - what it is, how it was recorded, why did you include it, etc.). It is OK to use someone else's material, as long as you provide a name and URL where it can be found.

# ''Macrocomposition'' or ''high-level structure'' of the piece (i.e., how you set up relationships between sonic entities, such as algebraic operations to make sonic entities line up, etc.)

!!!Reference

[1] Xenakis, I. (1971). ''Formalized Music: Thought and Mathematics in Composition''. Indiana University Press, p. 22.

!!Bonus

For extra points, you may explore the ''microcomposition'' or low-level interactions of the sonic elements (i.e., creating or assembling complex timbres from the sonic material).

!!Grading

Your grade will be based on how well you followed the above instructions, and the depth/quality of your work.

!!Example

Here is a not-so-serious example that demonstrates how to play a regular score using audio files as instruments. (Also compare with [[https://jythonmusic.me/ch-3-organization-and-data/#Autumn-Leaves | this]].)

It utilizes the following sonic material (download and save in your JythonMusic folder prior to running):
* [[https://www.dropbox.com/s/dbupwm6673yey43/moondog.Bird_sLament.wav?dl=0 | moondog.Bird_sLament.wav]]
* [[https://www.dropbox.com/s/neaa6m6derdg1cr/It_s_Real_Easy.wav?dl=0 | It_s_Real_Easy.wav]]
* [[https://www.dropbox.com/s/o5bpl95bqxw0idu/Korg-TR-Rack-Acoustic-Bass-C2.wav?dl=0 | Korg-TR-Rack-Acoustic-Bass-C2.wav]]

(:source lang=Python tabwidth=3 -trim :)
# autumnLeaves_AudioPlay.py
#
# It plays the theme from "Autumn Leaves", in a Jazz trio arrangement
# but using actual audio files as instruments.
#
# NOTE: This is just an example of possibilities (and a bit tongue-in-cheek).
#
# (For your submission, follow full documentation instructions.)

from music import *

##### load sonic material
a = AudioSample("moondog.Bird_sLament.wav", G4) # a loop from Moondog's "Bird's Lament"
b = AudioSample("It_s_Real_Easy.wav", BF2) # a funny voice recording
c = AudioSample("Korg-TR-Rack-Acoustic-Bass-C2.wav", C2) # an actual bass sample

##### define the data structure (score, parts, and phrases)
autumnLeavesScore = Score("Autumn Leaves (Jazz Trio)", 140) # 140 bpm

trumpetPart = Part(TRUMPET, 0) # trumpet to MIDI channel 0
vibesPart = Part(VIBES, 1) # vibraphone to MIDI channel 1
bassPart = Part(ACOUSTIC_BASS, 2) # bass to MIDI channel 2

melodyPhrase = Phrase() # holds the melody
chordPhrase = Phrase() # holds the chords
bassPhrase = Phrase() # holds the bass line

##### create musical data
# melody
melodyPitch1 = [REST, E4, FS4, G4, C5, REST, D4, E4, FS4, B4, B4]
melodyDur1 = [QN, QN, QN, QN, WN, EN, DQN,QN, QN, DQN, HN+EN]
melodyPitch2 = [REST, C4, D4, E4, A4, REST, B3, A4, G4, E4]
melodyDur2 = [QN, QN, QN, QN, WN, EN, DQN,QN, QN, 6.0]

melodyPhrase.addNoteList(melodyPitch1, melodyDur1) # add to phrase
melodyPhrase.addNoteList(melodyPitch2, melodyDur2)

# chords
chordPitches1 = [REST, [E3, G3, A3, C4], [E3, G3, A3, C4], REST,
[FS3, A3, C4]]
chordDurations1 = [WN, HN, QN, QN,
QN]
chordPitches2 = [REST, [D3, FS3, G3, B3], [D3, FS3, G3, B3]]
chordDurations2 = [DHN, HN, QN]
chordPitches3 = [REST, [C3, E3, G3, B3], REST, [E3, FS3, A3, C4],
[E3, FS3, A3, C4]]
chordDurations3 = [QN, QN, DHN, HN,
QN]
chordPitches4 = [REST, [DS3, FS3, A3, B3], REST, [E3, G3, B3],
[DS3, FS3, A3, B3]]
chordDurations4 = [QN, QN, DHN, HN,
QN]
chordPitches5 = [REST, [E3, G3, B3], REST]
chordDurations5 = [QN, HN, HN]

chordPhrase.addNoteList(chordPitches1, chordDurations1) # add them
chordPhrase.addNoteList(chordPitches2, chordDurations2)
chordPhrase.addNoteList(chordPitches3, chordDurations3)
chordPhrase.addNoteList(chordPitches4, chordDurations4)
chordPhrase.addNoteList(chordPitches5, chordDurations5)

# bass line
bassPitches1 = [REST, A2, REST, A2, E2, D2, REST, D2, A2, G2, REST,
G2, D2, C2]
bassDurations1 = [WN, QN, EN, EN, HN, QN, EN, EN, HN, QN, EN,
EN, HN, QN]
bassDurations2 = [EN, EN, HN, QN, EN, EN, HN, QN, EN, EN, HN,
QN]
bassPitches2 = [REST, C2, G2, FS2, REST, FS2, C2, B1, REST, B1, FS2,
E2]
bassPitches3 = [REST, E2, E2, B1, E2, REST]
bassDurations3 = [EN, EN, QN, QN, HN, HN]

bassPhrase.addNoteList(bassPitches1, bassDurations1) # add them
bassPhrase.addNoteList(bassPitches2, bassDurations2)
bassPhrase.addNoteList(bassPitches3, bassDurations3)

##### combine musical material
trumpetPart.addPhrase(melodyPhrase) # add phrases to parts
vibesPart.addPhrase(chordPhrase)
bassPart.addPhrase(bassPhrase)

autumnLeavesScore.addPart(trumpetPart) # add parts to score
autumnLeavesScore.addPart(vibesPart)
autumnLeavesScore.addPart(bassPart)

# play it
#Play.midi(autumnLeavesScore) # play music

Play.audio(autumnLeavesScore, [a, b, c]) # new way!
(:sourcend:)

'''Note:''' The above utilizes chords, but has not accounted for polyphony. See [[https://jythonmusic.me/play/#audio | warning and how to fix this]].