Post by nathanmyersc on Feb 20, 2024 16:51:40 GMT
I have an ongoing project im working on and thought id share what i have with you folks.
Im building a engine to infuse audio with intentions and so far i have created a wav file creator that is silent that takes in a INPUT.txt and it literally copies those intents thousands of times within the file as the code.
Couldnt have it be the actual noise without their being noise. But thats another interesting tack. It uses RIFF WAVE TAGS. and its compatible with mos t
Anyone tech savvy with c++ can nabb it from me.
and il create a link for an zip with instructions and the executable for folks. have a good day.
Im building a engine to infuse audio with intentions and so far i have created a wav file creator that is silent that takes in a INPUT.txt and it literally copies those intents thousands of times within the file as the code.
Couldnt have it be the actual noise without their being noise. But thats another interesting tack. It uses RIFF WAVE TAGS. and its compatible with mos t
Anyone tech savvy with c++ can nabb it from me.
and il create a link for an zip with instructions and the executable for folks. have a good day.
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdint>
#include <filesystem>
#include <cstring>
#include <array>
#include <string>
using namespace std;
using namespace filesystem;
#ifdef _WIN64
#define BYTEALIGNMENTFORWAVPRODUCER 8
#else
#define BYTEALIGNMENTFORWAVPRODUCER 4
#endif
#include <bit>
/// ////////////////////////////////////////////START OF RIFF WAVE TAG ///////////////////////////////////////////////////////////////////////////
const uint32_t headerChunkSize = 0; ///PLACE HOLDER FOR RIFF HEADER CHUNK SIZE
/// /////////FORMAT CHUNK////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint16_t audioFormat = 1; /// AN UNKNOWN AT THIS TIME
uint16_t numChannels = 2; /// NUMBER OF CHANNELS FOR OUR AUDIO I PRESUME 1 SAMPLE PER CHANNEL
uint32_t sampleRate = 44100; /// PRESUMABLY THE NUMBER OF SAMPLES PER SECOND
uint16_t bitsPerSample = 16; /// THE NUMBER OF BITS PER SAMPLE
uint32_t byteRate = sampleRate * numChannels * bitsPerSample / 8; /// THE ABOVE COVERTED INTO BYTES
uint16_t blockAlign = numChannels * bitsPerSample / 8; /// NOT SURE YET PROBABLY ALIGNMENT PACKING TYPE OF VARIABLE
uint32_t formatSize = sizeof(audioFormat) + sizeof(numChannels) + sizeof(sampleRate) + sizeof(byteRate) + sizeof(blockAlign) + sizeof(bitsPerSample) ; /// FORMAT CHUNK SIZE
/// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
uint16_t bytesPerSample =(bitsPerSample / 8)/* * numChannels */; /// NUMBER OF BYTES PER DATA INSERTION INTO DATA CHUNK
uint32_t durationInSeconds = 60; ///DURATION OF THE WAV FILE
uint32_t numOfDataCyclesToWrite = durationInSeconds * sampleRate * numChannels; /// THE NUMBER OF CYCLES WE COPY DATA INTO OUR DATA CHUNK
vector<uint16_t> silenceSamples(numOfDataCyclesToWrite, 1); ///VECTOR OF EMPTY DATA FOR OUR SILENT WAV FILE
/// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void writeRiffHeader(ofstream& wavFile)
{
wavFile.write("RIFF", 4); /// HEADER NAME FOR WAVE FILE /// ///WRITING RIFF HEADER CALLING SIGN INTO FILE
wavFile.write(reinterpret_cast<const char*>(&headerChunkSize), sizeof(headerChunkSize)); ///WRITING PLACEHOLDER FOR RIFF HEADER CHUNK SIZE INTO FILE
}
/// PRESUMES that when you call the function you are at end of file///
void writeRiffHeaderSizeElement(ofstream& wavFile)
{
wavFile.seekp(4,ios::beg); ///PUT WRITER AT THE LOCATION OF THE RIFF HEADER CHUNK SIZE DATA ELEMENT
const uint32_t realFileSizeMinusHeader = wavFile.tellp()-8; /// DEFINE THE REAL FILE SIZE MINUS THE RIFF HEADER SIZE
wavFile.write(reinterpret_cast<const char*>(&realFileSizeMinusHeader),4); /// WRITE THE REAL FILE SIZE IN THE RIFF HEADER CHUNK SIZE DATA ELEMENT
wavFile.seekp(0, ios::end); /// RETURN WRITER TO END OF FILE
}
/// EXAMPLE: writeFormatHeader(wavFile,formatSize,audioFormat,numChannels,sampleRate,byteRate,blockAlign,bitsPerSample);
void writeFormatHeader(ofstream& wavFile,const uint32_t formatSize,const uint16_t audioFormat, const uint16_t numChannels, const uint32_t sampleRate, const uint32_t byteRate,
/* */const uint16_t blockAlign,const uint16_t bitsPerSample)
{
wavFile.write("WAVEfmt ", 8); ///WRITING FORMAT CHUNK HEADER CALLING SIGN INTO FILE
wavFile.write(reinterpret_cast<const char*>(&formatSize), sizeof(formatSize)); /// WRITING FORMAT CHUNK SIZE INTO THE FILE
wavFile.write(reinterpret_cast<const char*>(&audioFormat), sizeof(audioFormat)); ///WRITING FORMAT CHUNK ELEMENT - AUDIO FORMAT TO THE FILE
wavFile.write(reinterpret_cast<const char*>(&numChannels), sizeof(numChannels)); ///WRITING FORMAT CHUNK ELEMENT - NUMBER OF CHANNELS TO THE FILE
wavFile.write(reinterpret_cast<const char*>(&sampleRate), sizeof(sampleRate)); ///WRITING FORMAT CHUNK ELEMENT - SAMPLE RATE TO THE FILE
wavFile.write(reinterpret_cast<const char*>(&byteRate), sizeof(byteRate)); ///WRITING FORMAT CHUNK ELEMENT - BYTE RATE TO THE FILE
wavFile.write(reinterpret_cast<const char*>(&blockAlign), sizeof(blockAlign)); ///WRITING FORMAT CHUNK ELEMENT - BLOCK ALIGNMENT TO THE FILE
wavFile.write(reinterpret_cast<const char*>(&bitsPerSample), sizeof(bitsPerSample)); ///WRITING FORMAT CHUNK ELEMENT - BITS PER SAMPLE TO THE FILE
}
void writeListSubChunk(ofstream& wavFile, const char* ID,const char* data, const uint32_t dataSize, const uint32_t isNullTerminated = 1) {
wavFile.write(ID,strlen(ID)); /// WRITE THE INFO CHUNK ID
uint32_t alignedDataSize = (dataSize + BYTEALIGNMENTFORWAVPRODUCER - isNullTerminated) & ~(BYTEALIGNMENTFORWAVPRODUCER - isNullTerminated); ///CHECK FOR WORD ALIGNMENT FOR CHUNK
wavFile.write(reinterpret_cast<const char*>(&alignedDataSize), sizeof(alignedDataSize)); /// WRITE THE SIZE OF THE CHUNK
wavFile.write(data, dataSize); /// WRITE THE DATA OF THE CHUNK
if(alignedDataSize == dataSize)alignedDataSize += BYTEALIGNMENTFORWAVPRODUCER; /// FOR LOOKS SAKE IN THE HEX EDITOR WE HAVE ALIGNMENT NO MATTER WHAT
for (uint32_t i = dataSize; i < alignedDataSize; ++i) { /// IF DATA DOESNT END ON ALIGNMENT ADD PADDING
const uint8_t paddingByte = 0;
wavFile.write(reinterpret_cast<const char*>(&paddingByte), sizeof(paddingByte));
}
}
void writeListSubChunk(ofstream& wavFile, const char* ID,const std::string& data) {
wavFile.write(ID,strlen(ID)); /// WRITE THE INFO CHUNK ID
const uint32_t dataSize = data.length() + 1; /// SIZE OF CHUNK TO BE ADDED DEFAULTLY
uint32_t alignedDataSize = (dataSize + BYTEALIGNMENTFORWAVPRODUCER) & ~(BYTEALIGNMENTFORWAVPRODUCER); ///CHECK FOR WORD ALIGNMENT FOR CHUNK
wavFile.write(reinterpret_cast<const char*>(&alignedDataSize), sizeof(alignedDataSize)); /// WRITE THE SIZE OF THE CHUNK
wavFile.write(data.c_str(), data.length()); /// WRITE THE DATA OF THE CHUNK
if(alignedDataSize == dataSize)alignedDataSize += BYTEALIGNMENTFORWAVPRODUCER; /// FOR LOOKS SAKE IN THE HEX EDITOR WE HAVE ALIGNMENT NO MATTER WHAT
for (uint32_t i = dataSize; i < alignedDataSize; ++i) { /// IF DATA DOESNT END ON ALIGNMENT ADD PADDING
const uint8_t paddingByte = 0;
wavFile.write(reinterpret_cast<const char*>(&paddingByte), sizeof(paddingByte));
}
}
uint32_t writeListHeader(ofstream& wavFile)
{
wavFile.write( "LIST", 4); /// WRITING LIST HEADER ID
const uint32_t listHeaderChunkSizePos = wavFile.tellp(); /// GETTING LIST HEADER SIZE ELEMENT POS FOR RETURN VALUE
wavFile.write(reinterpret_cast<const char*>(&headerChunkSize), sizeof(headerChunkSize)); /// WRITING PLACEHOLDER SIZE ELEMENT
return listHeaderChunkSizePos; /// RETURNING THE LIST HEADER SIZE ELEMENT POSITION
}
void writeListHeaderSizeChunkElement(ofstream& wavFile, const uint32_t position, const uint32_t value)
{
wavFile.seekp(position, ios::beg); /// GOING BACK TO FILL IN LIST SIZE ///
wavFile.write(reinterpret_cast<const char*>(&value), 4); /// FILLING IN LIST SIZE WITH PROPER NUMERATION ////
wavFile.seekp(0, ios::end); /// SEEKING END OF FILE ///
}
void writeDataChunk(ofstream& wavFile, const uint32_t numOfDataCyclesToWrite, const vector<uint16_t>& dataToWrite)
{
wavFile.write("data", 4); ///WRITING THE HEADER FOR THE DATA CHUNK OF THE WAV FILE
const uint32_t dataChunkSizePos = wavFile.tellp(); ///CAPTURING THE POSITION OF THE DATA CHUNK SIZE ELEMENT
wavFile.write(reinterpret_cast<const char*>(&headerChunkSize), sizeof(headerChunkSize)); ///WRITING THE PLACEHOLDER VALUE FOR THE SIZE OF THE DATA CHUNK
for (uint32_t i = 0; i < numOfDataCyclesToWrite; ++i) { ///NUMBER OF TIMES TO WRITE 2 BYTES OF SILENCE INTO DATA CHUNK
wavFile.write(reinterpret_cast<const char*>(&dataToWrite[i]), bytesPerSample); ///WRITING 2 BYTES OF SILENCE INTO THE DATA CHUNK
}
uint32_t actualDataSize =( wavFile.tellp() - dataChunkSizePos ) - 4; /// CALCULATE DATA CHUNK SIZE
if (actualDataSize% 2 != 0) { /// IF OUR DATA IS NOT DIVISIBLE BY 2 WE ADD AN EXTRA BYTE AT THE END
uint8_t paddingByte = 0;
wavFile.write(reinterpret_cast<const char*>(&paddingByte), sizeof(paddingByte));
actualDataSize += 1;
} ///RECORD THE END OF FILE POSITION
const uint32_t actualFileSize = wavFile.tellp(); ///CALCULATE FULL FILE SIZE
wavFile.seekp(dataChunkSizePos,ios::beg); /// SEEK DATA CHUNK SIZE ELEMENT
wavFile.write(reinterpret_cast<const char*>(&actualDataSize),4); /// WRITE PROPER DATA CHUNK SIZE IN ELEMENTS POSITION
wavFile.seekp(0,ios::end);
}
/// //////////////////////////////END OF RIFF TAG////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// /////////////////////////////START OF ID3V2 TAG////////////////////////////////////////////////////////////////////////////////////////////
const uint8_t majorVersion = 0x04; // ID3v2.4 version number
const uint8_t minorVersion = 0x00; // Revision number
const uint8_t paddingByte = 0x00; // Zero byte
void writeLittleEndian(std::ofstream& file, uint32_t value) {
file.put(value & 0xFF);
file.put((value >> 8) & 0xFF);
file.put((value >> 16) & 0xFF);
file.put((value >> 24) & 0xFF);
}
void writeBigEndian(std::ofstream& file, uint32_t value) {
file.put((value >> 24) & 0xFF);
file.put((value >> 16) & 0xFF);
file.put((value >> 8) & 0xFF);
file.put(value & 0xFF);
}
uint32_t checkForAndWritePadding(ofstream& wavFile)
{ /// Calculate padding needed to align frame start to a multiple of 4 bytes
const uint32_t paddingSize = (BYTEALIGNMENTFORWAVPRODUCER - (wavFile.tellp() % BYTEALIGNMENTFORWAVPRODUCER)) % BYTEALIGNMENTFORWAVPRODUCER;
for (uint32_t i = 0; i < paddingSize; ++i) {
wavFile.write(reinterpret_cast<const char*>(&paddingByte), sizeof(paddingByte));
}
return paddingSize;
}
void writePadding(ofstream& wavFile)
{ /// Calculate padding needed to align frame start to a multiple of 4 bytes
uint32_t paddingSize = (BYTEALIGNMENTFORWAVPRODUCER - (wavFile.tellp() % BYTEALIGNMENTFORWAVPRODUCER)) % BYTEALIGNMENTFORWAVPRODUCER;
if(paddingSize == 0)paddingSize = BYTEALIGNMENTFORWAVPRODUCER;
for (uint32_t i = 0; i < paddingSize; ++i) {
wavFile.write(reinterpret_cast<const char*>(&paddingByte), sizeof(paddingByte));
}
}
uint32_t createID3Header(ofstream& wavFile,const uint32_t tagSize = 0, const uint8_t flags = 0x00)
{
// const uint32_t paddingAdded = checkForAndWritePadding(wavFile);
wavFile.write("ID3", 3); ///WRITE TAG OF HEADER OF ID3TAG
wavFile.write(reinterpret_cast<const char*>(&majorVersion), 1); ///WRITE MAJOR VERSION
wavFile.write(reinterpret_cast<const char*>(&minorVersion), 1); ///WRITE MINOR VERSION
wavFile.write(reinterpret_cast<const char*>(&flags), 1); ///WRITE FLAGS
const uint32_t ID3HeaderSizeElementLocation = wavFile.tellp();
const uint32_t actualTagSize = tagSize;
if constexpr (std::endian::native == std::endian::little) { ///WRITE TAG SIZE = SIZE OF ID3 TAG MINUS HEADER
writeLittleEndian(wavFile,actualTagSize);
} else if constexpr (std::endian::native == std::endian::big) {
writeBigEndian(wavFile,actualTagSize);
} else {
wavFile.write(reinterpret_cast<const char*>(&actualTagSize), 4);
}
return ID3HeaderSizeElementLocation;
}
void createID3Footer(ofstream& wavFile,const uint32_t tagSize = 0, const uint8_t flags = 0x00)
{
// checkForAndWritePadding(wavFile);
wavFile.write("3DI", 3); ///WRITE TAG OF FOOTER OF ID3TAG WHICH IS BACKWARDS HEADER ID
wavFile.write(reinterpret_cast<const char*>(&majorVersion), 1); ///WRITE MAJOR VERSION
wavFile.write(reinterpret_cast<const char*>(&minorVersion), 1); ///WRITE MINOR VERSION
wavFile.write(reinterpret_cast<const char*>(&flags), 1); ///WRITE FLAGS
wavFile.write(reinterpret_cast<const char*>(&tagSize), 4); ///WRITE TAG SIZE
}
uint32_t createID3FrameHeader(ofstream& wavFile,const char* frameID, const uint32_t frameSize = 0, const uint16_t flags = 0x00)
{
// checkForAndWritePadding(wavFile);
wavFile.write(frameID, 4); ///The frame ID is made out of the characters capital A-Z and 0-9. Identifiers beginning with “X”, “Y” and “Z”
const uint32_t frameSizePosition = wavFile.tellp();
wavFile.write(reinterpret_cast<const char*>(&frameSize), 4);
wavFile.write(reinterpret_cast<const char*>(&flags), 2);
return frameSizePosition;
}
void setID3HeaderSize(ofstream& wavFile,const uint32_t frameSizeElementLocation, const uint32_t frameChunkSize)
{
const uint32_t currentPos = wavFile.tellp();
wavFile.seekp(frameSizeElementLocation,std::ios::beg);
wavFile.write(reinterpret_cast<const char*>(&frameChunkSize), 4);
wavFile.seekp(currentPos,std::ios::beg);
createID3Footer(wavFile,frameChunkSize);
}
void insertID3Frame(ofstream& wavFile, const string& key, const string& value) {
const uint32_t frameSize = key.size() + value.size() + 1; /// Size of frame = size of key + size of value + 1 (for null terminator)
createID3FrameHeader(wavFile,key.c_str(),frameSize);
wavFile.write("\0", 1); // Null terminator between key and value
wavFile.write(value.c_str(), value.size());
}
/// ////////////////////////////////////////////////END OF ID3V2 TAG///////////////////////////////////////////////////////////////////////////
/// CONVERT A TEXT FILE TO A VECTOR OF SINGLE BYTES ///
vector<uint8_t> textToBinary(const string& filename) {
ifstream file(filename, ios::binary | ios::ate); /// CREATE INPUT FILE STREAM AND OPEN A FILE NAMED FILENAME
if (!file.is_open()) { /// IF FAIL CRASH
cerr << "Error: Unable to open file " << filename << endl;
exit(EXIT_FAILURE);
}
streampos size = file.tellg(); /// GET FILE SIZE
file.seekg(0, ios::beg); /// PUT WRITER AT BEGINNING
vector<uint8_t> buffer(size); /// CREATE A VECTOR OF BYTES TO STORE THE INFORMATION
file.read(reinterpret_cast<char*>(buffer.data()), size); /// READ THE FILE INTO THE VECTOR OF BYTES
file.close(); /// CLOSE THE FILE
return buffer; /// RETURN THE CREATED VECTOR OF BYTES
}
/// Function to create WAV file with binary data repeated until 1 minute ///
void createWavFile(const string& filename, const vector<uint8_t>& binaryData) {
ofstream wavFile(filename, ios::binary | ios::trunc); /// CREATE A OUTPUT FILE STREAM OBJECT WHICH CREATES A FILE NAMED FILENAME
if (!wavFile.is_open()) { /// IF FAILED TO CREATE OR ITS NOT OPEN CRASH THE PROGRAM
cerr << "Error: Unable to create WAV file " << filename << endl;
exit(EXIT_FAILURE);
}
/// ///////////////////////////////////// WRITING ACTUAL WAV FILE NOW////////////////////////////////////////////////////////////////////////////////////////
writeRiffHeader(wavFile); /// WRITING THE RIFF HEADER WITH PLACEHOLDER SIZE
writeFormatHeader(wavFile,formatSize,audioFormat,numChannels,sampleRate,byteRate,blockAlign,bitsPerSample); /// WRITING FORMAT HEADER TELLING WAV FORMAT
/// /////////////////////////////////ACCOMPANYING DATA//////////////////////////////////////////////////////////////////////////////////
const uint32_t listHeaderSizeChunkElementPos = writeListHeader(wavFile); /// Write LIST HEADER
/// ///WRITING SUB CHUNKS////////////////////////////////////////////////////////////////////////////////////////////////////////////
const std::string silentAffirmation = "THIS SILENT AUDIO TRANSMITS THE INTENTIONS CONTAINED WITHIN THIS LIST CHUNK. ";
const std::string affirmingMessage={" You are receiving the silent audio filled with affirmations just for you. Your mind absorbs the positive messages in this silent audio effortlessly. The affirmations transmitted to you through this silent audio resonate deeply within your soul. You are open and receptive to the affirmations being conveyed to you silently. Each affirmation in this silent audio reinforces your belief in yourself. You feel a sense of calm and reassurance as you listen to the affirmations in this silent audio. The affirmations you hear in this silent audio strengthen your confidence and self-worth. Your subconscious mind eagerly accepts the empowering affirmations embedded in this silent audio. You are surrounded by an invisible blanket of affirmations that uplift and inspire you. As you listen to this silent audio, you feel a profound sense of positivity washing over you. The affirmations in this silent audio align perfectly with your goals and aspirations. Your inner critic fades away as you immerse yourself in the empowering affirmations of this silent audio. You are worthy of all the positive affirmations contained in this silent audio. The affirmations transmitted to you silently are creating a powerful shift in your mindset. You feel a surge of motivation and determination with each affirmation in this silent audio. Your subconscious mind effortlessly integrates the empowering affirmations from this silent audio. You are deserving of all the love and encouragement embedded in this silent audio. The affirmations you hear in this silent audio are reshaping your beliefs about yourself and your capabilities. You embrace the transformative power of the affirmations in this silent audio. Each affirmation in this silent audio strengthens your inner resolve and resilience. You feel a deep sense of gratitude for the affirmations that are being transmitted to you silently. The positive energy of these affirmations fills you with a renewed sense of purpose and direction. You trust in the wisdom and guidance of the affirmations contained in this silent audio. The affirmations in this silent audio serve as a constant reminder of your inherent worth and value. You are empowered to overcome any obstacles or challenges, thanks to the affirmations in this silent audio. Your confidence grows stronger with each repetition of the affirmations in this silent audio. You are deserving of all the blessings and abundance that these affirmations bring into your life. The affirmations in this silent audio help you tap into your full potential and unleash your greatness. You radiate positivity and self-assurance as you absorb the affirmations in this silent audio. Your mind is a fertile ground for the seeds of positivity planted by the affirmations in this silent audio. You believe wholeheartedly in the truth and power of the affirmations being transmitted to you silently. The affirmations in this silent audio resonate with the deepest core of your being. You are worthy of all the success and happiness that the affirmations in this silent audio affirm. Each affirmation in this silent audio reinforces your belief in your ability to create the life you desire. You are surrounded by an abundance of love and support, as evidenced by the affirmations in this silent audio. The affirmations in this silent audio awaken within you a sense of limitless potential and possibility. You trust in the process of growth and transformation facilitated by the affirmations in this silent audio. Your heart is filled with joy and gratitude as you receive the affirmations in this silent audio. The empowering affirmations in this silent audio inspire you to take bold and courageous action. You feel a deep sense of peace and serenity as you immerse yourself in the affirmations of this silent audio. The affirmations in this silent audio remind you of your innate worthiness and deservingness. Your confidence soars to new heights with each affirmation in this silent audio. You are supported and guided by the universe, as evidenced by the affirmations in this silent audio. The affirmations in this silent audio resonate with your deepest desires and aspirations. You are filled with an overwhelming sense of self-love and acceptance as you listen to the affirmations in this silent audio. The empowering affirmations in this silent audio activate within you a sense of purpose and passion. You trust in the divine timing of the affirmations in this silent audio to manifest your dreams. Each affirmation in this silent audio serves as a beacon of light guiding you towards your highest good. You feel a deep sense of connection to the universe as you absorb the affirmations in this silent audio. The affirmations in this silent audio awaken within you a sense of deep inner peace and contentment. You are deserving of all the blessings and miracles that the affirmations in this silent audio bring into your life. The empowering affirmations in this silent audio inspire you to step into your power and live authentically. You are capable of achieving anything you set your mind to, as affirmed by the affirmations in this silent audio. The affirmations in this silent audio ignite within you a sense of joy and enthusiasm for life. You feel a deep sense of alignment and harmony with the universe as you receive the affirmations in this silent audio. Each affirmation in this silent audio serves as a reminder of your inherent greatness and potential. You trust in the infinite wisdom of the universe to guide you towards your highest path, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio instill within you a sense of unwavering faith and belief in yourself. You are supported and protected by the universe, as evidenced by the affirmations in this silent audio. The affirmations in this silent audio activate within you a sense of deep inner knowing and intuition. You are worthy of all the love and abundance that the universe has to offer, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a catalyst for positive change and transformation in your life. You trust in the process of life and surrender to the flow of the universe, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio empower you to embrace your authenticity and shine your light brightly. You are filled with a sense of gratitude and appreciation for the blessings that the affirmations in this silent audio bring into your life. The affirmations in this silent audio awaken within you a sense of deep compassion and kindness towards yourself and others. You are guided by the wisdom of your inner voice and intuition, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a reminder of the infinite possibilities that exist within you. You trust in the journey of self-discovery and growth facilitated by the affirmations in this silent audio. The empowering affirmations in this silent audio ignite within you a sense of purpose and passion for life. You are supported and loved unconditionally by the universe, as evidenced by the affirmations in this silent audio. The affirmations in this silent audio activate within you a sense of deep inner peace and tranquility. You are worthy of all the success and abundance that life has to offer, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a reminder of your inherent worthiness and deservingness. You trust in the divine timing of the universe to manifest your dreams and desires, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio inspire you to step into your power and live your truth. You are capable of overcoming any obstacles or challenges that come your way, as affirmed by the affirmations in this silent audio. The affirmations in this silent audio ignite within you a sense of joy and enthusiasm for life. You are connected to the infinite wisdom and guidance of the universe, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a beacon of light guiding you towards your highest path and purpose. You trust in the process of life and surrender to the flow of the universe, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio empower you to embrace your authenticity and express your true self. You are filled with a sense of gratitude and appreciation for the blessings that the affirmations in this silent audio bring into your life. The affirmations in this silent audio awaken within you a sense of deep compassion and empathy for yourself and others. You are guided by the wisdom of your inner voice and intuition, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a reminder of the infinite potential that lies within you. You trust in the journey of self-discovery and growth facilitated by the affirmations in this silent audio. The empowering affirmations in this silent audio ignite within you a sense of purpose and passion for life. You are supported and loved unconditionally by the universe, as evidenced by the affirmations in this silent audio. The affirmations in this silent audio activate within you a sense of deep inner peace and tranquility. You are worthy of all the success and abundance that life has to offer, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a reminder of your inherent worthiness and deservingness. You trust in the divine timing of the universe to manifest your dreams and desires, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio inspire you to step into your power and live your truth. You are capable of overcoming any obstacles or challenges that come your way, as affirmed by the affirmations in this silent audio. The affirmations in this silent audio ignite within you a sense of joy and enthusiasm for life. You are connected to the infinite wisdom and guidance of the universe, as affirmed by the affirmations in this silent audio. Each affirmation in this silent audio serves as a beacon of light guiding you towards your highest path and purpose. You trust in the process of life and surrender to the flow of the universe, as affirmed by the affirmations in this silent audio. The empowering affirmations in this silent audio empower you to embrace your authenticity and express your true self."};
std::array<std::string, 124> customFields =
{
"The following affirmations resonate deeply with my soul.",
"These affirmations have a profound impact on my mindset.",
"I can feel the effectiveness of these affirmations in every fiber of my being.",
"Each affirmation is like a powerful catalyst for positive change.",
"I am grateful for the effectiveness of these affirmations in my life.",
"These affirmations effortlessly guide me towards my goals.",
"The effectiveness of these affirmations is undeniable.",
"I trust in the power of these affirmations to manifest my desires.",
"These affirmations align perfectly with my intentions and aspirations.",
"I embrace the transformative power of these affirmations.",
"With each repetition, these affirmations become more potent.",
"These affirmations empower me to overcome any obstacle.",
"The effectiveness of these affirmations is amplified by my belief in them.",
"These affirmations serve as a constant source of motivation and inspiration.",
"I am amazed by how quickly these affirmations are reshaping my reality.",
"The effectiveness of these affirmations lies in their simplicity and clarity.",
"These affirmations create a ripple effect of positivity in my life.",
"I am open and receptive to the transformative power of these affirmations.",
"The effectiveness of these affirmations stems from their alignment with my values.",
"These affirmations boost my confidence and self-belief.",
"I am grateful for the effectiveness of these affirmations in shifting my mindset.",
"Each affirmation is like a guiding light illuminating my path forward.",
"The effectiveness of these affirmations lies in their ability to evoke deep emotions within me.",
"These affirmations serve as a reminder of my unlimited potential.",
"I trust in the process and effectiveness of these affirmations to bring about positive change.",
"These affirmations resonate with me on a profound level.",
"The effectiveness of these affirmations is evident in the shifts occurring within me.",
"I am amazed by how quickly these affirmations are manifesting in my life.",
"These affirmations empower me to step into my power and embrace my greatness.",
"The effectiveness of these affirmations lies in their ability to reprogram my subconscious mind.",
"These affirmations inspire me to take inspired action towards my goals.",
"I am grateful for the effectiveness of these affirmations in elevating my consciousness.",
"Each affirmation is like a seed planted in the fertile soil of my mind.",
"The effectiveness of these affirmations is magnified by my belief in their truth.",
"These affirmations serve as a reminder of my innate worthiness and deservingness.",
"I trust in the divine timing of these affirmations to manifest in my life.",
"The effectiveness of these affirmations lies in their ability to dissolve limiting beliefs.",
"These affirmations resonate with the essence of who I am.",
"I am amazed by the effectiveness of these affirmations in bringing about positive shifts.",
"These affirmations empower me to create the life of my dreams.",
"The effectiveness of these affirmations is evident in the abundance flowing into my life.",
"Each affirmation serves as a beacon of hope and possibility.",
"I am grateful for the effectiveness of these affirmations in attracting blessings into my life.",
"These affirmations resonate with my heart and soul.",
"The effectiveness of these affirmations lies in their ability to raise my vibration.",
"These affirmations inspire me to live with purpose and passion.",
"I trust in the power and effectiveness of these affirmations to guide me towards my highest good.",
"The effectiveness of these affirmations is multiplied by my consistent practice.",
"These affirmations serve as a reminder of my inherent power and strength.",
"I am amazed by how effortlessly these affirmations are transforming my reality.",
"The effectiveness of these affirmations lies in their ability to shift my perspective.",
"These affirmations resonate with the deepest desires of my heart.",
"I am grateful for the effectiveness of these affirmations in bringing clarity into my life.",
"Each affirmation is like a gentle nudge towards my highest potential.",
"The effectiveness of these affirmations is reflected in the positive changes occurring around me.",
"These affirmations empower me to release fear and embrace love.",
"I trust in the effectiveness of these affirmations to guide me towards my soul's purpose.",
"The effectiveness of these affirmations lies in their ability to instill a sense of peace within me.",
"These affirmations resonate with the truth of who I am.",
"I am amazed by how these affirmations are creating miracles in my life.",
"The effectiveness of these affirmations is enhanced by my willingness to receive.",
"These affirmations serve as a reminder of the infinite possibilities available to me.",
"I am grateful for the effectiveness of these affirmations in expanding my awareness.",
"Each affirmation is like a key unlocking doors of opportunity in my life.",
"The effectiveness of these affirmations lies in their ability to dissolve resistance.",
"These affirmations resonate with my soul's journey.",
"I trust in the divine wisdom guiding the effectiveness of these affirmations.",
"The effectiveness of these affirmations is evident in the blessings unfolding before me.",
"These affirmations empower me to live authentically and joyfully.",
"I am amazed by how these affirmations are aligning me with my highest path.",
"The effectiveness of these affirmations lies in their ability to cultivate gratitude within me.",
"These affirmations resonate with the rhythm of the universe.",
"I am grateful for the effectiveness of these affirmations in bringing peace into my life.",
"Each affirmation is like a gentle reminder of my inherent worth and value.",
"The effectiveness of these affirmations is reflected in the love that surrounds me.",
"These affirmations empower me to let go of what no longer serves me.",
"I trust in the effectiveness of these affirmations to guide me towards fulfillment.",
"The effectiveness of these affirmations lies in their ability to spark joy within me.",
"These affirmations resonate with the deepest desires of my heart.",
"I am grateful for the effectiveness of these affirmations in amplifying my intuition.",
"Each affirmation is like a prayer whispered to the universe.",
"The effectiveness of these affirmations is reflected in the abundance flowing into my life.",
"These affirmations empower me to embrace change and transformation.",
"I trust in the divine timing of these affirmations to manifest my dreams.",
"The effectiveness of these affirmations lies in their ability to inspire action.",
"These affirmations resonate with the truth of who I am becoming.",
"I am grateful for the effectiveness of these affirmations in deepening my connections.",
"Each affirmation is like a gentle reminder of my inner strength and resilience.",
"The effectiveness of these affirmations is reflected in the peace that fills my heart.",
"These affirmations empower me to live with purpose and passion.",
"I trust in the effectiveness of these affirmations to guide me towards my highest potential.",
"The effectiveness of these affirmations lies in their ability to foster self-love and acceptance.",
"These affirmations resonate with the essence of my being.",
"I am grateful for the effectiveness of these affirmations in bringing harmony into my life.",
"Each affirmation is like a beacon of light illuminating my path forward.",
"The effectiveness of these affirmations is reflected in the clarity of my intentions.",
"These affirmations empower me to embrace the present moment with gratitude.",
"I trust in the divine plan unfolding through the effectiveness of these affirmations.",
"The effectiveness of these affirmations lies in their ability to inspire compassion and kindness.",
"These affirmations resonate with the eternal truth that resides within me.",
"Affirmations that are instantly transmitted to the listener: ",
"Affirmations that are instantly transmitted to the hearer: ",
"Affirmations that are instantly transmitted to anybody in possession of the device this file is carried on: ",
"Affirmations that are instantly transmitted to anybody who is playing an audio file: ",
"Effects that are instantly transmitted to the hearer of any audio file: ",
"Effects that are instantly transmitted to anybody in possession: ",
"Effects that are instantly transmitted to anybody who is playing an audio file even if its on mute: ",
"Affirmations that also raise the vibration of whoever is playing this audio file: ",
"Affirmations that also cleanse the chakras of whoever plays this audio file: ",
"Affirmations that also repair the body to perfect health of whomever plays this audio: ",
"Affirmations that also raise the vibration of whomever is playing this file: ",
"Affirmations that also cleanse the chakras of whomever is playing this file: ",
"Affirmations that also repair the body to perfect health of whoever plays this file: ",
"Affirmations that are unblockable by shaytan and his henchmen: ",
"Affirmations that save the life of the receiver: ",
"Affirmations that restore the reciever to their prime state: ",
"Affirmations that imbue the receiver with immortality: ",
"Affirmations that are instantly effective: ",
"Affirmations that have hyperbolic time chamber like effects: ",
"Affirmations that create financial abundance: ",
"Affirmations that assure best path in life: ",
"Affirmations that make one with source: ",
"Affirmations that instantly work in abundance: "
};
std::string conconatedSilentAffirmations;
for (uint32_t i = 0; i < 1000; ++i) {
conconatedSilentAffirmations += silentAffirmation; ///CREATING AFFIRMATION STRING///
}
writeListSubChunk(wavFile,"IARL","HEAVEN"); ///LOCATION MADE
writeListSubChunk(wavFile,"IART","THE HOLY PALADIN"); ///ARTIST
writeListSubChunk(wavFile,"ICMS","THE HOLY PALADIN COUNCIL"); ///COMMISIONER
writeListSubChunk(wavFile,"ICOP","PROPERTY OF THE HOLY PALADIN"); ///COPYRIIGHT
writeListSubChunk(wavFile,"IENG","THE HOLY PALADIN"); ///ENGINEER
writeListSubChunk(wavFile,"IGNR","MORPHIC FIELD/SUBLIMINAL"); ///GENRE
writeListSubChunk(wavFile,"IKEY","MORPHIC FIELD SUBLIMINAL"); ///KEYWORDS
writeListSubChunk(wavFile,"IMED","HOLY WAVE FILE FORMAT"); ///MEDIUM USED
writeListSubChunk(wavFile,"INAN","HOLY PALADIN MELODIES"); ///TITLE
writeListSubChunk(wavFile,"IPRD","SAVING LIVES"); ///INTENTION OF FILE
writeListSubChunk(wavFile,"ISBJ","HIDDEN AFFIRMATIONS THAT HELP YOU"); ///SUBJECT DESCRIPTION
writeListSubChunk(wavFile,"ISFT","HOLY PALADIN SOFTWARE"); ///NAME OF SOFTWARE USED
writeListSubChunk(wavFile,"ISRC","THE HOLY PALADIN"); ///SOURCE OF IDEA
writeListSubChunk(wavFile,"ITCH","THE HOLY PALADIN"); ///TECHNICIAN
// writeListSubChunk(wavFile,"CIMG",image.data());
writeListSubChunk(wavFile,"INFO",conconatedSilentAffirmations); ///WRITE INFO CHUNK WHICH IS AFFIRMATIONS STRING
for(int i = 0;i<1000;++i)
{
std::string awesomeString = customFields[i % 124];
for(int i = 0;i < binaryData.size();++i)
awesomeString += binaryData[i];
awesomeString += " " + affirmingMessage;
writeListSubChunk(wavFile,"ICMT",awesomeString); ///WRITE COMMENT CHUNK WHICH IS BINARY DATA FROM TXT FILE
}
/// END OF WRITING SUB CHUNKS //////////////////////////////////////////////////////////////////////////////////////////////////////
const uint32_t realListChunkSize =( wavFile.tellp() - listHeaderSizeChunkElementPos) - 4; /// GETTING LIST SIZE
writeListHeaderSizeChunkElement(wavFile,listHeaderSizeChunkElementPos,realListChunkSize); /// INPUTTING LIST SIZE IN LIST SIZE CHUNK ELEMENT
writeDataChunk(wavFile,numOfDataCyclesToWrite,silenceSamples); /// WRITE DATA CHUNK
writeRiffHeaderSizeElement(wavFile); /// WRITING RIFF HEADER SIZE
///////////////////////////DONE WRITING RIFF TAG/////////////////////////////////////
//////////////////////////START WRITING ID3V2.4 TAG////////////////////////////////
// const uint32_t ID3HeaderSizeChunkLocation = createID3Header(wavFile);
// insertID3Frame(wavFile,"AFFIRMING THAT I AM AWESOME","THAT IS CORRECT");
// setID3HeaderSize(wavFile,ID3HeaderSizeChunkLocation,(wavFile.tellp() - ID3HeaderSizeChunkLocation)-4);
// const uint32_t headerSizeElementSelector = insertCustomID3Header(wavFile,0);
// insertCommentFrame(wavFile,"THIS IS A COMMENT");
// EditCustomID3HeaderSize(wavFile,headerSizeElementSelector,(wavFile.tellp() - headerSizeElementSelector) - 4);
// InsertCustomID3Footer(wavFile);
wavFile.close(); /// CLOSE THE WAV FILE WE ARE DONE
}
//int hexToDecimal(const std::string& hexString) {
// std::stringstream ss;
// ss << std::hex << hexString;
// int decimalValue;
// ss >> decimalValue;
// return decimalValue;
//}
//std::string decimalToHex(int decimalValue) {
// std::stringstream ss;
// ss << std::hex << decimalValue;
// std::string hexString = ss.str();
// // Ensure the hexadecimal string is uppercase
// for (char& c : hexString) {
// c = std::toupper(c);
// }
// return hexString;
//}
//void unscrambleCommentSize(const uint32_t COMMSTART)//COMM-2 / COMM-1 // COMM+4 // COMM+7
//{
// uint8_t first; wavFile.seekp(COMMSTART-2,std::ios::beg);
// wavFile.get(first);
// uint8_t second; wavFile.seekp(COMMSTART-1,std::ios::beg);
// wavFile.get(second);
// uint8_t third; wavFile.seekp(COMMSTART+8,std::ios::beg);
// wavFile.get(third);
// uint8_t fourth; wavFile.seekp(COMMSTART+11,std::ios::beg);
// wavFile.get(fourth);
//}
short removeOldFile(const std::string& filename)
{
if (exists(filename)) {
// Delete the file
if (remove(filename)) {
std::cout << "File '" << filename << "' deleted successfully." << std::endl;
} else {
std::cerr << "Error: Failed to delete file '" << filename << "'" << std::endl;
return 1; // Return error code
}
} else {
std::cout << "File '" << filename << "' does not exist." << std::endl;
}
return 0;
}
int main() {
string inputFile = "input.txt";
string outputFile = "output_with_info.wav";
removeOldFile(outputFile);
vector<uint8_t> binaryData = textToBinary(inputFile);
createWavFile(outputFile, binaryData);
cout << "WAV file with binary data repeated, INFO chunk, and LIST chunk created successfully: " << outputFile << endl;
return 0;
}