Back to SimpleExamples001. This writes a single-channel raw pcm file, single floats, sample rate 48000. Use [SOX](/aw/media/multimedia/SoxTopic) to convert and play. e.g. ```bash sox -t raw -r 48000 -b 32 -e float -c 1 output.pcm output.wav play -t raw -r 48000 -b 32 -e float -c 1 output.pcm ``` The code: ```cpp #include #include #include #include #include using std::sin; constexpr double pi = 3.141592653589793238462643383279502884; int main() { int sr = 48000; float len = 2.0f; float freq = 440.0f; double phase_per_sample = 2*pi*freq/sr; int nsamps = (int)(len*sr); std::vector data(nsamps, 0.0f); std::printf("size: %ld\n",data.size()); for(int i=0; i(data.data()),data.size()*sizeof(float)); output_file.close(); } ```