<div class="alert alert-block alert-info" style="font-size:20px; background-color: #fffff; font-family:verdana; color: #ec4949; border-radius: 10px; border: 0px #533078 solid">
<h1>streamlit-audio-widgets</h1>
</div>
**Ask any questions. I will be very grateful if you rate the repository ⭐️**
<div class="alert alert-block alert-info" style="font-size:20px; background-color: #0b0e22; font-family:verdana; color: #423a7f; border-radius: 10px; border: 0px #533078 solid">
Need upload and preprocess an audio file with a crazy extension? 🫣
<br>We support converting all formats to a single standard, since ffmpeg is under the hood!<br>
Do you need to record audio rather than upload?
<br>This widget has a built-in recorder.<br>
</div>
## Installation & setup
### 1. Install widget from PyPI
```shell
pip install streamlit-audio-widgets
```
### 2. Make sure that you have the C++ ffmpeg library installed on your computer.
<br>Its absence will lead to an [error](https://stackoverflow.com/questions/62470863/ffmpeg-command-not-found-but-pip-list-shows-ffmpeg).<br>
If you are not sure that you have it, then run the command below (only for Unix)
```shell
sudo apt install ffmpeg
```
## How to use?
### import package with widget
```python
from soundlit import AudioWidget
```
### initialize component
```python
# Custom streamlit component for audio recording and uploading
widget = AudioWidget()
# You can see params of AudioWidget belove:
# min_duration: minimum duration of audio file (By default: 0 seconds)
# max_duration: maximum duration of audio file (By default: 60_000 seconds)
# available_formats: audio files with which formats available for uploading
# convert_to: what format to convert an audio file into if it needs to be converted (By default .wav)
# execlude_convert: audio files with which formats do not require conversion to a supported format
# sample_rate: sampling rate to which the audio file will be resampled
# mono: convert waveform to mono format with one channel if True else load 2 channels
```
### use only recorder
```python
audio = widget.record_audio()
```
### or only uploader for all audio formats
```python
audio = widget.load_audio()
```
### and finally you can use the whole widget
```python
audio = widget.get_audio()
```
## How change recoder style?
### 1. Install [node](https://nodejs.org/en/download) >= 16
### 2. Go to the cloned project directory, then to the audio_widgets package, and finally to the fronted folder.
```shell
cd ./audio_widgets/frontend
```
### 3. Install all fronted dependencies
```npm
npm i
```
### 4. Set Node options for legacy support
#### on Unix-like (Linux, macOS, Git bash, etc.)
```shell
export NODE_OPTIONS=--openssl-legacy-provider
```
#### on Windows command prompt
```shell
set NODE_OPTIONS=--openssl-legacy-provider
```
#### on PowerShell
```shell
$env:NODE_OPTIONS = "--openssl-legacy-provider"
```
### 5. Change component style
#### go to the file at the path below in any text editor
```shell
cd ./audio_widgets/frontend/src/StreamlitAudioRecorder.tsx
```
#### and change the styles that start from line 59
```html
<AudioReactRecorder
state={recordState}
onStop={this.onStop_audio}
type='audio/wav'
backgroundColor='#000000'
foregroundColor='#6633CC'
canvasWidth={450}
canvasHeight={100}
/>
```
### 6. Remove current frontend build
```shell
rm -rf ./audio_widgets/frontend/build
```
### 7. Build new fronted comnponent
```shell
npm run build
```
### 8. Remove all dependencies unless you no longer need to change the style
#### on Unix-like (Linux, macOS)
```shell
rm -rf node_modules
```
#### on Windows
```shell
npm i -g rm
rm -rf node_modules
```
Raw data
{
"_id": null,
"home_page": "https://github.com/YeaMerci/streamlit-audio-widgets",
"name": "soundlit",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "waveform,converting,streamlit-audio-recorder,recorder,audio,streamlit,streamlit-component",
"author": "YeaMerci",
"author_email": "entertomerci@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/4a/e8/ad55824815cf580fe6c8f6236dd1e4cf17b3e23564ab461457279ee91b3e/soundlit-0.1.0.tar.gz",
"platform": null,
"description": "<div class=\"alert alert-block alert-info\" style=\"font-size:20px; background-color: #fffff; font-family:verdana; color: #ec4949; border-radius: 10px; border: 0px #533078 solid\">\n <h1>streamlit-audio-widgets</h1>\n</div>\n\n**Ask any questions. I will be very grateful if you rate the repository \u2b50\ufe0f**\n\n<div class=\"alert alert-block alert-info\" style=\"font-size:20px; background-color: #0b0e22; font-family:verdana; color: #423a7f; border-radius: 10px; border: 0px #533078 solid\">\n Need upload and preprocess an audio file with a crazy extension? \ud83e\udee3 \n <br>We support converting all formats to a single standard, since ffmpeg is under the hood!<br>\n Do you need to record audio rather than upload? \n <br>This widget has a built-in recorder.<br>\n</div>\n\n## Installation & setup\n### 1. Install widget from PyPI\n```shell\npip install streamlit-audio-widgets\n```\n### 2. Make sure that you have the C++ ffmpeg library installed on your computer. \n<br>Its absence will lead to an [error](https://stackoverflow.com/questions/62470863/ffmpeg-command-not-found-but-pip-list-shows-ffmpeg).<br> \nIf you are not sure that you have it, then run the command below (only for Unix)\n```shell\nsudo apt install ffmpeg\n```\n\n## How to use?\n### import package with widget\n```python\nfrom soundlit import AudioWidget\n```\n\n### initialize component\n```python\n# Custom streamlit component for audio recording and uploading\nwidget = AudioWidget() \n\n# You can see params of AudioWidget belove:\n# min_duration: minimum duration of audio file (By default: 0 seconds)\n# max_duration: maximum duration of audio file (By default: 60_000 seconds)\n# available_formats: audio files with which formats available for uploading\n# convert_to: what format to convert an audio file into if it needs to be converted (By default .wav)\n# execlude_convert: audio files with which formats do not require conversion to a supported format\n# sample_rate: sampling rate to which the audio file will be resampled\n# mono: convert waveform to mono format with one channel if True else load 2 channels\n```\n\n### use only recorder \n```python\naudio = widget.record_audio()\n```\n\n### or only uploader for all audio formats\n```python\naudio = widget.load_audio()\n```\n\n### and finally you can use the whole widget\n```python\naudio = widget.get_audio()\n```\n\n## How change recoder style?\n### 1. Install [node](https://nodejs.org/en/download) >= 16\n### 2. Go to the cloned project directory, then to the audio_widgets package, and finally to the fronted folder.\n```shell\ncd ./audio_widgets/frontend\n```\n### 3. Install all fronted dependencies \n```npm\nnpm i\n```\n### 4. Set Node options for legacy support \n#### on Unix-like (Linux, macOS, Git bash, etc.)\n```shell\nexport NODE_OPTIONS=--openssl-legacy-provider\n```\n\n#### on Windows command prompt\n```shell\nset NODE_OPTIONS=--openssl-legacy-provider\n```\n\n#### on PowerShell\n```shell\n$env:NODE_OPTIONS = \"--openssl-legacy-provider\"\n```\n\n### 5. Change component style\n#### go to the file at the path below in any text editor\n```shell\ncd ./audio_widgets/frontend/src/StreamlitAudioRecorder.tsx\n```\n#### and change the styles that start from line 59\n```html\n<AudioReactRecorder\nstate={recordState}\nonStop={this.onStop_audio}\ntype='audio/wav'\nbackgroundColor='#000000'\nforegroundColor='#6633CC'\ncanvasWidth={450}\ncanvasHeight={100}\n/>\n```\n\n### 6. Remove current frontend build\n```shell\nrm -rf ./audio_widgets/frontend/build\n```\n\n### 7. Build new fronted comnponent\n```shell\nnpm run build\n```\n\n### 8. Remove all dependencies unless you no longer need to change the style\n#### on Unix-like (Linux, macOS)\n```shell \nrm -rf node_modules\n``` \n#### on Windows\n```shell\nnpm i -g rm\nrm -rf node_modules\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "The package contains a ready-to-use streamlit widget for downloading or recording audio. There is support for most audio formats.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/YeaMerci/streamlit-audio-widgets"
},
"split_keywords": [
"waveform",
"converting",
"streamlit-audio-recorder",
"recorder",
"audio",
"streamlit",
"streamlit-component"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ae8ad55824815cf580fe6c8f6236dd1e4cf17b3e23564ab461457279ee91b3e",
"md5": "d0d88fa3505b91a4f5ec12a80af7bc10",
"sha256": "ffec84e02d0fd96cf9131dc306bd042a1c234b73c3ac4b8d006a1cf13ebda2fc"
},
"downloads": -1,
"filename": "soundlit-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d0d88fa3505b91a4f5ec12a80af7bc10",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 19481,
"upload_time": "2023-12-15T02:09:46",
"upload_time_iso_8601": "2023-12-15T02:09:46.532902Z",
"url": "https://files.pythonhosted.org/packages/4a/e8/ad55824815cf580fe6c8f6236dd1e4cf17b3e23564ab461457279ee91b3e/soundlit-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-15 02:09:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "YeaMerci",
"github_project": "streamlit-audio-widgets",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "soundlit"
}