Skip to contentSkip to conversation

A minimal playback program does't work on my system

DISCUSSION Carpon frédéric 3 participants 5 messages Aug 15, 2014 – Aug 16, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

Yesterday i have written.
I answer to everybody. I am new and I don't know if there is special rule. Note : It would be good to have a forum to see the messages and answers in a pretty form.

the programme in c comes from

http://equalarea.com/paul/alsa-audio.html
you can download it at
https://mon-partage.fr/f/uvyw39wo/

To answer to Michael i have sound in my HDMI with that :

Quoted 1 line

speaker-test -c2 -D hw:0,0

so i did that

Quoted 1 line

gcc -o    minimal_playback     minimal_playback.c     -lasound (warning comes)

and

Quoted 1 line

./minimal_playback "plughw:0,0"

and i have this result :

Quoted 1 line

Error of segmentation

Where i can an exemple with the possibility to do something like that  :

Quoted 1 line

./minimal_playback  "plughw:0,0"  "mywave.wav"

Thank you for your help

#1 lore raw

Hi

Il 15/ago/2014 19:20 "Carpon frédéric" <[email protected]> ha scritto:

Quoted 5 lines

Hello,

Yesterday i have written.
I answer to everybody. I am new and I don't know if there is special

rule.

Quoted 1 line

Note : It would be good to have a forum to see the messages and answers

in a pretty form.

Quoted 12 lines

the programme in c comes from

http://equalarea.com/paul/alsa-audio.html
you can download it at
https://mon-partage.fr/f/uvyw39wo/

To answer to Michael i have sound in my HDMI with that :

Quoted 1 line

speaker-test -c2 -D hw:0,0

so i did that

Quoted 1 line

gcc -o minimal_playback minimal_playback.c -lasound (warning

comes)

Quoted 8 lines

and

Quoted 1 line

./minimal_playback "plughw:0,0"

and i have this result :

Quoted 1 line

Error of segmentation

Where i can an exemple with the possibility to do something like that :

Quoted 1 line

./minimal_playback "plughw:0,0" "mywave.wav"

aplay source code

I ask to test your small program on PC. Now I don't know about segmentation fault and I'm answering using mobile now. I will check tomorrow

Michael

Quoted 6 lines

Thank you for your help
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

Hi

Quoted 31 lines · Michael Trimarchi

Hi

Il 15/ago/2014 19:20 "Carpon frédéric" <[email protected]> ha scritto:

Quoted 25 lines

Hello,

Yesterday i have written.
I answer to everybody. I am new and I don't know if there is special rule. Note : It would be good to have a forum to see the messages and answers in a pretty form.

the programme in c comes from

http://equalarea.com/paul/alsa-audio.html
you can download it at
https://mon-partage.fr/f/uvyw39wo/

To answer to Michael i have sound in my HDMI with that :

Quoted 1 line

speaker-test -c2 -D hw:0,0

so i did that

Quoted 2 lines

gcc -o minimal_playback minimal_playback.c -lasound (warning
comes)

and

Quoted 1 line

./minimal_playback "plughw:0,0"

and i have this result :

Quoted 1 line

Error of segmentation

if ((err = snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 44100, 0)) < 0) {
fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err));
exit (1);
}

Quoted 17 lines
Quoted 3 lines

Where i can an exemple with the possibility to do something like that :

Quoted 1 line

./minimal_playback "plughw:0,0" "mywave.wav"

aplay source code

I ask to test your small program on PC. Now I don't know about segmentation fault and I'm answering using mobile now. I will check tomorrow

Michael

Quoted 6 lines

Thank you for your help
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Signature · 8 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#3 lore raw

Hi

hate gmail

Quoted 36 lines · Michael Trimarchi

Hi

Quoted 31 lines · Michael Trimarchi

Hi

Il 15/ago/2014 19:20 "Carpon frédéric" <[email protected]> ha scritto:

Quoted 25 lines

Hello,

Yesterday i have written.
I answer to everybody. I am new and I don't know if there is special rule. Note : It would be good to have a forum to see the messages and answers in a pretty form.

the programme in c comes from

http://equalarea.com/paul/alsa-audio.html
you can download it at
https://mon-partage.fr/f/uvyw39wo/

To answer to Michael i have sound in my HDMI with that :

Quoted 1 line

speaker-test -c2 -D hw:0,0

so i did that

Quoted 2 lines

gcc -o minimal_playback minimal_playback.c -lasound (warning
comes)

and

Quoted 1 line

./minimal_playback "plughw:0,0"

and i have this result :

Quoted 1 line

Error of segmentation

Quoted 6 lines

if ((err = snd_pcm_hw_params_set_rate_near (playback_handle, hw_params, 44100, 0)) < 0) {
fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err));
exit (1);
}

The error is how this function is called. Just change from snd_pcm_hw_params_set_rate_near

to

snd_pcm_hw_params_set_rate

let the example compile without warning

gcc playback.c pkg-config --cflags --libs alsa -o playback ./playback plughw:0,0

This example take some byte not initialized on the stack so it's not what you want. If you increase
the loop from 10 to 1024 you have a nice noise

Michael

Quoted 30 lines
Quoted 9 lines
Quoted 8 lines

Where i can an exemple with the possibility to do something like that :

Quoted 1 line

./minimal_playback "plughw:0,0" "mywave.wav"

Quoted 13 lines

aplay source code

I ask to test your small program on PC. Now I don't know about segmentation fault and I'm answering using mobile now. I will check tomorrow

Michael

Quoted 6 lines

Thank you for your help
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

--

| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
Signature · 8 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#4 lore raw
In reply to Carpon frédéric
Quoted 23 lines · Carpon frédéric

Hello,

Yesterday i have written.
I answer to everybody. I am new and I don't know if there is special rule. Note : It would be good to have a forum to see the messages and answers in a pretty form.

the programme in c comes from

http://equalarea.com/paul/alsa-audio.html
you can download it at
https://mon-partage.fr/f/uvyw39wo/

To answer to Michael i have sound in my HDMI with that :

Quoted 1 line

speaker-test -c2 -D hw:0,0

so i did that

Quoted 1 line

gcc -o minimal_playback minimal_playback.c -lasound (warning comes)

and

Quoted 1 line

./minimal_playback "plughw:0,0"

and i have this result :

Quoted 1 line

Error of segmentation

Where i can an exemple with the possibility to do something like that :

Quoted 8 lines
Quoted 1 line

./minimal_playback "plughw:0,0" "mywave.wav"

Thank you for your help
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Probably you want to use a library that does type and endianes conversion like:

http://www.mega-nerd.com/libsndfile/