PDA

View Full Version : Fixing the digital input sample rate




microneurog
Feb 25, 2013, 08:41 AM
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



spoonie1972
Feb 25, 2013, 09:14 AM
iirc, only the mac can set the sample rate master.

have you tried setting it to 48k prior to plugging in the cable?

I gave up on this long ago on both laptop and apple desktops - it just doesnt work when you try to slave clock using the built in. even if you can get it to 48k input, you'll get glitching as the mac won't accept clock - even if you set it to slave.

nothing but smiles and sunshine though (for me), when using an external fw motu or rme. or anything else, really.

microneurog
Mar 4, 2013, 05:10 AM
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.

spoonie1972
Mar 4, 2013, 07:00 AM
so you're creating something?

you can either set it up to slave to clock, or, if you have the bits/tech, set it up to accept wordclock over BNC cable (if your ESI device has a word-clock generator and port).

microneurog
Mar 5, 2013, 03:39 AM
Yes, we/mostly our supervisor have designed and built a small circuit capable of low noise amplification, which can hopefully work in the magnetic field of an MRI scanner (if that's what you were referring to).

Yeah there's been a redesign now to make the amplifier receive wordclock from the mac, but using an optical cable (we're using optical cables to reduce EM induction from large loop areas created by cables).