Fixing digital input sampling rate

System configuration, maintenance and utilities
Post Reply
microneurog
Posts: 3
Joined: 25 Feb 2013, 06:45

Fixing digital input sampling rate

Post by microneurog » 25 Feb 2013, 06:52

Dear all,

I am currently working on my final year physics project, where my lab partner and I are trying to build a set up which allows the detection of nerve impulses in MRI scanners. Essentially we're just using a low noise amplifier, and sending the signal digitally via SPDIF to a mac.

The sampling rate of the ADC on our amplifier is at 48000Hz, and so we try to set everything on the mac to sample at 48000Hz too.

However when we plug the optical cable into the mac, the sampling rate, as seen on the Audio MIDI setup, automatically changes to 44100Hz. This is causing us many problems. We've tried many things to get around this but with no success. Is there a program or something anyone could please suggest that could fix the input sampling rate permanently?? I'm 99% sure the problem lies here and not in the sampling rate of the programme we are using to record the signal, as this can be changed. Perhaps a program that can hog the settings of the mac in order to fix the sampling rate? I'm quite new to macs so bare with me please.

Our current setup consists of a MacBookPro3,1, 2.2GHz Intel Core 2 Due, running Mac OSX 10.6.8.

Many thanks

User avatar
G
Owner/Admin
Posts: 2150
Joined: 05 May 2003, 18:11
Twitter: glenngutierrez
Location: SF Bay Area, California
Contact:

Re: Fixing digital input sampling rate

Post by G » 25 Feb 2013, 15:06

What is the Clock Source according to Audio MIDI Setup? I haven't spent a lot of time with the built-in S/PDIF, but it sounds like something in the stream is setting that clock to 44. That shouldn't happen randomly. In other words, are you 100% sure your ADC is outputting 48? If you somehow get your software working at 48 on an incoming 44 data stream, you may only be forcing a real-time SRC, which OS X can/WILL do, and barely works as a last resort for audio (very bad to my ears), but would be bad for pristine data capture that way you describe it (very cool, btw!).
Mac mini (M1) . UA Apollo x6 + Quad . macOS Big Sur . Logic Pro . TwistedWave . FCP . PS CC . Affinity Suite . Get Info

User avatar
Loopy C
Moderator
Posts: 1119
Joined: 30 Aug 2004, 06:27
Location: Valyermo, CA, USA
Contact:

Re: Fixing digital input sampling rate

Post by Loopy C » 26 Feb 2013, 07:56

I use my optical in/outs for Macbook Pro _> Mac Pro (I run 10.5.8 and 10.6.8 so do it for purposes of continuing access to 'legacy' instruments).

I am no means an expert on how it works some of the time but one thought might be to use Cycling 74's free 'Soundflower' audio driver as your in/out device and see if same behavior is exhibited?

http://cycling74.com/products/soundflower/

I have my set-up through a Motu 828 which uses the 'TOSLINK' format.

I also would go along with G that the clock may be the culprit in setting things so continue along with that investigation path.

SPDIF specifics regarding clocking:

" In order to support both 44.1 and 48 k systems, as well as others that might be needed, the SPDIF format has no defined data rate. Instead, the data is sent using biphase mark code, which has either one or two transitions for every bit, allowing the original word clock to be extracted from the signal itself."

So this 'biphase mark code' is what sets your operational frequency (which goes to what G has suggested).
"Shut up, he explained"
Chris R Gibson ( a.k.a. Loopy C )
http://www.jesusworedickies.com/merch.html
http://www.loopyc.com
MacBook Pro| 2.8 GHz i7|8G RAM|OS 10.6.6 |Logic Pro 9.1.3
Mac Pro 'Nehalem' 8 Core 2.66 Ghz | 16G RAM | OS 10.5.8 | Logic 9.1.3

microneurog
Posts: 3
Joined: 25 Feb 2013, 06:45

Re: Fixing digital input sampling rate

Post by microneurog » 04 Mar 2013, 02:55

Hello again, sorry for such a delayed response and thanks for your help.

I think we've resolved the issue now. Almost certainly the sampling rate of our device is 48000Hz, and still I have no idea why the mac was convinced it was 44100Hz. We've got around it by using an ESI U24XL to receive the optical input, which allows us to select which sampling rate we want to use to read the incoming data. So now if I input a 1kHz signal using a function generator into our amplifier and record it using our computer, I get a 1kHz recording, rather than the previous ~920Hz recording which can be explained by mismatched sampling rates.

To improve our set up though I think we're going to have to make modifications to our amplifier, so that it takes its clock from that used for the recording sampling rate as opposed to the clock we put on the pcb (as clocks have errors and so although we think they're both sampling at 48000, one may be at 48003 and the other at 39998 for example, causing buffer underrun/overrrun issues).

Thanks again for your help, I just thought I'd post back what we're doing to help anyone with similar issues that might stumble across this thread.

microneurog
Posts: 3
Joined: 25 Feb 2013, 06:45

Re: Fixing digital input sampling rate

Post by microneurog » 05 Mar 2013, 01:31

Also, I forgot to mention, we've been using Jack to route between programmes on our computer, which I imagine is quite similar to Soundflower.

Post Reply