Commit Graph
41 Commits
Author SHA1 Message Date
david gauchard 4fed6a230f install and use a global audioLogger instead of Serial (#198)
* use of global audioLogger-> instead of Serial.

* default to silence

* initialize logger in examples
2019-07-24 10:02:21 -07:00
Simon L e6a4e6c886 Document the internal DAC on ESP32 more explicitly (#184)
* Document INTERNAL_DAC explicitly and its usage

* Add INTERNAL_DAC usage comment in example
2019-05-12 08:31:08 -07:00
Earle F. Philhower, III 582e6e70ac Add RTTTL example and use a non-square waveform
Seems like I2S DACs don't like to be presented with perfect bang-bang
square waveforms, so build a very simple model and use that to avoid
abrupt changes in values.  Sounds about as good as you're going to get
with this.

Also add a simple example showing how to play a RTTTL string.
2018-03-26 08:00:56 -07:00
Earle F. Philhower, III 3c7ffbe0b3 Support volume on each input channel
Call stub->SetGain(float) to set an input's volume before mixing.
2018-02-25 14:24:38 -08:00
Earle F. Philhower, III ca50839712 WIP - AudioOutputMixer to combine multiple streams
This runs but amplification is not working yet.  See MixerSample
for a very crufty example.
2018-02-25 13:37:17 -08:00
h3ndrik 4d9d010e8b Fix webradio to use buffer, not raw input streams
Thanks to @h3ndrik, again.
2018-01-31 19:20:08 -08:00
Earle F. Philhower, III 96fc37dce5 Refactor I2S to be cleaner, more extensible
With the multiple I2S modes on the ESP32, it makes sense to use a
cleaner class hierarchy for the I2S tools.  Make I2SNoDAC into a
subclass of I2S (renamed from I2SDAC) and remove about 80% of the
code which was identical exept for the per-sample bitstream synthesis.
2018-01-25 19:15:02 -08:00
Earle F. Philhower, III 93f7d90baf Update WebRadio to use prealloc'd buffers
To avoid allocations in the application, preallocate all decoder and
buffer memory in and then never free it.  Use the new pre-alloc'd
constructors to generate the playback objects.
2018-01-21 15:07:40 -08:00
Earle F. Philhower, III e5d23a4692 Enable Travis-CI builds
Enable automatic building of all examples and SAM(speech) on a
commit by using Travis-CI.  Build against ESP8266 and ESP32.

Minor tweaks to examples and codebase to allow successful compilation
on ESP32 compiler.
2018-01-19 15:57:30 -08:00
Earle F. Philhower, III 94a3f9ab91 Remove hostname setting for ESP32 compatability
The examples were setting a hostname for the WiFi connection, but this is
done via a different call on the ESP32 vs. the ESP8266.  To avoid #ifdef
explosion, simply remove the call as it's unneeded anyway.

Thanks to @reaper7 for reporting this in pull #33.
2018-01-18 10:57:02 -08:00
tueddy 03aa2467f0 Porting for ESP-32 (#33)
* support ESP-32
* make compile with ESP-32/arduino platform
* fixed: use libmad on ESP8266 as original
2018-01-18 08:55:03 -08:00
Earle F. Philhower, III d06dcf1123 Include type and volume in checksum, cleanup code 2017-12-24 09:31:36 -08:00
Earle F. Philhower, III e844536251 Fix the URL max limit in web interface
The web interface has a hardcoded 64 char URL limit, even though the
actual url[] array was increased to 96 chars.  Use sizeof(url) in the
handler instead of a hardcoded number to enable use of all space.
Addresses issue #21 , again.
2017-12-22 21:39:13 -08:00
Earle F. Philhower, III 4cb8861070 Fix PROGMEM string accesses in callbacks
The MD and STATUS callbacks can be passed PROGMEM strings, so be sure to
use proper strcpy_p()s to move them to RAM before printing to avoid crashes.
Found during debug of issue #21 .
2017-12-22 21:28:28 -08:00
Earle F. Philhower, III 5b45a79cf7 Fix ICY decoder overflow causing streams to die 2017-12-16 16:16:01 -08:00
Earle F. Philhower, III 397aee8c19 Actually change volume in the HandleVolue callback 2017-12-15 22:18:23 -08:00
Earle F. Philhower, III 0f0b6cd664 Fix EEPROM save/load and corruption on restart
EEPROM saving was not calculating the correct checksum because it was
not clearing memory before writing.  Fix that so it automatically will
restart the connection on a reset.

There was a fatal corruption caused by improper delete'ing of objects
without clearing their pointers when the initial connection to a stream
failed.  Refactor to use the proper StopPlaying() routine.

Extend the URL to 96 characters.  We not have enough memory to do so!
2017-12-15 19:03:03 -08:00
Earle F. Philhower, III 65a6cc4be7 Fix MetadataCallback function signatures
The MD callback now gets a string, not a stream, so update the examples
to compile properly.
2017-12-15 14:58:14 -08:00
Earle F. Philhower, III 8e94702468 Replace Stream with simple string in MD callback
@armSeb found that the stream interface caused a big slowdown and
hiccups in his playback, replace the MetadataCallback's *Stream with
a simple *char for faster operation and less overhead.
2017-12-15 12:54:49 -08:00
Earle F. Philhower, III d923ebef36 Move the callback constant strings to PMEM 2017-12-15 12:03:05 -08:00
Earle F. Philhower, III 634d0b8d02 Store AAC/MP3 flag in EEPROM for WebRadio 2017-12-15 10:31:19 -08:00
Earle F. Philhower, III 9f42358f31 Try and restart a stream 2secs after a disconnect. 2017-12-14 15:58:39 -08:00
Earle F. Philhower, III e3da480772 Add URL save and restore on reboot 2017-12-14 11:09:43 -08:00
Earle F. Philhower, III ee7febe1ec Refactor and store to EEPROM, restore on reboot
Save the current URL to EEPROM on each change, and try and restart it
after a power loss or reset
2017-12-14 10:35:14 -08:00
Earle F. Philhower, III 143c4e65ae Move request buff to stack
Save 384 heap bytes by handling the web request buffering in the loop()
stack context.
2017-12-14 09:47:00 -08:00
Earle F. Philhower, III ec4979e6f5 Fix web page update, move string to PROGMEM 2017-12-14 09:43:19 -08:00
Earle F. Philhower, III 94489c005a Use low-mem web server to save RAM for playback
Instead of ESP8266WebServer, which is something of a RAM hog and has
extensive use of Strings and allocations, use a simpler one with no
dynamic memory allocations at all, borrowed from PsychoPlug
https://github.com/earlephilhower/psychoplug.
2017-12-12 17:06:21 -08:00
Earle F. Philhower, III 3d88015cc2 Add in status update and free memory reporting
Also removed Serial.print() of status and Serial.flush() to avoid
hiccups.
2017-12-08 22:09:46 -08:00
Earle F. Philhower, III 8893ced2af Add WebRadio example, a web page controller
Simple example web interface to the player.  Can change the volume and
the station through a slider and menu box.
2017-12-08 13:07:59 -08:00
Earle F. Philhower, III 9c120a777a Add callbacks for metadata and status reports
All objects can have a metadata and/or status report callback once created.
They will call the source program with the parsed ID3 tag, ICY StreamTitle,
or text and numeric error ID of any interesting event.  It is up to the end
application to figure out what to do with this.  Normally, you'd just print
it to the LCD or Serial port.  But it is possible to detect, say, a buffer
overflow and then switch to a lower bitrate stream for example.
2017-12-06 21:11:23 -08:00
armSeb 97c05c9f34 SPIRAM buffer support from @armSeb
* Initial SPIRAM buffering support

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* SPI RAM Buffering fill & read.

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* First "working" version...

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Improved version of SPIRAM buffering

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Fixed spiram.h path

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Buffer fill optimization

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Modified read block min to avoid too little buffering attempts

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Temps buffer size decrease from 2048 to 1600 Bytes

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Decrease the temp buffer to 256Bytes

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Local buffer variable

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Added loop function to SPIRAMBuffer that refill it automatically

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Compile issue

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Add possibility to define Chip Select pin from Sketch

Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>

* Externalize libspiram

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Copyright fix

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Deleted embedded libspiram

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Added comments, example and keyword

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* README modification

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Correction

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* Schema example

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>

* README correction

Signed-off-by: sebastien <armseb@MacBook-de-sebastien.local>
2017-12-06 13:30:51 -08:00
Earle F. Philhower, III 471034707d Add ICY Metadata callback to the example 2017-12-04 12:53:58 -08:00
Earle F. Philhower, III 75268b5e3b Add inline ID3 decoder w/callback interface
ID3 tags can now automatically give your app a callback with different tag
types without any additional work on your application.  See the PlayMP3 example
for a very simple example of AudioFileSourceID3's use.
2017-12-02 13:01:46 -08:00
Earle F. Philhower, III 9c3f579c96 Add buffering to MP3 streaming
The buffer class seems to work very well to avoid hiccups while
streaming from the web, so add it by default to the example to
make it easier for users to cut-n-paste and make it work.
2017-11-20 12:15:32 -08:00
Earle F. Philhower, III 551a8ac0bb Add AAC playback using Helix from RealNetworks
AACs can now be played back on the ESP8266 thanks to the RealNetworks
Helix project's AAC decoder.  SBR is *not* supported, as there is not
enough RAM in the system to support it.
2017-11-18 08:42:09 -08:00
Earle F. Philhower, III e11da8c325 MIDI + Soundfont wavetable synthesis capability
AudioGeneratorMIDI plays a .MID file using any Soundfont2 wavetable
synthesis file.  This is a highly hacked combination of TinySoundFont
and MIDITONES, and requires the FastROMFS to run at real-time in most
cases.
2017-10-29 17:43:00 -07:00
Earle F. Philhower, III 685dcbf18d Add FLAC support to the framework via libflac-1.3.2
Ported libFLAC v1.3.2 to the ESP8266.  Moved CRC constants to PROGMEM
and the error strings.  Still to be done would be decreasing the output
buffer to an int16_t and moving a larce number of "const int" to enums
since "const int" eats 4 bytes per variable.
2017-08-17 18:25:04 -07:00
Earle F. Philhower, III 64ceb33a31 Add a HTTP streamer music "file" reader class
Implements a simple and stupid HTTP stream reader to allow for ShoutCast
and other MP3 radio streaming to happen.  Presently seems to stutter on
128K, 44.1KHz streams, but may be better on lower bitrates.
2017-08-14 19:47:22 -07:00
Earle F. Philhower, III 65519bd21e Add MOD sample code 2017-08-12 09:29:56 -07:00
Earle F. Philhower, III 6466df23f3 Add WAV and PROGMEM example 2017-08-12 09:20:09 -07:00
Earle F. Philhower, III 2cf8fcef2a Bring in files from original projects
The library was originally part of several separate projects.  Make the
needed structure and bring those files in, including some READMEs.
2017-08-12 09:01:42 -07:00