Skip to content

W14 | bronhuston 5pm | rtwaltman, dwang68 | A basic demo of some simple synthesis starting with sine waves

Notifications You must be signed in to change notification settings

dwang68/cs56-music-basic-synthesis-demo

This branch is 3 commits ahead of, 11 commits behind ucsb-cs56-projects/cs56-music-basic-synthesis-demo:master.

Repository files navigation

W14 Ready! (Bronwyn Perry-Huston) cs56-music-basic-synthesis-demo

A basic demo of some simple synthesis starting with sine waves

NOTE

The formats for YellowSub.txt, MaryHadALittleLamb.txt, and Default.txt are old and do not currently work as they are in incompatible format and need to be updated to use either midi, scientific name, or frequency for their pitch. See http://en.wikipedia.org/wiki/Piano_key_frequencies for reference. Keep in mind that the program has been written to support octaves 1-7, but can easily be changed by editing the bounds of the for loops in FrequencyMap.java.

Melody GUI Example

ant melodyGUI

GUI Skeleton Example Run

ant basicGUI

GUI is simply a skeleton, and is not functional

Melody of Specific File

 ant melody -Darg6=[filename]

Replace [filename] with any text file in build/resources. Ex:

 ant melody -Darg6=frereJacques.txt

This uses ADSR presets:

  • attack: 0.1
  • decay: 0.2
  • sustain amplitude: 0.6
  • sustain time 1.0
  • release 0.2

Melody Run of YellowSub, MaryHadALittleLamb, and Default

 ant melodyAll

Note: Will not work until these files are converted to the new pitch format. See the first section "NOTE".

This uses ADSR presets:

  • attack: 0.1
  • decay: 0.2
  • sustain amplitude: 0.6
  • sustain time 1.0
  • release 0.2

Melody With Full ASR Options (Single Melody File)

 ant melodyADSR_Options -Darg0=[attack] -Darg1=[decay] -Darg2=[sustain amp] -Darg3=[sustain time] -Darg4=[release] -Darg6=[filename.txt]

Replace each component of -Darg with the desired value. Ex:

 ant melodyADSR_Options -Darg0=0.1 -Darg1=0.2 -Darg2=0.3 -Darg3=0.4 -Darg4=0.5 -Darg6=frereJacques.txt

Note that -Darg5 is skipped, as it is set to '1' in build.xml

More Options With Full Classpath

To play more than one melody in a row, use

java -cp build edu.ucsb.cs56.projects.music.basic_synthesis_demo.Melody_Code.Melody 0.1 0.2 0.6 1.0 0.1 3 YellowSub.txt MaryHadALittleLamb.txt Default.txt 

This will play the Melodies contained in the files YellowSub.txt, MaryHadALittleLamb.txt, and Default.txt one after another. The Melodies in the files will be played in the order that they are entered. All of the text files to be played must be in the build/resource/ folder.

the parameters are: attack, decay, sustain amp, sustain time, release, the number of files to play, and the names of the files containing the melodies

Useful resources

The following may be helpful: http://proquest.safaribooksonline.com/book/programming/game-programming/0596007302/audio-synthesis/killergame-chp-10-sect-1?reader=html

From off campus: http://proquest.safaribooksonline.com.proxy.library.ucsb.edu:2048/book/programming/game-programming/0596007302/audio-synthesis/killergame-chp-10-sect-1?reader=html

About

W14 | bronhuston 5pm | rtwaltman, dwang68 | A basic demo of some simple synthesis starting with sine waves

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%