Talking Guess the Number game

Rick100

Senior Member
I've been working on playing audio stored on a Winbond W25Q80 flash memory chip. The results have been pretty good so I wrote a simple and silly guess the number game to demonstrate it. Here's a youtube clip.

https://youtu.be/SNK85AFBNos

The chip has one meg or 1048576 bytes of memory and can store 85 seconds of audio sampled at 12300 Hertz. The 12300 Hertz was chosen to match the speed of the playback loop in the 20X2. The Winbond chip is very easy to read from. Pull the /CS line low and then send the read command byte followed by the 3 address bytes . Then you can read continuously from the chip until /CS is returned high. The playClip subroutine in the program can play a clip starting at any address and of any length. Since I didn't want a 24 bit compare in the playback loop to determine the end of the clip , 16 bytes of data is read and poked into the pwm duty register each time through the loop. So the playback length can be held in 16 bits. The output is a pwm signal into a simple RC filter fed into a PC speaker amp.

sound_filter.png

The hard part of the project is getting the sound files into the memory chip. I modified a vb.net program I've been using to program 12c eeproms like the 24lc256, so it will handle the 24 bit Winbond chip. The sound files were recorded with Audacity. The process for getting the files into the right format is described in post 36 of this thread.

http://www.picaxeforum.co.uk/showthread.php?27408-PWM-music/page4

Here's the Picaxe code.
View attachment winbond_sound2.bas

Thanks,
Rick
 
Top