I have the project to built a DCC digital locomotive (see NmraDcc on Github).
For the command of electric motors and lights, the Arduino is enough without any problems.
But to sound the locos (electric, diesel or steam), I need more memories.
So, I have choosen the Teensy 3.2.
I start with the example :"SamplePlayer" https://github.com/PaulStoffregen/Audio/blob/master/examples/SamplePlayer/SamplePlayer.ino"
I removed all the instructions regarding the shield : AudioControlSGTL5000 audioShield or SD Shield
Obviously, I shall later change "AudioSampleSnare" by "Compressor release", "Horn", "Brake", . . . and sounds will be synchronized with speed, acceleration, deceleration or DCC commands for "Horn".
But, I got the following message on IDE Arduino:
C:\Documents\Arduino\PlayFromSketchV0\PlayFromSketchV0.ino:13:92: fatal error: AudioSampleSnare.h: No such file or directory
compilation terminated.
SamplePlayer.ino
AudioSampleSnare.cpp
AudioSampleSnare.h
Thanks
For the command of electric motors and lights, the Arduino is enough without any problems.
But to sound the locos (electric, diesel or steam), I need more memories.
So, I have choosen the Teensy 3.2.
I start with the example :"SamplePlayer" https://github.com/PaulStoffregen/Audio/blob/master/examples/SamplePlayer/SamplePlayer.ino"
I removed all the instructions regarding the shield : AudioControlSGTL5000 audioShield or SD Shield
Obviously, I shall later change "AudioSampleSnare" by "Compressor release", "Horn", "Brake", . . . and sounds will be synchronized with speed, acceleration, deceleration or DCC commands for "Horn".
But, I got the following message on IDE Arduino:
C:\Documents\Arduino\PlayFromSketchV0\PlayFromSketchV0.ino:13:92: fatal error: AudioSampleSnare.h: No such file or directory
compilation terminated.
SamplePlayer.ino
Code:
#include <output_dac.h>
#include <play_memory.h>
#include <Audio.h>
// WAV files converted to code by wav2sketch
#include "AudioSampleSnare.h" // http://www.freesound.org/people/KEVOY/sounds/82583/
// Create the Audio components. These should be created in the
// order data flows, inputs/sources -> processing -> outputs
AudioPlayMemory sound0;
AudioOutputAnalog dac; // play to both I2S audio board and on-chip DAC
// Create Audio connections between the components
//
AudioConnection c1(sound0,dac);
void setup() {
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(10);
analogWriteResolution(12);
// turn on the output
// audioShield.enable();
// audioShield.volume(50);
// 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
//dac.analogReference(INTERNAL);
}
void loop() {
sound0.play(AudioSampleSnare);
}
AudioSampleSnare.cpp
Code:
// Audio data converted from WAV file by wav2sketch
// Converted from AudioSampleSnare.wav, using 22050 Hz, u-law encoding
const unsigned int AudioSampleSnare [2817] = {
0x02002BD3,0x65636656,0x6B6A6B67,0x7071706F,0x43637171,0x29ABBA23,0x3137474C,0x3A4A544D,
0x30C1542C,0xE14F6360,0xEDDCE2E6, ............................................
};
AudioSampleSnare.h
Code:
// Audio data converted from WAV file by wav2sketch
extern const unsigned int AudioSampleSnare[2817];