Question

I want to make "music" or better just output a little "beep" with this assembler program:

play.s:

datei:
.ascii "/dev/dsp"

.globl play
play:
movl $5, %eax
movl $datei, %ebx
movl $1, %ecx
int $0x80
pushl %eax
movl %eax, %ebx
movl $4, %eax
movl 12(%esp), %ecx
movl 8(%esp), %edx
int $0x80

music.s:

.globl _start
#.lcomm buffer, 100
buffer:
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
.byte 0,255,0,255,0,255,0,255,0,255
_start:
pushl $buffer
pushl $100
loop:
call play
jmp loop
movl $1, %eax
movl $0, %ebx
int $128

I assemblered both with:

as music.s -o music.o as play.s -o play.o

and linked both with:

ld play.o music.o -o music

But then I registered that I do not have a "/dev/dsp"-file. So is there any similiar to /dev/dsp in pulseaudio?

Was it helpful?

Solution

The legacy /dev/dsp interface is not enabled by default.

To emulate it, try padsp (included with PulseAudio), or osspd.

Alternatively, output the sample data to stdout and pipe it into aplay.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top