Hello all,
I am working on a project using a teensy 3.2 and a Prop Shield (lite version). The 3.2 and shield are directly soldered together using header pins.
Sample programs using "AudioPlayMemory" work fine, but trying to extend to "AudioPlaySerialflashRaw" has been giving me trouble.
Here's an image of my Audio System Design:
And here's my source code. Also included in the Arduino Project is the "AudioSampleCashregister" .h and .cpp files.
This code works, but when I uncomment the "playFlashRaw1.play("hard.raw");" line, neither the hard.raw file plays, nor does the Cash Register effect.
I generated hard.raw using Audacity -- the original file is a .wav file that is "Mono, 44100hz, 32-bit float". I exported it by going to "File -> Export -> Export Audio". Under "Save as type", I chose "Other Uncompressed Files", and under "Format Options", I chose "Header: RAW (Header-less)", and "Encoding: Signed 16-bit PCM". I am not sure if this is LSB, as that isn't an option given to me.
I used TeensyTransfer to load "hard.raw" onto the Prop Shield's Serial Flash, and checked the contents using the following command:
My guess is that my converted file is in the wrong format, or I am misunderstanding how to use the SerialFlash in code. Any help would be appreciated
I've attached my raw file in a zip folder below, if anyone wants to take a peek at it.
Thanks!
I am working on a project using a teensy 3.2 and a Prop Shield (lite version). The 3.2 and shield are directly soldered together using header pins.
Sample programs using "AudioPlayMemory" work fine, but trying to extend to "AudioPlaySerialflashRaw" has been giving me trouble.
Here's an image of my Audio System Design:
And here's my source code. Also included in the Arduino Project is the "AudioSampleCashregister" .h and .cpp files.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioPlaySerialflashRaw playFlashRaw1; //xy=202,171
AudioPlayMemory playMem1; //xy=231,132
AudioMixer4 mixer1; //xy=444,158
AudioOutputAnalog dac1; //xy=609,162
AudioConnection patchCord1(playFlashRaw1, 0, mixer1, 1);
AudioConnection patchCord2(playMem1, 0, mixer1, 0);
AudioConnection patchCord3(mixer1, dac1);
// GUItool: end automatically generated code
// WAV files converted to code by wav2sketch
#include "AudioSampleCashregister.h" // http://www.freesound.org/people/kiddpark/sounds/201159/
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(10);
// by default the Teensy 3.1 DAC uses 3.3Vp-p output
// if your 3.3V power has noise, switching to the
// internal 1.2V reference can give you a clean signal
dac1.analogReference(INTERNAL);
delay(50); // time for DAC voltage stable
pinMode(5, OUTPUT);
digitalWrite(5, HIGH); // turn on the amplifier
delay(10); // allow time to wake up
mixer1.gain(0, 0.4);
mixer1.gain(1, 0.4);
}
void loop() {
playMem1.play(AudioSampleCashregister);
//playFlashRaw1.play("hard.raw");
delay(2000);
}
This code works, but when I uncomment the "playFlashRaw1.play("hard.raw");" line, neither the hard.raw file plays, nor does the Cash Register effect.
I generated hard.raw using Audacity -- the original file is a .wav file that is "Mono, 44100hz, 32-bit float". I exported it by going to "File -> Export -> Export Audio". Under "Save as type", I chose "Other Uncompressed Files", and under "Format Options", I chose "Header: RAW (Header-less)", and "Encoding: Signed 16-bit PCM". I am not sure if this is LSB, as that isn't an option given to me.
I used TeensyTransfer to load "hard.raw" onto the Prop Shield's Serial Flash, and checked the contents using the following command:
Code:
.\teensytransfer.exe -l
1590720 hard.raw
My guess is that my converted file is in the wrong format, or I am misunderstanding how to use the SerialFlash in code. Any help would be appreciated
I've attached my raw file in a zip folder below, if anyone wants to take a peek at it.
Thanks!