Name | audio-recorder-streamlit JSON |
Version |
0.0.9
JSON |
| download |
home_page | None |
Summary | None |
upload_time | 2024-05-09 12:41:32 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Copyright (c) 2018-2021 Streamlit Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
streamlit
audio
input
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Audio record streamlit
This streamlit component allows to register an audio utterence from a user.
<img src="https://raw.githubusercontent.com/Joooohan/audio-recorder-streamlit/main/img/recorder.png" alt="recorder.png" width="200"/>
## Installation
`pip install audio-recorder-streamlit`
## Usage
```python
import streamlit as st
from audio_recorder_streamlit import audio_recorder
audio_bytes = audio_recorder()
if audio_bytes:
st.audio(audio_bytes, format="audio/wav")
```
## Recording parameters
You can adjust the recording parameters `energy_threshold` and
`pause_threshold`:
- `energy_threshold`: The energy recording sensibility above which we consider
that the user is speaking. If it is a float, then this is the energy
threshold used to automatically detect recording start and recording end.
You can provide a tuple for specifying different threshold for recording
start detection and recording end detection.
- `pause_threshold`: The number of seconds to spend below `energy_level` to
automatically stop the recording.
- `sample_rate`: Sample rate of the recorded audio. If not provided, this will use the
default sample rate (https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext).
- `auto_start`: If `True` starts the recording as soon as the component has loaded.
```python
# The recording will stop automatically
# 2 sec after the utterance end
audio_bytes = audio_recorder(pause_threshold=2.0, sample_rate=41_000)
```
## Styling parameters
You can adjust the button style parameters:
- **Text**: specify the text displayed next to the icon
- **Icon**: specify the icon among the font awesome solid icons
(https://fontawesome.com/search?o=r&s=solid)
- **Color**: specify the neutral color and recording color.
- **Size**: specify the icon size using font awesome sizing
(https://fontawesome.com/docs/web/style/size).
```python
audio_bytes = audio_recorder(
text="",
recording_color="#e8b62c",
neutral_color="#6aa36f",
icon_name="user",
icon_size="6x",
)
```
<img src="https://raw.githubusercontent.com/Joooohan/audio-recorder-streamlit/main/img/custom.png" alt="custom.png" width="200"/>
# Frequently Asked Question
## How can I record for a fixed duration ?
You can record for a fixed duration by setting the `energy_threshold=(-1.0, 1.0)`
so that the recorder considers that you are speaking at the beginning and then
you are never speaking from this point on.
Then simply set `pause_threshold` to your desired recording length.
```python
# Records 3 seconds in any case
audio_bytes = audio_recorder(
energy_threshold=(-1.0, 1.0),
pause_threshold=3.0,
)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "audio-recorder-streamlit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "streamlit, audio, input",
"author": null,
"author_email": "Johan Leduc <johan.leduc90@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/0d/a8/1f8bc8f22ab2809769a025afe25ea3e66a85c9037973382a6d8ddaaea36a/audio_recorder_streamlit-0.0.9.tar.gz",
"platform": null,
"description": "# Audio record streamlit\n\nThis streamlit component allows to register an audio utterence from a user.\n\n<img src=\"https://raw.githubusercontent.com/Joooohan/audio-recorder-streamlit/main/img/recorder.png\" alt=\"recorder.png\" width=\"200\"/>\n\n## Installation\n\n`pip install audio-recorder-streamlit`\n\n## Usage\n\n```python\nimport streamlit as st\nfrom audio_recorder_streamlit import audio_recorder\n\naudio_bytes = audio_recorder()\nif audio_bytes:\n st.audio(audio_bytes, format=\"audio/wav\")\n```\n\n## Recording parameters\n\nYou can adjust the recording parameters `energy_threshold` and\n`pause_threshold`:\n- `energy_threshold`: The energy recording sensibility above which we consider\n that the user is speaking. If it is a float, then this is the energy\n threshold used to automatically detect recording start and recording end.\n You can provide a tuple for specifying different threshold for recording\n start detection and recording end detection.\n- `pause_threshold`: The number of seconds to spend below `energy_level` to\n automatically stop the recording.\n- `sample_rate`: Sample rate of the recorded audio. If not provided, this will use the\n default sample rate (https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/AudioContext).\n- `auto_start`: If `True` starts the recording as soon as the component has loaded.\n\n```python\n# The recording will stop automatically\n# 2 sec after the utterance end\naudio_bytes = audio_recorder(pause_threshold=2.0, sample_rate=41_000)\n```\n\n## Styling parameters\n\nYou can adjust the button style parameters:\n- **Text**: specify the text displayed next to the icon\n- **Icon**: specify the icon among the font awesome solid icons\n (https://fontawesome.com/search?o=r&s=solid)\n- **Color**: specify the neutral color and recording color.\n- **Size**: specify the icon size using font awesome sizing\n (https://fontawesome.com/docs/web/style/size).\n\n```python\naudio_bytes = audio_recorder(\n text=\"\",\n recording_color=\"#e8b62c\",\n neutral_color=\"#6aa36f\",\n icon_name=\"user\",\n icon_size=\"6x\",\n)\n```\n<img src=\"https://raw.githubusercontent.com/Joooohan/audio-recorder-streamlit/main/img/custom.png\" alt=\"custom.png\" width=\"200\"/>\n\n# Frequently Asked Question\n## How can I record for a fixed duration ?\n\nYou can record for a fixed duration by setting the `energy_threshold=(-1.0, 1.0)`\nso that the recorder considers that you are speaking at the beginning and then\nyou are never speaking from this point on.\n\nThen simply set `pause_threshold` to your desired recording length.\n\n```python\n# Records 3 seconds in any case\naudio_bytes = audio_recorder(\n energy_threshold=(-1.0, 1.0),\n pause_threshold=3.0,\n)\n```\n",
"bugtrack_url": null,
"license": "Copyright (c) 2018-2021 Streamlit Inc.\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": null,
"version": "0.0.9",
"project_urls": {
"Source": "https://github.com/Joooohan/audio-recorder-streamlit"
},
"split_keywords": [
"streamlit",
" audio",
" input"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f7df428ad969c0d44a2ba32c04245d159ded6de294fcb50907fb75624fda7832",
"md5": "e81430efc4958fe82d424d4306200f8d",
"sha256": "cab144be94712b4053e4687a0fd1247a12f93a29da6e2a92b7fd446763ca80dc"
},
"downloads": -1,
"filename": "audio_recorder_streamlit-0.0.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e81430efc4958fe82d424d4306200f8d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 2554659,
"upload_time": "2024-05-09T12:41:24",
"upload_time_iso_8601": "2024-05-09T12:41:24.866320Z",
"url": "https://files.pythonhosted.org/packages/f7/df/428ad969c0d44a2ba32c04245d159ded6de294fcb50907fb75624fda7832/audio_recorder_streamlit-0.0.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0da81f8bc8f22ab2809769a025afe25ea3e66a85c9037973382a6d8ddaaea36a",
"md5": "a0ca099d4e2bb2590522a63ff8bc295f",
"sha256": "77cac0798c6f75d117f9bdf5e1299cdaa5d8d9a9bdb2c0864e3e673e57255184"
},
"downloads": -1,
"filename": "audio_recorder_streamlit-0.0.9.tar.gz",
"has_sig": false,
"md5_digest": "a0ca099d4e2bb2590522a63ff8bc295f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1367943,
"upload_time": "2024-05-09T12:41:32",
"upload_time_iso_8601": "2024-05-09T12:41:32.473348Z",
"url": "https://files.pythonhosted.org/packages/0d/a8/1f8bc8f22ab2809769a025afe25ea3e66a85c9037973382a6d8ddaaea36a/audio_recorder_streamlit-0.0.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-09 12:41:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Joooohan",
"github_project": "audio-recorder-streamlit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "audio-recorder-streamlit"
}