[FFmpeg-user] Convert audio to CSV

Alexander Gribanov sunrisecoder at gmail.com
Sun Jun 30 11:40:08 EEST 2024


вс, 30 июн. 2024 г. в 09:14, Michael Koch <astroelectronic at t-online.de>:

> Am 30.06.2024 um 07:47 schrieb Alexander Gribanov:
> > вс, 30 июн. 2024 г. в 08:38, Michael Koch <astroelectronic at t-online.de>:
> >
> >> Hi,
> >>
> >> is it possible to convert an audio waveform to a CSV list?
> >> I want to insert 2048 samples of a waveform into the C source code for a
> >> microcontroller.
> >>
> > Hello! I don't know about how to make a CSV list, but if You need it for
> a
> > microcontroller, why wouldn't You make a .wav file and read the samples
> one
> > by one Your C code?
>
> The microcontroller can't read a file. It's a very simple circuit
> without SD card. That's why I want to insert the samples into the C
> source code.
>
Maybe then You can create another app in order to read WAV-file which will
make You ready C-code with Your samples,
for example (sorry, I'm Java Developer, not C/C++):
// make read wav-file from disk into byte array "samples"
print("int[] samples = new int[] { ");
for (int i = 44; i < samples.length; i++) { // find where file metadata
info ends and the sample data starts. If You have 16-bit quality (You
probably don't need to so much for Your microcontroller), use 2 bytes for
each sample, etc
    print(samples[i] + ", ");
}
print("};");

Then You manually copy and paste this line from the console into Your
C-code...

Viel erfolg! ;)


>
> Michael
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list