On the Board of Education how I use the microphone on it? I was thinking would an analog pin. It seems to be on a digital pin. I didn't see anywhere say how to use it? I'm using c/c++ not spin.
The microphone is connected to P20 and P21 with components which allow the output from the mic to be monitored with a sigma-delta algorithm.
Above is the microphone section of the PropBOE's schematic (page 6).
It's possible to record sound to the SD card on the PropBOE using the mic. I used a program (in Spin) from the OBEX to test out recording audio to the uSD card. The sound quality wasn't great but I could understand the recorded speech when it was played back.
I'm pretty sure you'll need PASM to monitor the mic fast enough to record or monitor sound. There are several examples in the Propeller Tool library of using the sigma-delta technique. ADC.spin can be used as a child object to monitor the mic (you'll need additional code to do something with the data). There are two programs in the "Demo" folder which use the microphone; "microphone_to_headphone.spin" and "microphone_to_vga.spin".
Sorry, but I'm not aware of any programs in C using the mic. Hopefully someone more familiar with using C on the Propeller can help.
The SimpleIDE libraries currently only include an ADC from the MCP3208 chip, but the Propeller also can do an ADC with a Sigma-Delta algorhtm and a few components. That is what your BOE board is wired to support. And all the currently available code is in OBEX or the Propeller Tool Examples that are SPIN and PASM.
For GCC, it seems we need some one to write a Sigma-Delta driver.
Duane Degn mentioned a couple of SPIN objects that work with the existing setup. There is also a bit of software called Spin2Cpp that can convert Spin code to C++
this object (yes, it's written in Spin), to record audio. I used this one to play it back.
I ran spin2cpp on the recorder object's code, but spin2cpp thinks the following lines in WAV-Recorder_ADCEngine.spin are syntax errors and will not complete a conversion:
[COLOR=#000000]ERRORS:
WAV-Recorder_ADCEngine.spin:304: syntax error
WAV-Recorder_ADCEngine.spin:305: syntax error
WAV-Recorder_ADCEngine.spin:306: syntax error
FOR THIS CODE:
[/COLOR]DAT WAVFileHeaderData ' DO NOT EDIT!
' /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[COLOR=#000000]byte byte "RIFF" ' "RIFF" chunk header.
byte long 0 ' "RIFF" chunk size = (fileSize - 8). Offset 4.
byte byte "WAVE" ' File type.
[/COLOR]
The code compiles with openspin in SimpleIDE without issue, so there's something about ' byte byte' and 'byte long' that spin2cpp is not happy with. Kye quotes in the code NOT to edit these lines, so I'm not sure how to get around these errors...
Hmmm... I had high hopes that the Spin2Cpp tool would simply work in this context. It certainly would appeal to those that already use the Aduino and want to run all and anything in OBEX ... just as long as it can be migrated to C++.
I suspect there still is a lot of OBEX code that will migrate without needing either a new verision of Spin2Cpp or a revision in the code. Catalina C also doesn't seem to have a Sigma-Delta driver in C.
The code compiles with openspin in SimpleIDE without issue, so there's something about ' byte byte' and 'byte long' that spin2cpp is not happy with. Kye quotes in the code NOT to edit these lines, so I'm not sure how to get around these errors...
Temporarily - until spin2cpp catches up - use this:
That gets me further, but the spin2cpp .c version of SD-MMC_FATEngine.spin does not compile without errors in a .s file created during the build process. That file is a temp file buried in /var/folders that disappears after the build attempt. I'll try to get a .c version of SD-MMC_FATEngine working separately...
That gets me further, but the spin2cpp .c version of SD-MMC_FATEngine.spin does not compile without errors in a .s file created during the build process. That file is a temp file buried in /var/folders that disappears after the build attempt. I'll try to get a .c version of SD-MMC_FATEngine working separately...
Ah, to find the build failure, I used the "--dat --gas" commands together to create a .S file for the ASM code in "SD-MMC_FATEngine". Trying to compile (assemble) that code showed the errors (yay!)
I fixed the inline ASM code that was created in D-MMC_FATEngine.c and now can compile the whole project...
I modded the project to use the pins of the Propeller BOE rather than the Prop Demo board (mostly just changes to WAV_Recorder_Program.h) and removed code that looked for toggling of pin 31 to stop recording. I set the recording period to a static 4 seconds for testing. The program starts up and runs until the record cog is started. It hangs there. I put in some code to blink the _stoplight LED (pin 26 on the Prop BOE) between calls to the SD & WAV engine code, still get no further than the first cognew in what I now have labelled as "main()".
It's possible that the code is not compatible with the Prop BOE in some other way as I was not able to get the .spin version to work either ...
I zipped the project in SimpleIDE for anyone to look at and help debug:
Comments
Above is the microphone section of the PropBOE's schematic (page 6).
It's possible to record sound to the SD card on the PropBOE using the mic. I used a program (in Spin) from the OBEX to test out recording audio to the uSD card. The sound quality wasn't great but I could understand the recorded speech when it was played back.
I'm pretty sure you'll need PASM to monitor the mic fast enough to record or monitor sound. There are several examples in the Propeller Tool library of using the sigma-delta technique. ADC.spin can be used as a child object to monitor the mic (you'll need additional code to do something with the data). There are two programs in the "Demo" folder which use the microphone; "microphone_to_headphone.spin" and "microphone_to_vga.spin".
Sorry, but I'm not aware of any programs in C using the mic. Hopefully someone more familiar with using C on the Propeller can help.
I believe Duane is referring to the demos that are in the Propellor Tool:
http://www.parallax.com/downloads/propeller-tool-software
"File>Open From> Propeller Library -Demos"
What does "I can't get it to work" mean? What is you try? What where you expecting? What happened? What code did you use?
By connecting a mic to an analog pin, do you mean connecting to the I2C ADC?
I think I used this object (yes, it's written in Spin), to record audio. I used this one to play it back.
Make sure any sigma-delta programs you try have the correct I/O pins set for the mic.
For GCC, it seems we need some one to write a Sigma-Delta driver.
Using that might be the least effort.
http://code.google.com/p/spin2cpp/
I ran spin2cpp on the recorder object's code, but spin2cpp thinks the following lines in WAV-Recorder_ADCEngine.spin are syntax errors and will not complete a conversion:
The code compiles with openspin in SimpleIDE without issue, so there's something about ' byte byte' and 'byte long' that spin2cpp is not happy with. Kye quotes in the code NOT to edit these lines, so I'm not sure how to get around these errors...
dgately
I suspect there still is a lot of OBEX code that will migrate without needing either a new verision of Spin2Cpp or a revision in the code. Catalina C also doesn't seem to have a Sigma-Delta driver in C.
Thanks, Kuroneko!
That gets me further, but the spin2cpp .c version of SD-MMC_FATEngine.spin does not compile without errors in a .s file created during the build process. That file is a temp file buried in /var/folders that disappears after the build attempt. I'll try to get a .c version of SD-MMC_FATEngine working separately...
dgately
Try David's SpinWrap program. http://forums.parallax.com/showthread.php/153919-SpinWrap-a-tool-for-allowing-C-or-C-to-use-Spin-Objects?p=1243144&viewfull=1#post1243144
Ah, to find the build failure, I used the "--dat --gas" commands together to create a .S file for the ASM code in "SD-MMC_FATEngine". Trying to compile (assemble) that code showed the errors (yay!)
I fixed the inline ASM code that was created in D-MMC_FATEngine.c and now can compile the whole project...
I modded the project to use the pins of the Propeller BOE rather than the Prop Demo board (mostly just changes to WAV_Recorder_Program.h) and removed code that looked for toggling of pin 31 to stop recording. I set the recording period to a static 4 seconds for testing. The program starts up and runs until the record cog is started. It hangs there. I put in some code to blink the _stoplight LED (pin 26 on the Prop BOE) between calls to the SD & WAV engine code, still get no further than the first cognew in what I now have labelled as "main()".
It's possible that the code is not compatible with the Prop BOE in some other way as I was not able to get the .spin version to work either
I zipped the project in SimpleIDE for anyone to look at and help debug:
WAV_Recorder_Program.zip
dgately...