1

我想用这个汇编程序制作“音乐”或更好的输出一点“哔”:

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

音乐.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

我组装了两个:

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

并与:

ld play.o 音乐.o -o 音乐

但后来我注册我没有“/dev/dsp”文件。那么pulseaudio中的/dev/dsp有什么类似的吗?

4

1 回答 1

3

/dev/dsp默认情况下不启用旧接口。

要模拟它,请尝试padsp(包含在 PulseAudio 中)或osspd

或者,将样本数据输出到 stdout 并将其通过管道传输到aplay.

于 2014-04-11T07:47:17.973 回答