This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### Get the most n highest-amplitude musical note using my custom algorithm of FFT (on FFT length 35999) on each period (4134 samples) in the arr. | |
| ### Metadata | |
| + Author : Nuttapong Punpipat (NP-chaonay) | |
| + Updated On : 25/05/2020 at 9:56 UTC | |
| + General Updating Frequency : Weekly | |
| + Code Snippet Completeness : N/A | |
| + Stability : Beta | |
| ### General Notices |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import objects | |
| import numpy as np | |
| import pandas as pd | |
| import h5py,random | |
| # Prepare file | |
| path='./Misc/msd_summary_file.h5' | |
| hd5_file=h5py.File(path,'r') | |
| # Shuffle and get n randomly-selected songs index (on each mode group (Major-Minor)) | |
| maj_index=np.where( hd5_file['analysis']['songs']['mode']==0 )[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Name: Main Stopwatch | |
| # Description: My main stopwatch program written in Python. | |
| # Author: Nuttapong Punpipat (NP-chaonay) | |
| # Version: V.2.0.0_beta | |
| # Revised Date: 2020-06-23 12:20 (UTC) | |
| # License: MIT License | |
| # Version Note: | |
| # - Major version: indicates of very significant changes or changes that break compatibility on some system/platforms. | |
| # - Minor version: indicates of significant changes or features adding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from types import SimpleNamespace as Namespace | |
| import sys | |
| # Future function from np_chaonay.main | |
| def tmp(err,status_msg=None,IsWarning=False): | |
| name=type(err).__name__ | |
| if not IsWarning: | |
| type_='Error' | |
| if status_msg==None: status_msg='Program operation has error due to Python exception.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| ## Function "pitch_letter_encoder" from future module "np_chaonay.pymusicnote" | |
| def pitch_letter_encoder(pitch_letter): | |
| """Encode pitch letter to 0-11 | |
| Arguments: | |
| - pitch_letter (str-alike): pitch letter | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Name: Academic Todo Recording | |
| # Description: Program helps you deal with entries of academic todo record. | |
| # Author: NP-chaonay (Nuttapong Punpipat) | |
| # Version: 0.0.0_alpha | |
| # Version Note: | |
| # - Major version: File produced on different major version is not compatible | |
| # - Minor version: Features adding | |
| # - Micro version: Bugs fixing | |
| # Revised Date: 2020-08-09 15:13 (UTC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Name: My edited version of gradient descent algorithm No.1 | |
| # Description: My edited version of gradient descent algorithm. | |
| # In this sample code, we use gradient descent for determining value of x in ax^3+bx^2+cx+d that nearly matches to truth value using given a,b,c,d values (x is weight; a,b,c,d are inputted data) | |
| # Author: NP-chaonay (Nuttapong Punpipat) | |
| # Version: Unversioned | |
| # Version Note: None | |
| # Revised Date: 2020-07-27 05:34 (UTC) | |
| # License: MIT License | |
| # Programming Language: Python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Mentimeter Wordcloud Question Scraping | |
| import http.client,json | |
| import pandas as pd | |
| question_id='000000000000' | |
| HTTP_C=http.client.HTTPSConnection('api.mentimeter.com') | |
| HTTP_C.request('GET','/questions/'+question_id+'/result?isPublic=true') | |
| HTTP_R=HTTP_C.getresponse() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Name: RandomQuizes | |
| # Description: Scripts for random quizes. | |
| # Author: NP-chaonay (Nuttapong Punpipat) | |
| # Version: Unversioned | |
| # Version Note: N/A | |
| # Revised Date: 2020-08-09 07:27 (UTC) | |
| # License: MIT License | |
| # Programming Language: Python | |
| # CUI/GUI Language: English |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # Name: Python Initialization for Academic Usage | |
| # Description: Python Initialization for Academic Usage | |
| # Author: NP-chaonay (Nuttapong Punpipat) | |
| # Version: Unversioned | |
| # Version Note: N/A | |
| # Revised Date: 2020-09-10 13:51 (UTC) | |
| # License: MIT License | |
| # Programming Language: Python | |
| # CUI/GUI Language: English |