gpt4 book ai didi

c - 在C中加载内存中的wav音频文件

转载 作者:行者123 更新时间:2023-11-30 17:51:19 25 4
gpt4 key购买 nike

我有一个波形文件(单声道,16 位),我必须用 C 语言编写一个程序,用它的内容填充一个数组。 (不仅仅是标题信息)我无法使用库,我必须从头开始编写它。

我需要这样做,以便随后对文件进行各种操作。 (这样的标准化ecc...)

不幸的是,我还没有找到任何关于这个问题的完整信息,尤其是在 C 语言中。

也将非常感谢一些描述此类问题的来源的引用。

谢谢!!!

最佳答案

some informations are big-endian and some other are little-endian.

根据Wikipedia,这不是真的。 (小端字节顺序)。

My question now is: when I interpret the data, must i care of the type of processor (big e. or l.e.) on which the code will run?? – Luca P.

是的,您必须这样做,但这种注意可能仅限于可移植的编程。例如,要获取以小端顺序存储的 2 字节有符号值,您可以编写

value = 256*(int8_t)byte_array[i+1] + (uint8_t)byte_array[i];

这适用于小端和大端处理器。

关于c - 在C中加载内存中的wav音频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16787117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com