Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ericzundel/fix dvolume Resolves #3, library requires changing WaveHC.h DVOLUME to 1 #5

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ericzundel
Copy link

@ericzundel ericzundel commented Oct 11, 2022

It's Halloween again. I dug out an old WaveShield kit, soldered it up, and started playing with it for the makers in my school's makerspace. It didn't work right away. Having used this before in a previous project https://blog.adafruit.com/2009/09/04/electric-plunger/, I knew that it used to work.

I quickly found the issue in #3 which is a few years old.
Essentially, the WaveHC library 1.0.2 and beyond is currently broken out of the box which really stinks
when using the Arduino Cloud IDE. I saw the proposed patch #4
which was not accepted. That patch allows the software to work again, but the code
is still broken if you try to disable software volume, which would be useful for playing
44kHz WAV files.

My fix turns DVOLUME back on by default and changes a hard error when it is set to 0 to a warning.

To test the changes, I found and fixed some other issues, updated a few comments, and fixed some formatting issues.

  • Describe any known limitations with your change. For example if the change
    doesn't apply to a supported platform of the library please mention it.

I only tested my change using an Arduino Uno.

I saw different files in the repo that looked like they are related to CI testing ( .uno.test.only, etc) but I don't understand how they work since these examples have to be run and examined manually.

I went through all the examples and ran them. When I went to test the code, I ran into a number of issues.

  • I added a sample .WAV file that is long enough for the SoftVolumeHC and SampleRateHC
    tests to work and updated the documentation in the code.
  • I fixed a bug in SampleRateHC.ino that reset the playback speed to normal when a new file was read.
  • I fixed a bug in SdReader.cpp around reading the size SDHC cards which caused
    SdReadTest to fail on my 32 GB SD card.

See related PRs #7 and #8.

Set software volume back on by default in WaveHC.h with DVOLUME=1
Replace fatal message when DVOLUME=0 in WaveHC.h with warning in play().
Add some documentation around using software volume.
Added some gratuitous comment changes as I was understanding the code.
Updated SoftVolumeHC example with shorter delay for smaller clips.
Added a sample WAV file for SampleRateHC that is long enough to be able
to adjust.
Fixed SampleRateHC to force a sample at the beginning of each WAV file
Added some extra output when reading from the SD card fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant