DSPRelated.com
Forums

Setting 25KHz playback sampling rate in sound card

Started by gaurav_lohiya 5 years ago13 replieslatest reply 5 years ago264 views
I am sampling the IF signal at 625 KHz and after AM demodulation I am getting the audio at sampling rate of 625 KHz. The audio is downsampled to 25 KHz and routed to the audio out buffer of PC sound card. I am using the winsound APIs with MSVC 2015 on Windows 7.
Please guide me, is the PC sound card will set 25KHz sampling frequency or the sampling rate would be set to the nearest standard sampling rate, like 24KHz or 44.1KHz.
Thanks in advance.
[ - ]
Reply by jbrowerMarch 28, 2020

Gaurav-

What you're asking about is sampling rate conversion (SRC).  Searching on that plus PC sound will bring up Google chatter on the subject.

Recently most PC sound supports 44.1 and 48 kHz, and built in PC audio drivers will perform basic SRC to interpolate up to one of those rates, so if you play .wav, .au, or other audio format files with various sampling rates they will sound Ok.

But if you're using Winsound or ALSA (Linux) then likely you have to handle SRC in your program.  ALSA, with which I'm somewhat familiar, has a plug-in; in our Linux packet and media software products we do our own SRC because of variability in the wide range of USB audio devices out there.  For Winsound, there might be APIs or a similar plug-in approach, you would have to search it.

-Jeff

[ - ]
Reply by gaurav_lohiyaMarch 28, 2020

Thanks Jeff

[ - ]
Reply by Rick LyonsMarch 28, 2020

Hi gaurav_lohiya.

It seems to me that you should downsample your IF signal BEFORE you perform AM demodulation.


[ - ]
Reply by dgshaw6March 28, 2020

You can use a Farrow interpolator to resample from 25 kHz to whatever rate is supported by your sound card. (22.050, 24, 44.1, 48 ksps etc) 
However, if you are trying to play back continuously from the 625 kHz IF, then you will have drift in the input to output sampling (because the IF and the sound card have different source oscillators) that will require a PLL to track the gradual phase shift between the re-sampled data and the sound card buffer.
This can also be handled by the Farrow Interpolation with the added adjustments coming from the PLL phase parameter.

We used this type of technique to deal with Sirius Satellite radio back in the 90's because the packet receive speed did not exactly match the playback rate of the D/As.  Because delay in playback was not that much of a concern, we had buffers before and after the Farrow Interpolator, and monitored high and low level thresholds in the buffers to find the fine timing adjustment.

We also had to do something similar for the audio processing for a speakerphone we built to run on the PC using an 8 ksps phone line interface.
The modem board had its own A/D and D/A running on its own clock sampling at 8 ksps, and the sound card had only (1, 2, 4) divisors of 44.1 ksps.
We used Farrow for 8 -> (22.050+delta) and (22.050-delta) -> 8 and the buffering technique for the fractional adjustments (delta) required in addition.

Good luck Gaurav

[ - ]
Reply by Rick LyonsMarch 28, 2020

Hi dgshaw6. Interesting! What company did you work for?

[ - ]
Reply by gaurav_lohiyaMarch 28, 2020

Bharat Electronics Limited, India

[ - ]
Reply by dgshaw6March 28, 2020

Hi Rick,

I started my career at Bell Labs in 1981 and worked for several AT&T elements and derivatives including AT&T Information Systems, AT&T Microelectronic, Lucent, agere, and LSI, just before LSI and Avago merged, and Avago bought Broadcom.
I was laid off in 2014.

I was fortunate to work for an internal consulting organization within Bell Labs that allowed me to work on a variety of DSP projects for several of the AT&T entities.
The Sirius Satellite Radio and the speakerphone work, based on the plugin modems, was done for AT&T Microelectronics.

In the interests of full disclosure, I worked for several years in the same group or department as Bill Farrow including during the time he developed the interpolator.
I worked in the same group as Bill where we developed the first echo-cancelling modems for 4800, 9600 bps rates.
Before his invention, we had to resample data using a D/A and A/D between the canceler and the receiver of the first full-band duplex modems experiments that resulted in the V.32, V.34 standards.

He was a funny man and many times he was asked why he chose to publish the paper on the interpolator at an obscure conference in Helsinki, Finland.  He would tell people, "I had never been to Finland."  It was that simple.
https://ieeexplore.ieee.org/document/15483

Bill passed away a few years back at the age of 90.  I had seen him within the last year or so of his life at luncheons we had periodically, and was able to gather with several Bell Labs people at a memorial service held to honor him.
https://obittree.com/obituary/us/new-jersey/long-branch/damiano-funeral-home/cecil-bill-farrow/2083790/

Best regards,

David

[ - ]
Reply by Rick LyonsMarch 28, 2020

Hi David. Thanks. Wow, that's quite a resume!

I've run a cross papers that mention Farrow filters, but I've never actually studied those filters. I went to the IEEE web link you provided, but for some reason my membership to the IEEE Signal Processing Society does NOT qualify me to download a copy of Farrow's paper (darn!). I'll search the Internet for Farrow filters and see if I can find any "understandable" information. Thanks again David.

[ - ]
Reply by dgshaw6March 28, 2020

Hi Rick,

Farrow's original paper.
All the plots in the paper were generated by Bill using HTBasic, which was his favorite platform.

00015483.pdf

One of the references is about echo-cancelling modems written by Jean-Jacque Werner, who was in the same group with several well known people in modems.

Richard Gitlin was the department head. (Columbia and FSU now)
Victor Lawrence was the supervisor. (Steven Institute of Technology now)
Jean-Jacque Werner,
Bill Keasler,
Bill Farrow,

Lee-Fang Wei, (Rotationally invariant Trellis Coded Modulation invented in the same time frame)
Hermant Thapar,
John Cioffi, (Started Amati that was a very big force in DSL. He was doing his PhD at Stanford when I was in the group)
Bob Cupo,
Reuben Marabuto.
Couple of others whose names I don't remember off the top of my head.

This was the same group that went on to do tons of work in the early development of DSL.  Both the work for CAP and considerable work on DMT (without Cioffi).  Jean-Jacque was the guy who studied the capacity of twisted pair wiring, into you home, to figure out the limits of DSL.

We worked in an old converted Sears store on the Asbury Park circle in NJ. because the Holmdel Bell Labs building was overflowing.
Back then all Sears stores looked exactly the same including the layout.
To add to my comment about Bill Farrow's sense of humor, he used to tell people that his office was in women's lingerie.

What nostalgic memories.

[ - ]
Reply by Rick LyonsMarch 28, 2020

Hi David (dgshaw6). 

That's quite a story you tell. You certainly did work with some signal processing "heavyweights". Thanks for the Farrow paper. I'm going to try to decipher it.

[ - ]
Reply by gaurav_lohiyaMarch 28, 2020

Thanks a lot

[ - ]
Reply by ZaellixAMarch 28, 2020

Hello there,


Most probably your sound-card does not support "arbitrary" sampling rates. This would either require the use of variable timing clocks (hardware, but I am not sure whether such a thing exists, hopefully someone else on the forums will let us know about it), or coded resampling algorithms.


In my knowledge, there are no audio interfaces that have sampling-rate conversion algorithms implemented, apart from maybe some of the most-often-used ones. Still, I cannot be sure whether they use hardware, software or a "hybrid method" to achieve the results.


Briefly, this means that you should either consult with the audio interface company, or implement your resampling algorithm (or use a software that can handle that) to resample your signal.


Not sure I was of much help here, but the end of the line (from my side) is that I haven't encountered a single hardware audio interface that can handle any sampling rate you would like to use.


Best,


Achilles.

[ - ]
Reply by gaurav_lohiyaMarch 28, 2020

Thanks Achilles