---
# System prepended metadata

title: Audio Message Handle

---

# Audio Message Handle 

1. problem with audio file format
- we don't have standard audio format. 

2. problem with client app
- mostly client app send audio as "record.wav"
- but the metadata is "audio/mpeg" (metadata for mp3)
- sometimes failed to send audio message. (at least matrix doesn't received the file)

3. problem with matrix 
- sometimes matrix did not received the file 
- something we failed to download audio from matrix 
- matrix failed send audio message (using wave format)

4. problem with API
- the API so far only support, 
	- audio/x-wav
	- frame_rate=16000, channels=1, sample_width=2 
- slow response 
	- for 9s audio need more than 10 seconds. 
	- sometimes error for long audio (9s)
	- often error for long audio (9s)
		- error message {'is_success': False, 'err': "'results'"}

5. success case. 
- upload audio/mpeg (mp3) to matrix 
- send message 
- convert mp3 to wave 16000 frame rate
- send to audio to text api
- reply user with text 


6. Propose solution 
- upload audio to matrix using "audio/mpeg" format (mp3)
	- implemented by client app
- send audio message using "audio/mpeg" format (mp3)
	- implemented by client app
- convert "audio/mpeg" to wave 16k frame rate
	- implemented by Lalebot (botlami)
- Send converted audio to external API. 
	- Botlami reply audio message with text. 
