Skip to content

8KHz/32KHz recording and playback does not work with WM8731 (PROTO AudioCODEC) #16

@am1337

Description

@am1337

If I open the device with 8KHz or 32KHz sample rate "cat /proc/asound/card1/pcm0p/sub0/hw_params" says that the device uses the correct rate. But all 8KHz or 32KHz files I play using aplay, mplayer or ffmpeg are played with 48kHz, independend of there origin sample rate (they are pitched, that means I play a 6 minute 8KHz file in one minute). For example I tried a 32KHz radio stream (Hard to find one with less than 44,1KHz today). It is played much to fast (with interrupts), you will hear it using "mplayer -ao alsa:device=hw=1,0 -nolirc -cache 64 http://stream.antenne1.de/stream2/livestream.mp3". Curiously playing an 44.1KHz file or stream works, e.g. "mplayer -ao alsa:device=hw=1,0 -nolirc http://1live.akacast.akamaistream.net/7/706/119434/v1/gnl.akacast.akamaistream.net/1live -cache 64".

UPDATE:
I did some further research and found out the following:

If reading from Line-In with 8kHz setting, six times of expected data are sent.

My application opens the device plughw:1,0 with SND_PCM_FORMAT_MU_LAW, 8kHz and one channel.
cat /proc/asound/card1/pcm0c/sub0/hw_params says:

access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 8000 (8000/1)
period_size: 160
buffer_size: 800

The setting (mostly) look like they shoul (I don't know why there are set 2 channels, maybe a bug in my software). But if I read from the device I get for example:

7f ff ff 7f ff ff (mulaw uses one byte per sample, 7f means silence)

The first and the 4th byte are always the same, byte 2,3,5 and 6 are alway ff. If I only use the first byte and drop the other 5 recording works.

I assume the wm8731 is setup correct, but the clock is still using 48kHZ. So this needs to be changed or to be independent from playback, the unneeded bytes must be dropped.

I will check if playback works if I play each byte 6 times.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions