Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Sleep
Thank you very much, Gerhard! ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user

Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Gerhard Wolfstieg
Hello together! On Wed, 24 Jun 2020 17:37:46 -0300 Sleep schrieb: > // Insert samples to framebuffer. > wav = fopen("pcm1611s.wav", "r"); > fseek(wav, 0L, SEEK_END); > size = ftell(wav); > fseek(wav, 0L, SEEK_SET); > buffer = malloc(size); > fread(buffer,

Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Sleep
Nevermind, it is frames * STEREO here, this is where the error is. ptrbuffer += FRAMEBUFFERSIZE * STEREO * BITS ___ Alsa-user mailing list Alsa-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/alsa-user

Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Sleep
https://files.catbox.moe/5jvu18.wav Here is the recording of the effect as requested, new code below. #include #include #include #define STEREO 2 #define BITS16 / 8 #define FRAMEBUFFERSIZE 512 // in samples #define PERIODS 2 #define SAMPLERATE 11025

Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Sleep
snd_pcm_hw_params_set_buffer_size() and snd_pcm_hw_params_set_period_size() returns an error, a mere "Invalid argument." which doesn't help much, commenting them out doesn't appear to address the scratchy sound. ___ Alsa-user mailing list Alsa-user@

Re: [Alsa-user] C program for playing sound

2020-06-24 Thread Sleep
I've used snd_pcm_prepare() because underrun (-EPIPE) was occurring because I had put the wrong value for frames, but despite adjusting the value of the frames, I am still getting the scratchy effect, here is the current code I have, now I am really stuck. Also yeah, "scratchy" would be a bette

Re: [Alsa-user] C program for playing sound

2020-06-23 Thread frederik
now the problem is that the sound is skipping. Can you provide a recording of what it sounds like? In alsa-lib there is an example test/latency.c which just moves samples from one device to another. When I run it, the sound that comes out of my speakers is what I would call "scratchy". I su

Re: [Alsa-user] C program for playing sound

2020-06-23 Thread Sleep
Update, forgot snd_pcm_prepare(), now the problem is that the sound is skipping. #include #include #include #define STEREO 2 #define BITS 16 / 8 #define FRAMEBUFFERSIZE 512 // in samples #define PERIODS 2 #define SAMPLERATE 11025 int main(void) { snd_pcm_t *handle; uint32_t channels

[Alsa-user] C program for playing sound

2020-06-23 Thread Sleep
Hello, I am trying to learn how to use the ALSA API library, I have the following program to play a stereo 16 bit wav file at 11025 Hz. I have created a buffer with 256 frames with 2 periods (period size 128 frames), but it only outputs a single tick and the program ends. Appreciate any help.