Monday, February 05, 2024

Re: how to play bytebeat on openbsd?

On Fri, Feb 02, 2024 at 06:41:46PM -0000, beecdaddict@danwin1210.de wrote:
> hello
>
> I've tried for hours to play bytebeat as everyone else
>
> I cannot find anything on the entire internet
>
> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code , a
> loop and `putchar(t*((t>>12|t>>8)&63&t>>4));`.. this doesn't sound nearly the
> same as it does to other people
> it's also slow, not fast
>

You've to compile the bytebeat program, run it and send the result to a
program that will play can play usinged 8-bit mono at 8kHz. aucat(1) can do
this.

Example, create a bytebeat.c file with your one-liner and the proper C
boilerplate:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

#include <stdio.h>

int main(void)
{
int t;

for (t = 0; t < 80000; t++) {
putchar(t*((t>>12|t>>8)&63&t>>4));
}

return 0;
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Build it:

cc -Wall bytebeat.c

Play the result:

./a.out | aucat -e u8 -c 0:1 -r 8000 -i -

Or save it a as music.wav so you can futher process it and/or send it to
someone:

./a.out | aucat -e u8 -c 0:0 -r 8000 -i - -n -o music.wav

HTH

No comments:

Post a Comment