質問

I have an array of 8-bit values which I have received from a microprocessor.
I am looking to turn those values into a wav file using PHP.

I found some examples, like this or this, that work in Java and C# but they all seem to leverage existing classes. Does anyone know of a PHP library that can do this? If not, can someone explain how to create a wav file in PHP?

役に立ちましたか?

解決

You can use pack function, but first you must discover what values used: signed or unsigned

function pack_array($v,$a) {
 return call_user_func_array(pack,array_merge(array($v),(array)$a));
}

$wav = pack_array('c*', $array); // 'C*' for unsigned
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top