diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/Audio.cpp b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/Audio.cpp index 71e53f9fa..952eb9dd7 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/Audio.cpp +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/Audio.cpp @@ -1357,6 +1357,8 @@ err_t AudioClass::writeWavHeader(File& myFile) return AUDIOLIB_ECODE_FILEACCESS_ERROR; } + m_es_size = 0; + return AUDIOLIB_ECODE_OK; } diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaRecorder.cpp b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaRecorder.cpp index e63238e0b..b8effa9cd 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaRecorder.cpp +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaRecorder.cpp @@ -616,6 +616,8 @@ err_t MediaRecorder::writeWavHeader(File& myfile) return MEDIARECORDER_ECODE_FILEACCESS_ERROR; } + m_es_size = 0; + return MEDIARECORDER_ECODE_OK; } diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/beep/beep.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/beep/beep.ino index c8416c98b..845fb8a69 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/beep/beep.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/beep/beep.ino @@ -118,20 +118,20 @@ void loop() theAudio->setBeep(1,-40,theNote.fs); - /* The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + /* The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(theNote.time * 1000); theAudio->setBeep(0,0,0); - /* The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + /* The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(100000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players/dual_players.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players/dual_players.ino index 867aa0f21..b0af6271a 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players/dual_players.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players/dual_players.ino @@ -58,10 +58,10 @@ void play_process( AudioClass *theAudio, AudioClass::PlayerId play_id, File& fil break; } - /* The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + /* The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(40000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players_objif/dual_players_objif.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players_objif/dual_players_objif.ino index 5c0a7c20d..1062afb47 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players_objif/dual_players_objif.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/dual_players_objif/dual_players_objif.ino @@ -64,7 +64,7 @@ SDClass theSD; /** * @brief Audio(player0) attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void attention_player_cb(const ErrorAttentionParam *atprm) @@ -259,10 +259,10 @@ void play_process( MediaPlayer *thePlayer, struct PLAY_ELM_T *elm, File& file) * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(40000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture/pcm_capture.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture/pcm_capture.ino index db3484423..52610b209 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture/pcm_capture.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture/pcm_capture.ino @@ -30,7 +30,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -153,10 +153,10 @@ void loop() { * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ // usleep(10000); @@ -190,4 +190,4 @@ exitRecording: puts("End Recording"); exit(1); -} +} diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture_objif/pcm_capture_objif.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture_objif/pcm_capture_objif.ino index ae77f68e3..e92ff8a48 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture_objif/pcm_capture_objif.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/pcm_capture_objif/pcm_capture_objif.ino @@ -42,7 +42,7 @@ bool ErrEnd = false; /** * @brief Frontend attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ void frontend_attention_cb(const ErrorAttentionParam *param) diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player/player.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player/player.ino index c658c0368..20bcb60d7 100755 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player/player.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player/player.ino @@ -30,7 +30,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -158,10 +158,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(40000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_hires/player_hires.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_hires/player_hires.ino index 3edac4096..83e6beeaf 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_hires/player_hires.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_hires/player_hires.ino @@ -30,7 +30,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -162,10 +162,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(1000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_objIf/player_objIf.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_objIf/player_objIf.ino index 7d2a06bfc..7aeea2de3 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_objIf/player_objIf.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_objIf/player_objIf.ino @@ -34,7 +34,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void attention_cb(const ErrorAttentionParam *atprm) @@ -246,10 +246,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(40000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_playlist/player_playlist.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_playlist/player_playlist.ino index b8e39c6fd..7bb36a739 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_playlist/player_playlist.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_playlist/player_playlist.ino @@ -465,10 +465,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(1000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_wav/player_wav.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_wav/player_wav.ino index b12351cf9..4c519290a 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_wav/player_wav.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_wav/player_wav.ino @@ -38,7 +38,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -211,10 +211,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(1000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/rec_play/rec_play.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/rec_play/rec_play.ino index 2ff9abc4b..6f9a171cf 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/rec_play/rec_play.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/rec_play/rec_play.ino @@ -40,7 +40,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -156,10 +156,10 @@ bool playStream() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(40000); @@ -237,10 +237,10 @@ bool recordStream() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(10000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder/recorder.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder/recorder.ino index cd5039749..277dba023 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder/recorder.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder/recorder.ino @@ -32,7 +32,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -156,10 +156,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ // usleep(10000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_objif/recorder_objif.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_objif/recorder_objif.ino index 7b8ad3239..0e3a8d771 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_objif/recorder_objif.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_objif/recorder_objif.ino @@ -34,7 +34,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void mediarecorder_attention_cb(const ErrorAttentionParam *atprm) @@ -289,10 +289,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ // usleep(10000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav/recorder_wav.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav/recorder_wav.ino index 5d4f66285..3ec0e4220 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav/recorder_wav.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav/recorder_wav.ino @@ -34,7 +34,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) @@ -48,7 +48,7 @@ static void audio_attention_cb(const ErrorAttentionParam *atprm) } /** - * @brief Setup recording of mp3 stream to file + * @brief Setup recording of wav stream to file * * Select input device as microphone
* Initialize filetype to stereo wav with 48 Kb/s sampling rate
@@ -174,10 +174,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ // usleep(10000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_objif/recorder_wav_objif.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_objif/recorder_wav_objif.ino index e8284887e..d3d90266c 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_objif/recorder_wav_objif.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_objif/recorder_wav_objif.ino @@ -33,7 +33,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void mediarecorder_attention_cb(const ErrorAttentionParam *atprm) @@ -279,10 +279,10 @@ void loop() * Please adjust in according with the processing contents * being processed at the same time by Application. * - * The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ // usleep(10000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_split/recorder_wav_split.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_split/recorder_wav_split.ino new file mode 100644 index 000000000..fb06f0c3f --- /dev/null +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_wav_split/recorder_wav_split.ino @@ -0,0 +1,281 @@ +/* + * recorder_wav_split.ino - Recorder(recording to split files) example application for WAV(PCM) + * Copyright 2022 Sony Semiconductor Solutions Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include + +#define RECORD_FILE_NAME "Sound" +#define RECORD_DIR_NAME "Rec" +#define DIR_PATH_LEN 32 +#define FILE_PATH_LEN 128 +static char dir_name[FILE_PATH_LEN]; + +SDClass theSD; +AudioClass *theAudio; + +File myFile; + +bool ErrEnd = false; + +/** + * @brief Audio attention callback + * + * When audio internal error occurs, this function will be called back. + */ + +static void audio_attention_cb(const ErrorAttentionParam *atprm) +{ + puts("Attention!"); + + if (atprm->error_code >= AS_ATTENTION_CODE_WARNING) + { + ErrEnd = true; + } +} + +/** + * @brief Setup recording of wav stream to file + * + * Select input device as microphone
+ * Initialize filetype to stereo wav with 48 Kb/s sampling rate
+ * Open RECORD_FILE_NAME file in write mode + */ + +/* Sampling rate + * Set 16000 or 48000 + */ + +static const uint32_t recoding_sampling_rate = 48000; + +/* Number of input channels + * Set either 1, 2, or 4. + */ + +static const uint8_t recoding_cannel_number = 2; + +/* Audio bit depth + * Set 16 or 24 + */ + +static const uint8_t recoding_bit_length = 16; + +/* Mic Gain */ + +static const uint8_t mic_gain = 16; + +/* Encoded date buffer size */ + +static const uint32_t enc_buf_size = 160*1024; + +/* Recording time[second] */ + +static const uint32_t recoding_time = 60*60; + +/* Recording split time[second] */ + +static const int32_t split_time = 10*60; + +/* Bytes per second */ + +static const int32_t recoding_byte_per_second = recoding_sampling_rate * + recoding_cannel_number * + recoding_bit_length / 8; + +/* Total recording size */ + +static const int32_t recoding_size = recoding_byte_per_second * recoding_time; + +/* split recording size */ + +static const uint32_t split_size = recoding_byte_per_second * split_time; + + +/* Number of files in one directory */ + +static const uint32_t dir_file_num = 100; + + +/* Number of directories */ + +static uint16_t dir_count = 0; + +/* Number of files */ + +static uint16_t file_count = 0; + +/** + * @brief create recording directories + */ + +static void create_dir() +{ + snprintf(dir_name, sizeof(dir_name), "%s%02d", RECORD_DIR_NAME, dir_count); + + if (!theSD.exists(dir_name)) + { + theSD.mkdir(dir_name); + } + + dir_count++; +} + +/** + * @brief create record file + * + * create the record file to SD card. + */ + +static void create_file(File *record_file, uint16_t count) +{ + char file_path[FILE_PATH_LEN]; + + snprintf(file_path, sizeof(file_path), "%s/%s%03d.wav", dir_name, RECORD_FILE_NAME, count); + if (theSD.exists(file_path)) + { + printf("Remove existing file [%s].\n", file_path); + theSD.remove(file_path); + } + + *record_file = theSD.open(file_path, FILE_WRITE); + /* Verify file open */ + if (!myFile) + { + printf("File open error\n"); + exit(1); + } + + printf("Open! [%s]\n", file_path); +} + +void setup() +{ + Serial.begin(115200); + + /* Initialize SD */ + while (!theSD.begin()) + { + /* wait until SD card is mounted. */ + Serial.println("Insert SD card."); + } + + theAudio = AudioClass::getInstance(); + + theAudio->begin(audio_attention_cb); + + puts("initialization Audio Library"); + + /* Select input device as microphone */ + theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC); + + /* If file writing fails, change the buffer size to a larger one. + And if recording volume is small, change microphone gain. */ +// theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC, mic_gain, enc_buf_size); + + /* Search for WAVDEC codec in "/mnt/sd0/BIN" directory */ + theAudio->initRecorder(AS_CODECTYPE_WAV, + "/mnt/sd0/BIN", + recoding_sampling_rate, + recoding_bit_length, + recoding_cannel_number); + puts("Init Recorder!"); + + create_dir(); + + create_file(&myFile, file_count++); + + theAudio->writeWavHeader(myFile); + puts("Write Header!"); + + theAudio->startRecorder(); + puts("Recording Start!"); + +} + +void loop() +{ + err_t err; + + if (file_count >= (dir_file_num * dir_count)) + { + create_dir(); + } + + /* recording end condition */ + if (theAudio->getRecordingSize() + split_size * (file_count - 1) > recoding_size) + { + theAudio->stopRecorder(); + sleep(1); + err = theAudio->readFrames(myFile); + + goto exitRecording; + } + else if ((uint32_t)theAudio->getRecordingSize() > split_size) + { + theAudio->closeOutputFile(myFile); + myFile.close(); + create_file(&myFile, file_count++); + + theAudio->writeWavHeader(myFile); + + err = theAudio->readFrames(myFile); + } + else + { + err = theAudio->readFrames(myFile); + } + + if (err != AUDIOLIB_ECODE_OK) + { + printf("Error End! =%d\n",err); + ErrEnd = true; + } + + if (ErrEnd) + { + printf("Error End\n"); + theAudio->stopRecorder(); + goto exitRecording; + } + + /* This sleep is adjusted by the time to write the audio stream file. + * Please adjust in according with the processing contents + * being processed at the same time by Application. + * + * The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. + */ + +// usleep(10000); + + return; + +exitRecording: + + theAudio->closeOutputFile(myFile); + myFile.close(); + + theAudio->setReadyMode(); + theAudio->end(); + + puts("End Recording"); + exit(1); + +} diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_with_rendering/recorder_with_rendering.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_with_rendering/recorder_with_rendering.ino index eb934738c..ab49f2a9c 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_with_rendering/recorder_with_rendering.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/recorder_with_rendering/recorder_with_rendering.ino @@ -41,7 +41,7 @@ bool ErrEnd = false; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void attention_cb(const ErrorAttentionParam *atprm) @@ -293,10 +293,10 @@ void loop() goto exitRecording; } - /* The usleep() function suspends execution of the calling thread for usec - * microseconds. But the timer resolution depends on the OS system tick time - * which is 10 milliseconds (10,000 microseconds) by default. Therefore, - * it will sleep for a longer time than the time requested here. + /* The usleep() function suspends execution of the calling thread for usec + * microseconds. But the timer resolution depends on the OS system tick time + * which is 10 milliseconds (10,000 microseconds) by default. Therefore, + * it will sleep for a longer time than the time requested here. */ usleep(10 * 1000); diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/through/through.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/through/through.ino index 494540781..517de57d0 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/through/through.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/through/through.ino @@ -24,7 +24,7 @@ AudioClass *theAudio; /** * @brief Audio attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ static void audio_attention_cb(const ErrorAttentionParam *atprm) diff --git a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/voice_effector/voice_effector.ino b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/voice_effector/voice_effector.ino index 9efbef85a..bd45ff2ac 100644 --- a/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/voice_effector/voice_effector.ino +++ b/Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/voice_effector/voice_effector.ino @@ -149,7 +149,7 @@ inline int16_t clip(int32_t val, int32_t peak) /** * @brief Frontend attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ void frontend_attention_cb(const ErrorAttentionParam *param) @@ -164,7 +164,7 @@ void frontend_attention_cb(const ErrorAttentionParam *param) /** * @brief OutputMixer attention callback * - * When audio internal error occurc, this function will be called back. + * When audio internal error occurs, this function will be called back. */ void mixer_attention_cb(const ErrorAttentionParam *param) {