Post by nathanmyersc on Feb 27, 2024 20:24:38 GMT
Heres a modified wave repeater that intakes a text file. and modifies the values from the min to the maximum ascii value available in your intention to range the full spectrum of the wave files amplitude capabilities
It gives values to entire words. and im working on making it so that words with the same value will be changed to a random value that isnt the same as the first word with this value nor any other value in the file.
You might want to change NUMBER OF CHANNELS depending on what application you are using to play the file. I havent figured out how to make true stereo tracks with python yet. I chose to make 8 channels of mono tracks.
It gives values to entire words. and im working on making it so that words with the same value will be changed to a random value that isnt the same as the first word with this value nor any other value in the file.
You might want to change NUMBER OF CHANNELS depending on what application you are using to play the file. I havent figured out how to make true stereo tracks with python yet. I chose to make 8 channels of mono tracks.
import time
import sys
import wave
import struct
import os
import math
import random
#######################################################################################################
PROCESS_STATEMENT = ": ONE INFINITE CREATOR. REQUESTING AID FROM ALL BEINGS WHO ARE WILLING TO ASSIST. METATRON'S CUBE. ALL AVAILABLE BENEFICIAL ENERGY GRIDS, ORGONE AETHER RESONATORS, & ORGONE BUBBLES. CREATE MANIFESTATION ZONE. ASCENSION PYRAMID. USE EVERY AVAILABLE RESOURCE. MANIFEST ASAP. CREATE STRUCTURE. CANCEL DESTRUCTIVE OR FEARFUL INTENTIONS, OR INTENTIONS THAT CONFLICT WITH THE HIGHEST AND GREATEST GOOD OF THE USER. REGULATE AND BALANCE THE ENERGY. USE THE MOST EFFECTIVE PATH IN THE MOST EFFICIENT WAY. OPTIMAL ENERGY. INTEGRATE THE ENERGY IN THE MOST EFFECTIVE AND PLEASANT WAY POSSIBLE. PROCESS THE CHANGES. GUIDED BY THE USER'S HIGHER SELF. CONNECTED TO SOURCE. ENABLE AND UTILIZE THE SACRED HEART, QUANTUM HEART, AND QUANTUM MIND. MANIFEST ALL SPECIFIED INTENTIONS AND/OR DESIRES, OR BETTER. IF IT WOULD AID IN THE MANIFESTATION PROCESS, PLEASE HELP USER TO SENSE AND EMOTIONALLY FEEL WHAT IT WOULD BE LIKE TO ALREADY BE EXPERIENCING THEIR SPECIFIED INTENTIONS AND/OR DESIRES NOW. PLEASE HELP USER TO RAISE THEIR VIBRATION TO THE LEVEL REQUIRED TO MAKE THEIR SPECIFIED INTENTIONS AND/OR DESIRES MANIFEST. ASSIST THE USER WITH ACHIEVING OPTIMAL GUT/HEART/MIND COHERENCE WITH THEIR SPECIFIED INTENTIONS AND/OR DESIRES. IF IT WOULD BENEFIT THE USER, ASSIST THEM WITH CLEARING & RELEASING ANY/ALL INTERNAL OR EXTERNAL INTERFERENCE OR BLOCKAGES TO THEIR SPECIFIED INTENTIONS AND/OR DESIRES. IT IS DONE. NOW RETURN A PORTION OF THE LOVE/LIGHT RECEIVED AND ACTIVATED BACK INTO THE HIGHER REALMS OF CREATION. I LOVE YOU. OM."
volume_level = 1.000
run_time_param = ''
string_to_write_param = ''
string_to_write = '∞∞∞'
string_to_write_value = ''
fileName = ''
fileNameToWriteFrom = ''
peak_value = 32767
peak_value_2 = peak_value * 2
benchmark = 0
CHANNELS = 8
BYTES_PER_SAMPLE = 2
SAMPLING_RATE = 765000.0
min_word_value = 0
max_word_value = 0
num_writes = 0
num_frames_written = 0
DURATION_OF_FILE = 60
MAX_FRAMES = DURATION_OF_FILE * SAMPLING_RATE
###################################################################################################
def modifyMinWordValue(x):
global min_word_value
min_word_value = x
###################################################################################################
def modifyMaxWordValue(x):
global max_word_value
max_word_value = x
###################################################################################################
def printOutWordListNumberOfTimesAndValues(word_list, mapped_values):
# Group words by their mapped values
word_value_dict = {}
for word, value in zip(word_list, mapped_values):
if value not in word_value_dict:
word_value_dict[value] = {}
if word not in word_value_dict[value]:
word_value_dict[value][word] = 0
word_value_dict[value][word] += 1
# Print words with the same mapped value but different characters
print("Words with the same mapped value but different characters:")
for value, words_dict in word_value_dict.items():
print(f"Value {value}:")
for word, count in words_dict.items():
print(f" {word} x{count}")
return word_value_dict
################################################################################################
def returnWordListMappedValueDictionary(word_list, mapped_values):
# Group words by their mapped values
word_value_dict = {}
for word, value in zip(word_list, mapped_values):
if value not in word_value_dict:
word_value_dict[value] = {}
if word not in word_value_dict[value]:
word_value_dict[value][word] = 0
word_value_dict[value][word] += 1
return word_value_dict
##########################################################################################################
def randomize_word_values(word_value_dict):
updated_word_value_dict = {}
existing_values = set()
# Collect all existing values
for words_dict in word_value_dict.values():
existing_values.update(words_dict.keys())
for value, words_dict in word_value_dict.items():
word_list = list(words_dict.keys())
random.shuffle(word_list) # Shuffle the list of words
# Generate random values that are not in the existing set
random_values = [val for val in range(-32768, 32768) if val not in existing_values]
for word, count in words_dict.items():
if word_list.index(word) == 0:
updated_value = value # Keep the value for the first word
else:
updated_value = random_values.pop(0) # Assign a random value from the list
if value not in updated_word_value_dict:
updated_word_value_dict[value] = {}
updated_word_value_dict[value][word] = updated_value
return updated_word_value_dict
# Example usage:
# Assuming you have already created word_value_dict
# updated_word_value_dict = randomize_word_values(word_value_dict)
############################################################################################################
def read_file_to_string(file_name):
try:
with open(file_name, 'rb') as file:
file_content = file.read()
# Split the content into lines
lines = file_content.split(b'\n') # Note: Use b'\n' for bytes split
# Filter out blank lines
non_blank_lines = [line for line in lines if line.strip()]
# Join the non-blank lines back into a single string
file_content_string = b'\n'.join(non_blank_lines).decode('utf-8') # Decode to UTF-8
return file_content_string
except FileNotFoundError:
print("Error: File not found.")
return ""
except Exception as e:
print("Error:", e)
return ""
#############################################################################################################
def human_format(num):
num = float('{:.3g}'.format(num))
magnitude = 0
while abs(num) >= 1000:
magnitude += 1
num /= 1000.0
return '{}{}'.format('{:f}'.format(num).rstrip('0').rstrip('.'), [
'',
'K',
'M',
'B',
'T',
'Q',
][magnitude])
##############################################################################################################
def getWavFileOutputName():
global fileName
while fileName == '':
fileName = input('File Name to Write (.wav): ')
if str.lower(fileName[-4:]) != '.wav':
if str.lower(fileName[-1:]) == '.':
fileName += 'wav'
else:
fileName += '.wav'
##############################################################################################################
def getTextFileInputName():
global fileNameToWriteFrom
while fileNameToWriteFrom == '':
fileNameToWriteFrom += input('Intention File to Write: ')
##############################################################################################################
def getMappedValuesOfStringToWriteToWav():
global string_to_write_value
global min_word_value
global max_word_value
# Initialize variables
combined_values = []
word_list = string_to_write_value.split()
# Calculate combined values for every word individually
for word in word_list:
word_value = 0
for char in word:
word_value += ord(char)
combined_values.append(word_value)
# Find the minimum and maximum combined values
min_word_value = min(combined_values)
max_word_value = max(combined_values)
# Map the combined values to the range between -32767 and 32767
mapped_values = []
for word_value in combined_values:
if word_value == 0: # If space, set value to 0
mapped_value = 0
else:
# Ensure that the value is within the valid range
scaled_value = ((word_value - min_word_value) / (max_word_value - min_word_value)) * 65536 - 32768
mapped_value = max(min(int(scaled_value), 32767), -32768)
mapped_values.append(mapped_value)
return mapped_values
##############################################################################################################
def getWordListOfStringToWriteToWav():
global string_to_write_value
return string_to_write_value.split()
##############################################################################################################
def updateAndReportNumberOfWrites():
global num_writes
num_writes += 1
sys.stdout.write(' ' + time.strftime('%H:%M:%S',
time.gmtime(int(num_writes))) + ' ['
+ human_format(num_writes) + '] '
+ string_to_write + ' \r')
sys.stdout.flush() # Flush stdout to ensure immediate printing
#############################################################################################################
def updateAndReportFrameNumbers(stereo_data):
global CHANNELS
global BYTES_PER_SAMPLE
global MAX_FRAMES
global num_frames_written
# Update the number of frames written
num_frames_written += len(stereo_data) // (CHANNELS * BYTES_PER_SAMPLE)
# Check if the maximum duration has been reached
if num_frames_written >= MAX_FRAMES:
print("Maximum duration reached. Exiting the loop.")
return True
# Update progress (optional)
progress = num_frames_written / MAX_FRAMES * 100
sys.stdout.write(f"\rProgress: {progress:.2f}%")
sys.stdout.flush() # Flush stdout to ensure immediate printing
return False
############################################################################################################
def fileSizeOver200kb():
global fileNameToWriteFrom
# Get the size of the file in bytes
file_size_bytes = os.path.getsize(fileNameToWriteFrom)
# Convert bytes to kilobytes
file_size_kb = file_size_bytes / 1024
# Check if the file size is over 500 KB
return file_size_kb > 200
############################################################################################################
def getFileSize():
global fileNameToWriteFrom
return os.path.getsize(fileNameToWriteFrom) / 1024.0
############################################################################################################
def generate_stereo_chunks(mapped_values, chunk_size_limit_bytes):
stereo_chunks = [] # Initialize an empty list to store stereo data chunks
stereo_data_chunk = b'' # Initialize an empty chunk of stereo data
for combined_value in mapped_values:
# Interleave stereo pairs correctly
stereo_pair_data = struct.pack('<h', combined_value) + struct.pack('<h', combined_value)
stereo_data_chunk += stereo_pair_data * (CHANNELS // 2) # Duplicate the stereo pair data for each set of 4 channels
# Check if the chunk size limit has been reached
if len(stereo_data_chunk) >= chunk_size_limit_bytes:
# Append the current chunk to the list of stereo chunks
stereo_chunks.append(stereo_data_chunk)
stereo_data_chunk = b'' # Reset the chunk to empty
# Append any remaining stereo data left in the last chunk
if stereo_data_chunk:
stereo_chunks.append(stereo_data_chunk)
return stereo_chunks
############ACTUAL EXECUTION###############ACTUAL EXECUTION###########ACTUAL EXECUTION##################
##########################GET WAVEFORM VALUES FROM THE WORDS IN THE TEXT FILE######################
print("Intention Repeater WAV File Writer v2.2 software created by Thomas Sweet.\n")
print("This software comes with no guarantees or warranty of any kind.\n")
getWavFileOutputName(); ### ASK USER FOR WAV FILE OUTPUT NAME
getTextFileInputName() ### ASK USER FOR TEXT FILE INPUT NAME
string_to_write_value = '∞∞∞' + read_file_to_string(fileNameToWriteFrom) + ' ' + PROCESS_STATEMENT + '∞∞∞' ### COMPILE STRING TO WRITE TO WAV FILE
mapped_values = getMappedValuesOfStringToWriteToWav() ### GET INITIAL WAV FORM VALUES OF WORD LIST
word_list = getWordListOfStringToWriteToWav() ### GET WORD LIST
#printOutWordListNumberOfTimesAndValues(word_list, mapped_values) ### PRINT OUT WORD LIST AND INITIAL WAV FORM VALUES
#word_value_dict = {}
#for word, value in zip(word_list, map_value):
# if word not in word_value_dict:
# word_value_dict[word] = {}
# word_value_dict[word][word] = value
#updated_word_dict = randomize_word_values(word_dict)
# Print the updated word dictionary
#for word, value in updated_word_dict.items():
# print(f"{word}: {value}")
##############################################################################################################
################################## Write mapped values to WAV file ###########################################
print("Press CTRL-C to stop running.\n")
obj = wave.open(fileName, 'wb')
obj.setnchannels(CHANNELS) # 2 channels
obj.setsampwidth(BYTES_PER_SAMPLE)
obj.setframerate(SAMPLING_RATE)
# We write to the WAV file repeatedly until 60 seconds or user presses stop
try:
if(fileSizeOver200kb()):
chunk_size_limit_kb = 100 # Set the chunk size limit in kilobytes
chunk_size_limit_bytes = chunk_size_limit_kb * 1024 # Convert kilobytes to bytes
stereo_chunks = generate_stereo_chunks(mapped_values, chunk_size_limit_bytes)
while num_frames_written < MAX_FRAMES:
for stereo_data_chunk in stereo_chunks:
obj.writeframesraw(stereo_data_chunk)
updateAndReportNumberOfWrites()
if updateAndReportFrameNumbers(stereo_data_chunk):
break
else: #DEALING WITH SMALLER FILE SO WE CAN DO IT FASTER#
stereo_data = b''
print(len(mapped_values));
for combined_value in mapped_values:
# Interleave stereo pairs correctly
stereo_pair_data = struct.pack('<h', combined_value) + struct.pack('<h', combined_value)
stereo_data += stereo_pair_data * (CHANNELS // 2) # Duplicate the stereo pair data for each set of 4 channels
print("made it here");
while True:
obj.writeframesraw(stereo_data)
updateAndReportNumberOfWrites()
if(updateAndReportFrameNumbers(stereo_data)):
break;
except KeyboardInterrupt:
pass
print("\Intention written " \
+ human_format(num_writes) \
+ " times to " + fileName + ".")
obj.close()