Convert an ulaw byte array to a wav array
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 540
- Forks
- 83
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
i'm trying to convert a raw 8k,8bit,mono ulaw byte array to a 16k,16bit,mono wav array.
It works if i write the byte array to a .raw file and use pysox like this:
```python
tfm = sox.Transformer()
tfm.set_input_format(rate=8000, channels=1, encoding="u-law",bits=8)
tfm.set_output_format(channels=1, rate=16000,bits=16)
def convert(data):
f = open("randomfilename.raw", "wb")
f.write(data)
f.close()
return (tfm.build_array(input_filepath="randomfilename.raw"))
```
But pysox has the capabilities to use build_array with an input_array parameter, but I dont know how to convert my byte array, so that it works.
Could you please help me?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's Python example and inspect pysox's Transformer.build_array API, especially its input_array parameter and input format handling. Determine whether raw 8 kHz, 8-bit mono u-law bytes can be passed directly, and consider the conversion complete when the result is a 16 kHz, 16-bit mono WAV array without writing a temporary raw file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100