Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @file streams-generator-server_wav.ino
- *
- * This sketch generates a test sine wave. The result is provided as WAV stream which can be listened to in a Web Browser
- *
- * @author Phil Schatzmann
- * @copyright GPLv3
- *
- */
- #define USE_FDK
- #include "AudioTools.h"
- #include "AudioCodecs/CodecAACFDK.h"
- using namespace audio_tools;
- // WIFI
- const char *ssid = "ssid";
- const char *password = "password";
- //WAVEncoder encoder;
- AACEncoderFDK encoder;
- AudioEncoderServer server(&encoder, ssid, password);
- // Sound Generation
- const int sample_rate = 44100;
- const int channels = 2;
- SineWaveGenerator<int16_t> sineWave; // Subclass of SoundGenerator with max amplitude of 32000
- GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
- void setup() {
- Serial.begin(115200);
- AudioLogger::instance().begin(Serial,AudioLogger::Info);
- // start server
- server.begin(in, sample_rate, channels);
- // start generation of sound
- sineWave.begin(channels, sample_rate, N_B4);
- in.begin();
- }
- // copy the data
- void loop() {
- server.doLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment