{"id":15741759,"url":"https://github.com/wabtey/audio_streaming_server","last_synced_at":"2025-10-17T08:15:08.682Z","repository":{"id":155403455,"uuid":"618808770","full_name":"Wabtey/audio_streaming_server","owner":"Wabtey","description":"in C, L3 System Project","archived":false,"fork":false,"pushed_at":"2023-05-03T11:21:28.000Z","size":671,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T05:27:03.649Z","etag":null,"topics":["audio","server","streaming","sys","system"],"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/Wabtey.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-03-25T12:17:49.000Z","updated_at":"2023-04-19T20:18:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"46aa193f-f70d-481f-b92a-798e4a75708a","html_url":"https://github.com/Wabtey/audio_streaming_server","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Wabtey/audio_streaming_server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wabtey%2Faudio_streaming_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wabtey%2Faudio_streaming_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wabtey%2Faudio_streaming_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wabtey%2Faudio_streaming_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wabtey","download_url":"https://codeload.github.com/Wabtey/audio_streaming_server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wabtey%2Faudio_streaming_server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279309607,"owners_count":26145214,"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","status":"online","status_checked_at":"2025-10-17T02:00:07.504Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","server","streaming","sys","system"],"created_at":"2024-10-04T03:00:41.286Z","updated_at":"2025-10-17T08:15:08.646Z","avatar_url":"https://github.com/Wabtey.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TP Projet System\n\n10-02-2023 -\u003e 24-03-2023\n\nGabriel DEHAYE et\nFlorian Emmanuelle EPAIN\nGrp 1.2\n\n## Execution\n\n`$ make all` into `$ make execute`, and type the music's locations from the repertory root.\n\n```text\n$ padsp ./src/lecteur\n\nassets/audio/test.wav\n```\n\n## TP4/5\n\nOn doit lire une chaîne de caractères rentrée par l'utilisateur.ice.\n\n```c\nchar music_file[MAX_LENGTH];\nfgets(music_file, MAX_LENGTH, stdin);\n// Remove the escape character from the user input\nmusic_file[strlen(music_file) - 1] = '\\0';\n\nprintf(\"Chaine lue: *%s*\\n\", music_file);\n```\n\nCréer un `file descriptor` qui va remplir les champs:\n\n- sample_rate\n- sample_size\n- channels\n\n```c\n// -- Creation of the file descriptior --\n\nint sample_rate;\nint sample_size;\nint channels;\nint fd = aud_readinit(music_file, \u0026sample_rate, \u0026sample_size, \u0026channels);\n\nif (fd \u003c 0)\n{\n    perror(\"Error aud_readinit !\");\n    exit(1);\n}\n```\n\nCréer un `audio descriptor` avec les champs précédemment remplis.\n\n```c\n// -- Creation of the audio descriptior --\n\nint audio_descriptor = aud_writeinit(sample_rate, sample_size, channels);\nif (audio_descriptor \u003c 0)\n{\n    perror(\"Error aud_writeinit !\");\n    exit(1);\n}\n```\n\nCréer un buffer, lire une première fois le `file descriptor` dans le buffer, tant qu'il reste des `bytes` à lire on joue dans la sortie audio, en utilisant l'`audio descriptor`, et on lit les restes.\n\n```c\n// -- Read and write the wave file using the 2 previous descriptors  --\n\nunsigned char buffer[1024];\n\nssize_t byte_left = read(fd, buffer, 1024);\nwhile (byte_left \u003e 0)\n{\n    // play in the audio output\n    write(audio_descriptor, buffer, byte_left);\n    byte_left = read(fd, buffer, byte_left);\n}\n\nif (byte_left == -1)\n{\n    perror(\"Error read !\");\n    exit(1);\n}\n```\n\nLe programme lit bien le fichier audio rentré, sans problème.\n\n### Questions\n\n1. Plus la *fréquence* est grande, plus la *vitesse de lecture* est rapide. Avec une fréquence deux fois plus importante, on obtient une vitesse deux fois plus élevée.\n\n    ```c\n    // -- Creation of the audio descriptior --\n\n    // double the sample rate\n    int audio_descriptor = aud_writeinit(sample_rate*2, sample_size, channels);\n    if (audio_descriptor \u003c 0)\n    {\n        perror(\"Error aud_writeinit !\");\n        exit(1);\n    }\n    ```\n\n2. Un fichier wave est orginisé en une suite d'échantillons. Un fichier *stéréo* aura le samble gauche puis sample droit, et lit deux par deux les samples. Un fichier *mono* a juste ses samples à la suite, et lit 1 par 1. Lire un fichier stéréo comme mono va produire un son ralenti par deux, sortant dans la gauche et droite.\n\n    ```c\n    // -- Creation of the audio descriptior --\n\n    // Force to mono\n    int audio_descriptor = aud_writeinit(sample_rate, sample_size, 1);\n    if (audio_descriptor \u003c 0)\n    {\n        perror(\"Error aud_writeinit !\");\n        exit(1);\n    }\n    ```\n\n3. 8bits instead of 16bits. or 32b instead of 16 = *do not try*.\n   This will create a distorded song and a big noisy song on top of the music.\n\n    ```c\n    // -- Creation of the audio descriptior --\n\n    // Welcome to Hell\n    int audio_descriptor = aud_writeinit(sample_rate, sample_size/2, channels);\n    if (audio_descriptor \u003c 0)\n    {\n        perror(\"Error aud_writeinit !\");\n        exit(1);\n    }\n    ```\n\n### Note\n\nNous avons été aidé par Pierre Guillaume, pour le makefile (pb de compilation du fichier audio.c) et pour la réalisation de la lecture audio.\n\n## TP6+ - AudioServer/Client\n\n### Strategie\n\nLae client-e envoie le nom d'une musique au serveur.\nLe serveur envoie le .wav petit a petit, avec qq infos (channels, freq, bitrate, etc)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabtey%2Faudio_streaming_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwabtey%2Faudio_streaming_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabtey%2Faudio_streaming_server/lists"}