Commit Graph
144 Commits
Author SHA1 Message Date
Earle F. Philhower, III bc87dca1be Add JohannesMTC link 2018-04-01 19:09:38 -07:00
Earle F. Philhower, III 898e960319 Use plain square wave, 8192 amplitude (25%) volume
An I2S bug in core ESP8266 Arduino was causing the square wave to fail,
not an I2S DAC problem.  Move back to the square wave and save some
PROGMEM space and make it simpler and faster.
2018-03-27 06:41:43 -07:00
Earle F. Philhower, III 66d1f37810 RTTTL parser made case-insensitive 2018-03-26 08:58:28 -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 abeba9dd89 Limit speed SerialWAV can send samples, avoid WDT 2018-03-26 07:15:58 -07:00
Earle F. Philhower, III 1e584d141a Merge branch 'master' of https://github.com/earlephilhower/ESP8266Audio 2018-03-25 21:45:38 -07:00
Earle F. Philhower, III b5faad674d Initial RTTTL (Nokia ringtone) checkin
Seems to be some problem with square wave production, but the note
processing looks good for now.
2018-03-25 21:44:22 -07:00
h3ndrik e3a3f2b278 Report buffer fill level (#52)
Add method to get the current buffer fill level (for real-time display/etc.)
2018-03-25 12:14:08 -07:00
reaper7 32cbbfed45 Add PDM mode for ESP32 (#77)
Add PDM (pulse delta modulation) mode for ESP32 using the builtin hardware.
2018-03-25 12:11:29 -07:00
Earle F. Philhower, III 9598c4862e Add ESP32-fs-plugin link to README, thx @rfestag 2018-03-09 10:11:05 -08:00
Earle F. Philhower, III 9e708af1f2 README now contains latest SPIFFS on ESP32 2018-03-05 07:26:12 -08:00
Earle F. Philhower, III 9991fb5300 Add links to cool uses 2018-02-28 20:35:59 -08:00
Earle F. Philhower, III db411fadbf Add Mixer::loop() to allow just sending I2S data
Allow users to call the ::loop() method to pump out any possible data
to the I2S interface, without requiring any Stubs to pump the queue.
2018-02-26 13:11:23 -08:00
Earle F. Philhower, III e9aec0449d Add AudioOutputMixer to valgrind testing
It, amazingly, worked without any issues found by Valgrind on the
first try.
2018-02-26 12:56:48 -08: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
Earle F. Philhower, III 11bd5d2188 Set builtindac mamber before calling SetPinout
Hans-J. Ubben found a bug where the pinout wasn't being set properly on
ESP32s because the builtInDAC member was not set before calling SetPinout.
Fix per his suggestion.
2018-02-17 15:24:29 -08:00
Earle F. Philhower, III 01d9daeb12 Fix ID3v2 decoding, avoid infinite loop
The ID3 reader was incorrectly skipping extended headers and was
cutting off the last 10 bytes of the last ID3 entry. Correct per
http://id3.org specs.

Fixes #41
2018-02-14 20:02:41 -08:00
Earle F. Philhower, III 54498a21a0 Fix overflow for 256x oversampling
Fixes #55
2018-02-08 17:39:51 -08:00
h3ndrik 0bb859037b handle esp32 apll issues (#51)
* make use_apll user-configurable (fixes #37)

* disable apll per default (fixes #47)
2018-02-06 08:06:22 -08:00
Earle F. Philhower, III eb677664f2 Add more default values to I2S output 2018-02-01 12:30:30 -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
h3ndrik 05a78dce2a Make stream reads orders of magnitude faster (fixes #38) (#44)
Fix by @h3ndrik 
* Use correct read for stream data on the ESP32 (fixes #38)
* Adjust types for read()
2018-01-31 19:18:35 -08:00
h3ndrik e7c2aba2aa don't use audio pll on buggy rev0 chips (#40)
as ESP32_MP3_Decoder does
2018-01-26 07:51:49 -08:00
h3ndrik f1916051ec initialize member variables (#39)
if AudioOutputI2S is instanciated in a function (like in the examples) the member variables are not initialized to a default value.
2018-01-26 07:50:43 -08:00
Earle F. Philhower, III b9f13a3161 Enable onboard DAC output 2018-01-25 20:52:58 -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 7a7f8bf449 Use a single hardcoded I2S config, tested working
Tested working i2s config for both I2S and I2SNoDac, only have the
one copy for later refactor into optional configuration.
2018-01-24 13:44:43 -08:00
Earle F. Philhower, III e8e7acb884 Fix warnings and off-by-one in AAC 2018-01-21 19:27:07 -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 22c80beb8f Merge branch 'master' of https://github.com/earlephilhower/ESP8266Audio 2018-01-21 13:08:25 -08:00
Earle F. Philhower, III 8ffebe6496 Enable static allocated buffers, no dynamic malloc
Because we are allocating objects totaling over 80% of the ESP8266 memory
space, we are very sensitive to memory fragmentation.  While we can control
our own allocs, the IP and SDK can allocate any size, at any time, which
can cause us to not be able to find the large contiguous memory areas we need
for the codes.

Work around this by preallocating, before anything else, buffer memory and
never freeing it.  Pass this memory into the codec and it will allocate from
this block and be guaranteed to always succeed.

This may fix the last of the hangs on the webradio/http streaming, which only
seemed to happen after a stop/start cycle.
2018-01-21 13:02:05 -08:00
Earle F. Philhower, III d04beb1105 More paranoid input checks, random error injection
Check for NULL input data buffers and set values to NULL after freeing()
local variables to avoid memory corruption on use-after-freee.

Add lots of error injection in the host testing to help find bugs on
the PC where they're easier to debug.
2018-01-20 21:08:13 -08:00
Earle F. Philhower, III 786354e678 More paranoid input checks, random error injection
Check for NULL input data buffers and set values to NULL after freeing()
local variables to avoid memory corruption on use-after-freee.

Add lots of error injection in the host testing to help find bugs on
the PC where they're easier to debug.
2018-01-20 20:56:05 -08:00
Earle F. Philhower, III f16cd2b269 Only mad_*_finish after a successful mad_*_start
When the input file(stream) doesn't open, you could end up calling
mp3::stop() which would try and mad_finish structures that were
not yet initialized.  Now carry a flag when these are set, and only
_finish when it's set.
2018-01-20 18:32:21 -08:00
Earle F. Philhower, III a359222eae Fix double close in ID3 routine, add buff to tests 2018-01-20 09:24:10 -08:00
Earle F. Philhower, III 4b3ca23d6e Include ID3 tag scanner in MP3 test 2018-01-20 08:42:51 -08:00
Earle F. Philhower, III 68e557fdaa Remove ESP8266 compile warning in layer3.c 2018-01-19 22:28:00 -08:00
Earle F. Philhower, III 24e9d0a585 Add AAC valgrind test on the host, clean up warns
The AAC codec didn't show any issues on initial valgrind runs except
for having a different stop() behavior than the MP3 one.  Make them
match.
2018-01-19 22:11:52 -08:00
Earle F. Philhower, III 07dee61fbf Merge branch 'hosttests' 2018-01-19 21:25:34 -08:00
Earle F. Philhower, III 0172f17b51 MP3 test in Valgrind
Run a host MP3 test using valgrind, shows no errors.
2018-01-19 21:23:17 -08:00
Earle F. Philhower, III da068e30e6 Ensure BPS=16 is set in MP3 decoder
Valgrind found another uninitialized use.  BitsPerSample was not being
called by the LIBMAD decoder, so it was possible to start out in a bad
state.  Now always set it to 16, the decoder native output size.

Channels are initialized to 2, but this setting is always reset on
a per-frame basis anyway.
2018-01-19 21:09:37 -08:00
Earle F. Philhower, III 158fe23181 Don't crash on an invalid (layer I or II) frame
We removed the MP2-layer I and II decoders to save space, but an occasional
bad frame can come in that, by random chance, specifies one of this type.
Was calling NULL because of that.  Now, just skip the frame and no crash.
2018-01-19 20:40:00 -08:00
Earle F. Philhower, III cffb424c2c WIP - build some code on the PC to run valgrind/etc. 2018-01-19 19:39:19 -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 5986831bd6 Fix I2S helpers to send/nonblock properly
The original I2S setup had the wrong # of bits being sent to the DAC
as well as wrong timeouts specified on the write_sample wrappers.
Fix those, allowing things like WebRadio.ino to work.
2018-01-19 10:01:43 -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
Earle F. Philhower, III 244007b0c5 Enable AAC-SBR on ESP-32, there's enough RAM
AAC-SBR allows for lower bitrates to have higher quality audio output,
and is used by many web radio stations.  It was disables on the ESP8266
due to RAM limitations (about 50KB too little), but the ESP32 has no
such problem.  Enable it automatically during compile.
2018-01-18 10:53:03 -08:00
Earle F. Philhower, III bd40d8af6f Include info on using BCLK/LRCLK as inputs w/SWDAC
The bit clock and l/r clock can be used as inputs, per issue #32 testing.
Explain how to do this in the readme.
2018-01-18 10:15:02 -08:00
Earle F. Philhower, III ddf4db187c Update to include 2.4 release + ESP32 support 2018-01-18 10:09:25 -08:00