dawsonjon / PicoRX

Build a SDR SW/MW/LW Receiver with a Raspberry Pi Pico
Other
252 stars 32 forks source link

Switched to fixed 15k samplerate #128

Closed mryndzionek closed 1 month ago

mryndzionek commented 1 month ago

The software interpolated samplerate turned out to be problematic, especially when streaming USB audio from core0. This PR disables the interpolation and switches to 15ksps audio samplerate (+fixes and adjusts few minor things).

dawsonjon commented 1 month ago

Great, thanks 👍

penfold42 commented 1 month ago

Sounds terrible on windows 11 :(

Looking at audacity (set to 15k) theres 256 good samples then 16 dead samples

mryndzionek commented 1 month ago

Sounds terrible on windows 11 :(

Looking at audacity (set to 15k) theres 256 good samples then 16 dead samples

The ultimate test for me was weatherfax. I saw no gaps, jumps and just a little slant, so I decided to do a PR.

mryndzionek commented 1 month ago

Sounds terrible on windows 11 :( Looking at audacity (set to 15k) theres 256 good samples then 16 dead samples

The ultimate test for me was weatherfax. I saw no gaps, jumps and just a little slant, so I decided to do a PR.

Can you, here, ignore s and just write sizeof(usb_buf)? I changed this, because it seems that s is used as a feedback value for USB stack. If less than sizeof(usb_buf) is sent USB stack knows to call the callback again, sooner.

mryndzionek commented 1 month ago

Also, what is the ring buffer level hovering at while streaming on Windows? Is it 50%?

penfold42 commented 1 month ago

Also, what is the ring buffer level hovering at while streaming on Windows? Is it 50%?

yep - I made a note of it while working on my "stupidity" pull request :)

penfold42 commented 1 month ago

Can you, here, ignore s and just write sizeof(usb_buf)? I changed this, because it seems that s is used as a feedback value for USB stack. If less than sizeof(usb_buf) is sent USB stack knows to call the callback again, sooner.

//  uint16_t s = ring_buffer_pop(&usb_rb, usb_buf, sizeof(usb_buf));
//  usb_audio_device_write(usb_buf, s);
  ring_buffer_pop(&usb_rb, usb_buf, sizeof(usb_buf));
  usb_audio_device_write(usb_buf, sizeof(usb_buf));

Like that? Just tried it and it looks the same

mryndzionek commented 1 month ago

@penfold42 you might want to check out current testing branch. There was a fix regarding interrupt configuration.