Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,197 Views

Intel Edison as a digital voice recorder. 44.1 KHz problem

Hello

I use microphone and Analog-to-Digital Converter MCP3204. I connect to the SPI, pins 10, 11, 12, 13 (Arduino Board).

In code:

for (int n = 0; n < 1000000; n++){// it's 1MHz

CS->write(1);

CS->write(0);

But this cycle is performed for 30 seconds. What should I do so that it runs in 1 second?

I wand create a digital voice recorder on the Intel Edison.

4 Replies
idata
Community Manager
55 Views

Hello nvozniy,

 

 

I have two ideas, one more complicated than the other but also more accurate. My first idea is that you take the value of n (currently 1000000) and simply divide it between thirty and this should make the cycle last one thirtieth of the current time (currently ~30 seconds) making the cycle last ~1 second. My second idea, is that you take the time of when the cycle begins and then compare it on your cycle to the current time and break the cycle when one second has passed. This last option is a little bit more complex but it could be also more accurate. If you don't mind as much about accuracy then you should be fine with the first option.

 

 

I hope this helps.

 

-Peter.
idata
Community Manager
55 Views

You should use the I2S bus which is for audio operations:

For faster GPIO access see here:

http://www.i-programmer.info/programming/hardware/8770-exploring-edison-fast-memory-mapped-io.html?s... Exploring Edison - Fast Memory Mapped I/O

Flo1991

idata
Community Manager
55 Views

Hello nvozniy,

 

 

Did Flo1991's suggestion or mine helped you? Please let us know, we would be glad to help in case you still need assistance.

 

 

-Peter.
idata
Community Manager
55 Views

Thank you, Flo1991.

I can not find ADC 44.1 KHz with I2C interface, so could not test. This method should to work.

Later, I shall necessarily write about the result.

Reply