Libraries, utilities, bootloaders...
by deepsheet » Sun Aug 10, 2014 1:06 pm
Just for fun, I used an Arduino WAV player library on the Gamebuino to test the quality of the speaker
Here are the results. I know there is already an audio demo, but it doesn't use WAV files read from the SD
Unfortunately, enabling the Gamebuino library disables the WAV audio. Is there a way to "disable" Gamebuino's Sound library?
https://vine.co/v/MVxtgrWVvJH
-
deepsheet
-
- Posts: 10
- Joined: Fri Aug 01, 2014 6:18 pm
by ripper121 » Mon Aug 11, 2014 8:24 am
Go to the lib files search for it and write a If around it with a flag you can set in the ino file
-
ripper121
-
- Posts: 224
- Joined: Fri Apr 04, 2014 2:02 pm
- Location: Germany
by rodot » Mon Aug 11, 2014 9:11 am
You can set NUM_CHANNEL to 0 in the file settings.c in the Gamebuino library
-
rodot
- Site Admin
-
- Posts: 1290
- Joined: Mon Nov 19, 2012 11:54 pm
- Location: France
-
by albertinjo » Mon Aug 11, 2014 8:39 pm
What library have you used, can we have a look at the code please.
-
albertinjo
-
- Posts: 98
- Joined: Wed Mar 26, 2014 2:26 pm
by deepsheet » Fri Aug 15, 2014 2:31 pm
Hello and sorry for the long delay
I used the
https://github.com/TMRh20/TMRpcm library mainly because I have used it in the past for other Arduino projects. The only change you need to make is to uncomment USE_TIMER2 in pcmConfig.h and use pin 3 in your sketches
Everything else (including converting every file to wav) is included in the project wiki.
I was planning on making a simple wav player but lost interest in favor to other Gamebuino apps I'm planning
-
deepsheet
-
- Posts: 10
- Joined: Fri Aug 01, 2014 6:18 pm
by Matrix828 » Fri Aug 15, 2014 3:03 pm
deepsheet wrote:I was planning on making a simple wav player but lost interest in favor to other Gamebuino apps I'm planning
Like what? Details please, I'm curious
-
Matrix828
-
- Posts: 43
- Joined: Tue Jul 22, 2014 7:44 pm
-
by quosa » Sun Jan 11, 2015 11:42 pm
Program runs with gamebuino library and TMRpcm-WAV library but hangs after playing first wav; any idea?
- Code: Select all
#include <SD.h>
#include <SPI.h>
#include <Gamebuino.h>
#include <TMRpcm.h>
Gamebuino gb;
TMRpcm tmrpcm;
#define SD_ChipSelectPin 10
#define SPEAKER 3
File dataFile;
void setup(){
pinMode(SD_ChipSelectPin, OUTPUT);
pinMode(SPEAKER, OUTPUT);
tmrpcm.speakerPin = SPEAKER; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
gb.begin();
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
Serial.println("SD fail");
return; // don't do anything more if not
}else
{
Serial.println("SD Ok");
}
initGame(); // Titlescreen
}
void initGame(){
gb.titleScreen(F("Quosa's Spacedelivery"));
//gb.popup(F("Game is not Saved!"), 100);
}
void loop(){
if(gb.update()){
if(gb.buttons.pressed(BTN_A)){
tmrpcm.play("2.wav");}
}
}
-
quosa
-
- Posts: 10
- Joined: Thu Nov 13, 2014 12:47 pm
by Muessigb » Thu May 21, 2015 11:40 am
quosa wrote:Program runs with gamebuino library and TMRpcm-WAV library but hangs after playing first wav; any idea?
- Code: Select all
#include <SD.h>
#include <SPI.h>
#include <Gamebuino.h>
#include <TMRpcm.h>
Gamebuino gb;
TMRpcm tmrpcm;
#define SD_ChipSelectPin 10
#define SPEAKER 3
File dataFile;
void setup(){
pinMode(SD_ChipSelectPin, OUTPUT);
pinMode(SPEAKER, OUTPUT);
tmrpcm.speakerPin = SPEAKER; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
gb.begin();
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
Serial.println("SD fail");
return; // don't do anything more if not
}else
{
Serial.println("SD Ok");
}
initGame(); // Titlescreen
}
void initGame(){
gb.titleScreen(F("Quosa's Spacedelivery"));
//gb.popup(F("Game is not Saved!"), 100);
}
void loop(){
if(gb.update()){
if(gb.buttons.pressed(BTN_A)){
tmrpcm.play("2.wav");}
}
}
I don't know if you noticed it, but I actually contributed to the tmrpcm library. I made the ID3 tag parser.
Well, the problem is, that it takes way to much ram to work on the Gamebuino, which has a little less available user ram than the Arduino Uno, because of the screen. Also, the wav decoder sometimes crashes because of some garbage at the end. I made my player completely myself because of this ram problem, so no libs used. It has the exact same sound quality, but the files need to be converted to raw before played.
I have no ram problems, as I'm streaming directly from SD (with a 64 bytes ring buffer). If you need any help, just ask me. I'd also love if you contribute to my player, and help improving it, than making a race out of everything
-
Muessigb
-
- Posts: 45
- Joined: Tue Dec 09, 2014 5:49 pm
- Location: Germany
-
Return to Software Development
Who is online
Users browsing this forum: No registered users and 29 guests