Importing samples as audio

I would like to use excel or C-code to generate waveforms that I would like to then import into audacity for further editing and playing out of the (Mac) audio jack. I see that audacity imports “raw” audio files, but I am not quite sure how to format my samples to meet that “raw” standard - could anyone point me to where to start? (Or a better way to do this! :slight_smile:
Thank you very much.

You can’t currently do it using Excel because that will produce a series of text values, whereas what you need for RAW import is the actual binary values.
RAW format is simply a series of binary values. For a 16 bit RAW file, it is a series of 16 bit values. I’m not a “C” programmer, but I’d guess it would be relatively simple to generate a binary file in C.

For educational purposes it may be nice if there a way to import a text file that contains a series of text values to represent the sample values. I wrote an experimental plug-in to do that a few years ago, but it was never completed. If you think that would be useful, please feel free to request it here: (including a link to this topic could be helpful).

So, if I understand correctly, you are saying that if I wrote a piece of code that spews out 16 bit unsigned quantities (I guess I’d have to try the big/little endian dance) they would be interpreted as samples? What would be the sample frequency (or perhaps that gets asked when I try “import->raw”) - ok that seems easy to try. I will report just to close the loop.
Yes text values I think would be useful since the connection between reading numbers, plotting the waveform and hearing the sounds is - in my opinion - quite powerful. Plus it allows visual experimentation with various functions. Although I wonder whether in fact one would quickly exceed the practical limits of excel (number of cells etc.).

Thanks for the pointers, I’ll report.

For 16 bit audio samples it is more usual to have signed integers.

Internally Audacity uses “32 bit floating point” (not widely supported by other audio applications, but great for editing and processing). If you want to play with 32 bit floating point values, the “valid” (below 0 dB) range is -1.0 to +1.0.

You could quickly end up with some HUGE text files :smiley:
44100 Hz is a standard sample rate (CD quality), which is of course 44100 sample values per second of audio (mono).
8000 Hz is adequate for low quality speech recording. You could go even lower for producing test signals. The limit is that the maximum audio frequency must be less than half the sample rate.
Excel should be able to handle a few tens of thousands of values, so I think it would be usable for educational purposes.

By the way, I presume that you have seen the “Sample Data Export” tool:
(it’s the reverse of what you are asking for)