{"id":17194658,"url":"https://github.com/gtxaspec/ingenic-audiodaemon","last_synced_at":"2025-04-13T19:32:28.998Z","repository":{"id":196188569,"uuid":"694815205","full_name":"gtxaspec/ingenic-audiodaemon","owner":"gtxaspec","description":"audio input/output daemon and client for ingenic hardware","archived":false,"fork":false,"pushed_at":"2024-10-08T14:53:16.000Z","size":2367,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T22:42:06.064Z","etag":null,"topics":["audio","ingenic","microphone","speaker","t10","t20","t21","t23","t31","t40","t41","thingino"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gtxaspec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-21T18:47:50.000Z","updated_at":"2024-10-08T14:53:26.000Z","dependencies_parsed_at":"2024-03-31T21:24:56.540Z","dependency_job_id":"366d6312-6287-40b1-ab94-ecb4bf5d39e0","html_url":"https://github.com/gtxaspec/ingenic-audiodaemon","commit_stats":null,"previous_names":["gtxaspec/ingenic_audiodaemon","gtxaspec/ingenic-audiodaemon"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtxaspec%2Fingenic-audiodaemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtxaspec%2Fingenic-audiodaemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtxaspec%2Fingenic-audiodaemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtxaspec%2Fingenic-audiodaemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gtxaspec","download_url":"https://codeload.github.com/gtxaspec/ingenic-audiodaemon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223602672,"owners_count":17171952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","ingenic","microphone","speaker","t10","t20","t21","t23","t31","t40","t41","thingino"],"created_at":"2024-10-15T01:47:44.077Z","updated_at":"2024-11-07T23:09:23.313Z","avatar_url":"https://github.com/gtxaspec.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ingenic Audio Daemon\n\nThe **Ingenic Audio Daemon** (iad) serves as an intermediary between the audio kernel modules and client applications, facilitating audio input and output operations on Ingenic hardware.\n\n- **iad (Ingenic Audio Daemon)**: A background process for handling audio on Ingenic devices.\n  - **iac (Ingenic Audio Client)**: A client-side utility to interact with the audio daemon.\n  - **audioplay**: A standalone audio player for Ingenic devices.\n  - **web_client**: A client utility that establishes a WebSocket server, enabling the capture and streaming of audio data from web browsers.\n  - **wc-console**: A client tool that establishes a WebSocket server, used for audio debugging, outputting the audio stream to stdout.\n\n---\n\n## Prerequisites\n\n- T20/T31/T40 Devices: Audio Input \u0026 Playback tested on T20/T31.  If you have a T40 device, feedback is welcome.\n- Before running the audio daemon, ensure that the audio kernel modules are loaded.\n- The daemon sets up the `IMP_AI` and `IMP_AO` devices, so it's essential for these modules to be initialized first.\n\n---\n\n## Features\n\n- Low latency\n- AI supports multiple clients\n- AO supports queued playback from multiple sources\n\n---\n\n## Compiling\n\n### Prerequisites\n\nBefore you begin, ensure you have:\n\n- A Linux-based operating system.\n- The required cross-compilation tools for Ingenic devices.\n- Git (for versioning support in the build system).\n\n### Directory Structure\n\n- `src/`: Contains the source code for the tools. Each tool has its own subdirectory.\n- `lib/`: Contains necessary libraries.\n- `include/`: Contains header files.\n- `build/`: Contains object files and binaries after compilation.\n- `config/`: Contains configuration files and templates.\n\n### Compiling the Tools\n\n1. **Prepare the Environment**: Ensure you have set up the cross-compilation environment for Ingenic devices.\n\n2. **Clone the Repository**\n\n3. **Compile All Tools**: `make`\nThis will compile the audio daemon (iad), audio client (iac), and the standalone audio player (audioplay)\n\n4. **Compile Individual Tools**:\nIf you only need to compile one of the tools, you can do so individually:\n```\nmake iad        # For the audio daemon\nmake iac        # For the audio client\nmake audioplay  # For the standalone audio player\nmake deps       # Build dependencies for websocket servers\nmake web_client # For the websocket server\nmake wc-console # For the websocket debugging server\n```\n\n5. **Clean the Build**:\nIf you need to clean up the compiled objects and binaries:\n`make clean`\nFor a deeper clean (removes the compiled binaries as well):\n`make distclean`\n\n---\n\n## Running the Daemon\n\nTo run the audio daemon:\n\n```\n./iad [-c] [-d \u003cAI|AO\u003e] [-h]\n```\n\n#### Options:\n\n- `-c`: \u003cpath\u003e - Path to configuration file specified by \u003cconfig_file_path\u003e (default: ./iad.json)\n- `-d`: \u003cAI|AO\u003e  Disable AI (Audio Input) or AO (Audio Output)\n- `-h`:          Display this help message\n\n---\n\n## Using the Audio Client\n\nThe audio client provides various functionalities, from playing audio to recording it.  Audio client functionality can be integrated into your own program to interface with the daemon if desired.\n\n### Usage:\n\n```\n./iac [-f \u003caudio_file_path\u003e] [-s] [-r \u003caudio_output_file_path\u003e] [-o]\n```\n\n#### Options:\n\n- `-f`: AO - Play an audio file specified by `\u003caudio_file_path\u003e`.\n- `-s`: AO - Read audio from the standard input (`stdin`).\n- `-r`: AI - Record audio and save it to a file specified by `\u003caudio_output_file_path\u003e`.\n- `-o`: AI - Output audio to the standard output (`stdout`).\n\nFor example, if you want to play a specific audio file, you can use:\n\n```\n./iac -f path_to_your_audio_file.wav\n```\n\n---\n\n### stdin examples:\n\n```\nffmpeg -re -i https://wpr-ice.streamguys1.com/wpr-ideas-mp3-64 -af volume=-15dB -f s16le -ac 1 -ar 48000 - | ./iac -s\nffmpeg -f s16le -ar 16000 -ac 1 -i test_file.pcm -acodec pcm_s16le -f s16le -ac 1 -ar 48000 - | ./iac -s\n```\n\n#### Play or send audio to the device over the network:\n\n#### On device ( using `nc`, listen persistently on device ip, port 8081 )\n\n```\nnc -ll -p 8081 -e ./iac -s\n```\n\n#### On PC:\n\n1. Capture microphone:\n```\nffmpeg -f alsa -ac 1 -i default -f s16le -ar 48000 -ac 1 tcp://192.168.2.2:8081\n```\n\n2. Play live audio stream:\n```\nffmpeg -re -i https://wpr-ice.streamguys1.com/wpr-ideas-mp3-64 -af volume=-5dB -f s16le -ac 1 -ar 48000 tcp://192.168.2.2:8081\n```\n\n3. Play computer audio output:  \n\nFind your output source:\n`pactl list short sources`:\n```\n$ pactl list short sources\n49\talsa_output.pci-0000_00_1f.3.analog-stereo.monitor\tPipeWire\ts32le 2ch 48000Hz\tSUSPENDED\n50\talsa_input.pci-0000_00_1f.3.analog-stereo\tPipeWire\ts32le 2ch 48000Hz\tSUSPENDED\n```\n\nSet your source on the ffmpeg commandline:\n```\nffmpeg -f pulse -ac 1 -i alsa_output.pci-0000_00_1f.3.analog-stereo.monitor -f s16le -ar 48000 -ac 1 tcp://192.168.2.2:8081\n```\n\nLatency is very decent!\n\nNote: Set the sample rate on the ffmpeg command line to match your settings.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtxaspec%2Fingenic-audiodaemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgtxaspec%2Fingenic-audiodaemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtxaspec%2Fingenic-audiodaemon/lists"}