{"id":23330395,"url":"https://github.com/ain1084/rust_psg_lite","last_synced_at":"2026-01-28T01:31:47.497Z","repository":{"id":243594628,"uuid":"812844517","full_name":"ain1084/rust_psg_lite","owner":"ain1084","description":"Generates PCM waveforms similar to those of the AY-3-8910 and its compatible chips.","archived":false,"fork":false,"pushed_at":"2024-11-26T13:18:01.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T14:43:22.621Z","etag":null,"topics":["audio","ay-3-8910","chiptune","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/psg_lite","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ain1084.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-10T02:07:17.000Z","updated_at":"2024-11-26T13:18:04.000Z","dependencies_parsed_at":"2025-10-28T14:39:17.156Z","dependency_job_id":"b6f37d3a-cd69-487e-addd-92e35e6079a1","html_url":"https://github.com/ain1084/rust_psg_lite","commit_stats":null,"previous_names":["ain1084/rust_psg_lite"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ain1084/rust_psg_lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ain1084%2Frust_psg_lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ain1084%2Frust_psg_lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ain1084%2Frust_psg_lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ain1084%2Frust_psg_lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ain1084","download_url":"https://codeload.github.com/ain1084/rust_psg_lite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ain1084%2Frust_psg_lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28831562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T23:29:49.665Z","status":"ssl_error","status_checked_at":"2026-01-27T23:25:58.379Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","ay-3-8910","chiptune","rust"],"created_at":"2024-12-20T22:17:36.403Z","updated_at":"2026-01-28T01:31:47.482Z","avatar_url":"https://github.com/ain1084.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PSG Lite\n\n[![Crates.io](https://img.shields.io/crates/v/psg_lite.svg)](https://crates.io/crates/psg_lite)\n[![Documentation](https://docs.rs/psg_lite/badge.svg)](https://docs.rs/psg_lite)\n[![Build Status](https://github.com/ain1084/rust_psg_lite/workflows/Rust/badge.svg)](https://github.com/ain1084/rust_psg_lite/actions?query=workflow%3ARust)\n![Crates.io License](https://img.shields.io/crates/l/psg_lite)\n\nThis crate generates PCM waveforms similar to those of the AY-3-8910 and its\ncompatible chips. This crate is not intended for high-quality audio applications.\nThe main use case is generating simple sound effects and tones in resource-\nconstrained environments. It is designed with a focus on speed to be usable\non 8-bit CPUs (such as AVR[^1]). Emulating the chip is not the goal. As such,\nthere are significant differences from the AY-3-8910 in terms of functionality.\n\n* **Hardware Envelope:** Not implemented. Channel volume ranges from 0 to 15.\n* **Noise Generator:** The number of bits in the shift register differs. Specifically,\n  it is 16 bits instead of 17 bits.\n* **Tone Period:** 0 cannot be set. The minimum value is constrained by the clock rate\n  and sample rate.\n\n[^1]: Although the C++ implementation (same structure) worked on ATTiny, it has not\nbeen confirmed with Rust.\n\n## Sample Rate\n\nPSG has an extremely simple structure, but the upper limit of the frequency that can\nbe generated is 125KHz at a clock rate of 2MHz. This crate reduces processing load\nby simply thinning out waveforms without performing downsampling. Therefore, at low\nsample rates, especially in the high-frequency range, the sound quality deteriorates\nsignificantly. At a sample rate of around 48000Hz, the sound quality is generally\nacceptable. If a sample rate of 250KHz is specified, waveforms are generated with\nalmost no degradation.\n\nIn a PC environment, most audio frameworks automatically perform sample rate\nconversion before outputting to the device. Therefore, it is often possible to play\nback a sample rate of 250KHz without any issues.\n\n## Features\n\nThis crate has the following `features` flags:\n\n`float`: Enables generating samples in `f32` format. Enabled by default. If this flag\nis not set, floating-point operations are not performed.\n\n## Usage\n\nTo use this crate, create a `SoundGenerator` instance, configure the tone period and\nmode for the channels, and then generate samples. The interface is simple and\ndesigned for use in embedded systems. Below is a basic example.\n\n```rust\nuse psg_lite::{SoundGenerator, Output};\n\nfn main() {\n    const CLOCK_RATE: u32 = 2_000_000;\n    const SAMPLE_RATE: u32 = 48_000;\n\n    let mut generator = SoundGenerator::new(CLOCK_RATE, SAMPLE_RATE);\n\n    generator.set_mode(0, Output::TONE);\n    generator.set_volume(0, 15);\n    generator.set_period(0, 123);\n\n    for _ in 0..SAMPLE_RATE {\n        let sample: i16 = generator.next_sample();\n        // Process the sample (e.g., send to DAC or audio buffer)\n    }\n}\n```\n\n## License\n\nLicensed under either of\n- Apache License, Version 2.0\n([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fain1084%2Frust_psg_lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fain1084%2Frust_psg_lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fain1084%2Frust_psg_lite/lists"}