diff options
author | Joel Holdsworth <joel@airwebreathe.org.uk> | 2017-11-07 19:55:15 -0700 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-11-11 18:25:08 +0100 |
commit | 7f214f533f4ce67f5f6e603784fd5b37809791b6 (patch) | |
tree | 71bb550d7d3704a7294320774432d0fd03ecc0e5 /decoders/i2s | |
parent | d40e77620426826fb589bfc1c44009bf90a1eb36 (diff) | |
download | libsigrokdecode-7f214f533f4ce67f5f6e603784fd5b37809791b6.tar.gz libsigrokdecode-7f214f533f4ce67f5f6e603784fd5b37809791b6.zip |
i2s: Make 32-bit wav files
Diffstat (limited to 'decoders/i2s')
-rw-r--r-- | decoders/i2s/pd.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/decoders/i2s/pd.py b/decoders/i2s/pd.py index b0b177f..474c606 100644 --- a/decoders/i2s/pd.py +++ b/decoders/i2s/pd.py @@ -18,6 +18,7 @@ ## import sigrokdecode as srd +import struct ''' OUTPUT_PYTHON format: @@ -112,21 +113,16 @@ class Decoder(srd.Decoder): h += b'\x01\x00' # Audio format (0x0001 == PCM) h += b'\x02\x00' # Number of channels (2) h += b'\x80\x3e\x00\x00' # Samplerate (16000) - h += b'\x00\x7d\x00\x00' # Byterate (32000) + h += b'\x00\xfa\x00\x00' # Byterate (64000) h += b'\x04\x00' # Blockalign (4) - h += b'\x10\x00' # Bits per sample (16) + h += b'\x20\x00' # Bits per sample (32) # Data subchunk h += b'data' h += b'\xff\xff\x00\x00' # Subchunk size (65535 bytes) TODO return h def wav_sample(self, sample): - # TODO: This currently assumes U32 samples, and converts to S16. - s = sample >> 16 - if s >= 0x8000: - s -= 0x10000 - lo, hi = s & 0xff, (s >> 8) & 0xff - return bytes([lo, hi]) + return struct.pack('I', self.data) def decode(self): if not self.samplerate: |