FS#9394 - IRiver H10 sample rate change

Attached to Project: Rockbox
Opened by Christian Lees (cdlees) - Thursday, 11 September 2008, 06:37 GMT
Last edited by Peter D'Hoye (petur) - Sunday, 28 September 2008, 23:26 GMT
Task Type Patches
Category Recording
Status Closed
Assigned To No-one
Operating System iriver H10
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Allows you to change the recording/playback sample rate on the IRiver H10. It was locked at 44.1kHz, now you can select 8, 32, 44.1, 48, 88.2 and 96kHz. Checked on r18325 (I don't have svn access, firewall). The patch was checked by recording 15 seconds of a 1kHz sine wave on the line in input at each sample rate. Tested by playing the samples back on the H10 as well as looking at the files in Cooledit.

Has only been tested on the H10 20GB.
This task depends upon

Closed by  Peter D'Hoye (petur)
Sunday, 28 September 2008, 23:26 GMT
Reason for closing:  Accepted
Additional comments about closing:  Thanks & welcome to the Rockbox credits file ;)
Comment by Michael Sevakis (MikeS) - Thursday, 11 September 2008, 23:39 GMT
Nice job. Does this actually change the internal clock rate of the codec? I also have a few notes to make.

This should follow the convention where pcm_set_frequency doesn't have immediate effect on the hardware.

pcm_apply_settings should apply all parameter changes done by other calls - this is done to have on-the-fly changes without having several settings take effect in succession.

pcm_apply_settings should synchronize with the interrupt properly by masking FIQ.

Any changes should be applied when starting playback (via pcm_apply_settings semantics): stopped->play, stopped->paused, paused->play

If any ports have implemented the interface outside spec they should be synced to proper behavior or else software development can't rely on a consistent interface.
Comment by Christian Lees (cdlees) - Friday, 12 September 2008, 00:54 GMT
It updates the variable pcm_freq in pcm_set_frequency. The change is then made in pcm_apply_changes, this calls audiohw_set_sample_rate. This way the codec is disabled, the change is made then the codec is enabled. This takes care of the FIQ so it all works nicely.

The internal sampling frequency of the codec is changed. I have tested the bandwidth of the codec by recording a white noise source then processing the data in matlab to get the spectral response at 44.1kHz and 96kHz to verify that it works.

This patch should work for any device using the PP5020 and a WM8731, if there are any others. The config_XXX.h will just have to be updated.
Comment by Peter D'Hoye (petur) - Friday, 12 September 2008, 20:23 GMT
Nice work...

Would be nice if you could create patches against SVN and not against another tree on your disk. (svn diff)
Comment by Michael Sevakis (MikeS) - Friday, 12 September 2008, 20:28 GMT
There is a test_sampr plugin to test on-the-fly samplerate changes. At 44.1kHz it is an A440 and should change pitch in proportion to the rate.
Comment by Peter D'Hoye (petur) - Friday, 12 September 2008, 21:05 GMT
patch against current SVN, also added H10-5GB

ipod 3gen could also use it if it has recording....