Hi DVDdoug thank you, for your reply.
I was reading that exact site before, but I didn`t get it. But your idea of copying or at least looking at an existing header is gold, because now I have an example to work with.
DVDdoug:
Audacity can import "raw" uncompressed audio data files but you have to type-in all of the information it normally gets from the file header such as the bit depth, sample rate, number of channels, etc. Then, you can optionally export to WAV (or other standard audio format).
Yes, I tried this function of Audacity, but I didn`t get a sound file that made sense(it was only noise).
DVDdoug:
I'm sure MATLAB can do that too, since MATLAB isn't strictly an audio program, but it may be more work for you to re-format the raw bytes into audio samples (if it's not simple 8-bit audio).
I haven`t tried MATLAB, yet. A friend recommended it to me. As I understand it it´s a very powerfull tool and basically capable of everything, but it also seems to be a massive rabbit hole to go down to.
DVDdoug:
- Since the Arduino ADC can't read negative values, the input is biased giving you biased A(unsigned) data. For signed formats, you'll have to subtract-out the bias before writing the WAV file.
And of course, you'll need to scale the ADC data (12-bits form the Due) up or down to 8 or 16 bits for a standard audio file.
I read about this quite a lot when I was first looking into audio with Arduino. As I understand it the Arduino simply reads nothing when it gets "hit" by a negative value. And this can be solved on the hardware side if I´m not mistaken.
To scale the data down to 8 bits I can use analogReadResolution( 8 ), discarding the least significant bits, can`t I?
But I have to admit, I cheated already
I simply connected the microphone to a 3.5mm jack and used my computers soundcard to record the files. Now I can at least analyse my data, but I still feel kind of bad for not doing it with the Arduino
I also think, I went at this the wrong way. I was thinking I could filter my audio for peaks, then write a program that utilizes that peaks to start a sequence. But by writing my project in this forum I realized, that what I want is basically a sort of clap-switch, which as I understand is much simpler to implement.
But I can still use the audio-analysing to test different base-materials for the microphone, so it wasn´t all for nothing.