Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i need music encoder

Status
Not open for further replies.
Please be more specific. Are you asking for a program to digitize music and if so, in what format, there are hundreds of different formats. Also, what format to you want the hex code to be in?

Brian.
 

Please be more specific. Are you asking for a program to digitize music and if so, in what format, there are hundreds of different formats. Also, what format to you want the hex code to be in?

Brian.

I want to make a sound generator using AT89C2051 in ASM format.
The resulting sound varies, eg police alarm, horn, sirene, ambulance, fire, gun effects, the effects of the bomb, until a song, etc..
Just use the button to move it.
Can you help me to help make sound effects using a voice changer software hex format (encode sound)

The example of my program .. police sirens, I just use it to make sense of the sound, for that I want to make it more accurate
Code:
	FLAG EQU 07FH
	SPEAKER EQU  P1.0

mulai:
	ORG 0000H
	AJMP MAIN


ISR:
	ORG 000BH
	LCALL ACTION
RETI


	ORG 0050H

MAIN: 
	MOV TMOD,#00010001B      ;
	MOV IE,#82H        ;
	MOV TH0,#0H;dc
	MOV TL0,#00H
	SETB TR0
	 MOV DPTR,#effect1


	MOV R0,#02

LOOP1:
	ACALL sound_effect
	CJNE R0,#02,CARRY_ON     
	SJMP MAIN          ;

CARRY_ON:
	ACALL PLAY
	SJMP LOOP1

PLAY:
	
	CLR EA
	SETB FLAG
	SETB EA

	RUN:
		JNB FLAG,STOP

	DO:
		CJNE R0,#0,START
		SJMP RUN

	START:
		MOV TH1,R2
		MOV TL1,R3
		SETB TR1
	
	HERE:   
      		JNB TF1,HERE

		CLR TF1
		CLR TR1
		CPL SPEAKER
		SJMP RUN

	STOP:   
		CLR SPEAKER

RET


sound_effect:
		CLR A
		MOVC A,@A+DPTR
		MOV R0,A ;pengulangan
		INC DPTR
	
		CLR A
		MOVC A,@A+DPTR
		MOV R1,A ;tone length
		INC DPTR
	
		CLR A
		MOVC A,@A+DPTR
		MOV R2,A ;tone
		INC DPTR

		CLR A
		MOVC A,@A+DPTR
		MOV R3,A
		INC DPTR
		RET


ACTION:
	CLR TR0
	CJNE R1,#0,DO2
	CLR FLAG
	SJMP DO3
DO2:    DEC R1
DO3:
	MOV TH0,#0abH ;delay/tempo
	MOV TL0,#00H
	SETB TR0
RET


effect1:  

;          R0 R1   R2  R3  
		
	DB 1,1,0feH,09cH
	DB 1,1,0feH,08cH
	DB 1,1,0feH,07cH
	DB 1,1,0feH,06cH
	DB 1,1,0feH,05cH
	DB 1,1,0feH,04cH
	DB 1,1,0feH,03cH
	DB 1,1,0feH,02cH
	DB 1,1,0feH,01cH
	DB 1,1,0feH,0cH
	DB 2,0,0,0

	END

thx
 
Last edited:

So what you are asking for is an assembly language program to play sound files that runs on an AT89C2051.

I cannot help with the code because I am not very familiar with the Atmel / MCS-50 processors but if you want to expand to play longer and more complicated sound and music files you will need to use a different technique than programmng an oscillator. The normal method used is to produce the sound using PWM then pass it through a low pass filter to average the samples. That method allows you to use WAV format files which you can record or edit in a PC application. The problem with this is the amount of memory it needs, you would not have enough space inside the AT89C2051 to store more than maybe 0.5 second of sound so an external memory IC would be necessary.

Perhaps other EDAboard users will be able to help or know of a WAV program you can use as an example. It can certainly be done though, I have used PIC processors to play speech files in projects before now.

Brian
 

So what you are asking for is an assembly language program to play sound files that runs on an AT89C2051.

I cannot help with the code because I am not very familiar with the Atmel / MCS-50 processors but if you want to expand to play longer and more complicated sound and music files you will need to use a different technique than programmng an oscillator. The normal method used is to produce the sound using PWM then pass it through a low pass filter to average the samples. That method allows you to use WAV format files which you can record or edit in a PC application. The problem with this is the amount of memory it needs, you would not have enough space inside the AT89C2051 to store more than maybe 0.5 second of sound so an external memory IC would be necessary.

Perhaps other EDAboard users will be able to help or know of a WAV program you can use as an example. It can certainly be done though, I have used PIC processors to play speech files in projects before now.

Brian


If you ever use PIC processors as a sound generator, if you please share here as a comparison my project though different processor
 

I'm sorry but I cannot post my project that produced PWM sound from a PIC becuase this is confidential to my client. If you look on the Microchip web site there are examples of how to do it which you may be able to adapt to your processor. Some PICs already have stereo sound outputs though which makes them much easier to use in applications like yours. I'm not sure if Atmel have equivalent hardware.

Brian.
 

Use APR33A3 chip which can store 8 voice messages (sounds). Record 8 different sounds into it. Play different sounds by triggering different voice messages. uC will trigger the APR33A3-C3.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top