Music by PWM on AVR

Thread Starter

John McMahon

Joined Dec 22, 2011
7
That looks like a lot of very helpful information and good tools, thanks. In my small amount of spare time, it'll keep me busy for a good while. There don't seem to be any basic significant obstacles in this project.
 

Pady

Joined Aug 10, 2017
2
Have a look at Roman Black's BTc sound compression algorithm:
http://www.romanblack.com/BTc_alg.htm

and his BTc sound encoder:
http://www.romanblack.com/picsound.htm

The sound quality is not great, but unless you have lots of memory and a good bit of computing power, it'll be difficult to get any kind of decent sound quality.

The first computer game I bought that had sound (voices) and music was "Galaxy Invasion" by Big Five Software, released in 1980. It was impressive that it made sound, as the TRS-80 Model I didn't even have a speaker! :eek: They got it to make sounds by switching current to an internal relay on and off; the relay was there to control a cassette tape deck which programs and data were saved to and loaded from.
A bit about the game: http://www.trs-80.org/galaxy-invasion/

Speaking of using non-speaker devices for producing sounds/music, you will probably find this YouTube video highly entertaining:

And the Imperial March:

A seasonal medley:
Well worth a listen.

This one is not to be missed!
Greetings.
I found this program " The BTC Sound Encoder", converted sound in wave files to code mikroC.C, Got the RC value but i dont know how to use the file converted in code of mikroC with Atmega8. Can anybody help me know how to use it with AVR Studio 5.

The circuit is attacked for your kind persual.
When we press SW12 we get the Buzzer going. Now we would like to send a audio sound to connect to Audio Mixer & produce the Music at the Speaker.

The code developed Starts like this:

//=====================================================
// AUTO CREATED FILE made by Windows BTc Sound Encoder
// v2.0 Copyright 2002-2008 - Roman Black
//
// Hippyware.
// www.RomanBlack.com
//=====================================================

// File Details:
// Size 61056 bits (7632 bytes)
// Sound encoded at 44100 bits/sec
// using BTc16 1bit Algorithm to be decoded on
// the following circuit:
//
//
// R = 1596 ohms
//
// Digital -----------R-----*----- Analogue
// | out
// |
// |
// C = 0.22 uF
// |
// |
// |
// Gnd
//
//
//=====================================================
// Bitstream data is MikroC .C table format,
// in 'functions' of 2048 bytes with a .C 'return' as
// the last of every 256 byte block. At the end of every
// 2048 bytes the C compiler inserts its own return.
//
// Bits are played from left to right, from ms_bit to
// ls_bit.
//=====================================================
//--------------------------------------------------
void sound_data1() org (1 * 256)
{
asm retlw 0xAA ;
asm retlw 0xAA ;


The code developed ends like this:


asm retlw 0x00 ;
// reserved for MikroC return!
//-------------------------------------
}




//---------------------------------------------------
// End of file.
//---------------------------------------------------

 
Last edited by a moderator:
Top