An advanced music playing program. This one allows for 6 octaves, sharpes and different lengths for each note.
This is part of a folder (a little library) of small bits of tested code that work. Things like file I/O, interrupts, GPIO definitions, print examples, etc. I don't have to re-invent the wheel every time I write a program. I can go to that folder, copy the pieces I need and be done with my program quickly and with less thrashing.
MATERIALS
Library folder
Individual files for each function (ex: FileIO.py, Array.py, ...)
#x = note, y = octave 0 - 8
#A, Bflat & B have been relocated to make decoding the table faster
a b c d e f g
Notes = [['28', '31', '16', '18', '21', '22', '25'],
['55', '62', '33', '37', '41', '44', '49'],
['110', '124', '65', '73', '82', '87', '98'],
['220', '247', '131', '147', '165', '175', '196'],
['440', '494', '262', '294', '330', '349', '392'],
['880', '988', '523', '587', '659', '699', '784'],
['1760','1976','1047', '1175','1319', '1397','1568'],
['3520','3951','2093', '2349','2637', '2794','3136'],
['7040','7902','4186', '4699','5274', '5588','6272']]
A# B C# D# E F# G# (all flats have been sharped)
Sharpe=[['29', '0', '17', '20', '0', '23', '26'],
['58', '0', '35', '39', '0', '46', '52'],
['117', '0', '69', '78', '0', '93', '104'],
['233', '0', '139', '156', '0', '185', '208'],
['466', '0', '277', '311', '0', '370', '415'],
['932', '0', '554', '622', '0', '740', '831'],
['1865','0', '1109', '1245','0','1480', '1661'],
['3729','0', '2217', '2489','0','2960', '3322'],
['7459','0', '4435', '4978','0','5920', '6645']]
#Zero entries are place holders for the indexing
PYTHON SOFTWARE LIBRARY (grouped by type and listed in order of difficulty)
001-Python Library of Tips & Tricks
• 001-Python Library of Tips & Tricks
103-Python-File Read
• 103-Python - File Read
104-Python (Text) File Write
• 104-Python (Text) File Write
105-Python - Directory File Search & Verify
• 105-Python - Directory File Search & Verify
110-Python-Floating Point Accuracy
• 110-Python-Floating Point Accuracy
120-Python - Format Numbers
• 120-Python - Formatting Numbers
130-Python - Simple Print Formatting
• 130-Python - Simple Print Formatting
140-Python - if, elif, else & CASE?
• 140-Python - if, elif, else & CASE?
201-Python - 2D Array Example
• 201-Python - 2D Array Example
202-Python - 3D Array Example
• 202-Python - 3D Array Example
210-Python - Get Multiple Variables With 1 Line of Input!
• 210-Python - User Input Multiple Variables...
211-Python - Get Multiple Variables From 1 Lin - Split/Replace Complex
• 211-Python - User Input Multiple Variables...
301-Python - Function, Simple
• 301- Python - Simple Function
302-Python - Function, Complex
• 302-Python - Function, Complex
310-Python - Random Numbers (integer & float)
• 310-Python - Random Numbers (integer & float)
410-Python - Beep Sound
• 410-Python Beep Sound
420-Python Music, Simple
• 420-Python Music Player, Simple
430-Python Music, Advanced
• 430-Python Music Player Advanced
500-Python - Graphics, Simple Circle Example
• 500-Python - Graphics, Simple Circle Example
510-Python - Graphics, Line Example
• 510-Python Line Graphic Example
520-Python - Graphics, Sine Wave Example 1
• 520-Python Sine Wave Graphic Example
530-Python - Graphics, Sine Wave Example 2
• 530-Python Sine Wave Example 2
540-Python - Graphics, Tiling / Tiles
• 540-Python Tiles/Tiling, Graphics
550-Python - Graphics, Tic Tac Toe Grid
• 550-Python Tic Tac Toe Grid, Graphical
600-Python - Bubble Sort, Simple
• 600-Python Simple Bubble Sort
601-Python - Bubble Sort, More Efficient
• 601- Python Bubble Sort, Efficient
610-Python - File Sort
• 610-Python File Sort
701-Python - Bit Shifting (needed for I2C stuff)
• 701-Python - Bit Shifting
710-Python - Recursion
• Video