sound card read integers or float?

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
mark_c
BCBJ Master
BCBJ Master
Posts: 244
Joined: Thu Jun 21, 2012 1:13 am

sound card read integers or float?

Post by mark_c »

Hello,
I ask someone who has already studied this kind of problems: generating a series of samples for the sound card in order to generate a sine wave.
I am using the following function: but I did not understand if the sound card reads integer or floating point values.

Code: Select all

        float *buffer = 0;
        buffer = (float *)malloc(100 * sizeof(float));
		
        float m_amplitude = 1.0;
        float m_frequency = 440.0;
        float m_phase = 0.0;
        float m_time = 0.0;
        float m_deltaTime = 1.0/8000;

        for (int t=0; t < 100; t++)
        {
                 buffer[t] = m_amplitude * sin(2 * M_PI * m_frequency * m_time + m_phase);
                 m_time+=m_deltaTime;
        }

		
		// ....... using buffer
		
		free(buffer);
Post Reply