Skip to content

Python class for generating frequency plots and audio files for a note or a chord

Notifications You must be signed in to change notification settings

vicchirino/music-theory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Theory

Coding a little bit of music theory.

Note Class

Creation

  class Note:
    base_frequency = BASE_FREQUENCY # A4
    name: str
    octave: int
  • Create a note without octave (default octave is 4)

A = Note('A')

  • Create a note with octave

C = Note('C', 5)

  • Create a sharp note

F_sharp4 = Note('F#', 4)

Methods

  • Create an audio file from a note.

C.generate_audio_file()

C5.mov
  • Plot the frequency spectrum of a note.
  G4 = Note('G')
  G4.plot_wave_note()

image

Classes method

  • Plot a list of notes.

Note.plot_list_of_note_waves([Note("C"), Note("E"), Note("G"), Note("B")], duration=1)

image

  • Plot frequency of a chord.

Note.plot_chord_wave([C4, E4, G4, B], duration=1)

image

  • Create an audio file from a chord.

Note.generate_audio_file_for_chord([Note("C"), Note("E"), Note("G"), Note("B")], duration=1)

C4-E4-G4-B4.mov
  • Create an audio file from a progression.
Note.generate_audio_file_for_progression(
  [
    Note("G"), Note("G"), Note("A"), Note("G"), Note("C", 5), Note("B"), Note("G"),
    Note("G"),Note("A"), Note("G"), Note("D", 5), Note("C", 5), Note("G"),
    Note("G"), Note("E", 5), Note("C", 5), Note("B"), Note("A"), Note("F", 5),
    Note("F", 5), Note("E", 5), Note("C", 5), Note("D", 5), Note("C", 5),
  ]
)
G4-G4-A4-G4-C5-B4-G4-G4-A4-G4-D5-C5-G4-G4-E5-C5-B4-A4-F5-F5-E5-C5-D5-C5.mov

About

Python class for generating frequency plots and audio files for a note or a chord

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages