Waitrud Weber’s blog

things and reminders for memories

sounds: windows-make: displayed a frequent.

A Frequent and On the Frequent:

Their power spectral is 1/f.
He is a nice person and kind of us but considered natural or not.

Sound data is graphed well.
We think, the shape of frequency is narrow.

f:id:Waitrud_Weber:20210605203824p:plain

sounds frequency

 download: 

https://github.com/WaitrudWeber/source_zip/blob/master/display-20210605.zip

 

There is a reason why sounds wave can skip a normal frequency.

.\sounds-011.h  Fri Apr 16 12:30:41 2021
...
 20 :    SoundEffect(const int noteInfo[], const int arraySize)
 21 :    {
 22 :        // Initialize the sound format we will request from sound card
 23 :        m_waveFormat.wFormatTag = WAVE_FORMAT_PCM;     // Uncompressed sound format
 24 :        m_waveFormat.nChannels = 1;                    // 1 = Mono, 2 = Stereo
 25 :        m_waveFormat.wBitsPerSample = 8;               // Bits per sample per channel
 26 :        m_waveFormat.nSamplesPerSec = 11025;           // Sample Per Second
 27 :        m_waveFormat.nBlockAlign = m_waveFormat.nChannels * m_waveFormat.wBitsPerSample / 8;
 28 :        m_waveFormat.nAvgBytesPerSec = m_waveFormat.nSamplesPerSec * m_waveFormat.nBlockAlign;
 29 :        m_waveFormat.cbSize = 0;
 30 :
 31 :        int dataLength = 0, moment = (m_waveFormat.nSamplesPerSec / 75);
 32 :        double period = 2.0 * PI / (double) m_waveFormat.nSamplesPerSec;
 33 :
 34 :        // Calculate how long we need the sound buffer to be
 35 :        for (int i = 1; i < arraySize; i += 2)
 36 :            dataLength += (noteInfo[i] != 0) ? noteInfo[i] * moment : moment;
 37 :
 38 :        // Allocate the array
 39 :        m_data = new char[m_bufferSize = dataLength];
 40 :
 41 :        int placeInData = 0;
 42 :
 43 :        // Make the sound buffer
 44 :        for (int i = 0; i < arraySize; i += 2)
 45 :        {
 46 :            int relativePlaceInData = placeInData;
 47 :
 48 :            while ((relativePlaceInData - placeInData) < ((noteInfo[i + 1] != 0) ? noteInfo[i + 1] * moment : moment))
 49 :            {
 50 :                // Generate the sound wave (as a sinusoid)
 51 :                // - x will have a range of -1 to +1
 52 :                double x = sin((relativePlaceInData - placeInData) * 55 * pow(HALF_NOTE, noteInfo[i]) * period);
 53 :
 54 :                // Scale x to a range of 0-255 (signed char) for 8 bit sound reproduction
 55 :                m_data[relativePlaceInData] = (char) (127 * x + 128);
 56 :
 57 :                relativePlaceInData++;
 58 :            }
 59 :
 60 :            placeInData = relativePlaceInData;
 61 :        }
 62 :    }