samtap / fang-hacks

Collection of modifications for the XiaoFang WiFi Camera
1.67k stars 340 forks source link

How to play wav files using the speaker (explanation, not issue) #310

Closed marcalv closed 4 months ago

marcalv commented 6 years ago

I was really interested in using the speaker of the camera. First I tried flashing the sd card with this fork wich is able to play wav files. I bricked the cam and i had to solder wires and via serial flash the original software.

My firmware is 3.0.3.56 right now (I used git clone from this repo to apply the hack, not used the 0.2.0 image) and I can play wav files through the speaker. I would like to share the process, so this is not an issue at all I guess...

Under winfows download as zip the previous fork that I mentioned:

https://github.com/davidjb/fang-hacks

Copy all files in \data\usr\bin\ (fork) to /media/mmcblk0p2/data/usr/bin If filezilla asks to overwrite, just click on skip and do this for all.

Probably is not necessary to copy all this files... The idea is to copy all sound related files without modifying nothing else. I think that most important files are play.sh, pcm_play-48k and pcm_play and the ones that start with 'snx'.

Make executable all these copied files with "chmod 775" via ssh (via Filezilla returns unknown command).

Copy the folder \sounds\ (fork) to /media/mmcblk0p2/

The fork has two audio files in the sounds folder: alarm.wav and dog.wav. I'm only able to play them by doing

chmod 775 alarm.wav
chmod 775 dog.wav

Now, via ssh you can use this commands:

#Enable the skeaker
gpio_aud write 1 4 1

#Play alarm.wav (crtl+c to stop)
pcm_play-48k alarm.wav

#Disable the skeaker
gpio_aud write 1 4 0

#Adjust volume (15 is the highest I can get)
snx_audio_vol_ctl -d spk -v 15

Thanks to @davidjb .

dvv commented 6 years ago

You can also try relevant binaries and techniques #305