snapshot
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# set the project name
|
||||
project(resample_ext)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
set (DCMAKE_CXX_FLAGS "-Werror")
|
||||
# add_compile_options(-Wstack-usage=1024)
|
||||
|
||||
# Build with arduino-audio-tools
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/arduino-audio-tools )
|
||||
endif()
|
||||
|
||||
# build sketch as executable
|
||||
add_executable (resample_ext resample_ext.cpp)
|
||||
|
||||
# set preprocessor defines
|
||||
target_compile_definitions(resample_ext PUBLIC -DIS_DESKTOP)
|
||||
|
||||
# specify libraries
|
||||
target_link_libraries(resample_ext arduino_emulator arduino-audio-tools)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "AudioTools.h"
|
||||
|
||||
AudioInfo info(44100, 1, 16);
|
||||
// subclass of SoundGenerator with max amplitude of 32000
|
||||
SineWaveGenerator<int16_t> sineWave(32000);
|
||||
// Stream generated from sine wave
|
||||
GeneratedSoundStream<int16_t> sound(sineWave);
|
||||
CsvOutput<int16_t> out(Serial);
|
||||
//ResampleStreamT<LinearInterpolaror> resample(out);
|
||||
ResampleStreamT<BSplineInterpolator> resample(sound);
|
||||
StreamCopy copier(out, resample); // copies sound to out
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Warning);
|
||||
|
||||
// define resample
|
||||
auto rcfg = resample.defaultConfig();
|
||||
rcfg.copyFrom(info);
|
||||
rcfg.step_size = 0.5;
|
||||
resample.begin(rcfg);
|
||||
|
||||
// Define CSV Output
|
||||
out.begin(info);
|
||||
|
||||
// Setup sine wave
|
||||
sineWave.begin(info, N_B4);
|
||||
Serial.println("started...");
|
||||
}
|
||||
|
||||
// Arduino loop - copy sound to out
|
||||
void loop() { copier.copy(); }
|
||||
Reference in New Issue
Block a user