miaomiao
Posts: 22
Joined: Fri Jun 30, 2017 4:07 am

How to play .wav or .mp3 file in Geany

Tue Jul 18, 2017 9:12 am

Dear all, does anyone know how to do this?

I am using Raspberyy Pi 2 and Geany in C language. I am also using bcm2835 for gpio for a LED. If LED on, play "Giveway.mp3" or "Giveway.wav" audio. I connect a headphone to micro USB. But I dont know how to play sound in Geany using C language. Can anyone help me? Thank you very much.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: How to play .wav or .mp3 file in Geany

Tue Jul 18, 2017 9:56 am

Geany is an editor for text files.

It does not make sense to attempt to use Geany to play audio files.

User avatar
PeterO
Posts: 5878
Joined: Sun Jul 22, 2012 4:14 pm

Re: How to play .wav or .mp3 file in Geany

Tue Jul 18, 2017 10:21 am

Being less pedantic that B.Goode...

Here is an example of using the alsa C API to play a wav file:

https://gist.github.com/ghedo/963382

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “General discussion”