Audio sampling - General Discussion - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Audio sampling

Audio sampling

  • Please log in to reply
5 replies to this topic

#1 Frank Szendzielarz

Frank Szendzielarz

    New Member

  • Members
  • Pip
  • 3 posts

Posted 20 August 2013 - 02:41 PM

Hello all

 

I have only just now discovered Netduino (and small programmable controller in general) and completely new here, so please forgive my lack of knowledge. Before I dig further into Netduino and purchase a device, I would like to find out a bit more about how applicable the technology is to audio sampling and applying some not-too-low-latency DSP .

 

If anyone can help, these are the questions I have at the moment:

1) What is the highest sampling rate that can be achieved through the AD converters?

2) Can C# be used to do the sampling and can >44100Hz be achieved?

3) If native code must be used for sampling how is this done and can this be executed from within managed code?

 

Thanks in advance



#2 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 21 August 2013 - 11:26 AM

Hi!

 

I think max sampling rate is 2Ms/second (see datasheet for the microcontroller) but you won't come anywhere near that rate or probably even 44.1kHz in managed code (plus for stereo you would need 2 channels = half the rate with a single multichannel ADC).

 

The Netduino ADC is only 10 or 12 bit (depending on micro) and meant for reading sensors and such much rather than sampling audio signals. För CD quality, even native code won't help.

 

I suggest you look at some external ADC board with more suitable specs, possibly something with a DSP onboard. Also bear in mind you need to handle the data stream which would be 2 * 16 * 44100 = 1,4Mbit/second for CD quality audio so if you're looking to do real time DSP, you're in for a real challenge.

 

You might want to look at the VS1053b from VLSI, it's an primarily a MP3 decoder but it can sample CD quality audio producing an MP3 (or Ogg Vorbis) encoded audio stream for you. The chip also has a few simple DSP effects.

 

You should probably check out www.minidsp.com

 

Sorry if I sound negative but I really don't think Netduino is you best choice for the task.

 

Good luck!



#3 Frank Szendzielarz

Frank Szendzielarz

    New Member

  • Members
  • Pip
  • 3 posts

Posted 21 August 2013 - 01:54 PM

Hi

 

Thanks for the response. The 2Ms is more than sufficient. I did not see that on the data sheet when I looked before.

 

I think the size of the data stream might not be so important as the latency will be low enough to allow for short buffers. Also, the real work might end up in filtering (low pass, hi pass), which I could end up doing electronically. Well, in any case, I think that with some determination and playing around, I would probably eventually manage to overcome these restrictions one way or another and learn something on the way.

 

However, I am more concerned about how things work if I wanted to get the high sampling rate you mentioned done in native code, while at the same time running managed code.  How does that all work? It has been a long time since I did low level programming. Is it possible to have the native code reading the samples, by interrupts, using a timer, while at the same time feeding the results of this to a parallel executing managed thread?



#4 Frank Szendzielarz

Frank Szendzielarz

    New Member

  • Members
  • Pip
  • 3 posts

Posted 22 August 2013 - 01:11 PM

Just thought I'd post this here in case anyone ends up searching for the same stuff: http://www.iar.com/G...4_MCU_part1.pdf

 

Cortex M4 has DSP instruction set and there are libraries available. 

 

Also - I found this: http://www.micromint...bambino200.html

 

It is a .NET Gadgeteer compatible board with a multi core ARM Cortex .



#5 hanzibal

hanzibal

    Advanced Member

  • Members
  • PipPipPip
  • 1287 posts
  • LocationSweden

Posted 23 August 2013 - 06:47 PM

...However, I am more concerned about how things work if I wanted to get the high sampling rate you mentioned done in native code, while at the same time running managed code. How does that all work? It has been a long time since I did low level programming. Is it possible to have the native code reading the samples, by interrupts, using a timer, while at the same time feeding the results of this to a parallel executing managed thread?

AFAIK, there's no ready made API for doing this, instead you need to modify the Netduino firmware to implement the functionality you need. This means setting up a C language tool chain for the micro in question, creating your own specialized branch of tinyCLR and thereby diverging and detaching from the Netduino main track. I haven't done this myself but many others have, so you can search the forum for guides on how to proceed along this path.

Just thought I'd post this here in case anyone ends up searching for the same stuff: http://www.iar.com/G...4_MCU_part1.pdf Cortex M4 has DSP instruction set and there are libraries available. Also - I found this: http://www.micromint...bambino200.html It is a .NET Gadgeteer compatible board with a multi core ARM Cortex .

That Bambino board looks interesting but for some reason I personally don't care much for gadgeteer boards and therefore don't know much about it. Ah, so there's a set of dedicated DSP instructions in M4, I was unaware of that. Texas are quite knowledgable within digital audio in general (especially since they aquired Burr-Brown) and the field of DSP in particular where they have a broad range of processors: http://www.ti.com/ls...AliasId=1200327 Did you have a look at MiniDSP.com? I really think that's more in line of what you are looking for. Please don't let this discourage you from getting a Netduino since I'm sure it would be a great tool for you to learn more of embedded programming and for interfacing with the other h/w parts that you will need. Please explain a little more of your goals and what you are hoping to achieve and I'm sure someone else here will be able to help you further.

#6 paolo67

paolo67

    New Member

  • Members
  • Pip
  • 1 posts

Posted 01 September 2013 - 10:42 AM

Hello Franz. I have used Netduino 2 plus to collect audio input and show it on a PC connected via UDP system.

The onboard  ADC converter use 50 microsec to generate a sigle data and return, but is not "hifi" due to the "analogic part" (you use 5V by USB). This time in not constant if you use the device to "do some things" (transfer data , ecc); you can have 1-10 ms of latence if save data on SD card.

 

I think the better way is to read data from another device, so you bypass Hitter problems, analogic reference, ecc and then trasfer the data by SPI or I2C channal.

The clock you can use in i2C is 250-400 Khz, so you can calcolate the max transfer rate.

If you want to generate "native code" you ought to compile a C code in Eclipse, then use it wrapped in a .net procedure - i have read the procedure but actually i haven't tried.

 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.