Forum Rule: Always post complete source code & details to reproduce any issue!
Instructions or tutorials for using wav2sketch?
Are there more detailed step by step instructions somewhere for using wav2sketch to convert .wav files to data arrays? "The wav2sketch program can convert WAV files to the data arrays needed by AudioPlayMemory" isn't very illuminating, at least for me who's more of a GUI/WYSIWYG guy. My searches haven't revealed detailed instructions.
I see links to some C source code and a Window executable. I don't know how you make C source code run in Terminal on a Mac. Initial searches indicate installing developer tools. I don't poke around in Terminal that much; it frightens me a bit.
I attempted to launch the Windows .exe in Windows 8 in VMWare Fusion, but nothing visible happened when I tried to run the .exe. I'm not a Windows guy, either.
After a lot of troubleshooting I was able to get a modified version of the SamplePlayer example sketch to play through the Teensy 3.2 DAC and into my little Sparkfun amp and small speaker. My next step is to try to replace those sounds with the two sound effects I need for my project, hence this request for help.
The wav2sketch program looks for *.wav files in your current directory and creates .h and .cpp files to put in your sketch folder.
So if you download wav2sketch.exe into your windows Downloads folder, then put your .wav files in the Downloads folder and open a command window in the Downloads folder (or cd to it). Then run wav2sketch from the command window
for linux, compile wav2sketch.c and run it in directory with your .wav files
Last edited by manitou; 02-27-2017 at 01:57 PM.
It's amazing to me how often people ask a question or talk about I feature, library or tool that I didn't even know existed that is perfect for something I'm about to do. I hadn't yet got into playing waves for canned sounds but just when I start thinking along those lines a post starts with all I could have wanted to know. The same with actual working code to have USB audio without an audio board, the Snooze library and more. A big thanks to Paul and the fantastic community here. Far better that some other arm communities/chip sets I tried in the past.
You're going to have to run it in Terminal. Here's a copy compiled for macintosh.
To use this, first create an empty folder. I made a folder called "wav2sketch" from my home dir. Put the zip file in that folder and extract it. Also put some WAV files in the folder. This program converts whatever WAV files happen to be in the same folder.
To get set up, you're going to type 3 commands. First use "cd wav2sketch" (or whatever folder name you used) to change the current working directory to the folder you created. Then type "ls -l" to see a list of files. The only reason for "ls -l" it to make sure you've successfully changed to the folder where you put this stuff. If your Terminal opens with you using a different folder, you're going to have to fiddle with "cd" commands until you manage to get to the folder you created.
(click for full size)
Once you get to the folder and you can see the files with "ls -l", there's one more prep command to type: "chmod 755 wav2sketch". This sets the execute permission, so you can actually run the file. Like most unix commands "no news is good news", it prints nothing if it works. See the screenshot above.
Then to run it, type "./wav2sketch". If you get "Permission Denied" the chmod command didn't work. If it works, it'll print a few lines telling you what it did (not the normal "no news" unix approach). You should see something like this:
(click for full size)
Probably best to do with with a familiar Finder window open next to Terminal, as I did for these screenshots. When it works, you'll see the Arduino compatible .cpp and .h files appear. Or you can type "ls -l" in Terminal, but at this point you can just quit Terminal and use the files.
Thanks, Paul, for taking the time to compile the code and create these step-by-step instructions for someone like me who's not savvy working in a command line environment. I appreciate the help.
I'll give this a go.