Best Python code snippet using localstack_python
generate_pcm_from_wav.py
Source:generate_pcm_from_wav.py
...150 os.remove(path_final_normalized)151 os.rename(path_in, path_final_normalized)152 153# Clean start loop154def parse_start_loop(start_loop):155 if start_loop != "" and start_loop != "json":156 return float(start_loop)157 158 elif start_loop != "json":159 return None160 161 return start_loop162def main():163 print("# This script will convert all .wav files from folder '{}' to .pcm files #\n".format(temp_folder))164 165 debug = True166 167 if not os.path.exists(looping_audio_converter_path) or "LoopingAudioConverter.exe" not in os.listdir(looping_audio_converter_path):168 input("Error because LoopingAudioConverter.exe not found! Please make sure 'looping_audio_converter_path' in the config file is correct!")169 return 0170 171 # If the script was runned directly without parameters172 if len(sys.argv) < 2:173 174 folder_end = input('> Enter Name of output folder:\n').replace(' ', '_')175 176 # Number of samples in smash website177 start_loop = input("> Enter start loop point:\n - as a number of samples\n - 'json' (without quotes) if using a file inside {}\n - just press Enter if no looping.\n".format(temp_folder))178 start_loop = parse_start_loop(start_loop)179 180 # If the script was runned directly with parameters sent by the command line interface181 else:182 folder_end = sys.argv[1]183 if len(sys.argv) > 2:184 parse_start_loop(start_loop)185 else:186 start_loop=None187 # List of .wav inside temp folder188 wav_files = [wav for wav in os.listdir(temp_folder) if ".wav" in wav]189 if len(wav_files) == 0:190 input("No .wav files found inside folder {}. Press enter to finish.\n".format(temp_folder))191 else:192 193 tracks=None194 if tracks_file in os.listdir(temp_folder) and start_loop == 'json':195 with open(temp_folder + tracks_file, 'r') as f:196 tracks = json.load(f)197 198 for wav in wav_files:...
generate_ogg_from_wav.py
Source:generate_ogg_from_wav.py
...96 97 return nchannels, sampwidth, framerate, nframes98 99# Clean start loop100def parse_start_loop(start_loop):101 if start_loop != "" and start_loop != "json":102 return float(start_loop)103 104 elif start_loop != "json":105 return None106 107 return start_loop108def main():109 print("# This script will convert all .wav files from folder '{}' to .pcm files #\n".format(temp_folder))110 111 debug = True112 113 # If the script was runned directly without parameters114 if len(sys.argv) < 2: 115 # Number of samples in smash website116 start_loop = input("> Enter start loop: number of samples, 'json' (without quotes) if using a file or press Enter if no looping.\n")117 start_loop = parse_start_loop(start_loop)118 119 # If the script was runned directly with parameters sent by the command line interface120 else:121 parse_start_loop(start_loop)122 # List of .wav inside temp folder123 wav_files = [wav for wav in os.listdir(temp_folder) if ".wav" in wav]124 if len(wav_files) == 0:125 input("No .wav files found inside folder {}. Press enter to finish.\n".format(temp_folder))126 else:127 128 tracks=None129 if start_loop == 'json':130 if tracks_file not in os.listdir(temp_folder):131 input("\nNo json found inside temp folder! Press enter to finish.\n".format(output_path))132 raise Exception("No json found!")133 134 with open(temp_folder + tracks_file, 'r') as f:135 tracks = json.load(f)...
parallel_discharge_analysis.py
Source:parallel_discharge_analysis.py
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3import os4# output folder location:5output_folder = "/projects/0/wtrcycle/users/edwin/edwin/hyperhydro_november_2015/RhineMeuse/05min/code__a__"6# starting and last run codes7start_code = 08end_code = 6249# number of process within a loop10n_process = 3611# initializing some counters12i_code = start_code13start_loop = start_code14while start_loop < (end_code + 1):15 16 # initiate command lines17 cmd = ''18 19 # starting and end codes for this loop20 start_loop = i_code21 end_loop = max(start_loop, i_code + n_process -1)22 end_loop = min(end_loop, end_code)23 end_loop = max(start_loop, end_loop)24 25 # generating jobs for this loop26 for i_code in range(start_loop, end_loop + 1, 1):27 28 cmd += "python 0_main_analyze_discharge.py " + str(output_folder) + str(i_code)29 cmd = cmd+" & "30 i_code = i_code + 131 32 # don't foget to add the following line33 cmd = cmd + "wait" 34 35 # execute the jobs36 print cmd37 os.system(cmd)38 39 # starting loop for the next loope40 start_loop = i_code...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!