Post by nathanmyersc on Mar 20, 2024 2:24:50 GMT
I made a super simple wav maker from text file python program that subtracts or adds each letters ORD value to 32767 or -32767 to create a loud but unique file to wav maker.
It makes it loud. and i feel like loudness might help more than my previous versions where it was all over the spectrum of noise level.
Just change HGH.txt to the filename you want to convert into wav. or go ahead and modify it howeever you like. But i think anthroteacher is onto something with the loudness the uniqueness of how each letter or word sounds seems secondary to its loudness.
Although it makes me question how silent ones work. or pictures for that matter.
It makes it loud. and i feel like loudness might help more than my previous versions where it was all over the spectrum of noise level.
Just change HGH.txt to the filename you want to convert into wav. or go ahead and modify it howeever you like. But i think anthroteacher is onto something with the loudness the uniqueness of how each letter or word sounds seems secondary to its loudness.
Although it makes me question how silent ones work. or pictures for that matter.
import wave
import struct
def text_to_wav(input_file, output_file, channels=8, sampling_rate=767500):
# Read data from text file
with open(input_file, 'r') as f:
data = f.read()
# Convert characters to their ordinal values and adjust amplitudes
adjusted_data = []
for char in data:
ord_value = ord(char)
if ord_value % 2 == 0:
adjusted_value = 32767 - ord_value
else:
adjusted_value = -32767 + ord_value
adjusted_data.append(adjusted_value)
# Reshape data to match the number of channels
num_samples = len(adjusted_data)
num_samples_per_channel = num_samples // channels
adjusted_data = adjusted_data[:num_samples_per_channel * channels]
data_channels = [adjusted_data[i::channels] for i in range(channels)]
# Convert data to bytes
frames = b''.join([struct.pack('<h', sample) for sample in adjusted_data])
# Write data to WAV file
with wave.open(output_file, 'w') as wav_file:
wav_file.setnchannels(channels)
wav_file.setsampwidth(2) # 16-bit audio
wav_file.setframerate(sampling_rate)
wav_file.writeframes(frames)
# Example usage:
input_file = "HGH.txt" # Your input text file
output_file = "output.wav" # Your output WAV file
text_to_wav(input_file, output_file)