Streaming mp3's (compiling error)

Understanding the language, error messages, etc.

Streaming mp3's (compiling error)

Postby nomisre » Wed Jul 30, 2014 11:14 am

Yesterday I was looking into the SD card audio streaming page on the wiki to see how you can stream audio, but I still can't manage to get it work.

I have very little programming experience, so bear with me if I say stupid things. I will try to explain what I've done so far.

I've downloaded the TimerOne library first and added the library to C:\Users\Username\Documents\Arduino\libraries. Then I've copied and pasted the exact code (I only changed "SAMPLE.RAW" into "FUSE.MP3") on the wiki page in a sketch file and saved it. So far so good, but when I try to compile the sketch I get several error messages saying:

C:\Program Files (x86)\Arduino\libraries\SD\utility\SdFile.cpp: In static member function 'static uint8_t SdFile::make83Name(const char*, uint8_t*)':
C:\Program Files (x86)\Arduino\libraries\SD\utility\SdFile.cpp:259: warning: only initialized variables can be placed into program memory area

C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:98: warning: comparison between signed and unsigned integer expressions
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In function 'void __vector_18()':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:127: warning: unused variable 'c'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In member function 'void HardwareSerial::begin(long unsigned int, byte)':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:368: warning: unused variable 'current_config'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:467: warning: comparison between signed and unsigned integer expressions

C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\Print.cpp:44: warning: '__progmem__' attribute ignored

C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino\Tone.cpp:119: warning: only initialized variables can be placed into program memory area

core.a(main.cpp.o): In function `main':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'


And I'm not quite sure how to fix this :|
nomisre
 
Posts: 6
Joined: Sat Jul 26, 2014 9:52 am

Re: Streaming mp3's (compiling error)

Postby juande » Thu Jul 31, 2014 9:47 pm

nomisre wrote:I only changed "SAMPLE.RAW" into "FUSE.MP3"

You can't play an mp3 with that code. Actually, you can. But it won't sound as you expect. :)

You need to use ffmpeg to convert the mp3 file to a raw file using the command you can find in the code comments
Here it is:

ffmpeg -i your_sound_file.mp3 -f s8 -acodec pcm_s8 -ar 20000 -ac 1 -af "volume=5dB" SAMPLE.RAW
juande
 
Posts: 17
Joined: Tue Mar 11, 2014 4:50 pm
Location: Spain

Re: Streaming mp3's (compiling error)

Postby 94k » Thu Jul 31, 2014 10:29 pm

Looks to me like you're missing the gamebuino libraries, did you follow the steps on
http://gamebuino.com/wiki/index.php?title=Getting_started#Install_the_Gamebuino_Library?
User avatar
94k
 
Posts: 44
Joined: Sun Jul 27, 2014 9:41 pm
Location: Germany

Re: Streaming mp3's (compiling error)

Postby nomisre » Thu Jul 31, 2014 10:41 pm

@ juane: Ok. Does it matter where I put "ffmpeg -i your_sound_file.mp3 -f s8 -acodec pcm_s8 -ar 20000 -ac 1 -af "volume=5dB" SAMPLE.RAW" in the sketch?

@ 94k: Yes, I've added the folders "Gamebuino" and "tinyFAT" to C:\Program Files (x86)\Arduino\libraries and "gamebuino_boot" to C:\Program Files (x86)\Arduino\hardware\arduino\bootloaders.
nomisre
 
Posts: 6
Joined: Sat Jul 26, 2014 9:52 am

Re: Streaming mp3's (compiling error)

Postby msevilgenius » Fri Aug 01, 2014 10:08 am

nomisre wrote:@ juane: Ok. Does it matter where I put "ffmpeg -i your_sound_file.mp3 -f s8 -acodec pcm_s8 -ar 20000 -ac 1 -af "volume=5dB" SAMPLE.RAW" in the sketch?


You don't put it in the sketch, you have to run it in the command line/terminal in the directory that the mp3 is in, you will need ffmpeg installed, if it isn't already, for it to work.

One more thing, do you have the TimerOne library installed too?
User avatar
msevilgenius
 
Posts: 12
Joined: Tue Mar 25, 2014 11:10 am

Re: Streaming mp3's (compiling error)

Postby nomisre » Fri Aug 01, 2014 11:25 am

msevilgenius wrote:
nomisre wrote:@ juane: Ok. Does it matter where I put "ffmpeg -i your_sound_file.mp3 -f s8 -acodec pcm_s8 -ar 20000 -ac 1 -af "volume=5dB" SAMPLE.RAW" in the sketch?


You don't put it in the sketch, you have to run it in the command line/terminal in the directory that the mp3 is in, you will need ffmpeg installed, if it isn't already, for it to work.

One more thing, do you have the TimerOne library installed too?


Yes, I have installed the TimerOne library and added it to Arduino. Installed FFmpeg succesfully now also and made a RAW-file of the MP3.

EDIT: It works now! Thanks :D
Last edited by nomisre on Fri Aug 01, 2014 8:51 pm, edited 1 time in total.
nomisre
 
Posts: 6
Joined: Sat Jul 26, 2014 9:52 am

Re: Streaming mp3's (compiling error)

Postby msevilgenius » Fri Aug 01, 2014 12:58 pm

Your welcome
User avatar
msevilgenius
 
Posts: 12
Joined: Tue Mar 25, 2014 11:10 am


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 68 guests

cron