Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 12 of 12

Thread: microSoundRecorder - very basic question

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    11

    microSoundRecorder - very basic question

    I am trying to learn how to use WMXZ's microSoundRecorder code and I am very confused about how to use this code. In general, I understand including header files for libraries in my Teensy code but this seems different.

    Are there any example files available? I have read through the wiki and read through the forum but I am still confused.

    I feel bad asking such a basic question but my question basically amounts to "I have downloaded these files from Github. Now what do I do with them?"

    If someone can point me in the correct direction, I would be very grateful and promise to pay it forward.

    Sasha

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,439
    Normally I would say:
    - download code
    - edit config.h to reflect your adc situation
    open microSoundRecorder.ino with Arduino IDE and compile (Verify)

    Don't get worried about include files.
    They are only including the different code snippets into main (myApp.cpp)
    (Usually one uses include for declarations and have implementation separated in cpp files, but I choose this method to minimize the numbers of files Arduino opens)
    Also the .ino file is empty and all code is in myApp.cpp to inhibit interferences of Arduino pre-compiler

    Note: Downloading Bill Greimann's SdFat-beta is not required (will remove this line in readme)

    Finally, if you run into problems, ask here on forum, but do not forget to be specific.

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    Thank you for your fast reply. That makes a lot of sense and is similar to the kind of coding that I have seen with real-time audio coding. I have never seen that done with Arduino/Teensy. It also makes a lot of the other forum questions and responses make more sense. Thanks a lot.

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,439
    Good,
    Do you have a particular application, microphone, sensor?
    If you are using a Windows PC you may try to use VisualCode to open directory.

  5. #5
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    Hello,

    Thank you for your response. I had to put this project on hold for a couple of weeks but I am back at it.

    I am trying to use the AUDIO_INPUT_MIC on the Teensy audio board to record a sound file when a high signal is received on one of the Teensy digital pins. I initially missed the existence of the microSoundRecorder wiki and as I have read through the documentation more, I am not sure if I can do what I was hoping to do.

    The goal of this project is to port a project that I made in Max/MSP for a theater company. I created a kiosk that allows audience members to leave feedback after theater performances in different ways (iPad surveys, paper surveys and voice recordings). In the Max patch, when a retro-style phone (https://opis-tech.com/en/support/doc...opis-60s-micro) is lifted off of a cradle, the button release triggers a message and then begins recording. This works great but I want to create a version that does not require a laptop.

    I was thinking that I could use the phone cradle button to trigger a pre-recorded message on a separate micro-controller and when the recording is finished, send out a signal via a digital pin to begin recording on a Teensy 3.6 using the microSoundRecorder code.

    I have two questions about this:

    1) I am reading through the microSoundRecorder wiki and am not sure if having a non-audio triggered recording is possible. Ie. instead of using audio to trigger recording, can I begin recording when a “button” is pressed or a signal sent on a digital pin?


    2) I was hoping to wire the electret microphone in the retro-style phone to the AUDIO_INPUT_MIC pins on the Teensy audio board but in reading the Wiki, it does not seem that that is possible. Do I need to use analog pins or an I2S signal to use this code?


    Thank you for your guidance with this.

  6. #6
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,439
    An audio recorder that is activated by button press (record while button press), if that is what you want, could easily be added.

  7. #7
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    Thank you for your help with this. I have a couple more questions

    1) I am getting the following error when I try to compile the code as you suggested above. I did this with a fresh download of the microsoundRecorder folder without any modifications to the config.h file just to make sure that it would at least compile/verify. I am using Teensyduino 1.53. Do you have any idea what I might need to change to make Arduino/Teensyduino no longer look for the setup and loop functions? Or is there some other place I should look first to address this issue?

    Error Message:
    /var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/arduino_build_430960/../arduino_cache_78914/core/core_084f1eb12907fd80bc23ccd3ac19d4a8.a(main.cpp.o ): In function `main':
    /private/var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/AppTranslocation/E2510082-5EBD-46D5-9DFC-BAD6BEC5BE06/d/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:51: undefined reference to `setup'
    /private/var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/AppTranslocation/E2510082-5EBD-46D5-9DFC-BAD6BEC5BE06/d/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:53: undefined reference to `loop'
    collect2: error: ld returned 1 exit status
    Error compiling for board Teensy 3.6.


    2) If I want to use the microphone on the Teensy Audio shield, do I make the following changes?
    a) in the config.h file,
    #define ACQ _I2S
    b) in the TeensyAudioControl.h file:

    class TeensyAudioControl
    {
    public:
    virtual bool enable(void) = 0;
    virtual bool disable(void) = 0;
    // Sasha Edited This
    virtual bool volume(float volume) = 0.7; // volume 0.0 to 1.0
    // Sasha Edited This
    virtual bool inputLevel(float volume) = 0.7; // volume 0.0 to 1.0
    // Sasha Edited This
    virtual bool inputSelect(int n) = 1;
    };

    3) If I want to add that button control press, where would I do so? I have tried to figure it out myself but I feel like I would just be taking random guesses.

    Thank you so much for your help with this.

    Sasha

  8. #8
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,439
    Quote Originally Posted by sleitman View Post
    Thank you for your help with this. I have a couple more questions

    1) I am getting the following error when I try to compile the code as you suggested above. I did this with a fresh download of the microsoundRecorder folder without any modifications to the config.h file just to make sure that it would at least compile/verify. I am using Teensyduino 1.53. Do you have any idea what I might need to change to make Arduino/Teensyduino no longer look for the setup and loop functions? Or is there some other place I should look first to address this issue?

    Error Message:
    /var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/arduino_build_430960/../arduino_cache_78914/core/core_084f1eb12907fd80bc23ccd3ac19d4a8.a(main.cpp.o ): In function `main':
    /private/var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/AppTranslocation/E2510082-5EBD-46D5-9DFC-BAD6BEC5BE06/d/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:51: undefined reference to `setup'
    /private/var/folders/hc/31j_84gn5b9_1bnz79q8r1sm0000gn/T/AppTranslocation/E2510082-5EBD-46D5-9DFC-BAD6BEC5BE06/d/Teensyduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3/main.cpp:53: undefined reference to `loop'
    collect2: error: ld returned 1 exit status
    Error compiling for board Teensy 3.6.
    The above should not happen, how did you install Arduino, TD on which OS?


    2) If I want to use the microphone on the Teensy Audio shield, do I make the following changes?
    a) in the config.h file,
    #define ACQ _I2S
    Yes
    b) in the TeensyAudioControl.h file:

    class TeensyAudioControl
    {
    public:
    virtual bool enable(void) = 0;
    virtual bool disable(void) = 0;
    // Sasha Edited This
    virtual bool volume(float volume) = 0.7; // volume 0.0 to 1.0
    // Sasha Edited This
    virtual bool inputLevel(float volume) = 0.7; // volume 0.0 to 1.0
    // Sasha Edited This
    virtual bool inputSelect(int n) = 1;
    };
    Don't edit Audio Library but call the relative methods
    3) If I want to add that button control press, where would I do so? I have tried to figure it out myself but I feel like I would just be taking random guesses.
    That would need some code in loop().
    There are a variety of ideas
    simple one:
    -check button press
    -if pressed start storing acquired data
    -if released stop storing acquired data

  9. #9
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    1) You wrote: The above should not happen, how did you install Arduino, TD on which OS?

    It is installed on Mac OS 10.14.6. Arduino and Teensyduino in their current setup have been on this OS and machine for about 6 months without problem. I am happy to change OSs though.

    2) I am sorry for being so dense. When you say, "Don't edit Audio Library but call the relative methods", I initially looked for a place where TeensyAudioControl is called and did not find it. Would I declare that a TeensyAudioControl object inside of the config.h file?

    3) When you say loop (), I am assuming that you mean the loop in myApp.cpp, correct?

  10. #10
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,439
    I'm just wondering if a simpler program than the microSoundRecorder would be more appropriate for you application.
    e.g. starting with the audio/examples/Recorder
    which does nearly what you wanted.

  11. #11
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    It might be that I should go back and begin from the audio/examples/Recorder which is more at my level of coding.

    I came to microSoundRecorder because:

    1) it was reported as being very robust and even though what I am doing is very simple, that robustness is useful for interactive installations that are unattended for long periods.

    2) In other work, I do field recording and thought this might be a useful project to work on to get to know the library.

    I know that I am taking more time than most users to figure this out. But if I do end up using it, I am happy to create some sort of getting started documentation to share.

  12. #12
    Junior Member
    Join Date
    Feb 2021
    Posts
    11
    The other 2 items in your code that would be very useful for the group that I am working with are the time stamps and the wav file recording instead of raw files. If they can just grab the SD card after an event, that would be wonderful. It will not be audio engineers who want to parse through raw sound files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •